|
PatchworkOS
|
#include <kernel/net/socket.h>#include <kernel/fs/ctl.h>#include <kernel/fs/file.h>#include <kernel/fs/mount.h>#include <kernel/fs/path.h>#include <kernel/net/socket_family.h>#include <kernel/proc/process.h>#include <kernel/sched/sched.h>#include <kernel/sched/wait.h>#include <kernel/sync/lock.h>#include <kernel/sync/mutex.h>#include <kernel/sync/rwmutex.h>#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <sys/io.h>Go to the source code of this file.
Variables | |
| static file_ops_t | dataOps |
| static file_ops_t | acceptOps |
| static inode_ops_t | inodeOps |
| static superblock_ops_t | superblockOps |
| static const bool | validTransitions [SOCKET_STATE_AMOUNT][SOCKET_STATE_AMOUNT] |
| CTL_STANDARD_OPS_DEFINE | ( | ctlOps | , |
| (ctl_array_t){ {"bind", socket_ctl_bind, 2, 2}, {"listen", socket_ctl_listen, 1, 2}, {"connect", socket_ctl_connect, 2, 2}, {0}, } | |||
| ) |
References socket_ctl_bind(), socket_ctl_connect(), and socket_ctl_listen().
|
static |
Definition at line 235 of file socket.c.
References socket_family_ops_t::accept, socket_t::currentState, DEREF, EINVAL, ENOSYS, ERR, errno, socket_t::family, file, dentry_t::inode, socket_t::mutex, NULL, socket_family_t::ops, dentry_t::private, inode_t::private, RWMUTEX_READ_SCOPE, SOCKET_CONNECTED, SOCKET_CONNECTING, socket_continue_transition(), socket_end_transition(), SOCKET_LISTENING, socket_new(), socket_start_transition(), and socket_t::type.
| bool socket_can_transition | ( | socket_state_t | from, |
| socket_state_t | to | ||
| ) |
Definition at line 482 of file socket.c.
References SOCKET_STATE_AMOUNT, and validTransitions.
Referenced by socket_continue_transition(), and socket_start_transition().
Definition at line 122 of file socket.c.
References socket_family_ops_t::bind, EINVAL, ENOSYS, ERR, errno, socket_t::family, file, dentry_t::inode, NULL, socket_family_t::ops, inode_t::private, SOCKET_BOUND, socket_end_transition(), and socket_start_transition().
Referenced by CTL_STANDARD_OPS_DEFINE().
Definition at line 180 of file socket.c.
References socket_family_ops_t::connect, EINPROGRESS, EINVAL, ENOSYS, ERR, errno, socket_t::family, file, socket_t::flags, dentry_t::inode, NULL, socket_family_t::ops, PATH_NONBLOCK, inode_t::private, SOCKET_CONNECTED, SOCKET_CONNECTING, socket_continue_transition(), socket_end_transition(), and socket_start_transition().
Referenced by CTL_STANDARD_OPS_DEFINE().
Definition at line 149 of file socket.c.
References atol, EINVAL, ENOSYS, ERR, errno, socket_t::family, file, dentry_t::inode, socket_family_ops_t::listen, NULL, socket_family_t::ops, inode_t::private, socket_end_transition(), SOCKET_LISTENING, and socket_start_transition().
Referenced by CTL_STANDARD_OPS_DEFINE().
|
static |
Definition at line 20 of file socket.c.
References EINVAL, ERR, errno, socket_t::family, file, dentry_t::inode, NULL, dentry_t::private, inode_t::private, and REF.
|
static |
Definition at line 96 of file socket.c.
References EINVAL, ENOSYS, errno, socket_t::family, file, NULL, socket_family_t::ops, socket_family_ops_t::poll, and dentry_t::private.
|
static |
Definition at line 44 of file socket.c.
References count, socket_t::currentState, EINVAL, ENOSYS, ENOTCONN, ERR, errno, socket_t::family, file, socket_t::mutex, NULL, socket_family_t::ops, dentry_t::private, socket_family_ops_t::recv, RWMUTEX_READ_SCOPE, and SOCKET_CONNECTED.
|
static |
Definition at line 70 of file socket.c.
References count, socket_t::currentState, EINVAL, ENOSYS, ENOTCONN, ERR, errno, socket_t::family, file, socket_t::mutex, NULL, socket_family_t::ops, dentry_t::private, RWMUTEX_READ_SCOPE, socket_family_ops_t::send, and SOCKET_CONNECTED.
|
static |
Will only be called when the socket reference count reaches 0. Meaning the socket must be unmounted first.
Definition at line 320 of file socket.c.
References socket_family_ops_t::deinit, socket_t::family, free(), socket_t::mutex, NULL, socket_family_t::ops, and rwmutex_deinit().
Referenced by socket_new().
|
static |
Definition at line 302 of file socket.c.
References DEREF, NULL, and inode_t::private.
|
static |
Definition at line 336 of file socket.c.
References socket_t::acceptFile, socket_t::ctlFile, socket_t::dataFile, DEREF, NULL, and superblock_t::private.
|
static |
Definition at line 294 of file socket.c.
Referenced by socket_new().
|
static |
Definition at line 114 of file socket.c.
Referenced by socket_new().
|
static |
Definition at line 313 of file socket.c.
Referenced by socket_new().
|
static |
Definition at line 355 of file socket.c.
Referenced by socket_new(), sysfs_mount(), and sysfs_mount_new().
|
static |
Definition at line 448 of file socket.c.
Referenced by socket_can_transition().