RTE OSAdapter POSIX 0.1.0 build 41b3eb3
POSIX/Linux OAL OSAdapter for Platform_RTE
Loading...
Searching...
No Matches
rte_posix_osadapter_channel_service.c File Reference

POSIX named-channel adapter. More...

#include "rte/posix_osadapter/rte_posix_osadapter_channel_service.h"
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <poll.h>
#include <stdio.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include "rte/oal/memory/rte_mem_util.h"
#include "rte_posix_osadapter_poll.h"
#include "rte_posix_osadapter_sockbuf.h"
Include dependency graph for rte_posix_osadapter_channel_service.c:

Go to the source code of this file.

Data Structures

struct  rte_posix_channel_state_t

Macros

#define _POSIX_C_SOURCE   200809L
#define RTE_POSIX_CHANNEL_REHELLO_MS   2000U

Typedefs

typedef char rte_posix_channel_state_fits_[(sizeof(rte_posix_channel_state_t)<=sizeof(rte_channel_service_storage_t)) ? 1 :-1]

Functions

static uint64_t channel_now_ms (void)
static rte_posix_channel_state_t * channel_state (rte_channel_service_storage_t *storage)
static rte_status_t set_nonblocking (int fd)
static rte_status_t init_listen_socket (rte_posix_channel_state_t *state)
static rte_status_t init_connect_socket (rte_posix_channel_state_t *state)
static rte_status_t osadapter_setup (rte_channel_service_storage_t *storage, const char *channel_name)
static rte_status_t do_read (rte_channel_service_storage_t *storage, void *data, size_t data_size, rte_duration_ms_t timeout_ms, size_t *out_actual_size)
static rte_status_t osadapter_read (rte_channel_service_storage_t *storage, void *data, size_t data_size, rte_duration_ms_t timeout_ms)
static rte_status_t osadapter_read_ex (rte_channel_service_storage_t *storage, void *data, size_t data_size, rte_duration_ms_t timeout_ms, size_t *out_actual_size)
static rte_status_t backend_send (rte_channel_service_storage_t *storage, const void *data, size_t data_size, rte_duration_ms_t timeout_ms)
static rte_status_t osadapter_close (rte_channel_service_storage_t *storage)
rte_status_t rte_posix_osadapter_channel_service_register_resolver (rte_posix_channel_resolve_fn resolver, void *context)
 Registers the channel-name resolver and the POSIX channel service OSAdapter (ADR-005 seam).
const rte_osadapter_channel_service_t * rte_posix_osadapter_channel_service (void)
 The POSIX channel service OSAdapter vtable (UDP; setup binds or dials and returns, the peer handshake is deferred to the first read). A setup returns RTE_STATUS_INTERNAL_ERROR when a configured socket buffer size is refused (REQ-OAL-NETLINK-015); a later read/send that has to re-init the socket maps any failure to RTE_STATUS_TIMEOUT. A listen-role link learns its peer from the first datagram it reads; a send before that sends nothing and returns RTE_STATUS_NOT_CONNECTED (Platform_RTE REQ-CHANSVC-001).

Variables

static rte_posix_channel_resolve_fn s_resolver
static void * s_resolver_context
static const rte_osadapter_channel_service_t s_osadapter

Detailed Description

POSIX named-channel adapter.

Definition in file rte_posix_osadapter_channel_service.c.

Macro Definition Documentation

◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE   200809L

Definition at line 1 of file rte_posix_osadapter_channel_service.c.

◆ RTE_POSIX_CHANNEL_REHELLO_MS

#define RTE_POSIX_CHANNEL_REHELLO_MS   2000U

Definition at line 42 of file rte_posix_osadapter_channel_service.c.

Typedef Documentation

◆ rte_posix_channel_state_fits_

typedef char rte_posix_channel_state_fits_[(sizeof(rte_posix_channel_state_t)<= sizeof(rte_channel_service_storage_t)) ? 1 :-1]

Definition at line 35 of file rte_posix_osadapter_channel_service.c.

Function Documentation

◆ backend_send()

rte_status_t backend_send ( rte_channel_service_storage_t * storage,
const void * data,
size_t data_size,
rte_duration_ms_t timeout_ms )
static

