24 #ifndef __KOS_FS_SOCKET_H
25 #define __KOS_FS_SOCKET_H
27 #include <sys/cdefs.h>
35 #include <sys/queue.h>
291 void *option_value,
socklen_t *option_len);
310 const void *option_value,
socklen_t option_len);
340 #define FS_SOCKET_PROTO_ENTRY { NULL, NULL }
344 int fs_socket_init(
void);
345 int fs_socket_shutdown(
void);
374 #define FS_SOCKET_NONBLOCK 0x00000001
375 #define FS_SOCKET_V6ONLY 0x00000002
377 #define FS_SOCKET_GEN_MAX 0x00008000
378 #define FS_SOCKET_FAM_MAX 0x00800000
399 const uint8 *data,
size_t size);
file_t fd
File handle from the VFS layer.
Definition: fs_socket.h:57
int type
Type of support for this protocol handler.
Definition: fs_socket.h:104
ssize_t(* recvfrom)(net_socket_t *s, void *buffer, size_t len, int flags, struct sockaddr *addr, socklen_t *alen)
Recieve data on a socket created with the protocol.
Definition: fs_socket.h:215
struct fs_socket_proto * protocol
The protocol handler for this socket.
Definition: fs_socket.h:60
int protocol
Protocol of support for this protocol handler.
Definition: fs_socket.h:112
int(* listen)(net_socket_t *s, int backlog)
Listen for incoming connections on a socket created with the protocol.
Definition: fs_socket.h:193
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.
Internal representation of a socket for fs_socket.
Definition: fs_socket.h:50
Virtual filesystem support.
int(* getsockopt)(net_socket_t *s, int level, int option_name, void *option_value, socklen_t *option_len)
Get socket options.
Definition: fs_socket.h:290
int domain
Domain of support for this protocol handler.
Definition: fs_socket.h:96
int(* bind)(net_socket_t *s, const struct sockaddr *addr, socklen_t alen)
Bind a socket created with the protocol to an address.
Definition: fs_socket.h:166
int(* shutdownsock)(net_socket_t *s, int how)
Shut down a socket created with the protocol.
Definition: fs_socket.h:250
int fs_socket_proto_add(fs_socket_proto_t *proto)
Add a new protocol for use with fs_socket.
int(* accept)(net_socket_t *s, struct sockaddr *addr, socklen_t *alen)
Accept a connection on a socket created with the protocol.
Definition: fs_socket.h:153
ssize_t(* sendto)(net_socket_t *s, const void *msg, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
Send data on a socket created with the protocol.
Definition: fs_socket.h:237
Socket address structure.
Definition: socket.h:38
TAILQ_ENTRY(fs_socket_proto) entry
Entry into the global list of protocols.
short(* poll)(net_socket_t *s, short events)
Poll for events.
Definition: fs_socket.h:336
int fs_socket_proto_remove(fs_socket_proto_t *proto)
Unregister a protocol from fs_socket.
void * data
Protocol-specific data.
Definition: fs_socket.h:63
__uint32_t socklen_t
Socket length type.
Definition: socket.h:30
int(* input)(netif_t *src, int domain, const void *hdr, const uint8 *data, size_t size)
Input a packet into a protocol.
Definition: fs_socket.h:269
net_socket_t * fs_socket_open_sock(fs_socket_proto_t *proto)
Open a socket without calling the protocol initializer.
struct fs_socket_proto fs_socket_proto_t
Internal sockets protocol handler.
unsigned char uint8
8-bit unsigned integer
Definition: types.h:30
int file_t
File descriptor type.
Definition: fs.h:86
Internal sockets protocol handler.
Definition: fs_socket.h:81
int(* socket)(net_socket_t *s, int domain, int type, int protocol)
Create a new socket for the protocol.
Definition: fs_socket.h:129
int(* setsockopt)(net_socket_t *s, int level, int option_name, const void *option_value, socklen_t option_len)
Set socket options.
Definition: fs_socket.h:309
Structure describing one usable network device.
Definition: net.h:42
int(* fcntl)(net_socket_t *s, int cmd, va_list ap)
Manipulate file options.
Definition: fs_socket.h:322
void(* close)(net_socket_t *hnd)
Close a socket that was created with the protocol.
Definition: fs_socket.h:140
int(* connect)(net_socket_t *s, const struct sockaddr *addr, socklen_t alen)
Connect a socket created with the protocol to a remote system.
Definition: fs_socket.h:179
struct net_socket net_socket_t
Internal representation of a socket for fs_socket.