38 #define vl_print(handle, ...) 45 #define VPPCOM_DEBUG 1 47 #define VPPCOM_DEBUG 0 78 u64 vpp_session_handle;
167 st =
"STATE_APP_START";
171 st =
"STATE_APP_CONN_VPP";
175 st =
"STATE_APP_ENABLED";
179 st =
"STATE_APP_ATTACHED";
183 st =
"UNKNOWN_APP_STATE";
202 st =
"STATE_CONNECT";
214 st =
"STATE_DISCONNECT";
222 st =
"UNKNOWN_STATE";
241 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
242 vcm->
my_pid, session_index);
256 printf (
"\nConnecting to VPP api...");
267 printf (
" connected!\n");
277 i32 error = va_arg (*args,
u32);
283 s =
format (s,
"%s (%d)", p[0], error);
285 s =
format (s,
"%d", error);
296 #define _(n,v,s) hash_set (vcm->error_string_by_error_number, -v, s); 339 if (session->
state == state)
367 if (wait_for_time == 0)
371 clib_warning (
"[%d] timeout waiting for client_session_index",
385 memset (bmp, 0,
sizeof (*bmp));
387 bmp->_vl_msg_id = ntohs (VL_API_SESSION_ENABLE_DISABLE);
389 bmp->
context = htonl (0xfeedface);
407 clib_warning (
"[%d] Session enable timed out, rv = %s (%d)",
417 (vl_api_session_enable_disable_reply_t * mp)
436 memset (bmp, 0,
sizeof (*bmp));
438 bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_ATTACH);
440 bmp->
context = htonl (0xfeedface);
442 APP_OPTIONS_FLAGS_USE_FIFO | APP_OPTIONS_FLAGS_ADD_SEGMENT;
461 clib_warning (
"[%d] application attach timed out, rv = %s (%d)",
474 memset (bmp, 0,
sizeof (*bmp));
476 bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_DETACH);
478 bmp->
context = htonl (0xfeedface);
491 memset (a, 0,
sizeof (*a));
557 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
584 memset (a, 0,
sizeof (*a));
592 clib_warning (
"[%d] svm_fifo_segment_attach ('%s') failed",
619 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
635 memset (rmp, 0,
sizeof (*rmp));
637 rmp->_vl_msg_id = ntohs (VL_API_DISCONNECT_SESSION_REPLY);
661 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
677 memset (rmp, 0,
sizeof (*rmp));
678 rmp->_vl_msg_id = ntohs (VL_API_RESET_SESSION_REPLY);
704 session_index, session_index);
711 clib_warning (
"[%d] invalid session, sid %d is closed!",
712 vcm->
my_pid, session_index);
723 memset (a, 0,
sizeof (*a));
732 clib_warning (
"[%d] sm_fifo_segment_attach ('%s') failed",
750 rx_fifo->client_session_index = session_index;
752 tx_fifo->client_session_index = session_index;
773 memset (cmp, 0,
sizeof (*cmp));
774 cmp->_vl_msg_id = ntohs (VL_API_CONNECT_SOCK);
780 vcm->
my_pid, session_index, session_index);
805 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
806 vcm->
my_pid, session_index);
811 memset (dmp, 0,
sizeof (*dmp));
812 dmp->_vl_msg_id = ntohs (VL_API_DISCONNECT_SESSION);
870 u8 *
a = va_arg (*args,
u8 *);
871 return format (s,
"%d.%d.%d.%d", a[0], a[1], a[2], a[3]);
878 u32 i, i_max_n_zero, max_n_zeros, i_first_zero, n_zeros, last_double_colon;
882 i_first_zero = i_max_n_zero;
887 if (is_zero && i_first_zero >= ARRAY_LEN (a->
as_u16))
893 if ((!is_zero && n_zeros > max_n_zeros)
896 i_max_n_zero = i_first_zero;
897 max_n_zeros = n_zeros;
903 last_double_colon = 0;
906 if (i == i_max_n_zero && max_n_zeros > 1)
909 i += max_n_zeros - 1;
910 last_double_colon = 1;
915 (last_double_colon || i == 0) ?
"" :
":",
916 clib_net_to_host_u16 (a->
as_u16[i]));
917 last_double_colon = 0;
928 ip46_address_t *ip46 = va_arg (*args, ip46_address_t *);
963 rv = VNET_API_ERROR_QUEUE_FULL;
971 clib_net_to_host_u16 (mp->
port));
978 memset (session, 0,
sizeof (*session));
979 session_index = session - vcm->
sessions;
982 rx_fifo->client_session_index = session_index;
984 tx_fifo->client_session_index = session_index;
1008 memset (rmp, 0,
sizeof (*rmp));
1009 rmp->_vl_msg_id = ntohs (VL_API_ACCEPT_SESSION_REPLY);
1010 rmp->
retval = htonl (rv);
1038 rv = VNET_API_ERROR_QUEUE_FULL;
1043 memset (a, 0,
sizeof (*a));
1056 clib_warning (
"[%d] svm_fifo_segment_create ('%s') failed",
1059 rv = VNET_API_ERROR_URI_FIFO_CREATE_FAILED;
1068 memset (session, 0,
sizeof (*session));
1069 session_index = session - vcm->
sessions;
1081 clib_warning (
"[%d] rx fifo alloc failed, size %ld (0x%lx)",
1084 rv = VNET_API_ERROR_URI_FIFO_CREATE_FAILED;
1096 clib_warning (
"[%d] tx fifo alloc failed, size %ld (0x%lx)",
1099 rv = VNET_API_ERROR_URI_FIFO_CREATE_FAILED;
1119 sizeof (session_fifo_event_t),
1128 clib_warning (
"[%d] Connected cut-thru to client: sid %d",
1129 vcm->
my_pid, session_index);
1135 memset (rmp, 0,
sizeof (*rmp));
1137 rmp->_vl_msg_id = ntohs (VL_API_CONNECT_SESSION_REPLY);
1139 rmp->
retval = htonl (rv);
1166 memset (bmp, 0,
sizeof (*bmp));
1168 bmp->_vl_msg_id = ntohs (VL_API_BIND_SOCK);
1170 bmp->
context = htonl (0xfeedface);
1194 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
1195 vcm->
my_pid, session_index);
1200 memset (ump, 0,
sizeof (*ump));
1202 ump->_vl_msg_id = ntohs (VL_API_UNBIND_SOCK);
1237 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
1238 vcm->
my_pid, session_index);
1251 clib_warning (
"[%d] server unbind timed out, rv = %s (%d)",
1273 clib_warning (
"[%d] client disconnect timed out, rv = %s (%d)",
1280 #define foreach_sock_msg \ 1281 _(SESSION_ENABLE_DISABLE_REPLY, session_enable_disable_reply) \ 1282 _(BIND_SOCK_REPLY, bind_sock_reply) \ 1283 _(UNBIND_SOCK_REPLY, unbind_sock_reply) \ 1284 _(ACCEPT_SESSION, accept_session) \ 1285 _(CONNECT_SOCK, connect_sock) \ 1286 _(CONNECT_SESSION_REPLY, connect_session_reply) \ 1287 _(DISCONNECT_SESSION, disconnect_session) \ 1288 _(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \ 1289 _(RESET_SESSION, reset_session) \ 1290 _(APPLICATION_ATTACH_REPLY, application_attach_reply) \ 1291 _(APPLICATION_DETACH_REPLY, application_detach_reply) \ 1292 _(MAP_ANOTHER_SEGMENT, map_another_segment) 1298 vl_msg_api_set_handlers(VL_API_##N, #n, \ 1299 vl_api_##n##_t_handler, \ 1301 vl_api_##n##_t_endian, \ 1302 vl_api_##n##_t_print, \ 1303 sizeof(vl_api_##n##_t), 1); 1313 vcl_cfg->
heapsize = (256ULL << 20);
1342 fp = fopen (conf_fname,
"r");
1346 fprintf (stderr,
"open configuration file '%s' failed\n", conf_fname);
1349 argv = calloc (1,
sizeof (
char *));
1355 if (fgets (inbuf, 4096, fp) == 0)
1357 p = strtok (inbuf,
" \t\n");
1363 char **tmp = realloc (argv, argc *
sizeof (
char *));
1367 arg = strndup (p, 1024);
1370 argv[argc - 1] = arg;
1371 p = strtok (
NULL,
" \t\n");
1378 char **tmp = realloc (argv, (argc + 1) *
sizeof (
char *));
1391 for (i = 1; i < (argc - 1); i++)
1393 if (!strncmp (argv[i],
"heapsize", 8))
1395 sizep = (
u8 *) argv[i + 1];
1397 while (*sizep >=
'0' && *sizep <=
'9')
1400 size += *sizep++ -
'0';
1406 "using default heapsize %lld (0x%llx)",
1407 vcm->
my_pid, argv[i], argv[i + 1],
1412 if (*sizep ==
'g' || *sizep ==
'G')
1414 else if (*sizep ==
'm' || *sizep ==
'M')
1420 "using default heapsize %lld (0x%llx)",
1421 vcm->
my_pid, argv[i], argv[i + 1],
1436 clib_warning (
"[%d] allocated vppcom heapsize %lld (0x%llx)",
1448 u8 vc_cfg_input = 0;
1453 fd = open (conf_fname, O_RDONLY);
1457 clib_warning (
"[%d] open configuration file '%s' failed!",
1458 vcm->
my_pid, conf_fname);
1462 if (fstat (fd, &s) < 0)
1469 if (!(S_ISREG (s.st_mode) || S_ISLNK (s.st_mode)))
1484 if (
unformat (line_input,
"vppcom {"))
1492 if (
unformat (line_input,
"heapsize %s", &chroot_path))
1497 "actual heapsize %lld (0x%llx)",
1502 else if (
unformat (line_input,
"api-prefix %s", &chroot_path))
1508 vcm->
my_pid, chroot_path);
1511 else if (
unformat (line_input,
"uid %d", &uid))
1517 else if (
unformat (line_input,
"gid %d", &gid))
1523 else if (
unformat (line_input,
"segment-baseva 0x%llx",
1530 else if (
unformat (line_input,
"segment-size 0x%lx",
1534 clib_warning (
"[%d] configured segment_size 0x%lx (%ld)",
1538 else if (
unformat (line_input,
"segment-size %ld",
1542 clib_warning (
"[%d] configured segment_size %ld (0x%lx)",
1546 else if (
unformat (line_input,
"add-segment-size 0x%lx",
1551 (
"[%d] configured add_segment_size 0x%lx (%ld)",
1555 else if (
unformat (line_input,
"add-segment-size %ld",
1560 (
"[%d] configured add_segment_size %ld (0x%lx)",
1564 else if (
unformat (line_input,
"preallocated-fifo-pairs %d",
1568 clib_warning (
"[%d] configured preallocated_fifo_pairs " 1569 "%d (0x%x)", vcm->
my_pid,
1573 else if (
unformat (line_input,
"rx-fifo-size 0x%lx",
1577 clib_warning (
"[%d] configured rx_fifo_size 0x%lx (%ld)",
1581 else if (
unformat (line_input,
"rx-fifo-size %ld",
1585 clib_warning (
"[%d] configured rx_fifo_size %ld (0x%lx)",
1589 else if (
unformat (line_input,
"tx-fifo-size 0x%lx",
1593 clib_warning (
"[%d] configured tx_fifo_size 0x%lx (%ld)",
1597 else if (
unformat (line_input,
"tx-fifo-size %ld",
1601 clib_warning (
"[%d] configured tx_fifo_size %ld (0x%lx)",
1605 else if (
unformat (line_input,
"event-queue-size 0x%lx",
1609 clib_warning (
"[%d] configured event_queue_size 0x%lx (%ld)",
1613 else if (
unformat (line_input,
"event-queue-size %ld",
1617 clib_warning (
"[%d] configured event_queue_size %ld (0x%lx)",
1621 else if (
unformat (line_input,
"listen-queue-size 0x%lx",
1625 clib_warning (
"[%d] configured listen_queue_size 0x%lx (%ld)",
1629 else if (
unformat (line_input,
"listen-queue-size %ld",
1633 clib_warning (
"[%d] configured listen_queue_size %ld (0x%lx)",
1637 else if (
unformat (line_input,
"app-timeout %f",
1644 else if (
unformat (line_input,
"session-timeout %f",
1651 else if (
unformat (line_input,
"accept-timeout %f",
1658 else if (
unformat (line_input,
"}"))
1668 if (line_input->buffer[line_input->index] !=
'#')
1670 clib_warning (
"[%d] Unknown vppcom config option: '%s'",
1672 &line_input->buffer[line_input->index]);
1751 clib_warning (
"[%d] vppcom_app_session_enable() failed!",
1768 clib_warning (
"[%d] app_name '%s', my_client_index %d (0x%x)",
1785 clib_warning (
"[%d] detaching from VPP, my_client_index %d (0x%x)",
1793 clib_warning (
"[%d] application detach timed out, rv = %s (%d)",
1810 session_index = session - vcm->
sessions;
1813 session->
proto = proto;
1821 return (
int) session_index;
1837 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
1838 vcm->
my_pid, session_index);
1852 clib_warning (
"[%d] unbind cut-thru (session %d) failed, " 1854 vcm->
my_pid, session_index,
1862 clib_warning (
"[%d] unbind (session %d) failed, rv = %s (%d)",
1869 clib_warning (
"[%d] disconnect (session %d) failed, rv = %s (%d)",
1887 ip46_address_t *ip46;
1898 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
1899 vcm->
my_pid, session_index);
1908 memset (session->
ip, 0, sizeof (session->
ip));
1909 ip46 = (ip46_address_t *) session->
ip;
1930 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
1931 vcm->
my_pid, listen_session_index);
1949 clib_warning (
"[%d] server listen timed out, rv = %d (%d)",
1960 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
1961 vcm->
my_pid, listen_session_index);
1973 double wait_for_time)
1978 u32 client_session_index;
1988 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
1989 vcm->
my_pid, listen_session_index);
1997 clib_warning (
"[%d] session not in listen state, state = %s",
2007 listen_session_index,
2009 listen_session->
state);
2018 clib_warning (
"[%d] sid %d, accept timed out, rv = %s (%d)",
2019 vcm->
my_pid, listen_session_index,
2021 if ((wait_for == 0) || (wait_for_time > 0))
2037 client_session_index);
2039 ep->
vrf = client_session->
vrf;
2043 if (client_session->
is_ip4)
2048 return (
int) client_session_index;
2057 ip46_address_t *ip46;
2065 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
2066 vcm->
my_pid, session_index);
2074 clib_warning (
"[%d] session, sid (%d) already connected!",
2075 vcm->
my_pid, session_index);
2079 session->
vrf = server_ep->
vrf;
2081 memset (session->
ip, 0, sizeof (session->
ip));
2082 ip46 = (ip46_address_t *) session->
ip;
2090 clib_warning (
"[%d] connect sid %d to %s server port %d",
2091 vcm->
my_pid, session_index, ip_str,
2092 clib_net_to_host_u16 (session->
port));
2129 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
2130 vcm->
my_pid, session_index);
2138 clib_warning (
"[%d] sid (%d) has been closed by remote peer!",
2139 vcm->
my_pid, session_index);
2146 "server_rx_fifo" :
"server_tx_fifo");
2154 session_index, n_read, fifo_str, rx_fifo);
2170 clib_warning (
"[%d] sid (%d) has been closed by remote peer!",
2171 vcm->
my_pid, session_index);
2188 session->
is_server ?
"server_rx_fifo" :
"server_tx_fifo",
2200 session_fifo_event_t evt;
2213 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
2214 vcm->
my_pid, session_index);
2222 clib_warning (
"[%d] sid (%d) has been closed by remote peer!",
2223 vcm->
my_pid, session_index);
2230 "server_tx_fifo" :
"server_rx_fifo");
2239 while (!is_nonblocking && (rv <= 0));
2257 clib_warning (
"[%d] invalid session, sid (%d) has been closed!",
2258 vcm->
my_pid, session_index);
2270 session_index, rv, fifo_str, tx_fifo);
2287 clib_warning (
"[%d] sid (%d) has been closed by remote peer!",
2288 vcm->
my_pid, session_index);
2295 "server_tx_fifo" :
"server_rx_fifo");
2301 session_index, fifo_str, tx_fifo, rv);
2307 unsigned long *write_map,
unsigned long *except_map,
2308 double time_to_wait)
2313 int rv, bits_set = 0;
2343 clib_spinlock_lock (&vcm->sessions_lockp);
2344 rv = vppcom_session_at_index (session_index, &session);
2347 clib_spinlock_unlock (&vcm->sessions_lockp);
2348 if (VPPCOM_DEBUG > 1)
2349 clib_warning (
"[%d] session %d specified in " 2350 "read_map is closed.", vcm->my_pid,
2352 bits_set = VPPCOM_EBADFD;
2377 clib_spinlock_lock (&vcm->sessions_lockp);
2378 rv = vppcom_session_at_index (session_index, &session);
2381 clib_spinlock_unlock (&vcm->sessions_lockp);
2382 if (VPPCOM_DEBUG > 0)
2383 clib_warning (
"[%d] session %d specified in " 2384 "write_map is closed.", vcm->my_pid,
2386 bits_set = VPPCOM_EBADFD;
2403 clib_spinlock_lock (&vcm->sessions_lockp);
2404 rv = vppcom_session_at_index (session_index, &session);
2407 clib_spinlock_unlock (&vcm->sessions_lockp);
2408 if (VPPCOM_DEBUG > 1)
2409 clib_warning (
"[%d] session %d specified in " 2410 "except_map is closed.", vcm->my_pid,
2412 bits_set = VPPCOM_EBADFD;
static int vppcom_app_session_enable(void)
static void vl_api_connect_sock_t_handler(vl_api_connect_sock_t *mp)
u32 * client_session_index_fifo
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
int vppcom_app_create(char *app_name)
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
vpp->client reset session API
#define hash_unset(h, key)
clib_bitmap_t * wr_bitmap
static uword clib_fifo_elts(void *v)
static int vppcom_app_attach(void)
u64 vpp_event_queue_address
int vppcom_session_create(u32 vrf, u8 proto, u8 is_nonblocking)
void vl_set_memory_gid(int gid)
int vppcom_session_bind(uint32_t session_index, vppcom_endpt_t *ep)
static void vppcom_send_unbind_sock(u32 session_index)
unix_shared_memory_queue_t * vl_input_queue
int my_client_index
All VLIB-side message handlers use my_client_index to identify the queue / client.
static f64 clib_time_now(clib_time_t *c)
static void vppcom_send_bind_sock(session_t *session)
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
Bind to an ip:port pair for a given transport protocol.
client->vpp, reply to an accept message
volatile u32 bind_session_index
static u8 * format_api_error(u8 *s, va_list *args)
static mheap_t * mheap_header(u8 *v)
static u32 svm_fifo_max_enqueue(svm_fifo_t *f)
ssvm_shared_header_t * sh
static void vl_api_disconnect_session_reply_t_handler(vl_api_disconnect_session_reply_t *mp)
#define VPPCOM_CONF_DEFAULT
#define MHEAP_FLAG_THREAD_SAFE
static void vl_api_reset_session_t_handler(vl_api_reset_session_t *mp)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
svm_fifo_t * server_rx_fifo
int vppcom_session_connect(uint32_t session_index, vppcom_endpt_t *server_ep)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
svm_fifo_segment_main_t svm_fifo_segment_main
struct _svm_fifo svm_fifo_t
static uword clib_bitmap_set_no_check(uword *a, uword i, uword new_value)
Sets the ith bit of a bitmap to new_value.
#define clib_bitmap_validate(v, n_bits)
struct vppcom_cfg_t_ vppcom_cfg_t
void vl_set_memory_uid(int uid)
static int vppcom_wait_for_session_state_change(u32 session_index, session_state_t state, f64 wait_for_time)
unix_shared_memory_queue_t * vpp_event_queue
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
static uword clib_fifo_free_elts(void *v)
vpp/server->client, connect reply – used for all connect_* messages
int vl_client_connect_to_vlib(const char *svm_name, const char *client_name, int rx_queue_size)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void * ssvm_push_heap(ssvm_shared_header_t *sh)
struct vl_shmem_hdr_ * shmem_hdr
Binary API shared-memory segment header pointer.
int vppcom_session_accept(uint32_t listen_session_index, vppcom_endpt_t *ep, double wait_for_time)
static void vl_api_unbind_sock_reply_t_handler(vl_api_unbind_sock_reply_t *mp)
static void ssvm_pop_heap(void *oldheap)
static uword pointer_to_uword(const void *p)
void * vl_msg_api_alloc(int nbytes)
void vppcom_app_destroy(void)
static void clib_spinlock_init(clib_spinlock_t *p)
int unix_shared_memory_queue_add(unix_shared_memory_queue_t *q, u8 *elem, int nowait)
static void vl_api_connect_session_reply_t_handler(vl_api_connect_session_reply_t *mp)
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vppcom_send_session_enable_disable(u8 is_enable)
#define clib_fifo_sub1(f, e)
int vppcom_session_listen(uint32_t listen_session_index, uint32_t q_len)
static const char * vppcom_retval_str(int retval)
client->vpp, attach application to session layer
#define pool_put(P, E)
Free an object E in pool P.
static void * clib_mem_get_per_cpu_heap(void)
static void vl_api_application_attach_reply_t_handler(vl_api_application_attach_reply_t *mp)
void svm_fifo_segment_init(u64 baseva, u32 timeout_in_seconds)
struct vppcom_main_t_ vppcom_main_t
vppcom_main_t vppcom_main
void clib_time_init(clib_time_t *c)
static int vppcom_session_unbind_cut_thru(session_t *session)
u64 vpp_event_queue_address
vpp->client, accept this session
uword * session_index_by_vpp_handles
#define uword_to_pointer(u, type)
API main structure, used by both vpp and binary API clients.
static void vppcom_app_detach(void)
#define ip46_address_is_ip4(ip46)
void * clib_mem_init(void *heap, uword size)
static int vppcom_send_disconnect(u32 session_index)
static u8 svm_fifo_set_event(svm_fifo_t *f)
Sets fifo event flag.
static void vl_api_map_another_segment_t_handler(vl_api_map_another_segment_t *mp)
int vppcom_select(unsigned long n_bits, unsigned long *read_map, unsigned long *write_map, unsigned long *except_map, double time_to_wait)
clib_bitmap_t * rd_bitmap
volatile session_state_t state
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
#define clib_memcpy(a, b, c)
clib_bitmap_t * ex_bitmap
u32 * new_segment_indices
static void vl_api_disconnect_session_t_handler(vl_api_disconnect_session_t *mp)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static void vppcom_app_send_attach(void)
static void vppcom_api_hookup(void)
static const char * vppcom_session_state_str(session_state_t state)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
int svm_fifo_enqueue_nowait(svm_fifo_t *f, u32 max_bytes, u8 *copy_from_here)
svm_fifo_t * server_tx_fifo
static int vppcom_connect_to_vpp(char *app_name)
Application attach reply.
static svm_fifo_segment_private_t * svm_fifo_segment_get_segment(u32 segment_index)
#define foreach_vnet_api_error
#define hash_create(elts, value_bytes)
static ip46_address_t to_ip46(u32 is_ipv6, u8 *buf)
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
#define pool_put_index(p, i)
Free pool element with given index.
enable/disable session layer
static int vppcom_session_unbind(u32 session_index)
static void vppcom_cfg_read(char *conf_fname)
static int vppcom_session_read_ready(session_t *session, u32 session_index)
u64 app_event_queue_address
client->vpp, attach application to session layer
unix_shared_memory_queue_t * unix_shared_memory_queue_init(int nels, int elsize, int consumer_pid, int signal_when_queue_non_empty)
unix_shared_memory_queue_t * app_event_queue
vhost_vring_state_t state
vpp->client, please map an additional shared memory segment
static void vppcom_send_connect_sock(session_t *session, u32 session_index)
Connect to a remote peer.
void svm_fifo_segment_free_fifo(svm_fifo_segment_private_t *s, svm_fifo_t *f, svm_fifo_segment_freelist_t list_index)
clib_spinlock_t sessions_lockp
int svm_fifo_segment_create(svm_fifo_segment_create_args_t *a)
(master) create an svm fifo segment
u8 * format_ip6_address(u8 *s, va_list *args)
static void vl_api_application_detach_reply_t_handler(vl_api_application_detach_reply_t *mp)
bidirectional disconnect API
#define clib_fifo_add1(f, e)
svm_fifo_segment_private_t * segments
pool of segments
uword * error_string_by_error_number
static void vppcom_cfg_init(vppcom_cfg_t *vcl_cfg)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u8 * format_ip4_address(u8 *s, va_list *args)
#define clib_fifo_validate(f, n_elts)
u32 preallocated_fifo_pairs
void vl_client_disconnect_from_vlib(void)
static int vppcom_wait_for_client_session_index(f64 wait_for_time)
static void vppcom_cfg_heapsize(char *conf_fname)
int vppcom_session_read(uint32_t session_index, void *buf, int n)
static_always_inline uword os_get_thread_index(void)
u8 * format_ip46_address(u8 *s, va_list *args)
u32 preallocated_fifo_pairs
static int vppcom_wait_for_app_state_change(app_state_t app_state)
static void vl_api_session_enable_disable_reply_t_handler(vl_api_session_enable_disable_reply_t *mp)
static int vppcom_session_at_index(u32 session_index, session_t *volatile *sess)
client->vpp reset session reply
static const char * vppcom_app_state_str(app_state_t state)
Vector bootsrap header file.
int vppcom_session_close(uint32_t session_index)
static void ssvm_unlock_non_recursive(ssvm_shared_header_t *h)
static void vl_api_bind_sock_reply_t_handler(vl_api_bind_sock_reply_t *mp)
unix_shared_memory_queue_t * vl_input_queue
void vl_set_memory_root_path(const char *root_path)
bidirectional disconnect reply API
#define CLIB_CACHE_LINE_BYTES
int svm_fifo_segment_attach(svm_fifo_segment_create_args_t *a)
(slave) attach to an svm fifo segment
volatile app_state_t app_state
int svm_fifo_dequeue_nowait(svm_fifo_t *f, u32 max_bytes, u8 *copy_here)
static void vppcom_init_error_string_table(void)
static int vppcom_session_disconnect(u32 session_index)
int vppcom_session_write(uint32_t session_index, void *buf, int n)
static void vl_api_accept_session_t_handler(vl_api_accept_session_t *mp)
static int vppcom_session_write_ready(session_t *session, u32 session_index)
static void ssvm_lock_non_recursive(ssvm_shared_header_t *h, u32 tag)
void svm_fifo_segment_delete(svm_fifo_segment_private_t *s)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
svm_fifo_t * svm_fifo_segment_alloc_fifo(svm_fifo_segment_private_t *s, u32 data_size_in_bytes, svm_fifo_segment_freelist_t list_index)