Definition at line 402 of file rte_posix_osadapter_channel_service.c.

◆ channel_now_ms()

uint64_t channel_now_ms ( void )
static

Definition at line 44 of file rte_posix_osadapter_channel_service.c.

◆ channel_state()

rte_posix_channel_state_t * channel_state ( rte_channel_service_storage_t * storage)
static

Definition at line 55 of file rte_posix_osadapter_channel_service.c.

◆ do_read()

rte_status_t do_read ( rte_channel_service_storage_t * storage,
void * data,
size_t data_size,
rte_duration_ms_t timeout_ms,
size_t * out_actual_size )
static

Definition at line 238 of file rte_posix_osadapter_channel_service.c.

◆ init_connect_socket()

rte_status_t init_connect_socket ( rte_posix_channel_state_t * state)
static

Definition at line 138 of file rte_posix_osadapter_channel_service.c.

◆ init_listen_socket()

rte_status_t init_listen_socket ( rte_posix_channel_state_t * state)
static

Definition at line 74 of file rte_posix_osadapter_channel_service.c.

◆ osadapter_close()

rte_status_t osadapter_close ( rte_channel_service_storage_t * storage)
static

Definition at line 485 of file rte_posix_osadapter_channel_service.c.

◆ osadapter_read()

rte_status_t osadapter_read ( rte_channel_service_storage_t * storage,
void * data,
size_t data_size,
rte_duration_ms_t timeout_ms )
static

Definition at line 386 of file rte_posix_osadapter_channel_service.c.

◆ osadapter_read_ex()

rte_status_t osadapter_read_ex ( rte_channel_service_storage_t * storage,
void * data,
size_t data_size,
rte_duration_ms_t timeout_ms,
size_t * out_actual_size )
static

Definition at line 392 of file rte_posix_osadapter_channel_service.c.

◆ osadapter_setup()

rte_status_t osadapter_setup ( rte_channel_service_storage_t * storage,
const char * channel_name )
static

Definition at line 208 of file rte_posix_osadapter_channel_service.c.

◆ rte_posix_osadapter_channel_service()

const rte_osadapter_channel_service_t * rte_posix_osadapter_channel_service ( void )

The POSIX channel service OSAdapter vtable (UDP; setup binds or dials and returns, the peer handshake is deferred to the first read). A setup returns RTE_STATUS_INTERNAL_ERROR when a configured socket buffer size is refused (REQ-OAL-NETLINK-015); a later read/send that has to re-init the socket maps any failure to RTE_STATUS_TIMEOUT. A listen-role link learns its peer from the first datagram it reads; a send before that sends nothing and returns RTE_STATUS_NOT_CONNECTED (Platform_RTE REQ-CHANSVC-001).

Returns
Pointer to the static vtable; never NULL.

Definition at line 527 of file rte_posix_osadapter_channel_service.c.

◆ rte_posix_osadapter_channel_service_register_resolver()

rte_status_t rte_posix_osadapter_channel_service_register_resolver ( rte_posix_channel_resolve_fn resolver,
void * context )

Registers the channel-name resolver and the POSIX channel service OSAdapter (ADR-005 seam).

Parameters
resolverResolver called by every setup. Must not be NULL.
contextPassed to resolver unchanged.
Returns
RTE_STATUS_OK; RTE_STATUS_INVALID_PARAM for a NULL resolver; otherwise the status of rte_osadapter_channel_service_register().

Definition at line 516 of file rte_posix_osadapter_channel_service.c.

◆ set_nonblocking()

rte_status_t set_nonblocking ( int fd)
static

Definition at line 60 of file rte_posix_osadapter_channel_service.c.

Variable Documentation

◆ s_osadapter

const rte_osadapter_channel_service_t s_osadapter
static
Initial value:
= {
osadapter_setup,
osadapter_read,
backend_send,
osadapter_close,
osadapter_read_ex
}

Definition at line 508 of file rte_posix_osadapter_channel_service.c.

◆ s_resolver

rte_posix_channel_resolve_fn s_resolver
static

Definition at line 52 of file rte_posix_osadapter_channel_service.c.

◆ s_resolver_context

void* s_resolver_context
static

Definition at line 53 of file rte_posix_osadapter_channel_service.c.