PatchworkOS
Loading...
Searching...
No Matches
Socket Families

Socket Families. More...

Data Structures

struct  socket_factory_t
 Socket Factory structure. More...
 
struct  socket_family_ops_t
 Socket Family operations structure. More...
 
struct  socket_family_t
 Socket Family structure. More...
 

Functions

uint64_t socket_family_register (const socket_family_ops_t *ops, const char *name, socket_type_t supportedTypes)
 Register a socket family.
 
void socket_family_unregister (const char *name)
 Unregister a socket family.
 
socket_family_tsocket_family_get (const char *name)
 Get a socket family by name.
 
uint64_t socket_family_get_dir (socket_family_t *family, path_t *outPath)
 Get the directory of a socket family.
 

Detailed Description

Socket Families.

A socket family defines a set of operations for a socket, defining what it means to read, write, etc., for that specific family.

Each socket family is exposed as /net/<family_name>/.

Function Documentation

◆ socket_family_get()

socket_family_t * socket_family_get ( const char *  name)

Get a socket family by name.

Parameters
nameName of the socket family to get.
Returns
Pointer to the socket family or NULL.

Definition at line 143 of file socket_family.c.

References families, LIST_FOR_EACH, lock, LOCK_SCOPE, socket_family_t::name, NULL, and strcmp().

Referenced by local_listen_dir_init().

◆ socket_family_get_dir()

uint64_t socket_family_get_dir ( socket_family_t family,
path_t outPath 
)

Get the directory of a socket family.

Parameters
familyPointer to the socket family.
outPathOutput path for the directory (/net/<family_name>/).
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 195 of file socket_family.c.

References DEREF, socket_family_t::dir, EINVAL, ERR, errno, mount, net_get_mount(), NULL, and path_set().

Referenced by socket_new().

◆ socket_family_register()

uint64_t socket_family_register ( const socket_family_ops_t ops,
const char *  name,
socket_type_t  supportedTypes 
)

◆ socket_family_unregister()

void socket_family_unregister ( const char *  name)

Unregister a socket family.

Parameters
nameName of the socket family to unregister.

Definition at line 172 of file socket_family.c.

References DEREF, socket_family_t::dir, socket_family_t::factories, socket_factory_t::file, free(), LIST_FOR_EACH_SAFE, LOG_INFO, LOG_WARN, socket_family_t::name, NULL, and socket_family_get_and_remove().