-typedef enum
-{
- VL_API_TRACE_TX,
- VL_API_TRACE_RX,
-} vl_api_trace_which_t;
-
-#define VL_API_LITTLE_ENDIAN 0x00
-#define VL_API_BIG_ENDIAN 0x01
-
-typedef struct
-{
- u8 *name;
- u16 first_msg_id;
- u16 last_msg_id;
-} vl_api_msg_range_t;
-
-typedef clib_error_t *(vl_msg_api_init_function_t) (u32 client_index);
-
-typedef struct _vl_msg_api_init_function_list_elt
-{
- struct _vl_msg_api_init_function_list_elt *next_init_function;
- vl_msg_api_init_function_t *f;
-} _vl_msg_api_function_list_elt_t;
-
-typedef struct
-{
- void (**msg_handlers) (void *);
- int (**pd_msg_handlers) (void *, int);
- void (**msg_cleanup_handlers) (void *);
- void (**msg_endian_handlers) (void *);
- void (**msg_print_handlers) (void *, void *);
- const char **msg_names;
- u8 *message_bounce;
- u8 *is_mp_safe;
- struct ring_alloc_ *arings;
- u32 ring_misses;
- u32 garbage_collects;
- u32 missing_clients;
- vl_api_trace_t *rx_trace;
- vl_api_trace_t *tx_trace;
- int msg_print_flag;
- trace_cfg_t *api_trace_cfg;
- int our_pid;
- svm_region_t *vlib_rp;
- svm_region_t **mapped_shmem_regions;
- struct vl_shmem_hdr_ *shmem_hdr;
- vl_api_registration_t **vl_clients;
-
- u8 *serialized_message_table_in_shmem;
-
- /* For plugin msg allocator */
- u16 first_available_msg_id;
-
- /* message range by name hash */
- uword *msg_range_by_name;
-
- /* vector of message ranges */
- vl_api_msg_range_t *msg_ranges;
-
- /* uid for the api shared memory region */
- int api_uid;
- /* gid for the api shared memory region */
- int api_gid;
-
- /* base virtual address for global VM region */
- u64 global_baseva;
-
- /* size of the global VM region */
- u64 global_size;
-
- /* size of the API region */
- u64 api_size;
-
- /* size of the global VM private mheap */
- u64 global_pvt_heap_size;
-
- /* size of the api private mheap */
- u64 api_pvt_heap_size;
-
- /* Client-only data structures */
- unix_shared_memory_queue_t *vl_input_queue;
-
- /*
- * All VLIB-side message handlers use my_client_index to identify
- * the queue / client. This works in sim replay.
- */
- int my_client_index;
- /*
- * This is the (shared VM) address of the registration,
- * don't use it to id the connection since it can't possibly
- * work in simulator replay.
- */
- vl_api_registration_t *my_registration;
-
- i32 vlib_signal;
-
- /* client side message index hash table */
- uword *msg_index_by_name_and_crc;
-
- const char *region_name;
- const char *root_path;
-
- /* Replay in progress? */
- int replay_in_progress;
-
- /* List of API client reaper functions */
- _vl_msg_api_function_list_elt_t *reaper_function_registrations;
-
-} api_main_t;
-
-extern api_main_t api_main;
-
-typedef struct
-{
- int id;
- char *name;
- u32 crc;
- void *handler;
- void *cleanup;
- void *endian;
- void *print;
- int size;
- int traced;
- int replay;
- int message_bounce;
- int is_mp_safe;
-} vl_msg_api_msg_config_t;
-
-typedef struct msgbuf_
-{
- unix_shared_memory_queue_t *q;
- u32 data_len;
- u32 gc_mark_timestamp;
- u8 data[0];
-} msgbuf_t;
-
-/* api_shared.c prototypes */
-int vl_msg_api_rx_trace_enabled (api_main_t * am);
-int vl_msg_api_tx_trace_enabled (api_main_t * am);
-void vl_msg_api_trace (api_main_t * am, vl_api_trace_t * tp, void *msg);
-int vl_msg_api_trace_onoff (api_main_t * am, vl_api_trace_which_t which,
- int onoff);
-int vl_msg_api_trace_free (api_main_t * am, vl_api_trace_which_t which);