21 #include <sys/socket.h>
26 #define XLIO_MAGIC_NUMBER (0x4f494c584144564eULL)
36 XLIO_EXTRA_API_ADD_CONF_RULE = (1 << 3),
37 XLIO_EXTRA_API_THREAD_OFFLOAD = (1 << 4),
38 XLIO_EXTRA_API_DUMP_FD_STATS = (1 << 11),
39 XLIO_EXTRA_API_XLIO_ULTRA = (1 << 13),
42 struct __attribute__((packed)) xlio_api_t {
65 int (*add_conf_rule)(
const char *config_line);
74 int (*thread_offload)(
int offload, pthread_t tid);
82 int (*dump_fd_stats)(
int fd,
int log_level);
125 static inline struct xlio_api_t *xlio_get_api()
127 struct xlio_api_t *api_ptr = NULL;
128 socklen_t len =
sizeof(api_ptr);
131 int err = getsockopt(-2, SOL_SOCKET, SO_XLIO_GET_API, &api_ptr, &len);
135 if (len <
sizeof(
struct xlio_api_t *) || api_ptr == NULL ||
136 api_ptr->magic != XLIO_MAGIC_NUMBER) {
int xlio_exit(void)
Finalize XLIO.
int xlio_init_ex(const struct xlio_init_attr *attr)
Initialize the XLIO Ultra API.
int xlio_poll_group_destroy(xlio_poll_group_t group)
Destroy a polling group.
int xlio_poll_group_create(const struct xlio_poll_group_attr *attr, xlio_poll_group_t *group_out)
Create a new polling group.
uintptr_t xlio_poll_group_t
Polling group handle.
Definition: xlio_types.h:89
void xlio_poll_group_poll(xlio_poll_group_t group)
Poll for events on a polling group.
void xlio_socket_buf_free(xlio_socket_t sock, struct xlio_buf *buf)
Free a receive buffer (socket-specific)
void xlio_poll_group_buf_free(xlio_poll_group_t group, struct xlio_buf *buf)
Free a receive buffer (group-specific)
int xlio_socket_attach_group(xlio_socket_t sock, xlio_poll_group_t group)
Attach socket to polling group.
int xlio_socket_create(const struct xlio_socket_attr *attr, xlio_socket_t *sock_out)
Create a new XLIO socket.
int xlio_socket_update(xlio_socket_t sock, unsigned flags, uintptr_t userdata_sq)
Update socket attributes.
uintptr_t xlio_socket_t
Socket handle.
Definition: xlio_types.h:97
int xlio_socket_listen(xlio_socket_t sock)
Listen for incoming connections.
int xlio_socket_getsockname(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen)
Get socket name.
int xlio_socket_destroy(xlio_socket_t sock)
Destroy an XLIO socket.
int xlio_socket_getpeername(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen)
Get peer name.
int xlio_socket_detach_group(xlio_socket_t sock)
Detach socket from polling group.
int xlio_socket_setsockopt(xlio_socket_t sock, int level, int optname, const void *optval, socklen_t optlen)
Set socket options.
int xlio_socket_bind(xlio_socket_t sock, const struct sockaddr *addr, socklen_t addrlen)
Bind socket to address.
int xlio_socket_connect(xlio_socket_t sock, const struct sockaddr *to, socklen_t tolen)
Connect socket to remote address.
void xlio_poll_group_flush(xlio_poll_group_t group)
Flush all dirty sockets in a polling group.
int xlio_socket_sendv(xlio_socket_t sock, const struct iovec *iov, unsigned iovcnt, const struct xlio_socket_send_attr *attr)
Send vectored data on a socket.
int xlio_socket_send(xlio_socket_t sock, const void *data, size_t len, const struct xlio_socket_send_attr *attr)
Send data on a socket.
void xlio_socket_flush(xlio_socket_t sock)
Flush pending data on a socket.
Buffer descriptor.
Definition: xlio_types.h:123
XLIO initialization attributes.
Definition: xlio_types.h:296
Polling group attributes.
Definition: xlio_types.h:339
Socket creation attributes.
Definition: xlio_types.h:375
Send operation attributes.
Definition: xlio_types.h:414
XLIO API type definitions and structures.