Dear Jon, Sorry for the delayed response.
Anyhow, the constant VL_MSG_FIRST_AVAILABLE is a historical name for a simple thing: the number of binary API messages defined by a given plugin. I’m not sure what you’re trying to do, but it’s actually just as well that you ran into a compile error. I need to explain a number of details so you won’t end up seriously annoyed after wasting a bunch of your time. When the vpp data-plane loads plugins, each plugin which defines a binary API is expected to do something like the following: name = format (0, "snat_%08x%c", api_version, 0); /* Ask for a correctly-sized block of API message decode slots */ sm->msg_id_base = vl_msg_api_get_msg_ids ((char *) name, VL_MSG_FIRST_AVAILABLE); The data-plane plugin asks for a block of message-ID’s. vl_msg_api_get_msg_ids(...) makes a string-hash entry, to map the string <plugin-name>_<api-version> to the base of the message-id block. When it comes time to send binary API messages to a given plugin, the control-plane agent recovers msg_id_base like so: /* Ask the vpp engine for the first assigned message-id */ name = format (0, "snat_%08x%c", api_version, 0); sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name); and adds it to the enumerated message id values: mp->_vl_msg_id = ntohs (msg_id_base + VL_API_some_msg_id); Since the set of plugins can change between runs, absolute message ID’s can’t be guaranteed. Thanks… Dave From: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On Behalf Of Jon Loeliger Sent: Tuesday, January 24, 2017 6:46 PM To: vpp-dev <vpp-dev@lists.fd.io> Subject: [vpp-dev] SNAT Plugin Use Folks, What is the expected method to use the SNAT plugin within the framework of the rest of a VPP system? Specifically, what is the expected use of VL_MSG_FIRST_AVAILABLE? It is several (4) enum include files, and they conflict if two or more are used in the same source file. Here is a terse example. Did I miss some documentation that shows how to use the SNAT plugin? I don't think I need to use the "plugin-ness" of SNAT, as we will always need to have it present in our app. Thanks, jdl CC interface.c In file included from interface.c:13:0: /usr/include/vpp_plugins/snat/snat_msg_enum.h:27:5: error: redeclaration of enumerator ‘VL_MSG_FIRST_AVAILABLE’ VL_MSG_FIRST_AVAILABLE, ^ In file included from interface.c:12:0: /usr/include/vpp/api/vpe_msg_enum.h:25:3: note: previous definition of ‘VL_MSG_FIRST_AVAILABLE’ was here VL_MSG_FIRST_AVAILABLE, ^ In file included from interface.c:13:0: /usr/include/vpp_plugins/snat/snat_msg_enum.h:28:3: error: conflicting types for ‘vl_msg_id_t’ } vl_msg_id_t; ^ In file included from interface.c:12:0: /usr/include/vpp/api/vpe_msg_enum.h:26:3: note: previous declaration of ‘vl_msg_id_t’ was here } vl_msg_id_t; ^ make: *** [interface.o] Error 1
_______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev