POSIX implementation of the raw OS socket layer (rte_os_socket_ops_t).
More...
#include "rte/posix_osadapter/rte_posix_osadapter.h"
#include "rte_posix_osadapter_poll.h"
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <poll.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
Go to the source code of this file.
|
| static rte_status_t | posix_socket_set_nonblocking (rte_os_socket_handle_t handle, bool nonblocking) |
| static rte_status_t | posix_socket_open (rte_os_socket_type_t type, rte_os_socket_handle_t *out_handle) |
| static rte_status_t | posix_socket_bind (rte_os_socket_handle_t handle, const char *host, uint16_t port) |
| static rte_status_t | posix_socket_connect (rte_os_socket_handle_t handle, const char *host, uint16_t port) |
| static rte_status_t | posix_socket_send (rte_os_socket_handle_t handle, const void *buf, size_t len, size_t *out_sent) |
| static rte_status_t | posix_socket_sendto (rte_os_socket_handle_t handle, const void *buf, size_t len, const char *host, uint16_t port, size_t *out_sent) |
| static rte_status_t | posix_socket_recv (rte_os_socket_handle_t handle, void *buf, size_t len, size_t *out_recv) |
| static rte_status_t | posix_socket_recvfrom (rte_os_socket_handle_t handle, void *buf, size_t len, char *out_host, size_t host_len, uint16_t *out_port, size_t *out_recv) |
| static rte_status_t | posix_socket_poll (rte_os_socket_handle_t handle, uint32_t events, rte_duration_ms_t timeout_ms, uint32_t *out_revents) |
| static rte_status_t | posix_socket_close (rte_os_socket_handle_t handle) |
| const rte_os_socket_ops_t * | rte_posix_osadapter_socket_ops (void) |
| | The POSIX raw OS socket operations vtable (UDP and TCP).
|
POSIX implementation of the raw OS socket layer (rte_os_socket_ops_t).
Compliant with CENELEC EN 50128 SIL 4 and MISRA C:2012.
Definition in file rte_posix_osadapter_socket.c.
◆ _POSIX_C_SOURCE
| #define _POSIX_C_SOURCE 200809L |
◆ posix_socket_bind()
| rte_status_t posix_socket_bind |
( |
rte_os_socket_handle_t | handle, |
|
|
const char * | host, |
|
|
uint16_t | port ) |
|
static |
◆ posix_socket_close()
| rte_status_t posix_socket_close |
( |
rte_os_socket_handle_t | handle | ) |
|
|
static |
◆ posix_socket_connect()
| rte_status_t posix_socket_connect |
( |
rte_os_socket_handle_t | handle, |
|
|
const char * | host, |
|
|
uint16_t | port ) |
|
static |
◆ posix_socket_open()
| rte_status_t posix_socket_open |
( |
rte_os_socket_type_t | type, |
|
|
rte_os_socket_handle_t * | out_handle ) |
|
static |
◆ posix_socket_poll()
| rte_status_t posix_socket_poll |
( |
rte_os_socket_handle_t | handle, |
|
|
uint32_t | events, |
|
|
rte_duration_ms_t | timeout_ms, |
|
|
uint32_t * | out_revents ) |
|
static |
◆ posix_socket_recv()
| rte_status_t posix_socket_recv |
( |
rte_os_socket_handle_t | handle, |
|
|
void * | buf, |
|
|
size_t | len, |
|
|
size_t * | out_recv ) |
|
static |
◆ posix_socket_recvfrom()
| rte_status_t posix_socket_recvfrom |
( |
rte_os_socket_handle_t | handle, |
|
|
void * | buf, |
|
|
size_t | len, |
|
|
char * | out_host, |
|
|
size_t | host_len, |
|
|
uint16_t * | out_port, |
|
|
size_t * | out_recv ) |
|
static |
◆ posix_socket_send()
| rte_status_t posix_socket_send |
( |
rte_os_socket_handle_t | handle, |
|
|
const void * | buf, |
|
|
size_t | len, |
|
|
size_t * | out_sent ) |
|
static |
◆ posix_socket_sendto()
| rte_status_t posix_socket_sendto |
( |
rte_os_socket_handle_t | handle, |
|
|
const void * | buf, |
|
|
size_t | len, |
|
|
const char * | host, |
|
|
uint16_t | port, |
|
|
size_t * | out_sent ) |
|
static |
◆ posix_socket_set_nonblocking()
| rte_status_t posix_socket_set_nonblocking |
( |
rte_os_socket_handle_t | handle, |
|
|
bool | nonblocking ) |
|
static |
◆ rte_posix_osadapter_socket_ops()
| const rte_os_socket_ops_t * rte_posix_osadapter_socket_ops |
( |
void | | ) |
|
The POSIX raw OS socket operations vtable (UDP and TCP).
open returns a non-blocking socket (O_NONBLOCK, OSA rule R5): recv/send on it return RTE_STATUS_TIMEOUT instead of blocking; set_nonblocking(false) switches it to blocking. If O_NONBLOCK cannot be set, open closes the socket, leaves *out_handle unwritten and returns RTE_STATUS_INTERNAL_ERROR.
- Returns
- The adapter's static vtable (never NULL).
Definition at line 371 of file rte_posix_osadapter_socket.c.
◆ s_posix_socket_ops
| const rte_os_socket_ops_t s_posix_socket_ops |
|
static |
Initial value: = {
posix_socket_open,
posix_socket_bind,
posix_socket_connect,
posix_socket_send,
posix_socket_sendto,
posix_socket_recv,
posix_socket_recvfrom,
posix_socket_poll,
posix_socket_set_nonblocking,
posix_socket_close
}
Definition at line 358 of file rte_posix_osadapter_socket.c.