summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/client/stat_client.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-02-26 16:37:03 +0100
committerNeale Ranns <nranns@cisco.com>2019-02-28 13:25:22 +0000
commit703908aaf4f80ef6bc78166d46eba3a3b3aa15f7 (patch)
tree35bf3939113a8e0db85ec41671cdbbdb4f96d687 /src/vpp-api/client/stat_client.c
parent8b409635b44fd599eea37c7f259be294141a38bb (diff)
stats: Add interface name to sw_if_index as /if/names
Expose interface name to sw_if_index table as a directory node in the stats segment. Change-Id: Ie50e4af01997d141880f02e3a8496bfeb91b9944 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/client/stat_client.c')
-rw-r--r--src/vpp-api/client/stat_client.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index 2cf53d5d0af..25a37f76da8 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -252,8 +252,29 @@ copy_data (stat_segment_directory_entry_t * ep, stat_client_main_t * sm)
result.error_value = error_base[ep->index];
break;
+ case STAT_DIR_TYPE_NAME_VECTOR:
+ if (ep->offset == 0)
+ return result;
+ uint8_t **name_vector =
+ stat_segment_pointer (sm->shared_header, ep->offset);
+ result.name_vector = vec_dup (name_vector);
+ offset_vector =
+ stat_segment_pointer (sm->shared_header, ep->offset_vector);
+ for (i = 0; i < vec_len (name_vector); i++)
+ {
+ if (offset_vector[i])
+ {
+ u8 *name =
+ stat_segment_pointer (sm->shared_header, offset_vector[i]);
+ result.name_vector[i] = vec_dup (name);
+ }
+ else
+ result.name_vector[i] = 0;
+ }
+ break;
+
default:
- fprintf (stderr, "Unknown type: %d", ep->type);
+ fprintf (stderr, "Unknown type: %d\n", ep->type);
}
return result;
}