VFS Driver for adding a BSD-sockets-like filesystem.
More...
|
| Flags |
| Flags for Socket VFS
|
|
|
file | fs_socket.h |
| Definitions for a sockets "filesystem".
|
|
VFS Driver for adding a BSD-sockets-like filesystem.
◆ FS_SOCKET_PROTO_ENTRY
#define FS_SOCKET_PROTO_ENTRY { NULL, NULL } |
◆ fs_socket_input()
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.
This function is used by the lower-level network protocol handlers to input packets for further processing by upper-level protocols. This will call the input function on the family handler, if one is found.
- Parameters
-
src | The network interface the packet came in on |
domain | The low-level protocol used (AF_INET or AF_INET6) |
protocol | The upper-level protocol that we're looking for |
hdr | The low-level protocol header |
data | The upper-level packet, without any lower-level protocol headers, but with the upper-level ones intact |
size | The size of the packet (the data parameter) |
- Return values
-
-2 | The protocol is not known |
-1 | Protocol-level error processing packet |
0 | On success |
◆ fs_socket_open_sock()
Open a socket without calling the protocol initializer.
This function creates a new socket, but does not call the protocol's socket() function. This is meant to be used for things like accepting an incoming connection, where calling the regular socket initializer could cause issues. You shouldn't really have any need to call this function unless you are implementing a new protocol handler.
- Parameters
-
proto | The protocol to use for the socket. |
- Returns
- The newly created socket on success, NULL on failure.
- Error Conditions:
- EWOULDBLOCK - if the function would block in an IRQ
ENOMEM - out of memory
EMFILE - too many files open
◆ fs_socket_proto_add()
Add a new protocol for use with fs_socket.
This function registers a protocol handler with fs_socket for use when creating and using sockets. This protocol handler must implement all of the functions in the fs_socket_proto_t structure. See the code in kos/kernel/net/net_udp.c for an example of how to do this.
- Warning
- This function is NOT safe to call inside an interrupt.
- Parameters
-
proto | The new protocol handler to register |
- Return values
-
0 | On success (no error conditions are currently defined) |
◆ fs_socket_proto_remove()
Unregister a protocol from fs_socket.
This function does the exact opposite of fs_socket_proto_add, and removes a protocol from use with fs_socket.
- Note
- It is the programmer's responsibility to make sure that no sockets are still around that are registered with the protocol to be removed (as they will not work properly once the handler has been removed).
- Parameters
-
proto | The protocol handler to remove |
- Return values
-
-1 | On error (This function does not directly change errno) |
0 | On success |