|
PatchworkOS
621ae6b
A non-POSIX operating system.
|
Socket Family structure. More...
#include <netfs.h>
Data Fields | |
| const char * | name |
| 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 |
Bind a socket to its address.
The address is stored in socket_t::address.
| sock | Pointer to the socket to bind. |
0. On failure, ERR and errno is set. Connect a socket to its address.
The address is stored in socket_t::address.
| sock | Pointer to the socket to connect. |
0. On failure, ERR and errno is set. | 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.
| sock | Pointer to the socket to send data on. |
| buffer | Pointer to the data to send. |
| count | Number of bytes to send. |
| offset | Pointer to the position in the file, families may ignore this. |
| mode | Mode flags for sending. |
ERR and errno is set. | 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.
| sock | Pointer to the socket to receive data on. |
| buffer | Pointer to the buffer to store received data. |
| count | Maximum number of bytes to receive. |
| offset | Pointer to the position in the file, families may ignore this. |
| mode | Mode flags for receiving. |
ERR and errno is set. | wait_queue_t *(* netfs_family_t::poll) (socket_t *sock, poll_events_t *revents) |
| list_entry_t netfs_family_t::listEntry |