};
/**
- * This telemetry callback is used when registering a telemetry command.
- * It handles getting and formatting information to be returned to telemetry
- * when requested.
- *
- * @param cmd
- * The cmd that was requested by the client.
- * @param params
- * Contains data required by the callback function.
- * @param info
- * The information to be returned to the caller.
+ * Start an array of the specified type for returning from a callback
*
+ * @param d
+ * The data structure passed to the callback
+ * @param type
+ * The type of the array of data
* @return
- * Length of buffer used on success.
+ * 0 on success, negative errno on error
+ */
+__rte_experimental
+int
+rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type);
+
+/**
+ * Start a dictionary of values for returning from a callback
+ *
+ * @param d
+ * The data structure passed to the callback
* @return
- * Negative integer on error.
+ * 0 on success, negative errno on error
*/
-typedef int (*telemetry_cb)(const char *cmd, const char *params,
- struct rte_tel_data *info);
+__rte_experimental
+int
+rte_tel_data_start_dict(struct rte_tel_data *d);
/**
- * Used for handling data received over a telemetry socket.
+ * Set a string for returning from a callback
*
- * @param sock_id
- * ID for the socket to be used by the handler.
+ * @param d
+ * The data structure passed to the callback
+ * @param str
+ * The string to be returned in the data structure
+ * @return
+ * 0 on success, negative errno on error, E2BIG on string truncation
+ */
+__rte_experimental
+int
+rte_tel_data_string(struct rte_tel_data *d, const char *str);
+
+/**
+ * Add a string to an array.
+ * The array must have been started by rte_tel_data_start_array() with
+ * RTE_TEL_STRING_VAL as the type parameter.
*
+ * @param d
+ * The data structure passed to the callback
+ * @param str
+ * The string to be returned in the array
* @return
- * Void.
+ * 0 on success, negative errno on error, E2BIG on string truncation
*/
-typedef void * (*handler)(void *sock_id);
+__rte_experimental
+int
+rte_tel_data_add_array_string(struct rte_tel_data *d, const char *str);
/**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
+ * Add an int to an array.
+ * The array must have been started by rte_tel_data_start_array() with
+ * RTE_TEL_INT_VAL as the type parameter.
*
- * Initialize Telemetry
+ * @param d
+ * The data structure passed to the callback
+ * @param x
+ * The number to be returned in the array
+ * @return
+ * 0 on success, negative errno on error
+ */
+__rte_experimental
+int
+rte_tel_data_add_array_int(struct rte_tel_data *d, int x);
+
+/**
+ * Add a uint64_t to an array.
+ * The array must have been started by rte_tel_data_start_array() with
+ * RTE_TEL_U64_VAL as the type parameter.
*
+ * @param d
+ * The data structure passed to the callback
+ * @param x
+ * The number to be returned in the array
* @return
- * 0 on successful initialisation.
+ * 0 on success, negative errno on error
+ */
+__rte_experimental
+int
+rte_tel_data_add_array_u64(struct rte_tel_data *d, uint64_t x);
+
+/**
+ * Add a string value to a dictionary.
+ * The dict must have been started by rte_tel_data_start_dict().
+ *
+ * @param d
+ * The data structure passed to the callback
+ * @param name
+ * The name the value is to be stored under in the dict
+ * @param val
+ * The string to be stored in the dict
* @return
- * -ENOMEM on memory allocation error
+ * 0 on success, negative errno on error, E2BIG on string truncation of
+ * either name or value.
+ */
+__rte_experimental
+int
+rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name,
+ const char *val);
+
+/**
+ * Add an int value to a dictionary.
+ * The dict must have been started by rte_tel_data_start_dict().
+ *
+ * @param d
+ * The data structure passed to the callback
+ * @param name
+ * The name the value is to be stored under in the dict
+ * @param val
+ * The number to be stored in the dict
* @return
- * -EPERM on unknown error failure
+ * 0 on success, negative errno on error, E2BIG on string truncation of name.
+ */
+__rte_experimental
+int
+rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val);
+
+/**
+ * Add a uint64_t value to a dictionary.
+ * The dict must have been started by rte_tel_data_start_dict().
+ *
+ * @param d
+ * The data structure passed to the callback
+ * @param name
+ * The name the value is to be stored under in the dict
+ * @param val
+ * The number to be stored in the dict
* @return
- * -EALREADY if Telemetry is already initialised.
+ * 0 on success, negative errno on error, E2BIG on string truncation of name.
*/
__rte_experimental
-int32_t
-rte_telemetry_init(void);
+int
+rte_tel_data_add_dict_u64(struct rte_tel_data *d,
+ const char *name, uint64_t val);
/**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
+ * This telemetry callback is used when registering a telemetry command.
+ * It handles getting and formatting information to be returned to telemetry
+ * when requested.
*
- * Clean up and free memory.
+ * @param cmd
+ * The cmd that was requested by the client.
+ * @param params
+ * Contains data required by the callback function.
+ * @param info
+ * The information to be returned to the caller.
*
* @return
- * 0 on success
+ * Length of buffer used on success.
* @return
- * -EPERM on failure
+ * Negative integer on error.
*/
-__rte_experimental
-int32_t
-rte_telemetry_cleanup(void);
+typedef int (*telemetry_cb)(const char *cmd, const char *params,
+ struct rte_tel_data *info);
/**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
+ * Used for handling data received over a telemetry socket.
*
- * Runs various tests to ensure telemetry initialisation and register/unregister
- * functions are working correctly.
+ * @param sock_id
+ * ID for the socket to be used by the handler.
*
* @return
- * 0 on success when all tests have passed
- * @return
- * -1 on failure when the test has failed
+ * Void.
*/
-__rte_experimental
-int32_t
-rte_telemetry_selftest(void);
+typedef void * (*handler)(void *sock_id);
/**
* Used when registering a command and callback function with telemetry.
rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);
/**
- * Initialize new version of Telemetry.
+ * Initialize Telemetry.
*
* @return
* 0 on success.
*/
__rte_experimental
int
-rte_telemetry_new_init(void);
+rte_telemetry_init(const char *runtime_dir, const char **err_str);
+
#endif