zebra: optionally use protobuf with FPM

Change zebra so that it can optionally use protobuf serialization when
communicating with a Forwarding Plane Manager component.

  * zebra/main.c

    Add the --fpm-format/-F command line option. This allows the user
    to control the format (protbuf|netlink) that is used to
    communicate with the FPM.

  * zebra/zebra_fpm.c

    - zebra_init_msg_format(),

      This new function is invoked on process startup to determine the
      FPM format that should be used.

    - zfpm_init()

      Change to accept any 'FPM message format' specified by the user
      (via the new command line flag).

    - zebra_encode_route()

      Tweak to use the selected FPM format.

  * zebra_fpm_protobuf.c

    New code to build protobuf messages to be sent to the FPM.

  * zebra/Makefile.am

    - Include common.am

    - Build new file zebra_fpm_protobuf.c when protobuf is available.

    - Link with the fpm_pb library.

Signed-off-by: Avneesh Sachdev <avneesh@sproute.com>
diff --git a/zebra/main.c b/zebra/main.c
index 8370732..35cb159 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -71,6 +71,7 @@
   { "batch",       no_argument,       NULL, 'b'},
   { "daemon",      no_argument,       NULL, 'd'},
   { "keep_kernel", no_argument,       NULL, 'k'},
+  { "fpm_format",  required_argument, NULL, 'F'},
   { "config_file", required_argument, NULL, 'f'},
   { "pid_file",    required_argument, NULL, 'i'},
   { "socket",      required_argument, NULL, 'z'},
@@ -130,6 +131,7 @@
 	      "-b, --batch        Runs in batch mode\n"\
 	      "-d, --daemon       Runs in daemon mode\n"\
 	      "-f, --config_file  Set configuration file name\n"\
+	      "-F, --fpm_format   Set fpm format to 'netlink' or 'protobuf'\n"\
 	      "-i, --pid_file     Set process identifier file name\n"\
 	      "-z, --socket       Set path of zebra socket\n"\
 	      "-k, --keep_kernel  Don't delete old routes which installed by "\
@@ -295,6 +297,7 @@
   char *progname;
   struct thread thread;
   char *zserv_path = NULL;
+  char *fpm_format = NULL;
 
   /* Set umask before anything for security */
   umask (0027);
@@ -310,9 +313,9 @@
       int opt;
   
 #ifdef HAVE_NETLINK  
-      opt = getopt_long (argc, argv, "bdkf:i:z:hA:P:ru:g:vs:C", longopts, 0);
+      opt = getopt_long (argc, argv, "bdkf:F:i:z:hA:P:ru:g:vs:C", longopts, 0);
 #else
-      opt = getopt_long (argc, argv, "bdkf:i:z:hA:P:ru:g:vC", longopts, 0);
+      opt = getopt_long (argc, argv, "bdkf:F:i:z:hA:P:ru:g:vC", longopts, 0);
 #endif /* HAVE_NETLINK */
 
       if (opt == EOF)
@@ -336,6 +339,9 @@
 	case 'f':
 	  config_file = optarg;
 	  break;
+	case 'F':
+	  fpm_format = optarg;
+	  break;
 	case 'A':
 	  vty_addr = optarg;
 	  break;
@@ -423,9 +429,9 @@
 #endif /* HAVE_SNMP */
 
 #ifdef HAVE_FPM
-  zfpm_init (zebrad.master, 1, 0);
+  zfpm_init (zebrad.master, 1, 0, fpm_format);
 #else
-  zfpm_init (zebrad.master, 0, 0);
+  zfpm_init (zebrad.master, 0, 0, fpm_format);
 #endif
 
   /* Process the configuration file. Among other configuration