diff options
author | Jakub Grajciar <jgrajcia@cisco.com> | 2020-01-30 14:14:15 +0100 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2020-02-26 11:46:39 +0000 |
commit | db86329abb4ea164b9061a1d6b47f186c6b9b8fb (patch) | |
tree | 669fe5cf65e70fa91449b12610558f2549949ea2 /src/vnet/pg/pg_api.c | |
parent | 00ec4019b399132a72467ed4c3fb039d4f2466b7 (diff) |
pg: API cleanup
Use consistent API types.
Type: fix
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Change-Id: Ibf693e4b178d2579bc3afb9653bffc07fbb7dd0a
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'src/vnet/pg/pg_api.c')
-rw-r--r-- | src/vnet/pg/pg_api.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/vnet/pg/pg_api.c b/src/vnet/pg/pg_api.c index 5b64a77c0fc..18de1e9e8c4 100644 --- a/src/vnet/pg/pg_api.c +++ b/src/vnet/pg/pg_api.c @@ -87,10 +87,8 @@ vl_api_pg_capture_t_handler (vl_api_pg_capture_t * mp) if (hw_if_index != ~0) { pg_capture_args_t _a, *a = &_a; - - u32 len = ntohl (mp->pcap_name_length); - u8 *pcap_file_name = vec_new (u8, len); - clib_memcpy (pcap_file_name, mp->pcap_file_name, len); + char *pcap_file_name = + vl_api_from_api_to_new_c_string (&mp->pcap_file_name); hi = vnet_get_sup_hw_interface (vnm, hw_if_index); a->hw_if_index = hw_if_index; @@ -121,12 +119,10 @@ vl_api_pg_enable_disable_t_handler (vl_api_pg_enable_disable_t * mp) u32 stream_index = ~0; int is_enable = mp->is_enabled != 0; - u32 len = ntohl (mp->stream_name_length) - 1; - if (len > 0) + if (vl_api_string_len (&mp->stream_name) > 0) { - u8 *stream_name = vec_new (u8, len); - clib_memcpy (stream_name, mp->stream_name, len); + u8 *stream_name = vl_api_from_api_to_new_vec (&mp->stream_name); uword *p = hash_get_mem (pg->stream_index_by_name, stream_name); if (p) stream_index = *p; |