|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
38 #ifndef _clib_included_socket_h
39 #define _clib_included_socket_h
41 #include <sys/types.h>
42 #include <sys/socket.h>
43 #include <netinet/in.h>
49 typedef struct _socket_t
58 #define CLIB_SOCKET_F_IS_SERVER (1 << 0)
59 #define CLIB_SOCKET_F_IS_CLIENT (0 << 0)
60 #define CLIB_SOCKET_F_RX_END_OF_FILE (1 << 2)
61 #define CLIB_SOCKET_F_NON_BLOCKING_CONNECT (1 << 3)
62 #define CLIB_SOCKET_F_ALLOW_GROUP_WRITE (1 << 4)
63 #define CLIB_SOCKET_F_SEQPACKET (1 << 5)
64 #define CLIB_SOCKET_F_PASSCRED (1 << 6)
65 #define CLIB_SOCKET_F_BLOCKING (1 << 7)
74 struct sockaddr_in
peer;
82 clib_error_t *(*read_func) (
struct _socket_t * sock,
int min_bytes);
84 clib_error_t *(*recvmsg_func) (
struct _socket_t * s,
void *msg,
int msglen,
85 int fds[],
int num_fds);
86 clib_error_t *(*sendmsg_func) (
struct _socket_t * s,
void *msg,
int msglen,
87 int fds[],
int num_fds);
143 return s->write_func (s);
149 return s->read_func (s,
n_bytes);
154 int fds[],
int num_fds)
156 return s->sendmsg_func (s, msg, msglen, fds, num_fds);
161 int fds[],
int num_fds)
163 return s->recvmsg_func (s, msg, msglen, fds, num_fds);
180 err = (*sock->close_func) (sock);
clib_error_t * clib_socket_init_netns(clib_socket_t *socket, u8 *namespace)
#define CLIB_SOCKET_F_IS_SERVER
static clib_error_t * clib_socket_recvmsg(clib_socket_t *s, void *msg, int msglen, int fds[], int num_fds)
static clib_error_t * tx_buffer(void *transport, mc_transport_type_t type, u32 buffer_index)
clib_error_t * clib_socket_accept(clib_socket_t *server, clib_socket_t *client)
static clib_error_t * clib_socket_rx(clib_socket_t *s, int n_bytes)
static uword clib_socket_is_client(clib_socket_t *s)
static void clib_socket_tx_add_va_formatted(clib_socket_t *s, char *fmt, va_list *va)
static uword clib_socket_is_server(clib_socket_t *sock)
void clib_socket_tx_add_formatted(clib_socket_t *s, char *fmt,...)
static int clib_socket_rx_end_of_file(clib_socket_t *s)
clib_error_t * clib_socket_init(clib_socket_t *socket)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static clib_error_t * clib_socket_close(clib_socket_t *sock)
static clib_error_t * clib_socket_sendmsg(clib_socket_t *s, void *msg, int msglen, int fds[], int num_fds)
static uword clib_socket_is_connected(clib_socket_t *sock)
static void clib_socket_free(clib_socket_t *s)
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * clib_socket_tx(clib_socket_t *s)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
struct _socket_t clib_socket_t
static void * clib_socket_tx_add(clib_socket_t *s, int n_bytes)
static uword clib_mem_is_heap_object(void *p)
#define CLIB_SOCKET_F_RX_END_OF_FILE
vl_api_wireguard_peer_flags_t flags