vat2: add shared memory argument

Add prefix argument to specifiy shared memory segment.
Add long arguments.
Add argument to dump apis.
Add help.
Add template argument

E.g:
vat2 --template sw_interface_add_del_address
{
	"_msgname":	"sw_interface_add_del_address",
	"sw_if_index":	0,
	"is_add":	false,
	"del_all":	false,
	"prefix":	"0.0.0.0"
}

Usage: vat2 [OPTION] <message-name> <JSON object>
Send API message to VPP and print reply

-d, --debug       Print additional information
-p, --prefix      Specify shared memory prefix to connect to a given VPP instance
-f, --file        File containing a JSON object with the arguments for the message to send
--dump-apis       List all APIs available from connected VPP instance

Type: improvement
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I2d32483a727bc16990c9a30dfa9bc1fa7b1fa85a
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/src/tools/vppapigen/vppapigen_c.py b/src/tools/vppapigen/vppapigen_c.py
index 8564ade..4227cae 100644
--- a/src/tools/vppapigen/vppapigen_c.py
+++ b/src/tools/vppapigen/vppapigen_c.py
@@ -1717,12 +1717,12 @@
             continue
         c_test_api_service(s, s.stream, stream)
 
-    write('void vat2_register_function(char *, cJSON * (*)(cJSON *));\n')
+    write('void vat2_register_function(char *, cJSON * (*)(cJSON *), cJSON * (*)(void *));\n')
     # write('__attribute__((constructor))')
     write('clib_error_t *\n')
     write('vat2_register_plugin (void) {\n')
     for s in services:
-        write('   vat2_register_function("{n}", api_{n});\n'
+        write('   vat2_register_function("{n}", api_{n}, (cJSON * (*)(void *))vl_api_{n}_t_tojson);\n'
               .format(n=s.caller))
     write('   return 0;\n')
     write('}\n')