PatchworkOS  621ae6b
A non-POSIX operating system.
Loading...
Searching...
No Matches
netfs_family_t Struct Reference

Socket Family structure. More...

#include <netfs.h>

Collaboration diagram for netfs_family_t:

Data Fields

const charname
 
uint64_t(* init )(socket_t *sock)
 Initialize a socket.
 
void(* deinit )(socket_t *sock)
 Deinitialize a socket.
 
uint64_t(* bind )(socket_t *sock)
 Bind a socket to its address.
 
uint64_t(* listen )(socket_t *sock, uint32_t backlog)
 Listen for incoming connections on a socket.
 
uint64_t(* connect )(socket_t *sock)
 Connect a socket to its address.
 
uint64_t(* accept )(socket_t *sock, socket_t *newSock, mode_t mode)
 Accept an incoming connection on a listening socket.
 
size_t(* send )(socket_t *sock, const void *buffer, size_t count, size_t *offset, mode_t mode)
 Send data on a socket.
 
size_t(* recv )(socket_t *sock, void *buffer, size_t count, size_t *offset, mode_t mode)
 Receive data on a socket.
 
wait_queue_t *(* poll )(socket_t *sock, poll_events_t *revents)
 Poll a socket for events.
 
list_entry_t listEntry
 
list_t sockets
 
rwmutex_t mutex
 

Detailed Description

Socket Family structure.

Definition at line 143 of file netfs.h.

Field Documentation

◆ name

const char* netfs_family_t::name

Definition at line 145 of file netfs.h.

◆ init

uint64_t(* netfs_family_t::init) (socket_t *sock)

Initialize a socket.

Parameters
sockPointer to the socket to initialize.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 152 of file netfs.h.

◆ deinit

void(* netfs_family_t::deinit) (socket_t *sock)

Deinitialize a socket.

Parameters
sockPointer to the socket to deinitialize.

Definition at line 158 of file netfs.h.

◆ bind

uint64_t(* netfs_family_t::bind) (socket_t *sock)

Bind a socket to its address.

The address is stored in socket_t::address.

Parameters
sockPointer to the socket to bind.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 167 of file netfs.h.

◆ listen

uint64_t(* netfs_family_t::listen) (socket_t *sock, uint32_t backlog)

Listen for incoming connections on a socket.

Parameters
sockPointer to the socket to listen on.
backlogMaximum number of pending connections.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 175 of file netfs.h.

◆ connect

uint64_t(* netfs_family_t::connect) (socket_t *sock)

Connect a socket to its address.

The address is stored in socket_t::address.

Parameters
sockPointer to the socket to connect.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 184 of file netfs.h.

◆ accept

uint64_t(* netfs_family_t::accept) (socket_t *sock, socket_t *newSock, mode_t mode)

Accept an incoming connection on a listening socket.

Parameters
sockPointer to the listening socket.
newSockPointer to the socket to initialize for the new connection.
modeMode flags for the new socket.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 193 of file netfs.h.

◆ send

size_t(* netfs_family_t::send) (socket_t *sock, const void *buffer, size_t count, size_t *offset, mode_t mode)

Send data on a socket.

Parameters
sockPointer to the socket to send data on.
bufferPointer to the data to send.
countNumber of bytes to send.
offsetPointer to the position in the file, families may ignore this.
modeMode flags for sending.
Returns
On success, number of bytes sent. On failure, ERR and errno is set.

Definition at line 204 of file netfs.h.

◆ recv

size_t(* netfs_family_t::recv) (socket_t *sock, void *buffer, size_t count, size_t *offset, mode_t mode)

Receive data on a socket.

Parameters
sockPointer to the socket to receive data on.
bufferPointer to the buffer to store received data.
countMaximum number of bytes to receive.
offsetPointer to the position in the file, families may ignore this.
modeMode flags for receiving.
Returns
On success, number of bytes received. On failure, ERR and errno is set.

Definition at line 215 of file netfs.h.

◆ poll

wait_queue_t *(* netfs_family_t::poll) (socket_t *sock, poll_events_t *revents)

Poll a socket for events.

Parameters
sockPointer to the socket to poll.
reventsPointer to store the events that occurred.
Returns
On success, a pointer to the wait queue to block on. On failure, NULL and errno is set.

Definition at line 223 of file netfs.h.

◆ listEntry

list_entry_t netfs_family_t::listEntry

Definition at line 224 of file netfs.h.

◆ sockets

list_t netfs_family_t::sockets

Definition at line 225 of file netfs.h.

◆ mutex

rwmutex_t netfs_family_t::mutex

Definition at line 226 of file netfs.h.


The documentation for this struct was generated from the following file: