diff options
author | Ole Troan <ot@cisco.com> | 2018-12-18 12:23:13 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-12-18 13:30:40 +0000 |
commit | 003d5da298b2cd1e20400fb5fdcefce752ca616e (patch) | |
tree | f348793bd749e504b80b483191e95168c9df44bd /src | |
parent | 91bfa6e2666c56f79cc97407c929d188cb34e90f (diff) |
VAPI/VOM: Removing legacy stats tests, add string type.
Fix misc VAPI/VOM generation and test cases.
Change-Id: I1abf9ecdb6f8a2129f11e0a9ed1c0fe04cdf5c47
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vlibapi/api_types.h | 10 | ||||
-rw-r--r-- | src/vpp-api/vapi/vapi.h | 1 | ||||
-rw-r--r-- | src/vpp-api/vapi/vapi_json_parser.py | 1 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/vlibapi/api_types.h b/src/vlibapi/api_types.h index 8a86612f0fb..406ccfa6745 100644 --- a/src/vlibapi/api_types.h +++ b/src/vlibapi/api_types.h @@ -21,6 +21,8 @@ #define included_api_types_h #include <vppinfra/types.h> +#include <arpa/inet.h> +#include <string.h> /* VPP API string type */ typedef struct @@ -32,8 +34,8 @@ typedef struct static inline int vl_api_to_api_string (u32 len, const char *buf, vl_api_string_t * str) { - clib_memcpy(str->buf, buf, len); - str->length = clib_host_to_net_u32 (len); + memcpy(str->buf, buf, len); + str->length = htonl (len); return len + sizeof (u32); } @@ -47,13 +49,13 @@ vl_api_from_api_string (vl_api_string_t * astr) static inline u32 vl_api_string_len (vl_api_string_t * astr) { - return clib_net_to_host_u32 (astr->length); + return ntohl (astr->length); } static inline char * vl_api_from_api_string_c (vl_api_string_t *astr) { - return strndup((char *)astr->buf, clib_net_to_host_u32(astr->length)); + return strndup((char *)astr->buf, ntohl (astr->length)); } #endif diff --git a/src/vpp-api/vapi/vapi.h b/src/vpp-api/vapi/vapi.h index 2a401c21189..08d016b0dd7 100644 --- a/src/vpp-api/vapi/vapi.h +++ b/src/vpp-api/vapi/vapi.h @@ -21,6 +21,7 @@ #include <string.h> #include <stdbool.h> #include <vppinfra/types.h> +#include <vlibapi/api_types.h> #include <vapi/vapi_common.h> #include <svm/queue.h> diff --git a/src/vpp-api/vapi/vapi_json_parser.py b/src/vpp-api/vapi/vapi_json_parser.py index 3eb5d3616e1..2c08b90a93b 100644 --- a/src/vpp-api/vapi/vapi_json_parser.py +++ b/src/vpp-api/vapi/vapi_json_parser.py @@ -302,6 +302,7 @@ class JsonParser(object): ] } + self.types['string'] = simple_type_class('vl_api_string_t') self.replies = set() self.events = set() self.simple_type_class = simple_type_class |