CNDP
22.08.0
|
Go to the source code of this file.
Typedefs | |
typedef struct uds_group | uds_group_t |
typedef int(* | uds_cb) (uds_client_t *client, const char *cmd, const char *params) |
Enumerations | |
enum | { UDS_START = 0 , UDS_CONNECTED , UDS_HOST_OK , UDS_GOT_FD , UDS_FD_NAK , UDS_FIN , UDS_HOST_NAK , UDS_HOST_ERR , UDS_BUSY_POLL_ACK , UDS_BUSY_POLL_NAK } |
Functions | |
CNDP_API int | uds_register (const uds_group_t *grp, const char *cmd, uds_cb fn) |
CNDP_API uds_info_t * | uds_create (const char *runtime_dir, const char *uds_name, const char **err_str, void *priv) |
CNDP_API uds_info_t * | uds_get_default (void *priv) |
CNDP_API const uds_group_t * | uds_create_group (const uds_info_t *info, const char *group, void *priv) |
CNDP_API int | uds_destroy_group (const uds_group_t *group) |
CNDP_API const uds_group_t * | uds_get_group_by_name (const uds_info_t *info, const char *name) |
CNDP_API uds_info_t * | uds_connect (const char *uds_name, const char **err_str, void *priv) |
CNDP_API void | uds_destroy (uds_info_t *info) |
CNDP_API int | uds_append (uds_client_t *client, const char *format,...) |
CNDP_API const char * | uds_cmd (uds_client_t *client) |
CNDP_API const char * | uds_params (uds_client_t *client) |
uds-related utility functions
Definition in file uds.h.
typedef struct uds_group uds_group_t |
returned by uds_cb to indicate UDS should not send its output buffer. This is usually used when the application sends its own data, not necessarily json formatted.
typedef int(* uds_cb) (uds_client_t *client, const char *cmd, const char *params) |
anonymous enum |
CNDP_API int uds_register | ( | const uds_group_t * | grp, |
const char * | cmd, | ||
uds_cb | fn | ||
) |
Register a new command to the uds interface
grp | UDS command group to register the callback for |
cmd | The command string including the '/' e.g. '/pktdev:stats' |
fn | The function to callback for this command |
CNDP_API uds_info_t* uds_create | ( | const char * | runtime_dir, |
const char * | uds_name, | ||
const char ** | err_str, | ||
void * | priv | ||
) |
Create a uds instance.
runtime_dir | The base directory to create the local domain socket file. |
uds_name | The name of the local domain socket. |
err_str | The error return pointer, used to send back error messages, Can be NULL |
priv | The private data to be passed to uds_info_t, Can be NULL |
CNDP_API uds_info_t* uds_get_default | ( | void * | priv | ) |
Returns default UDS instance.
CNDP_API const uds_group_t* uds_create_group | ( | const uds_info_t * | info, |
const char * | group, | ||
void * | priv | ||
) |
Register a new command group to the uds interface.
info | UDS socket information |
group | Group name |
priv | Private data to be associated with the command group. |
CNDP_API int uds_destroy_group | ( | const uds_group_t * | group | ) |
Destroy a command group, freeing all associated callbacks.
group | UDS command group handle to destroy. |
CNDP_API const uds_group_t* uds_get_group_by_name | ( | const uds_info_t * | info, |
const char * | name | ||
) |
Get command group by name for this UDS interface.
info | UDS socket information |
name | Group name to look up. Set to NULL to get root command group. |
CNDP_API uds_info_t* uds_connect | ( | const char * | uds_name, |
const char ** | err_str, | ||
void * | priv | ||
) |
Connect to a an existing UDS without creating it. Creates a uds_info_t instance.
uds_name | The name of the local domain socket to connect to. |
err_str | The error return pointer, used to send back error messages, Can be NULL |
priv | The private data to be passed to uds_info_t, Can be NULL |
CNDP_API void uds_destroy | ( | uds_info_t * | info | ) |
Destroy and stop the uds threads and close sockets
info | The pointer returned from the uds_create() call. |
CNDP_API int uds_append | ( | uds_client_t * | client, |
const char * | format, | ||
... | |||
) |
A snprintf() like routine to add text or data to the output buffer.
client | The client pointer that holds the buffer to append the text data. |
format | The snprintf() like format string with variable arguments |
... | Arguments for the format string to use |
CNDP_API const char* uds_cmd | ( | uds_client_t * | client | ) |
Return the command string pointer
client | The client structure pointer |
CNDP_API const char* uds_params | ( | uds_client_t * | client | ) |
Return the params string pointer
client | The client structure pointer |