SafeAPI Backend POSIX
POSIX/Linux OAL backend for safeAPIFreamwork
Loading...
Searching...
No Matches
sapi_posix_backend_channel_service.c File Reference

POSIX named-channel adapter. More...

#include "safeapi/posix_backend/sapi_posix_backend_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 <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include "safeapi/oal/memory/sapi_mem_util.h"
Include dependency graph for sapi_posix_backend_channel_service.c:

Go to the source code of this file.

Data Structures

struct  sapi_posix_channel_state_t

Macros

#define _POSIX_C_SOURCE   200809L

Typedefs

typedef char sapi_posix_channel_state_fits_[(sizeof(sapi_posix_channel_state_t)<=sizeof(sapi_channel_service_storage_t)) ? 1 :-1]

Functions

static sapi_posix_channel_state_tchannel_state (sapi_channel_service_storage_t *storage)
static sapi_status_t set_nonblocking (int fd)
static sapi_status_t init_listen_socket (sapi_posix_channel_state_t *state)
static sapi_status_t init_connect_socket (sapi_posix_channel_state_t *state)
static sapi_status_t backend_setup (sapi_channel_service_storage_t *storage, const char *channel_name)
static sapi_status_t backend_read (sapi_channel_service_storage_t *storage, void *data, size_t data_size, sapi_duration_ms_t timeout_ms)
static sapi_status_t backend_send (sapi_channel_service_storage_t *storage, const void *data, size_t data_size, sapi_duration_ms_t timeout_ms)
static sapi_status_t backend_close (sapi_channel_service_storage_t *storage)
sapi_status_t sapi_posix_backend_channel_service_register_resolver (sapi_posix_channel_resolve_fn resolver, void *context)
const sapi_channel_service_backend_t * sapi_posix_backend_channel_service (void)

Variables

static sapi_posix_channel_resolve_fn s_resolver
static void * s_resolver_context
static const sapi_channel_service_backend_t s_backend

Detailed Description

POSIX named-channel adapter.

Definition in file sapi_posix_backend_channel_service.c.

Macro Definition Documentation

◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE   200809L

Definition at line 1 of file sapi_posix_backend_channel_service.c.

Typedef Documentation

◆ sapi_posix_channel_state_fits_

typedef char sapi_posix_channel_state_fits_[(sizeof(sapi_posix_channel_state_t)<= sizeof(sapi_channel_service_storage_t)) ? 1 :-1]

Definition at line 30 of file sapi_posix_backend_channel_service.c.

Function Documentation

◆ backend_close()

sapi_status_t backend_close ( sapi_channel_service_storage_t * storage)
static

Definition at line 389 of file sapi_posix_backend_channel_service.c.

◆ backend_read()

sapi_status_t backend_read ( sapi_channel_service_storage_t * storage,
void * data,
size_t data_size,
sapi_duration_ms_t timeout_ms )
static

Definition at line 181 of file sapi_posix_backend_channel_service.c.

◆ backend_send()

sapi_status_t backend_send ( sapi_channel_service_storage_t * storage,
const void * data,
size_t data_size,
sapi_duration_ms_t timeout_ms )
static

Definition at line 307 of file sapi_posix_backend_channel_service.c.

◆ backend_setup()

sapi_status_t backend_setup ( sapi_channel_service_storage_t * storage,
const char * channel_name )
static

Definition at line 156 of file sapi_posix_backend_channel_service.c.

◆ channel_state()

sapi_posix_channel_state_t * channel_state ( sapi_channel_service_storage_t * storage)
static

Definition at line 36 of file sapi_posix_backend_channel_service.c.

◆ init_connect_socket()

sapi_status_t init_connect_socket ( sapi_posix_channel_state_t * state)
static

Definition at line 103 of file sapi_posix_backend_channel_service.c.

◆ init_listen_socket()

sapi_status_t init_listen_socket ( sapi_posix_channel_state_t * state)
static

Definition at line 55 of file sapi_posix_backend_channel_service.c.

◆ sapi_posix_backend_channel_service()

const sapi_channel_service_backend_t * sapi_posix_backend_channel_service ( void )

Definition at line 430 of file sapi_posix_backend_channel_service.c.

◆ sapi_posix_backend_channel_service_register_resolver()

sapi_status_t sapi_posix_backend_channel_service_register_resolver ( sapi_posix_channel_resolve_fn resolver,
void * context )

Definition at line 419 of file sapi_posix_backend_channel_service.c.

◆ set_nonblocking()

sapi_status_t set_nonblocking ( int fd)
static

Definition at line 41 of file sapi_posix_backend_channel_service.c.

Variable Documentation

◆ s_backend

const sapi_channel_service_backend_t s_backend
static
Initial value:
= {
backend_setup,
backend_read,
backend_send,
backend_close
}

Definition at line 412 of file sapi_posix_backend_channel_service.c.

◆ s_resolver

sapi_posix_channel_resolve_fn s_resolver
static

Definition at line 33 of file sapi_posix_backend_channel_service.c.

◆ s_resolver_context

void* s_resolver_context
static

Definition at line 34 of file sapi_posix_backend_channel_service.c.