25#ifndef __KOS_FS_SOCKET_H
26#define __KOS_FS_SOCKET_H
45struct fs_socket_proto;
57typedef struct net_socket {
60 LIST_ENTRY(net_socket) sock_list;
89typedef struct fs_socket_proto {
277 int (*input)(
netif_t *src,
int domain,
const void *hdr,
const uint8 *data,
299 void *option_value,
socklen_t *option_len);
318 const void *option_value,
socklen_t option_len);
386#define FS_SOCKET_PROTO_ENTRY { NULL, NULL }
390int fs_socket_init(
void);
391int fs_socket_shutdown(
void);
424#define FS_SOCKET_NONBLOCK 0x00000001
425#define FS_SOCKET_V6ONLY 0x00000002
427#define FS_SOCKET_GEN_MAX 0x00008000
428#define FS_SOCKET_FAM_MAX 0x00800000
451 const uint8 *data,
size_t size);
Virtual filesystem support.
int accept(int socket, struct sockaddr *address, socklen_t *address_len)
Accept a new connection on a socket.
int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len)
Set socket options.
int bind(int socket, const struct sockaddr *address, socklen_t address_len)
Bind a name to a socket.
int getsockname(int socket, struct sockaddr *name, socklen_t *name_len)
Get socket name.
__uint32_t socklen_t
Socket length type.
Definition socket.h:39
int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
Get socket options.
ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len)
Send a message on a socket.
int listen(int socket, int backlog)
Listen for socket connections and set the queue length.
ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
Receive a message on a socket.
int connect(int socket, const struct sockaddr *address, socklen_t address_len)
Connect a socket.
int socket(int domain, int type, int protocol)
Create an endpoint for communications.
int getpeername(int socket, struct sockaddr *__RESTRICT name, socklen_t *__RESTRICT name_len)
Get the name of the connected peer socket.
unsigned char uint8
8-bit unsigned integer
Definition types.h:35
int poll(struct pollfd fds[], nfds_t nfds, int timeout)
Poll a group of file descriptors for activity.
int file_t
File descriptor type.
Definition fs.h:94
int fs_socket_input(netif_t *src, int domain, int protocol, const void *hdr, const uint8 *data, size_t size)
Input a packet into some socket family handler.
int fs_socket_proto_remove(fs_socket_proto_t *proto)
Unregister a protocol from fs_socket.
net_socket_t * fs_socket_open_sock(fs_socket_proto_t *proto)
Open a socket without calling the protocol initializer.
int fs_socket_proto_add(fs_socket_proto_t *proto)
Add a new protocol for use with fs_socket.
Internal sockets protocol handler.
Definition fs_socket.h:89
int type
Type of support for this protocol handler.
Definition fs_socket.h:112
int domain
Domain of support for this protocol handler.
Definition fs_socket.h:104
int protocol
Protocol of support for this protocol handler.
Definition fs_socket.h:120
TAILQ_ENTRY(fs_socket_proto) entry
Entry into the global list of protocols.
Internal representation of a socket for fs_socket.
Definition fs_socket.h:57
struct fs_socket_proto * protocol
The protocol handler for this socket.
Definition fs_socket.h:67
file_t fd
File handle from the VFS layer.
Definition fs_socket.h:64
void * data
Protocol-specific data.
Definition fs_socket.h:70
Structure describing one usable network device.
Definition net.h:53
Socket address structure.
Definition socket.h:47