1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2020 Intel Corporation 3 */ 4 5 #ifndef _TELEMETRY_DATA_H_ 6 #define _TELEMETRY_DATA_H_ 7 8 #include "rte_telemetry.h" 9 10 enum tel_container_types { 11 TEL_NULL, /** null, used as error value */ 12 TEL_STRING, /** basic string type, no included data */ 13 TEL_DICT, /** name-value pairs, of individual value type */ 14 TEL_ARRAY_STRING, /** array of string values only */ 15 TEL_ARRAY_INT, /** array of signed, 32-bit int values */ 16 TEL_ARRAY_UINT, /** array of unsigned 64-bit int values */ 17 TEL_ARRAY_CONTAINER, /** array of container structs */ 18 }; 19 20 struct container { 21 struct rte_tel_data *data; 22 int keep; 23 }; 24 25 /* each type here must have an equivalent enum in the value types enum in 26 * telemetry.h and an array type defined above, and have appropriate 27 * type assignment in the RTE_TEL_data_start_array() function 28 */ 29 union tel_value { 30 char sval[RTE_TEL_MAX_STRING_LEN]; 31 int64_t ival; 32 uint64_t uval; 33 struct container container; 34 }; 35 36 struct tel_dict_entry { 37 char name[RTE_TEL_MAX_STRING_LEN]; 38 enum rte_tel_value_type type; 39 union tel_value value; 40 }; 41 42 struct rte_tel_data { 43 enum tel_container_types type; 44 unsigned int data_len; /* for array or object, how many items */ 45 union { 46 char str[RTE_TEL_MAX_SINGLE_STRING_LEN]; 47 struct tel_dict_entry dict[RTE_TEL_MAX_DICT_ENTRIES]; 48 union tel_value array[RTE_TEL_MAX_ARRAY_ENTRIES]; 49 } data; /* data container */ 50 }; 51 52 #endif 53