75 data->listen->isClosed =
true;
84 data->conn->isClosed =
true;
115 data->listen = listen;
195 data->isServer =
false;
231 conn =
REF(container);
394 if (header.
size > readCount)
398 while (remaining > 0)
400 uint64_t toRead = remaining <
sizeof(temp) ? remaining :
sizeof(temp);
512MODULE_INFO(
"Local Networking",
"Kai Norberg",
"Local networking module", OS_VERSION,
"MIT",
"BOOT_ALWAYS");
#define assert(expression)
EFI_PHYSICAL_ADDRESS buffer
uint64_t netfs_family_register(netfs_family_t *family)
Register a network family.
void netfs_family_unregister(netfs_family_t *family)
Unregister a network family.
@ SOCKET_SEQPACKET
A sequenced, reliable, two-way connection-based packet stream.
mode_t
Path flags and permissions.
#define MODULE_INFO(_name, _author, _description, _version, _licence, _deviceTypes)
Macro to define module information.
uint64_t wait_unblock(wait_queue_t *queue, uint64_t amount, errno_t err)
Unblock threads waiting on a wait queue.
#define WAIT_ALL
Used to indicate that the wait should unblock all waiting threads.
#define WAIT_BLOCK_LOCK(queue, lock, condition)
Blocks until the condition is true, condition will be tested on every wakeup. Will release the lock b...
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
static void lock_release(lock_t *lock)
Releases a lock.
static void lock_acquire(lock_t *lock)
Acquires a lock, blocking until it is available.
static size_t fifo_read(fifo_t *fifo, void *buffer, size_t count)
Read data from a fifo buffer at a specific offset.
static size_t fifo_bytes_writeable(const fifo_t *fifo)
Return the number of bytes available for writing in a fifo buffer.
static size_t fifo_write(fifo_t *fifo, const void *buffer, size_t count)
Write data to the fifo buffer.
static size_t fifo_bytes_readable(const fifo_t *fifo)
Return the number of bytes available for reading in a fifo buffer.
#define UNREF_DEFER(ptr)
RAII-style cleanup for scoped references.
#define REF(ptr)
Increment reference count.
#define UNREF(ptr)
Decrement reference count.
#define EISCONN
Transport endpoint is already connected.
#define EBADMSG
Not a data message.
#define EINVAL
Invalid argument.
#define ECONNABORTED
Software caused connection abort.
#define EWOULDBLOCK
Operation would block.
#define EPIPE
Broken pipe.
#define ECONNREFUSED
Connection refused.
#define errno
Error number variable.
#define ECONNRESET
Connection reset by peer.
#define EMSGSIZE
Message too long.
#define UNUSED(x)
Mark a variable as unused.
poll_events_t
Poll events type.
@ POLLIN
File descriptor is ready to read.
@ POLLHUP
Stream socket peer closed connection, or shut down writing of connection.
@ POLLOUT
File descriptor is ready to write.
@ POLLERR
File descriptor caused an error.
static void list_push_back(list_t *list, list_entry_t *entry)
Pushes an entry to the end of the list.
static bool list_is_empty(list_t *list)
Checks if a list is empty.
static list_entry_t * list_pop_front(list_t *list)
Pops the first entry from the list.
#define NULL
Pointer error value.
#define ERR
Integer error value.
#define CONTAINER_OF(ptr, type, member)
Container of macro.
local_conn_t * local_conn_new(local_listen_t *listen)
Allocate and initialize a new local connection.
local_listen_t * local_listen_find(const char *address)
Find a local listener by its address.
local_listen_t * local_listen_new(const char *address)
Allocate and initialize a new local listener.
#define LOCAL_MAX_PACKET_SIZE
The maximum size of a packet allowed to be sent/received via local sockets.
#define LOCAL_PACKET_MAGIC
Magic number for local socket packets, used for validation.
#define LOCAL_MAX_BACKLOG
The maximum backlog of connections for a local listener.
static netfs_family_t local
static local_conn_t * local_socket_get_conn(local_socket_t *data)
static local_listen_t * local_socket_get_listen(local_socket_t *data)
static uint64_t local_socket_accept(socket_t *sock, socket_t *newSock, mode_t mode)
static uint64_t local_socket_connect(socket_t *sock)
static size_t local_socket_send(socket_t *sock, const void *buffer, size_t count, size_t *offset, mode_t mode)
static void local_socket_deinit(socket_t *sock)
uint64_t _module_procedure(const module_event_t *event)
static uint64_t local_socket_init(socket_t *sock)
static wait_queue_t * local_socket_poll(socket_t *sock, poll_events_t *revents)
static uint64_t local_socket_listen(socket_t *sock, uint32_t backlog)
static size_t local_socket_recv(socket_t *sock, void *buffer, size_t count, size_t *offset, mode_t mode)
static uint64_t local_socket_bind(socket_t *sock)
_PUBLIC void * calloc(size_t nmemb, size_t size)
_PUBLIC void free(void *ptr)
A entry in a doubly linked list.
Local Connection structure.
Local Listener structure.
Local socket data structure. struct local_socket_t.
The primitive that threads block on.