MOS Source Code
Loading...
Searching...
No Matches
ipc_io.c File Reference
#include "mos/ipc/ipc_io.h"
#include "mos/io/io.h"
#include "mos/ipc/ipc.h"
#include "mos/mm/slab_autoinit.h"
#include "mos/platform/platform.h"
#include <mos_stdlib.h>
+ Include dependency graph for ipc_io.c:

Go to the source code of this file.

Classes

struct  ipc_server_io_t
 

Functions

 SLAB_AUTOINIT ("ipc_server_io", ipc_server_io_slab, ipc_server_io_t)
 
 SLAB_AUTOINIT ("ipc_conn_io", ipc_conn_io_slab, ipc_conn_io_t)
 
static void ipc_control_io_close (io_t *io)
 
static size_t ipc_client_io_write (io_t *io, const void *buf, size_t size)
 
static size_t ipc_client_io_read (io_t *io, void *buf, size_t size)
 
static void ipc_client_io_close (io_t *io)
 
static size_t ipc_server_io_write (io_t *io, const void *buf, size_t size)
 
static size_t ipc_server_io_read (io_t *io, void *buf, size_t size)
 
static void ipc_server_io_close (io_t *io)
 
ipc_conn_io_tipc_conn_io_create (ipc_t *ipc, bool is_server_side)
 Create a new IPC connection io descriptor.
 
io_tipc_create (const char *name, size_t max_pending_connections)
 Create a new IPC server.
 
io_tipc_accept (io_t *server)
 Accept a new connection on an IPC server.
 
io_tipc_connect (const char *name, size_t buffer_size)
 Connect to an IPC servers.
 

Variables

static slab_tipc_server_io_slab = NULL
 
static slab_tipc_conn_io_slab = NULL
 
static const io_op_t ipc_control_io_op
 
static const io_op_t ipc_client_io_op
 
static const io_op_t ipc_server_io_op
 

Function Documentation

◆ SLAB_AUTOINIT() [1/2]

SLAB_AUTOINIT ( "ipc_server_io" ,
ipc_server_io_slab ,
ipc_server_io_t  )

◆ SLAB_AUTOINIT() [2/2]

SLAB_AUTOINIT ( "ipc_conn_io" ,
ipc_conn_io_slab ,
ipc_conn_io_t  )

◆ ipc_control_io_close()

static void ipc_control_io_close ( io_t * io)
static

Definition at line 25 of file ipc_io.c.

+ Here is the call graph for this function:

◆ ipc_client_io_write()

static size_t ipc_client_io_write ( io_t * io,
const void * buf,
size_t size )
static

Definition at line 40 of file ipc_io.c.

+ Here is the call graph for this function:

◆ ipc_client_io_read()

static size_t ipc_client_io_read ( io_t * io,
void * buf,
size_t size )
static

Definition at line 46 of file ipc_io.c.

+ Here is the call graph for this function:

◆ ipc_client_io_close()

static void ipc_client_io_close ( io_t * io)
static

Definition at line 52 of file ipc_io.c.

+ Here is the call graph for this function:

◆ ipc_server_io_write()

static size_t ipc_server_io_write ( io_t * io,
const void * buf,
size_t size )
static

Definition at line 62 of file ipc_io.c.

+ Here is the call graph for this function:

◆ ipc_server_io_read()

static size_t ipc_server_io_read ( io_t * io,
void * buf,
size_t size )
static

Definition at line 68 of file ipc_io.c.

+ Here is the call graph for this function:

◆ ipc_server_io_close()

static void ipc_server_io_close ( io_t * io)
static

Definition at line 74 of file ipc_io.c.

+ Here is the call graph for this function:

◆ ipc_conn_io_create()

ipc_conn_io_t * ipc_conn_io_create ( ipc_t * ipc,
bool is_server_side )

Create a new IPC connection io descriptor.

Parameters
ipcThe IPC object to create the connection for
is_server_sideWhether this is the server side of the connection
Returns
ipc_conn_io_t* A new IPC connection io descriptor

Definition at line 96 of file ipc_io.c.

Referenced by ipc_accept(), ipc_connect(), and vfs_ipc_file_read().

+ Here is the call graph for this function:

◆ ipc_create()

io_t * ipc_create ( const char * name,
size_t max_pending_connections )

Create a new IPC server.

Parameters
nameThe name of the server
max_pending_connectionsThe maximum number of pending connections to allow
Returns
A new io_t object that represents the server, or an error code on failure
Note
The io_t returned by this function is only to accept new connections or close the server, reading or writing to it will fail.

Definition at line 106 of file ipc_io.c.

◆ ipc_accept()

io_t * ipc_accept ( io_t * server)

Accept a new connection on an IPC server.

Parameters
serverThe server to accept a connection on
Returns
An io_t for the server side of the connection, or an error code on failure

Definition at line 121 of file ipc_io.c.

+ Here is the call graph for this function:

◆ ipc_connect()

io_t * ipc_connect ( const char * name,
size_t buffer_size )

Connect to an IPC servers.

Parameters
nameThe name of the server to connect to
buffer_sizeThe size of a shared-memory buffer to use for the connection
Returns
A new io_t object that represents the connection, or an error code on failure

Definition at line 138 of file ipc_io.c.

Variable Documentation

◆ ipc_server_io_slab

slab_t* ipc_server_io_slab = NULL
static

Definition at line 19 of file ipc_io.c.

Referenced by ipc_create().

◆ ipc_conn_io_slab

slab_t* ipc_conn_io_slab = NULL
static

Definition at line 22 of file ipc_io.c.

Referenced by ipc_conn_io_create().

◆ ipc_control_io_op

const io_op_t ipc_control_io_op
static
Initial value:
= {
}
static void ipc_control_io_close(io_t *io)
Definition ipc_io.c:25

Definition at line 36 of file ipc_io.c.

Referenced by ipc_create().

◆ ipc_client_io_op

const io_op_t ipc_client_io_op
static
Initial value:
= {
}
static size_t ipc_client_io_write(io_t *io, const void *buf, size_t size)
Definition ipc_io.c:40
static void ipc_client_io_close(io_t *io)
Definition ipc_io.c:52
static size_t ipc_client_io_read(io_t *io, void *buf, size_t size)
Definition ipc_io.c:46

Definition at line 84 of file ipc_io.c.

Referenced by ipc_conn_io_create().

◆ ipc_server_io_op

const io_op_t ipc_server_io_op
static
Initial value:
= {
}
static size_t ipc_server_io_write(io_t *io, const void *buf, size_t size)
Definition ipc_io.c:62
static size_t ipc_server_io_read(io_t *io, void *buf, size_t size)
Definition ipc_io.c:68
static void ipc_server_io_close(io_t *io)
Definition ipc_io.c:74

Definition at line 90 of file ipc_io.c.

Referenced by ipc_conn_io_create().