20 #ifndef included_api_common_h 21 #define included_api_common_h 78 #define VL_API_INVALID_FI ((u32)~0) 109 #define VL_API_LITTLE_ENDIAN 0x00 110 #define VL_API_BIG_ENDIAN 0x01 178 void *print,
int msg_size,
int traced);
186 #ifdef BARRIER_TRACING 188 __attribute__ ((weak));
190 #define vl_msg_api_barrier_trace_context(X) 198 u16 msg_id_host_byte_order);
211 typedef struct _vl_msg_api_init_function_list_elt
213 struct _vl_msg_api_init_function_list_elt *next_init_function;
215 } _vl_msg_api_function_list_elt_t;
229 void (**msg_handlers) (
void *);
231 int (**pd_msg_handlers) (
void *, int);
234 void (**msg_cleanup_handlers) (
void *);
237 void (**msg_endian_handlers) (
void *);
240 void (**msg_print_handlers) (
void *,
void *);
Message range (belonging to a plugin)
u64 api_pvt_heap_size
size of the api private mheap
vl_registration_type_t
API registration types.
#define CLIB_MEM_UNPOISON(a, s)
void vl_msg_api_handler_no_trace_no_free(void *the_msg)
u8 * name
name of the plugin
void vl_msg_api_socket_handler(void *the_msg)
int vl_msg_api_pd_handler(void *mp, int rv)
void * print
message print function
u64 api_size
size of the API region
u8 wrapped
trace has wrapped
int size
for sanity checking
int my_client_index
All VLIB-side message handlers use my_client_index to identify the queue / client.
u32 crc
message definition CRC
void vl_noop_handler(void *mp)
u8 * message_bounce
Don't automatically free message buffer vetor.
void vl_msg_api_register_pd_handler(void *handler, u16 msg_id_host_byte_order)
static void VL_MSG_API_POISON(const void *a)
Message configuration definition.
u32 gc_mark_timestamp
message garbage collector mark TS
svm_region_t * vlib_primary_rp
Primary api segment descriptor.
void vl_msg_api_post_mortem_dump(void)
api_version_t * api_version_list
api version list
int api_uid
uid for the api shared memory region
svm_queue_t * q
message allocated in this shmem ring
u32 server_index
Socket client only: server index.
#define vl_msg_api_barrier_trace_context(X)
struct msgbuf_ msgbuf_t
Message header structure.
svm_queue_t * vl_input_queue
Peer input queue pointer.
int api_gid
gid for the api shared memory region
void * cleanup
non-default message cleanup handler
trace_cfg_t * api_trace_cfg
Current trace configuration.
void vl_msg_pop_heap_w_region(svm_region_t *vlib_rp, void *oldheap)
_vl_msg_api_function_list_elt_t * reaper_function_registrations
List of API client reaper functions.
int our_pid
Current process PID.
u32 clib_file_index
Socket only: file index.
void * endian
message endian function
vl_api_registration_t * my_registration
This is the (shared VM) address of the registration, don't use it to id the connection since it can't...
vl_api_trace_t * rx_trace
Received message trace configuration.
static void vlibapi_set_main(api_main_t *am)
void vl_msg_api_barrier_sync(void)
u32 ring_misses
Number of times that the ring allocator failed.
vl_api_registration_t ** vl_clients
vlib/vpp only: vector of client registrations
void vl_msg_api_handler_no_free(void *the_msg)
int replay_in_progress
Replay in progress?
const char * root_path
Chroot path to the shared memory API files.
svm_region_t * vlib_rp
Current binary api segment descriptor.
struct vl_shmem_hdr_ * shmem_hdr
Binary API shared-memory segment header pointer.
vl_registration_type_t registration_type
type
u16 last_msg_id
last assigned message ID
__thread api_main_t * my_api_main
int elog_trace_api_messages
void vl_msg_pop_heap(void *oldheap)
svm_queue_t * vl_input_queue
shared memory only: pointer to client input queue
void vl_msg_api_clean_handlers(int msg_id)
int replay_enable
This message can be replayed.
void vl_msg_api_cleanup_handler(void *the_msg)
int message_bounce
do not free message after processing
u32 curindex
Current index in circular buffer.
static void cleanup(void)
svm_region_t ** vlib_private_rps
Vector of all mapped shared-VM segments.
u32 unprocessed_msg_length
Socket only: unprocssed length.
clib_error_t *() vl_msg_api_init_function_t(u32 client_index)
void vl_msg_api_set_handlers(int msg_id, char *msg_name, void *handler, void *cleanup, void *endian, void *print, int msg_size, int traced)
elog_main_t * elog_main
event log
#define CLIB_NOSANITIZE_ADDR
void vl_msg_api_replay_handler(void *the_msg)
API main structure, used by both vpp and binary API clients.
void vl_msg_api_config(vl_msg_api_msg_config_t *)
u64 global_size
size of the global VM region
u8 enabled
trace is enabled
An API client registration, only in vpp/vlib.
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
void * vl_msg_push_heap_w_region(svm_region_t *vlib_rp)
Shared memory connection.
u64 global_baseva
base virtual address for global VM region
vl_api_msg_range_t * msg_ranges
vector of message ranges
u32 vl_msg_api_get_msg_index(u8 *name_and_crc)
u8 * output_vector
Socket only: output vector.
int * additional_fds_to_close
const char ** msg_names
Message name vector.
static CLIB_NOSANITIZE_ADDR void VL_MSG_API_SVM_QUEUE_UNPOISON(const svm_queue_t *q)
struct vl_api_registration_ vl_api_registration_t
An API client registration, only in vpp/vlib.
int replay
is this message to be replayed?
u8 * save_msg_table_filename
Dump (msg-name, crc) snapshot here at startup.
vl_api_trace_t * tx_trace
Sent message trace configuration.
u32 garbage_collects
Number of garbage-collected message buffers.
void vl_msg_api_trace_only(void *the_msg)
u32 data_len
message length not including header
Message header structure.
vl_api_trace_which_t
Trace RX / TX enum.
u8 * serialized_message_table_in_shmem
vlib/vpp only: serialized (message, name, crc) table
void vl_msg_api_set_cleanup_handler(int msg_id, void *fp)
u64 global_pvt_heap_size
size of the global VM private mheap
i8 * unprocessed_input
Socket only: pending input.
void vl_msg_api_queue_handler(svm_queue_t *q)
pthread_t rx_thread_handle
Bin API thread handle.
struct ring_alloc_ * arings
Allocator ring vectors (in shared memory)
void vl_msg_api_free(void *)
u32 missing_clients
Number of missing clients / failed message sends.
u16 first_msg_id
first assigned message ID
api_main_t api_global_main
u32 vl_api_registration_pool_index
Index in VLIB's brain (not shared memory).
struct _svm_queue svm_queue_t
u16 first_available_msg_id
First available message ID, for theplugin msg allocator.
static api_main_t * vlibapi_get_main(void)
u8 endian
trace endianness
u8 * is_mp_safe
Message is mp safe vector.
void vl_msg_api_increment_missing_client_counter(void)
void * vl_msg_push_heap(void)
int trace_enable
trace this message
int msg_print_flag
Print every received message.
u32 server_handle
Socket client only: server handle.
int is_mp_safe
worker thread barrier required?
int traced
is this message to be traced?
const char * region_name
Shared VM binary API region name.
Trace configuration for a single message.
svm_region_t ** mapped_shmem_regions
uword * msg_index_by_name_and_crc
client message index hash table
void vl_msg_api_barrier_release(void)
uword * msg_range_by_name
Message range by name hash.
char * name
the message name
void vl_msg_api_post_mortem_dump_enable_disable(int enable)
u32 nitems
Number of trace records.
void vl_msg_api_set_first_available_msg_id(u16 first_avail)
void * handler
the message handler
u32 vlib_input_queue_length
vpp/vlib input queue length
static CLIB_NOSANITIZE_ADDR void VL_MSG_API_UNPOISON(const void *a)
#define CLIB_MEM_POISON(a, s)
u16 vl_msg_api_get_msg_ids(const char *name, int n)
void vl_msg_api_handler(void *the_msg)