23 #include <sys/types.h> 26 #include <netinet/in.h> 59 #define vl_print(handle, ...) clib_warning (__VA_ARGS__) 67 u32 vl (
void *p) __attribute__ ((weak));
77 int n, current_rx_index;
135 char *client_name,
u32 socket_buffer_size)
151 if (socket_path == 0 || client_name == 0)
154 sock->config = socket_path;
169 mbp->
data_len = htonl (
sizeof (*mp));
173 mp->_vl_msg_id = htons (VL_API_SOCKCLNT_CREATE);
174 strncpy ((
char *) mp->
name, client_name, sizeof (mp->
name) - 1);
175 mp->
name[
sizeof (mp->
name) - 1] = 0;
178 n = write (scm->
socket_fd, mbp, sizeof (*mbp) +
sizeof (*mp));
185 memset (buffer, 0,
sizeof (buffer));
191 n = read (scm->
socket_fd, rdptr, sizeof (buffer) - (rdptr - buffer));
203 if (ntohs (rp->_vl_msg_id) != VL_API_SOCKCLNT_CREATE_REPLY)
205 clib_warning (
"connect reply got msg id %d\n", ntohs (rp->_vl_msg_id));
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Fixed length block allocator.
int vl_socket_client_connect(socket_client_main_t *scm, char *socket_path, char *client_name, u32 socket_buffer_size)
u32 gc_mark_timestamp
message garbage collector mark TS
clib_error_t * clib_socket_init(clib_socket_t *s)
u8 data[0]
actual message begins here
int control_pings_outstanding
void vl_socket_client_enable_disable(socket_client_main_t *scm, int enable)
void vl_msg_api_socket_handler(void *the_msg)
socket_client_main_t socket_client_main
#define SOCKET_CLIENT_DEFAULT_BUFFER_SIZE
clib_socket_t client_socket
unix_shared_memory_queue_t * q
message allocated in this shmem ring
#define clib_warning(format, args...)
void vl_socket_client_read_reply(socket_client_main_t *scm)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
u32 data_len
message length not including header
Message header structure.
Bitmaps built as vectors of machine words.
#define CLIB_SOCKET_F_IS_CLIENT
#define clib_error_report(e)
struct _socket_t clib_socket_t
#define CLIB_SOCKET_F_SEQPACKET
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define clib_unix_warning(format, args...)
void vl_socket_client_disconnect(socket_client_main_t *scm)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".