aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi/api_helper_macros.h
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-03-15 14:54:19 +0200
committerDave Barach <openvpp@barachs.net>2017-03-15 15:06:59 +0000
commit0856b97b494ea54f3daa6e0c31a2f882bf23a551 (patch)
tree6dad4f3981ef67df0e3b929ffd6db0df8d782272 /src/vlibapi/api_helper_macros.h
parent7c0858e2a40a5e496ed39a815566ff47aa2fc2be (diff)
API: define optional base_id for REPLY_MACRO's
this enables sharing the api_helper_macros.h implementation Change-Id: Ie3fc89f3b4b5a47fcfd4b5776db90e249c55dbc3 Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src/vlibapi/api_helper_macros.h')
-rw-r--r--src/vlibapi/api_helper_macros.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vlibapi/api_helper_macros.h b/src/vlibapi/api_helper_macros.h
index 4e281342db5..aacea7c15e7 100644
--- a/src/vlibapi/api_helper_macros.h
+++ b/src/vlibapi/api_helper_macros.h
@@ -23,6 +23,10 @@
#define f64_endian(a)
#define f64_print(a,b)
+#ifndef REPLY_MSG_ID_BASE
+#define REPLY_MSG_ID_BASE 0
+#endif
+
#define REPLY_MACRO(t) \
do { \
unix_shared_memory_queue_t * q; \
@@ -32,7 +36,7 @@ do { \
return; \
\
rmp = vl_msg_api_alloc (sizeof (*rmp)); \
- rmp->_vl_msg_id = ntohs((t)); \
+ rmp->_vl_msg_id = htons((t)+REPLY_MSG_ID_BASE); \
rmp->context = mp->context; \
rmp->retval = ntohl(rv); \
\
@@ -48,7 +52,7 @@ do { \
return; \
\
rmp = vl_msg_api_alloc (sizeof (*rmp)); \
- rmp->_vl_msg_id = ntohs((t)); \
+ rmp->_vl_msg_id = htons((t)+REPLY_MSG_ID_BASE); \
rmp->context = mp->context; \
rmp->retval = ntohl(rv); \
do {body;} while (0); \
@@ -64,7 +68,7 @@ do { \
return; \
\
rmp = vl_msg_api_alloc (sizeof (*rmp) + n); \
- rmp->_vl_msg_id = ntohs((t)); \
+ rmp->_vl_msg_id = htons((t)+REPLY_MSG_ID_BASE); \
rmp->context = mp->context; \
rmp->retval = ntohl(rv); \
do {body;} while (0); \
@@ -93,7 +97,7 @@ do { \
rv = VNET_API_ERROR_TABLE_TOO_BIG; \
is_error = 1; \
} \
- rmp->_vl_msg_id = ntohs((t)); \
+ rmp->_vl_msg_id = htons((t)+REPLY_MSG_ID_BASE); \
rmp->context = mp->context; \
rmp->retval = ntohl(rv); \
if (!is_error) \