FD.io VPP
v18.10-34-gcce845e
Vector Packet Processing
|
common vpp api C declarations More...
Go to the source code of this file.
Typedefs | |
typedef struct vapi_ctx_s * | vapi_ctx_t |
typedef vapi_error_e(* | vapi_event_cb) (vapi_ctx_t ctx, void *callback_ctx, void *payload) |
generic vapi event callback More... | |
typedef vapi_error_e(* | vapi_generic_event_cb) (vapi_ctx_t ctx, void *callback_ctx, vapi_msg_id_t id, void *msg) |
generic vapi event callback More... | |
Functions | |
void * | vapi_msg_alloc (vapi_ctx_t ctx, size_t size) |
allocate vapi message of given size More... | |
void | vapi_msg_free (vapi_ctx_t ctx, void *msg) |
free a vapi message More... | |
vapi_error_e | vapi_ctx_alloc (vapi_ctx_t *result) |
allocate vapi context More... | |
void | vapi_ctx_free (vapi_ctx_t ctx) |
free vapi context More... | |
bool | vapi_is_msg_available (vapi_ctx_t ctx, vapi_msg_id_t type) |
check if message identified by it's message id is known by the vpp to which the connection is open More... | |
vapi_error_e | vapi_connect (vapi_ctx_t ctx, const char *name, const char *chroot_prefix, int max_outstanding_requests, int response_queue_size, vapi_mode_e mode, bool handle_keepalives) |
connect to vpp More... | |
vapi_error_e | vapi_disconnect (vapi_ctx_t ctx) |
disconnect from vpp More... | |
vapi_error_e | vapi_get_fd (vapi_ctx_t ctx, int *fd) |
get event file descriptor More... | |
vapi_error_e | vapi_send (vapi_ctx_t ctx, void *msg) |
low-level api for sending messages to vpp More... | |
vapi_error_e | vapi_send2 (vapi_ctx_t ctx, void *msg1, void *msg2) |
low-level api for atomically sending two messages to vpp - either both messages are sent or neither one is More... | |
vapi_error_e | vapi_recv (vapi_ctx_t ctx, void **msg, size_t *msg_size, svm_q_conditional_wait_t cond, u32 time) |
low-level api for reading messages from vpp More... | |
vapi_error_e | vapi_wait (vapi_ctx_t ctx, vapi_wait_mode_e mode) |
wait for connection to become readable or writable More... | |
vapi_error_e | vapi_dispatch_one (vapi_ctx_t ctx) |
pick next message sent by vpp and call the appropriate callback More... | |
vapi_error_e | vapi_dispatch (vapi_ctx_t ctx) |
loop vapi_dispatch_one until responses to all currently outstanding requests have been received and their callbacks called More... | |
void | vapi_set_event_cb (vapi_ctx_t ctx, vapi_msg_id_t id, vapi_event_cb callback, void *callback_ctx) |
set event callback to call when message with given id is dispatched More... | |
void | vapi_clear_event_cb (vapi_ctx_t ctx, vapi_msg_id_t id) |
clear event callback for given message id More... | |
void | vapi_set_generic_event_cb (vapi_ctx_t ctx, vapi_generic_event_cb callback, void *callback_ctx) |
set generic event callback More... | |
void | vapi_clear_generic_event_cb (vapi_ctx_t ctx) |
clear generic event callback More... | |
common vpp api C declarations
This file declares the common C API functions. These include connect, disconnect and utility functions as well as the low-level vapi_send and vapi_recv API. This is only the transport layer.
Message formats and higher-level APIs are generated by running the vapi_c_gen.py script (which is run for in-tree APIs as part of the build process). It's not recommended to mix the higher and lower level APIs. Due to version issues, the higher-level APIs are not part of the shared library.
Definition in file vapi.h.
typedef struct vapi_ctx_s* vapi_ctx_t |
typedef vapi_error_e(* vapi_event_cb) (vapi_ctx_t ctx, void *callback_ctx, void *payload) |
typedef vapi_error_e(* vapi_generic_event_cb) (vapi_ctx_t ctx, void *callback_ctx, vapi_msg_id_t id, void *msg) |
void vapi_clear_event_cb | ( | vapi_ctx_t | ctx, |
vapi_msg_id_t | id | ||
) |
void vapi_clear_generic_event_cb | ( | vapi_ctx_t | ctx | ) |
vapi_error_e vapi_connect | ( | vapi_ctx_t | ctx, |
const char * | name, | ||
const char * | chroot_prefix, | ||
int | max_outstanding_requests, | ||
int | response_queue_size, | ||
vapi_mode_e | mode, | ||
bool | handle_keepalives | ||
) |
connect to vpp
ctx | opaque vapi context, must be allocated using vapi_ctx_alloc first |
name | application name |
chroot_prefix | shared memory prefix |
max_outstanding_requests | max number of outstanding requests queued |
response_queue_size | size of the response queue |
mode | mode of operation - blocking or nonblocking |
handle_keepalives | - if true, automatically handle memclnt_keepalive |
Definition at line 299 of file vapi.c.
vapi_error_e vapi_ctx_alloc | ( | vapi_ctx_t * | result | ) |
void vapi_ctx_free | ( | vapi_ctx_t | ctx | ) |
vapi_error_e vapi_disconnect | ( | vapi_ctx_t | ctx | ) |
vapi_error_e vapi_dispatch | ( | vapi_ctx_t | ctx | ) |
loop vapi_dispatch_one until responses to all currently outstanding requests have been received and their callbacks called
Definition at line 802 of file vapi.c.
vapi_error_e vapi_dispatch_one | ( | vapi_ctx_t | ctx | ) |
vapi_error_e vapi_get_fd | ( | vapi_ctx_t | ctx, |
int * | fd | ||
) |
get event file descriptor
ctx | opaque vapi context | |
[out] | fd | pointer to result variable |
Definition at line 433 of file vapi.c.
bool vapi_is_msg_available | ( | vapi_ctx_t | ctx, |
vapi_msg_id_t | type | ||
) |
void* vapi_msg_alloc | ( | vapi_ctx_t | ctx, |
size_t | size | ||
) |
allocate vapi message of given size
ctx | opaque vapi context |
Definition at line 216 of file vapi.c.
void vapi_msg_free | ( | vapi_ctx_t | ctx, |
void * | msg | ||
) |
vapi_error_e vapi_recv | ( | vapi_ctx_t | ctx, |
void ** | msg, | ||
size_t * | msg_size, | ||
svm_q_conditional_wait_t | cond, | ||
u32 | time | ||
) |
low-level api for reading messages from vpp
ctx | opaque vapi context | |
[out] | msg | pointer to result variable containing message |
[out] | msg_size | pointer to result variable containing message size |
cond | enum type for blocking, non-blocking or timed wait call | |
time | in sec for timed wait |
Definition at line 525 of file vapi.c.
vapi_error_e vapi_send | ( | vapi_ctx_t | ctx, |
void * | msg | ||
) |
low-level api for sending messages to vpp
ctx | opaque vapi context |
msg | message to send |
Definition at line 439 of file vapi.c.
vapi_error_e vapi_send2 | ( | vapi_ctx_t | ctx, |
void * | msg1, | ||
void * | msg2 | ||
) |
low-level api for atomically sending two messages to vpp - either both messages are sent or neither one is
ctx | opaque vapi context |
msg1 | first message to send |
msg2 | second message to send |
Definition at line 481 of file vapi.c.
void vapi_set_event_cb | ( | vapi_ctx_t | ctx, |
vapi_msg_id_t | id, | ||
vapi_event_cb | callback, | ||
void * | callback_ctx | ||
) |
void vapi_set_generic_event_cb | ( | vapi_ctx_t | ctx, |
vapi_generic_event_cb | callback, | ||
void * | callback_ctx | ||
) |
vapi_error_e vapi_wait | ( | vapi_ctx_t | ctx, |
vapi_wait_mode_e | mode | ||
) |