![]() |
Data Structures | |
struct | socket |
Socket specific data. More... | |
struct | socket_client_globals |
Socket client library global data. More... | |
struct | socket_port |
Bound port sockets. More... | |
struct | socket_core |
Socket core. More... | |
Files | |
file | socket.h |
Socket application program interface (API). | |
file | socket_codes.h |
Socket codes and definitions. | |
file | socket_client.c |
Socket application program interface (API) implementation. | |
file | socket_core.c |
Socket common core implementation. | |
file | socket_core.h |
Socket common core. | |
file | socket_messages.h |
Socket messages. | |
Defines | |
#define | SOCKET_INITIAL_RECEIVED_SIZE 4 |
Initial received packet queue size. | |
#define | SOCKET_MAX_RECEIVED_SIZE 0 |
Maximum received packet queue size. | |
#define | SOCKET_INITIAL_ACCEPTED_SIZE 1 |
Initial waiting sockets queue size. | |
#define | SOCKET_MAX_ACCEPTED_SIZE 0 |
Maximum waiting sockets queue size. | |
#define | SOCKET_CONNECT_TIMEOUT (1 * 1000 * 1000) |
Default timeout for connections in microseconds. | |
#define | SOCKET_ID_TRIES 100 |
Maximum number of random attempts to find a new socket identifier before switching to the sequence. | |
#define | SOCKET_ID_TRIES 100 |
Maximum number of random attempts to find a new socket identifier before switching to the sequence. | |
#define | SOCKET_INITIAL_RECEIVED_SIZE 4 |
Initial size of the received packet queue. | |
#define | SOCKET_MAX_RECEIVED_SIZE 0 |
Maximum size of the received packet queue. | |
#define | SOCKET_INITIAL_ACCEPTED_SIZE 1 |
Initial size of the sockets for acceptance queue. | |
#define | SOCKET_MAX_ACCEPTEDED_SIZE 0 |
Maximum size of the sockets for acceptance queue. | |
#define | SOCKET_MAP_KEY_LISTENING "L" |
Listening sockets' port map key. | |
Typedefs | |
typedef enum sock_type | sock_type_t |
Socket types. | |
typedef int32_t | socklen_t |
Type definition of the socket length. | |
typedef struct socket | socket_t |
Type definition of the socket specific data. | |
typedef socket_t * | socket_ref |
Type definition of the socket specific data pointer. | |
typedef struct socket_core | socket_core_t |
Type definition of the socket core. | |
typedef socket_core_t * | socket_core_ref |
Type definition of the socket core pointer. | |
typedef struct socket_port | socket_port_t |
Type definition of the socket port. | |
typedef socket_port_t * | socket_port_ref |
Type definition of the socket port pointer. | |
Enumerations | |
enum | sock_type { SOCK_STREAM = 1, SOCK_DGRAM = 2, SOCK_RAW = 3 } |
Socket types. More... | |
enum | socket_messages { NET_SOCKET = NET_SOCKET_FIRST, NET_SOCKET_BIND, NET_SOCKET_LISTEN, NET_SOCKET_ACCEPT, NET_SOCKET_CONNECT, NET_SOCKET_CLOSE, NET_SOCKET_SEND, NET_SOCKET_SENDTO, NET_SOCKET_RECV, NET_SOCKET_RECVFROM, NET_SOCKET_GETSOCKOPT, NET_SOCKET_SETSOCKOPT, NET_SOCKET_ACCEPTED, NET_SOCKET_RECEIVED, NET_SOCKET_DATA_FRAGMENT_SIZE } |
Socket client messages. More... | |
Functions | |
INT_MAP_DECLARE (sockets, socket_t) | |
Sockets map. | |
INT_MAP_IMPLEMENT (sockets, socket_t) | |
static int | socket_get_tcp_phone (void) |
Returns the TCP module phone. | |
static int | socket_get_udp_phone (void) |
Returns the UDP module phone. | |
static sockets_ref | socket_get_sockets (void) |
Returns the active sockets. | |
static int | socket_generate_new_id (void) |
Tries to find a new free socket identifier. | |
void | socket_connection (ipc_callid_t iid, ipc_call_t *icall) |
Default thread for new connections. | |
int | socket_send_data (int socket_id, ipcarg_t message, ipcarg_t arg2, const void *data, size_t datalength) |
Sends message to the socket parent module with specified data. | |
void | socket_initialize (socket_ref socket, int socket_id, int phone, services_t service) |
Initializes a new socket specific data. | |
void | socket_destroy (socket_ref socket) |
Clears and destroys the socket. | |
int | recvfrom_core (ipcarg_t message, int socket_id, void *data, size_t datalength, int flags, struct sockaddr *fromaddr, socklen_t *addrlen) |
Receives data via the socket. | |
int | sendto_core (ipcarg_t message, int socket_id, const void *data, size_t datalength, int flags, const struct sockaddr *toaddr, socklen_t addrlen) |
Sends data via the socket to the remote address. | |
int | socket_bind_insert (socket_ports_ref global_sockets, socket_core_ref socket, int port) |
Binds the socket to the port. | |
void | socket_destroy_core (int packet_phone, socket_core_ref socket, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void(*socket_release)(socket_core_ref socket)) |
Destroys the socket. | |
int | socket_port_add_core (socket_port_ref socket_port, socket_core_ref socket, const char *key, size_t key_length) |
Adds the socket to a socket port. | |
static int | socket_generate_new_id (socket_cores_ref local_sockets, int positive) |
Tries to find a new free socket identifier. | |
INT_MAP_IMPLEMENT (socket_cores, socket_core_t) | |
GENERIC_CHAR_MAP_IMPLEMENT (socket_port_map, socket_core_ref) | |
INT_MAP_IMPLEMENT (socket_ports, socket_port_t) | |
void | socket_cores_release (int packet_phone, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void(*socket_release)(socket_core_ref socket)) |
Destroys local sockets. | |
int | socket_bind (socket_cores_ref local_sockets, socket_ports_ref global_sockets, int socket_id, void *addr, size_t addrlen, int free_ports_start, int free_ports_end, int last_used_port) |
Binds the socket to the port. | |
int | socket_bind_free_port (socket_ports_ref global_sockets, socket_core_ref socket, int free_ports_start, int free_ports_end, int last_used_port) |
Binds the socket to a free port. | |
int | socket_create (socket_cores_ref local_sockets, int app_phone, void *specific_data, int *socket_id) |
Creates a new socket. | |
int | socket_destroy (int packet_phone, int socket_id, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void(*socket_release)(socket_core_ref socket)) |
Destroys the socket. | |
int | socket_reply_packets (packet_t packet, size_t *length) |
Replies the packet or the packet queue data to the application via the socket. | |
socket_core_ref | socket_port_find (socket_ports_ref global_sockets, int port, const char *key, size_t key_length) |
Finds the bound port socket. | |
void | socket_port_release (socket_ports_ref global_sockets, socket_core_ref socket) |
Releases the socket port. | |
int | socket_port_add (socket_ports_ref global_sockets, int port, socket_core_ref socket, const char *key, size_t key_length) |
Adds the socket to an already bound port. | |
INT_MAP_DECLARE (socket_cores, socket_core_t) | |
Sockets map. | |
GENERIC_CHAR_MAP_DECLARE (socket_port_map, socket_core_ref) | |
Bount port sockets map. | |
INT_MAP_DECLARE (socket_ports, socket_port_t) | |
Ports map. | |
Variables | |
static struct socket_client_globals | socket_globals |
Socket client library global data. | |
Socket application programming interface | |
| |
int | socket (int domain, int type, int protocol) |
Creates a new socket. | |
int | bind (int socket_id, const struct sockaddr *my_addr, socklen_t addrlen) |
Binds the socket to a port address. | |
int | listen (int socket_id, int backlog) |
Sets the number of connections waiting to be accepted. | |
int | accept (int socket_id, struct sockaddr *cliaddr, socklen_t *addrlen) |
Accepts waiting socket. | |
int | connect (int socket_id, const struct sockaddr *serv_addr, socklen_t addrlen) |
Connects socket to the remote server. | |
int | closesocket (int socket_id) |
Closes the socket. | |
int | send (int socket_id, void *data, size_t datalength, int flags) |
Sends data via the socket. | |
int | sendto (int socket_id, const void *data, size_t datalength, int flags, const struct sockaddr *toaddr, socklen_t addrlen) |
Sends data via the socket to the remote address. | |
int | recv (int socket_id, void *data, size_t datalength, int flags) |
Receives data via the socket. | |
int | recvfrom (int socket_id, void *data, size_t datalength, int flags, struct sockaddr *fromaddr, socklen_t *addrlen) |
Receives data via the socket. | |
int | getsockopt (int socket_id, int level, int optname, void *value, size_t *optlen) |
Gets socket option. | |
int | setsockopt (int socket_id, int level, int optname, const void *value, size_t optlen) |
Sets socket option. | |
Address families definitions | |
| |
#define | AF_UNSPEC 0 |
Unspecified address family. | |
#define | AF_UNIXL 1 |
Unix domain sockets address family. | |
#define | AF_LOCAL 1 |
POSIX name for AF_UNIX address family. | |
#define | AF_INET 2 |
Internet IP Protocol address family. | |
#define | AF_AX25 3 |
Amateur Radio AX.25 address family. | |
#define | AF_IPX 4 |
Novell IPX address family. | |
#define | AF_APPLETALK 5 |
AppleTalk DDP address family. | |
#define | AF_NETROM 6 |
Amateur Radio NET/ROM address family. | |
#define | AF_BRIDGE 7 |
Multiprotocol bridge address family. | |
#define | AF_ATMPVC 8 |
ATM PVCs address family. | |
#define | AF_X25 9 |
Reserved for X.25 project address family. | |
#define | AF_INET6 10 |
IP version 6 address family. | |
#define | AF_ROSE 11 |
Amateur Radio X.25 PLP address family. | |
#define | AF_DECnet 12 |
Reserved for DECnet project address family. | |
#define | AF_NETBEUI 13 |
Reserved for 802.2LLC project address family. | |
#define | AF_SECURITY 14 |
Security callback pseudo AF address family. | |
#define | AF_KEY 15 |
PF_KEY key management API address family. | |
#define | AF_NETLINK 16 |
Alias to emulate 4.4BSD address family. | |
#define | AF_PACKET 17 |
Packet family address family. | |
#define | AF_ASH 18 |
Ash address family. | |
#define | AF_ECONET 19 |
Acorn Econet address family. | |
#define | AF_ATMSVC 20 |
ATM SVCs address family. | |
#define | AF_SNA 22 |
Linux SNA Project (nutters!) address family. | |
#define | AF_IRDA 23 |
IRDA sockets address family. | |
#define | AF_PPPOX 24 |
PPPoX sockets address family. | |
#define | AF_WANPIPE 25 |
Wanpipe API Sockets address family. | |
#define | AF_LLC 26 |
Linux LLC address family. | |
#define | AF_CAN 29 |
Controller Area Network address family. | |
#define | AF_TIPC 30 |
TIPC sockets address family. | |
#define | AF_BLUETOOTH 31 |
Bluetooth sockets address family. | |
#define | AF_IUCV 32 |
IUCV sockets address family. | |
#define | AF_RXRPC 33 |
RxRPC sockets address family. | |
#define | AF_MAX 34 |
Maximum address family. | |
Protocol families definitions | |
| |
#define | PF_UNSPEC AF_UNSPEC |
Unspecified protocol family. | |
#define | PF_UNIXL AF_UNIXL |
Unix domain sockets protocol family. | |
#define | PF_LOCAL AF_LOCAL |
POSIX name for AF_UNIX protocol family. | |
#define | PF_INET AF_INET |
Internet IP Protocol protocol family. | |
#define | PF_AX25 AF_AX25 |
Amateur Radio AX.25 protocol family. | |
#define | PF_IPX AF_IPX |
Novell IPX protocol family. | |
#define | PF_APPLETALK AF_APPLETALK |
AppleTalk DDP protocol family. | |
#define | PF_NETROM AF_NETROM |
Amateur Radio NET/ROM protocol family. | |
#define | PF_BRIDGE AF_BRIDGE |
Multiprotocol bridge protocol family. | |
#define | PF_ATMPVC AF_ATMPVC |
ATM PVCs protocol family. | |
#define | PF_X25 AF_X25 |
Reserved for X.25 project protocol family. | |
#define | PF_INET6 AF_INET6 |
IP version 6 protocol family. | |
#define | PF_ROSE AF_ROSE |
Amateur Radio X.25 PLP protocol family. | |
#define | PF_DECnet AF_DECnet |
Reserved for DECnet project protocol family. | |
#define | PF_NETBEUI AF_NETBEUI |
Reserved for 802.2LLC project protocol family. | |
#define | PF_SECURITY AF_SECURITY |
Security callback pseudo AF protocol family. | |
#define | PF_KEY AF_KEY |
PF_KEY key management API protocol family. | |
#define | PF_NETLINK AF_NETLINK |
Alias to emulate 4.4BSD protocol family. | |
#define | PF_PACKET AF_PACKET |
Packet family protocol family. | |
#define | PF_ASH AF_ASH |
Ash protocol family. | |
#define | PF_ECONET AF_ECONET |
Acorn Econet protocol family. | |
#define | PF_ATMSVC AF_ATMSVC |
ATM SVCs protocol family. | |
#define | PF_SNA AF_SNA |
Linux SNA Project (nutters!) protocol family. | |
#define | PF_IRDA AF_IRDA |
IRDA sockets protocol family. | |
#define | PF_PPPOX AF_PPPOX |
PPPoX sockets protocol family. | |
#define | PF_WANPIPE AF_WANPIPE |
Wanpipe API Sockets protocol family. | |
#define | PF_LLC AF_LLC |
Linux LLC protocol family. | |
#define | PF_CAN AF_CAN |
Controller Area Network protocol family. | |
#define | PF_TIPC AF_TIPC |
TIPC sockets protocol family. | |
#define | PF_BLUETOOTH AF_BLUETOOTH |
Bluetooth sockets protocol family. | |
#define | PF_IUCV AF_IUCV |
IUCV sockets protocol family. | |
#define | PF_RXRPC AF_RXRPC |
RxRPC sockets protocol family. | |
#define | PF_MAX AF_MAX |
Maximum protocol family. | |
Socket option levels definitions | |
Thanks to BSD these must match IPPROTO_xxx | |
#define | SOL_IP 0 |
IP socket option level. | |
#define | SOL_ICMP 1 |
ICMP socket option level. | |
#define | SOL_TCP 6 |
TCP socket option level. | |
#define | SOL_UDP 17 |
UDP socket option level. | |
#define | SOL_IPV6 41 |
IPV socket option level. | |
#define | SOL_ICMPV6 58 |
ICMPV socket option level. | |
#define | SOL_SCTP 132 |
SCTP socket option level. | |
#define | SOL_UDPLITE 136 |
UDP-Lite (RFC 3828) socket option level. | |
#define | SOL_RAW 255 |
RAW socket option level. | |
#define | SOL_IPX 256 |
IPX socket option level. | |
#define | SOL_AX25 257 |
AX socket option level. | |
#define | SOL_ATALK 258 |
ATALK socket option level. | |
#define | SOL_NETROM 259 |
NETROM socket option level. | |
#define | SOL_ROSE 260 |
ROSE socket option level. | |
#define | SOL_DECNET 261 |
DECNET socket option level. | |
#define | SOL_X25 262 |
X25 socket option level. | |
#define | SOL_PACKET 263 |
PACKET socket option level. | |
#define | SOL_ATM 264 |
ATM layer (cell level) socket option level. | |
#define | SOL_AAL 265 |
ATM Adaption Layer (packet level) socket option level. | |
#define | SOL_IRDA 266 |
IRDA socket option level. | |
#define | SOL_NETBEUI 267 |
NETBEUI socket option level. | |
#define | SOL_LLC 268 |
LLC socket option level. | |
#define | SOL_DCCP 269 |
DCCP socket option level. | |
#define | SOL_NETLINK 270 |
NETLINK socket option level. | |
#define | SOL_TIPC 271 |
TIPC socket option level. | |
#define | SOL_RXRPC 272 |
RXRPC socket option level. | |
#define | SOL_PPPOL2TP 273 |
PPPOL socket option level. | |
#define | SOL_BLUETOOTH 274 |
BLUETOOTH socket option level. | |
Socket specific message parameters definitions | |
| |
#define | SOCKET_SET_SOCKET_ID(answer) (int *) &IPC_GET_ARG1(answer) |
Sets the socket identifier in the message answer. | |
#define | SOCKET_GET_SOCKET_ID(call) (int) IPC_GET_ARG1(call) |
Returns the socket identifier message parameter. | |
#define | SOCKET_SET_READ_DATA_LENGTH(answer) (int *) &IPC_GET_ARG1(answer) |
Sets the read data length in the message answer. | |
#define | SOCKET_GET_READ_DATA_LENGTH(call) (int) IPC_GET_ARG1(call) |
Returns the read data length message parameter. | |
#define | SOCKET_GET_BACKLOG(call) (int) IPC_GET_ARG2(call) |
Returns the backlog message parameter. | |
#define | SOCKET_GET_OPT_LEVEL(call) (int) IPC_GET_ARG2(call) |
Returns the option level message parameter. | |
#define | SOCKET_GET_DATA_FRAGMENT_SIZE(call) (size_t) IPC_GET_ARG2(call) |
Returns the data fragment size message parameter. | |
#define | SOCKET_SET_DATA_FRAGMENT_SIZE(answer) (size_t *) &IPC_GET_ARG2(answer) |
Sets the data fragment size in the message answer. | |
#define | SOCKET_SET_ADDRESS_LENGTH(answer) (socklen_t *) &IPC_GET_ARG3(answer) |
Sets the address length in the message answer. | |
#define | SOCKET_GET_ADDRESS_LENGTH(call) (socklen_t) IPC_GET_ARG3(call) |
Returns the address length message parameter. | |
#define | SOCKET_SET_HEADER_SIZE(answer) (int *) &IPC_GET_ARG3(answer) |
Sets the header size in the message answer. | |
#define | SOCKET_GET_HEADER_SIZE(call) (int) IPC_GET_ARG3(call) |
Returns the header size message parameter. | |
#define | SOCKET_GET_FLAGS(call) (int) IPC_GET_ARG4(call) |
Returns the flags message parameter. | |
#define | SOCKET_GET_OPT_NAME(call) (int) IPC_GET_ARG4(call) |
Returns the option name message parameter. | |
#define | SOCKET_GET_DATA_FRAGMENTS(call) (int) IPC_GET_ARG5(call) |
Returns the data fragments message parameter. | |
#define | SOCKET_GET_NEW_SOCKET_ID(call) (int) IPC_GET_ARG5(call) |
Returns the new socket identifier message parameter. |
#define AF_APPLETALK 5 |
AppleTalk DDP address family.
#define AF_ASH 18 |
Ash address family.
#define AF_ATMPVC 8 |
ATM PVCs address family.
#define AF_ATMSVC 20 |
ATM SVCs address family.
#define AF_AX25 3 |
Amateur Radio AX.25 address family.
#define AF_BLUETOOTH 31 |
Bluetooth sockets address family.
#define AF_BRIDGE 7 |
Multiprotocol bridge address family.
#define AF_CAN 29 |
Controller Area Network address family.
#define AF_DECnet 12 |
Reserved for DECnet project address family.
#define AF_ECONET 19 |
Acorn Econet address family.
#define AF_INET 2 |
Internet IP Protocol address family.
Referenced by inet_ntop(), inet_pton(), ip_deliver_local(), ip_netif_initialize(), ip_prepare_icmp(), ip_process_packet(), and main().
#define AF_INET6 10 |
IP version 6 address family.
Referenced by inet_ntop(), inet_pton(), and main().
#define AF_IPX 4 |
Novell IPX address family.
#define AF_IRDA 23 |
IRDA sockets address family.
#define AF_IUCV 32 |
IUCV sockets address family.
#define AF_KEY 15 |
PF_KEY key management API address family.
#define AF_LLC 26 |
Linux LLC address family.
#define AF_LOCAL 1 |
POSIX name for AF_UNIX address family.
#define AF_MAX 34 |
Maximum address family.
#define AF_NETBEUI 13 |
Reserved for 802.2LLC project address family.
#define AF_NETLINK 16 |
Alias to emulate 4.4BSD address family.
#define AF_NETROM 6 |
Amateur Radio NET/ROM address family.
#define AF_PACKET 17 |
Packet family address family.
#define AF_PPPOX 24 |
PPPoX sockets address family.
#define AF_ROSE 11 |
Amateur Radio X.25 PLP address family.
#define AF_RXRPC 33 |
RxRPC sockets address family.
#define AF_SECURITY 14 |
Security callback pseudo AF address family.
#define AF_SNA 22 |
Linux SNA Project (nutters!) address family.
#define AF_TIPC 30 |
TIPC sockets address family.
#define AF_UNIXL 1 |
Unix domain sockets address family.
#define AF_UNSPEC 0 |
Unspecified address family.
#define AF_WANPIPE 25 |
Wanpipe API Sockets address family.
#define AF_X25 9 |
Reserved for X.25 project address family.
#define PF_APPLETALK AF_APPLETALK |
AppleTalk DDP protocol family.
#define PF_ASH AF_ASH |
Ash protocol family.
#define PF_ATMPVC AF_ATMPVC |
ATM PVCs protocol family.
#define PF_ATMSVC AF_ATMSVC |
ATM SVCs protocol family.
#define PF_AX25 AF_AX25 |
Amateur Radio AX.25 protocol family.
#define PF_BLUETOOTH AF_BLUETOOTH |
Bluetooth sockets protocol family.
#define PF_BRIDGE AF_BRIDGE |
Multiprotocol bridge protocol family.
#define PF_CAN AF_CAN |
Controller Area Network protocol family.
#define PF_DECnet AF_DECnet |
Reserved for DECnet project protocol family.
#define PF_ECONET AF_ECONET |
Acorn Econet protocol family.
#define PF_INET6 AF_INET6 |
IP version 6 protocol family.
Referenced by main().
#define PF_IPX AF_IPX |
Novell IPX protocol family.
#define PF_IRDA AF_IRDA |
IRDA sockets protocol family.
#define PF_IUCV AF_IUCV |
IUCV sockets protocol family.
#define PF_KEY AF_KEY |
PF_KEY key management API protocol family.
#define PF_LLC AF_LLC |
Linux LLC protocol family.
#define PF_LOCAL AF_LOCAL |
POSIX name for AF_UNIX protocol family.
#define PF_MAX AF_MAX |
Maximum protocol family.
#define PF_NETBEUI AF_NETBEUI |
Reserved for 802.2LLC project protocol family.
#define PF_NETLINK AF_NETLINK |
Alias to emulate 4.4BSD protocol family.
#define PF_NETROM AF_NETROM |
Amateur Radio NET/ROM protocol family.
#define PF_PACKET AF_PACKET |
Packet family protocol family.
#define PF_PPPOX AF_PPPOX |
PPPoX sockets protocol family.
#define PF_ROSE AF_ROSE |
Amateur Radio X.25 PLP protocol family.
#define PF_RXRPC AF_RXRPC |
RxRPC sockets protocol family.
#define PF_SECURITY AF_SECURITY |
Security callback pseudo AF protocol family.
#define PF_SNA AF_SNA |
Linux SNA Project (nutters!) protocol family.
#define PF_TIPC AF_TIPC |
TIPC sockets protocol family.
#define PF_UNIXL AF_UNIXL |
Unix domain sockets protocol family.
#define PF_UNSPEC AF_UNSPEC |
Unspecified protocol family.
#define PF_WANPIPE AF_WANPIPE |
Wanpipe API Sockets protocol family.
#define PF_X25 AF_X25 |
Reserved for X.25 project protocol family.
#define SOCKET_CONNECT_TIMEOUT (1 * 1000 * 1000) |
Default timeout for connections in microseconds.
Referenced by socket_get_tcp_phone(), and socket_get_udp_phone().
#define SOCKET_GET_ADDRESS_LENGTH | ( | call | ) | (socklen_t) IPC_GET_ARG3(call) |
Returns the address length message parameter.
[in] | call | The message call structure. |
Referenced by accept(), and recvfrom_core().
#define SOCKET_GET_BACKLOG | ( | call | ) | (int) IPC_GET_ARG2(call) |
Returns the backlog message parameter.
[in] | call | The message call structure. |
Referenced by tcp_process_client_messages().
#define SOCKET_GET_DATA_FRAGMENT_SIZE | ( | call | ) | (size_t) IPC_GET_ARG2(call) |
Returns the data fragment size message parameter.
[in] | call | The message call structure. |
Referenced by accept(), sendto_core(), and socket_connection().
#define SOCKET_GET_DATA_FRAGMENTS | ( | call | ) | (int) IPC_GET_ARG5(call) |
Returns the data fragments message parameter.
[in] | call | The message call structure. |
Referenced by socket_connection(), tcp_process_client_messages(), and udp_process_client_messages().
#define SOCKET_GET_FLAGS | ( | call | ) | (int) IPC_GET_ARG4(call) |
Returns the flags message parameter.
[in] | call | The message call structure. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
#define SOCKET_GET_HEADER_SIZE | ( | call | ) | (int) IPC_GET_ARG3(call) |
Returns the header size message parameter.
[in] | call | The message call structure. |
#define SOCKET_GET_NEW_SOCKET_ID | ( | call | ) | (int) IPC_GET_ARG5(call) |
Returns the new socket identifier message parameter.
[in] | call | The message call structure. |
Referenced by tcp_process_client_messages().
#define SOCKET_GET_OPT_LEVEL | ( | call | ) | (int) IPC_GET_ARG2(call) |
Returns the option level message parameter.
[in] | call | The message call structure. |
#define SOCKET_GET_OPT_NAME | ( | call | ) | (int) IPC_GET_ARG4(call) |
Returns the option name message parameter.
[in] | call | The message call structure. |
#define SOCKET_GET_READ_DATA_LENGTH | ( | call | ) | (int) IPC_GET_ARG1(call) |
Returns the read data length message parameter.
[in] | call | The message call structure. |
Referenced by recvfrom_core().
#define SOCKET_GET_SOCKET_ID | ( | call | ) | (int) IPC_GET_ARG1(call) |
Returns the socket identifier message parameter.
[in] | call | The message call structure. |
Referenced by socket_connection(), tcp_process_client_messages(), and udp_process_client_messages().
#define SOCKET_ID_TRIES 100 |
Maximum number of random attempts to find a new socket identifier before switching to the sequence.
#define SOCKET_ID_TRIES 100 |
Maximum number of random attempts to find a new socket identifier before switching to the sequence.
Referenced by socket_generate_new_id().
#define SOCKET_INITIAL_ACCEPTED_SIZE 1 |
Initial size of the sockets for acceptance queue.
#define SOCKET_INITIAL_ACCEPTED_SIZE 1 |
Initial waiting sockets queue size.
Referenced by socket_initialize().
#define SOCKET_INITIAL_RECEIVED_SIZE 4 |
Initial size of the received packet queue.
#define SOCKET_INITIAL_RECEIVED_SIZE 4 |
Initial received packet queue size.
Referenced by socket_initialize().
#define SOCKET_MAP_KEY_LISTENING "L" |
Listening sockets' port map key.
Referenced by socket_bind_insert(), tcp_process_listen(), tcp_process_packet(), and udp_process_packet().
#define SOCKET_MAX_ACCEPTED_SIZE 0 |
Maximum waiting sockets queue size.
Referenced by socket_connection().
#define SOCKET_MAX_ACCEPTEDED_SIZE 0 |
Maximum size of the sockets for acceptance queue.
#define SOCKET_MAX_RECEIVED_SIZE 0 |
Maximum size of the received packet queue.
#define SOCKET_MAX_RECEIVED_SIZE 0 |
Maximum received packet queue size.
Referenced by socket_connection(), tcp_queue_received_packet(), and udp_process_packet().
#define SOCKET_SET_ADDRESS_LENGTH | ( | answer | ) | (socklen_t *) &IPC_GET_ARG3(answer) |
Sets the address length in the message answer.
[out] | answer | The message answer structure. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
#define SOCKET_SET_DATA_FRAGMENT_SIZE | ( | answer | ) | (size_t *) &IPC_GET_ARG2(answer) |
Sets the data fragment size in the message answer.
[out] | answer | The message answer structure. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
#define SOCKET_SET_HEADER_SIZE | ( | answer | ) | (int *) &IPC_GET_ARG3(answer) |
Sets the header size in the message answer.
[out] | answer | The message answer structure. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
#define SOCKET_SET_READ_DATA_LENGTH | ( | answer | ) | (int *) &IPC_GET_ARG1(answer) |
Sets the read data length in the message answer.
[out] | answer | The message answer structure. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
#define SOCKET_SET_SOCKET_ID | ( | answer | ) | (int *) &IPC_GET_ARG1(answer) |
Sets the socket identifier in the message answer.
[out] | answer | The message answer structure. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
#define SOL_ATALK 258 |
ATALK socket option level.
#define SOL_ATM 264 |
ATM layer (cell level) socket option level.
#define SOL_AX25 257 |
AX socket option level.
#define SOL_BLUETOOTH 274 |
BLUETOOTH socket option level.
#define SOL_DCCP 269 |
DCCP socket option level.
#define SOL_DECNET 261 |
DECNET socket option level.
#define SOL_ICMP 1 |
ICMP socket option level.
#define SOL_ICMPV6 58 |
ICMPV socket option level.
#define SOL_IP 0 |
IP socket option level.
#define SOL_IPV6 41 |
IPV socket option level.
#define SOL_IPX 256 |
IPX socket option level.
#define SOL_IRDA 266 |
IRDA socket option level.
#define SOL_LLC 268 |
LLC socket option level.
#define SOL_NETBEUI 267 |
NETBEUI socket option level.
#define SOL_NETLINK 270 |
NETLINK socket option level.
#define SOL_NETROM 259 |
NETROM socket option level.
#define SOL_PACKET 263 |
PACKET socket option level.
#define SOL_PPPOL2TP 273 |
PPPOL socket option level.
#define SOL_RAW 255 |
RAW socket option level.
#define SOL_ROSE 260 |
ROSE socket option level.
#define SOL_RXRPC 272 |
RXRPC socket option level.
#define SOL_SCTP 132 |
SCTP socket option level.
#define SOL_TCP 6 |
TCP socket option level.
#define SOL_TIPC 271 |
TIPC socket option level.
#define SOL_UDP 17 |
UDP socket option level.
#define SOL_UDPLITE 136 |
UDP-Lite (RFC 3828) socket option level.
#define SOL_X25 262 |
X25 socket option level.
typedef enum sock_type sock_type_t |
Socket types.
typedef socket_core_t* socket_core_ref |
Type definition of the socket core pointer.
typedef struct socket_core socket_core_t |
Type definition of the socket core.
typedef socket_port_t* socket_port_ref |
Type definition of the socket port pointer.
typedef struct socket_port socket_port_t |
Type definition of the socket port.
typedef socket_t* socket_ref |
enum sock_type |
enum socket_messages |
Socket client messages.
NET_SOCKET |
Creates a new socket.
|
NET_SOCKET_BIND |
Binds the socket.
|
NET_SOCKET_LISTEN |
Creates a new socket.
|
NET_SOCKET_ACCEPT |
Accepts an incomming connection.
|
NET_SOCKET_CONNECT |
Connects the socket.
|
NET_SOCKET_CLOSE |
Closes the socket.
|
NET_SOCKET_SEND |
Sends data via the stream socket.
|
NET_SOCKET_SENDTO |
Sends data via the datagram socket.
|
NET_SOCKET_RECV |
Receives data from the stream socket.
|
NET_SOCKET_RECVFROM |
Receives data from the datagram socket.
|
NET_SOCKET_GETSOCKOPT |
Gets the socket option.
|
NET_SOCKET_SETSOCKOPT |
Sets the socket option.
|
NET_SOCKET_ACCEPTED |
New socket for acceptence notification message. |
NET_SOCKET_RECEIVED |
New data received notification message. |
NET_SOCKET_DATA_FRAGMENT_SIZE |
New socket data fragment size notification message. |
Accepts waiting socket.
Blocks until such a socket exists.
[in] | socket_id | Socket identifier. |
[out] | cliaddr | The remote client address. |
[in] | addrlen | The address length. |
References accept_lock, accept_signal, accepted, blocked, data_fragment_size, dyn_fifo_pop(), dyn_fifo_value(), ENOTSOCK, free, socket_client_globals::lock, NET_SOCKET_ACCEPT, phone, service, socket_generate_new_id(), SOCKET_GET_ADDRESS_LENGTH, SOCKET_GET_DATA_FRAGMENT_SIZE, socket_get_sockets(), socket_globals, socket_id, and socket_initialize().
Referenced by main().
Binds the socket to a port address.
[in] | socket_id | Socket identifier. |
[in] | my_addr | The port address. |
[in] | addrlen | The address length. |
References NET_SOCKET_BIND, and socket_send_data().
Referenced by main().
int closesocket | ( | int | socket_id | ) |
Closes the socket.
[in] | socket_id | Socket identifier. |
References blocked, EINPROGRESS, ENOTSOCK, ERROR_DECLARE, ERROR_PROPAGATE, socket_client_globals::lock, NET_SOCKET_CLOSE, phone, service, socket_destroy(), socket_get_sockets(), socket_globals, and socket_id.
Referenced by main().
Connects socket to the remote server.
[in] | socket_id | Socket identifier. |
[in] | serv_addr | The remote server address. |
[in] | addrlen | The address length. |
References EDESTADDRREQ, NET_SOCKET_CONNECT, and socket_send_data().
GENERIC_CHAR_MAP_DECLARE | ( | socket_port_map | , | |
socket_core_ref | ||||
) |
Bount port sockets map.
The listening socket has the SOCKET_MAP_KEY_LISTENING key identifier whereas the other use the remote addresses.
GENERIC_CHAR_MAP_IMPLEMENT | ( | socket_port_map | , | |
socket_core_ref | ||||
) |
int getsockopt | ( | int | socket_id, | |
int | level, | |||
int | optname, | |||
void * | value, | |||
size_t * | optlen | |||
) |
Gets socket option.
[in] | socket_id | Socket identifier. |
[in] | level | The socket options level. |
[in] | optname | The socket option to be get. |
[out] | value | The value buffer to be filled. |
[in,out] | optlen | The value buffer length. The maximum length is read. The actual length is set. |
References ENOTSOCK, socket_client_globals::lock, NET_SOCKET_GETSOCKOPT, NO_DATA, phone, service, socket_get_sockets(), socket_globals, and socket_id.
INT_MAP_DECLARE | ( | socket_ports | , | |
socket_port_t | ||||
) |
Ports map.
The key is the port number.
INT_MAP_DECLARE | ( | socket_cores | , | |
socket_core_t | ||||
) |
Sockets map.
The key is the socket identifier.
INT_MAP_DECLARE | ( | sockets | , | |
socket_t | ||||
) |
INT_MAP_IMPLEMENT | ( | socket_ports | , | |
socket_port_t | ||||
) |
INT_MAP_IMPLEMENT | ( | socket_cores | , | |
socket_core_t | ||||
) |
INT_MAP_IMPLEMENT | ( | sockets | , | |
socket_t | ||||
) |
int listen | ( | int | socket_id, | |
int | backlog | |||
) |
Sets the number of connections waiting to be accepted.
[in] | socket_id | Socket identifier. |
[in] | backlog | The maximum number of waiting sockets to be accepted. |
References ENOTSOCK, socket_client_globals::lock, NET_SOCKET_LISTEN, phone, service, socket_get_sockets(), socket_globals, and socket_id.
Referenced by main().
int recv | ( | int | socket_id, | |
void * | data, | |||
size_t | datalength, | |||
int | flags | |||
) |
Receives data via the socket.
[in] | socket_id | Socket identifier. |
[out] | data | The data buffer to be filled. |
[in] | datalength | The data length. |
[in] | flags | Various receive flags. |
References NET_SOCKET_RECV, and recvfrom_core().
int recvfrom | ( | int | socket_id, | |
void * | data, | |||
size_t | datalength, | |||
int | flags, | |||
struct sockaddr * | fromaddr, | |||
socklen_t * | addrlen | |||
) |
Receives data via the socket.
[in] | socket_id | Socket identifier. |
[out] | data | The data buffer to be filled. |
[in] | datalength | The data length. |
[in] | flags | Various receive flags. |
[out] | fromaddr | The source address. |
[in,out] | addrlen | The address length. The maximum address length is read. The actual address length is set. |
References NET_SOCKET_RECVFROM, NO_DATA, and recvfrom_core().
Referenced by main().
int recvfrom_core | ( | ipcarg_t | message, | |
int | socket_id, | |||
void * | data, | |||
size_t | datalength, | |||
int | flags, | |||
struct sockaddr * | fromaddr, | |||
socklen_t * | addrlen | |||
) |
Receives data via the socket.
[in] | message | The action message. |
[in] | socket_id | Socket identifier. |
[out] | data | The data buffer to be filled. |
[in] | datalength | The data length. |
[in] | flags | Various receive flags. |
[out] | fromaddr | The source address. May be NULL for connected sockets. |
[in,out] | addrlen | The address length. The maximum address length is read. The actual address length is set. Used only if fromaddr is not NULL. |
References blocked, dyn_fifo_pop(), dyn_fifo_value(), ENOTSOCK, free, socket_client_globals::lock, NO_DATA, phone, receive_lock, receive_signal, received, service, SOCKET_GET_ADDRESS_LENGTH, SOCKET_GET_READ_DATA_LENGTH, socket_get_sockets(), socket_globals, and socket_id.
Referenced by recv(), and recvfrom().
int send | ( | int | socket_id, | |
void * | data, | |||
size_t | datalength, | |||
int | flags | |||
) |
Sends data via the socket.
[in] | socket_id | Socket identifier. |
[in] | data | The data to be sent. |
[in] | datalength | The data length. |
[in] | flags | Various send flags. |
References NET_SOCKET_SEND, and sendto_core().
int sendto | ( | int | socket_id, | |
const void * | data, | |||
size_t | datalength, | |||
int | flags, | |||
const struct sockaddr * | toaddr, | |||
socklen_t | addrlen | |||
) |
Sends data via the socket to the remote address.
Binds the socket to a free port if not already connected/bound.
[in] | socket_id | Socket identifier. |
[in] | data | The data to be sent. |
[in] | datalength | The data length. |
[in] | flags | Various send flags. |
[in] | toaddr | The destination address. |
[in] | addrlen | The address length. |
References EDESTADDRREQ, NET_SOCKET_SENDTO, and sendto_core().
Referenced by main().
int sendto_core | ( | ipcarg_t | message, | |
int | socket_id, | |||
const void * | data, | |||
size_t | datalength, | |||
int | flags, | |||
const struct sockaddr * | toaddr, | |||
socklen_t | addrlen | |||
) |
Sends data via the socket to the remote address.
Binds the socket to a free port if not already connected/bound.
[in] | message | The action message. |
[in] | socket_id | Socket identifier. |
[in] | data | The data to be sent. |
[in] | datalength | The data length. |
[in] | flags | Various send flags. |
[in] | toaddr | The destination address. May be NULL for connected sockets. |
[in] | addrlen | The address length. Used only if toaddr is not NULL. |
References data_fragment_size, ENOTSOCK, header_size, socket_client_globals::lock, NO_DATA, phone, sending_lock, service, SOCKET_GET_DATA_FRAGMENT_SIZE, socket_get_sockets(), socket_globals, and socket_id.
Referenced by send(), and sendto().
int setsockopt | ( | int | socket_id, | |
int | level, | |||
int | optname, | |||
const void * | value, | |||
size_t | optlen | |||
) |
Sets socket option.
[in] | socket_id | Socket identifier. |
[in] | level | The socket options level. |
[in] | optname | The socket option to be set. |
[in] | value | The value to be set. |
[in] | optlen | The value length. |
References NET_SOCKET_SETSOCKOPT, and socket_send_data().
int socket | ( | int | domain, | |
int | type, | |||
int | protocol | |||
) |
Creates a new socket.
[in] | domain | The socket protocol family. |
[in] | type | Socket type. |
[in] | protocol | Socket protocol. |
References accepted, data_fragment_size, dyn_fifo_destroy(), EPFNOSUPPORT, EPROTONOSUPPORT, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ESOCKTNOSUPPORT, free, header_size, IPPROTO_TCP, IPPROTO_UDP, socket_client_globals::lock, NET_SOCKET, NET_SOCKET_CLOSE, PF_INET, received, SOCK_DGRAM, SOCK_RAW, SOCK_STREAM, socket_generate_new_id(), socket_get_sockets(), socket_get_tcp_phone(), socket_get_udp_phone(), socket_globals, and socket_initialize().
Referenced by main().
int socket_bind | ( | socket_cores_ref | local_sockets, | |
socket_ports_ref | global_sockets, | |||
int | socket_id, | |||
void * | addr, | |||
size_t | addrlen, | |||
int | free_ports_start, | |||
int | free_ports_end, | |||
int | last_used_port | |||
) |
Binds the socket to the port.
The address port is used if set, a free port is used if not.
[in] | local_sockets | The local sockets to be searched. |
[in,out] | global_sockets | The global sockets to be updated. |
[in] | socket_id | The new socket identifier. |
[in] | addr | The address to be bound to. |
[in] | addrlen | The address length. |
[in] | free_ports_start | The minimum free port. |
[in] | free_ports_end | The maximum free port. |
[in] | last_used_port | The last used free port. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
int socket_bind_free_port | ( | socket_ports_ref | global_sockets, | |
socket_core_ref | socket, | |||
int | free_ports_start, | |||
int | free_ports_end, | |||
int | last_used_port | |||
) |
Binds the socket to a free port.
The first free port is used.
[in,out] | global_sockets | The global sockets to be updated. |
[in,out] | socket | The socket to be bound. |
[in] | free_ports_start | The minimum free port. |
[in] | free_ports_end | The maximum free port. |
[in] | last_used_port | The last used free port. |
Referenced by tcp_connect_core(), and udp_sendto_message().
int socket_bind_insert | ( | socket_ports_ref | global_sockets, | |
socket_core_ref | socket, | |||
int | port | |||
) |
Binds the socket to the port.
The SOCKET_MAP_KEY_LISTENING key identifier is used.
[in] | global_sockets | The global sockets to be updated. |
[in] | socket | The socket to be added. |
[in] | port | The port number to be bound to. |
References socket_port::count, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, socket_port::map, socket_core::port, SOCKET_MAP_KEY_LISTENING, and socket_port_add_core().
void socket_connection | ( | ipc_callid_t | iid, | |
ipc_call_t * | icall | |||
) |
Default thread for new connections.
[in] | iid | The initial message identifier. |
[in] | icall | The initial message call structure. |
References accept_lock, accept_signal, accepted, data_fragment_size, dyn_fifo_push(), ENOTSOCK, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, socket_client_globals::lock, NET_SOCKET_ACCEPTED, NET_SOCKET_DATA_FRAGMENT_SIZE, NET_SOCKET_RECEIVED, receive_lock, receive_signal, received, sending_lock, SOCKET_GET_DATA_FRAGMENT_SIZE, SOCKET_GET_DATA_FRAGMENTS, SOCKET_GET_SOCKET_ID, socket_get_sockets(), socket_globals, SOCKET_MAX_ACCEPTED_SIZE, and SOCKET_MAX_RECEIVED_SIZE.
Referenced by socket_get_tcp_phone(), and socket_get_udp_phone().
void socket_cores_release | ( | int | packet_phone, | |
socket_cores_ref | local_sockets, | |||
socket_ports_ref | global_sockets, | |||
void(*)(socket_core_ref socket) | socket_release | |||
) |
Destroys local sockets.
Releases all buffered packets and calls the release function for each of the sockets.
[in] | packet_phone | The packet server phone to release buffered packets. |
[in] | local_sockets | The local sockets to be destroyed. |
[in,out] | global_sockets | The global sockets to be updated. |
[in] | socket_release | The client release callback function. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
int socket_create | ( | socket_cores_ref | local_sockets, | |
int | app_phone, | |||
void * | specific_data, | |||
int * | socket_id | |||
) |
Creates a new socket.
[in,out] | local_sockets | The local sockets to be updated. |
[in] | app_phone | The application phone. |
[in] | specific_data | The socket specific data. |
[in,out] | socket_id | The new socket identifier. A new identifier is chosen if set to zero (0) or negative. A negative identifier is chosen if set to negative. |
Referenced by tcp_process_client_messages(), tcp_process_listen(), and udp_process_client_messages().
int socket_destroy | ( | int | packet_phone, | |
int | socket_id, | |||
socket_cores_ref | local_sockets, | |||
socket_ports_ref | global_sockets, | |||
void(*)(socket_core_ref socket) | socket_release | |||
) |
Destroys the socket.
If the socket is bound, the port is released. Releases all buffered packets, calls the release function and removes the socket from the local sockets.
[in] | packet_phone | The packet server phone to release buffered packets. |
[in] | socket_id | The socket identifier. |
[in,out] | local_sockets | The local sockets to be updated. |
[in,out] | global_sockets | The global sockets to be updated. |
[in] | socket_release | The client release callback function. |
void socket_destroy | ( | socket_ref | socket | ) |
Clears and destroys the socket.
References accepted, dyn_fifo_destroy(), dyn_fifo_pop(), received, socket_get_sockets(), and socket_id.
Referenced by closesocket(), tcp_close_message(), tcp_process_listen(), tcp_release_after_timeout(), and udp_process_client_messages().
void socket_destroy_core | ( | int | packet_phone, | |
socket_core_ref | socket, | |||
socket_cores_ref | local_sockets, | |||
socket_ports_ref | global_sockets, | |||
void(*)(socket_core_ref socket) | socket_release | |||
) |
Destroys the socket.
If the socket is bound, the port is released. Releases all buffered packets, calls the release function and removes the socket from the local sockets.
[in] | packet_phone | The packet server phone to release buffered packets. |
[in] | socket | The socket to be destroyed. |
[in,out] | local_sockets | The local sockets to be updated. |
[in,out] | global_sockets | The global sockets to be updated. |
[in] | socket_release | The client release callback function. |
References socket_core::accepted, dyn_fifo_destroy(), dyn_fifo_pop(), socket_core::port, pq_release(), socket_core::received, socket_core::socket_id, and socket_port_release().
static int socket_generate_new_id | ( | socket_cores_ref | local_sockets, | |
int | positive | |||
) | [static] |
Tries to find a new free socket identifier.
[in] | local_sockets | The local sockets to be searched. |
[in] | positive | A value indicating whether a positive identifier is requested. A negative identifier is requested if set to false. |
References count, and SOCKET_ID_TRIES.
static int socket_generate_new_id | ( | void | ) | [static] |
Tries to find a new free socket identifier.
References count, socket_get_sockets(), and SOCKET_ID_TRIES.
Referenced by accept(), and socket().
static sockets_ref socket_get_sockets | ( | void | ) | [static] |
Returns the active sockets.
References free, socket_globals, and socket_client_globals::sockets.
Referenced by accept(), closesocket(), getsockopt(), listen(), recvfrom_core(), sendto_core(), socket(), socket_connection(), socket_destroy(), socket_generate_new_id(), and socket_send_data().
static int socket_get_tcp_phone | ( | void | ) | [static] |
Returns the TCP module phone.
Connects to the TCP module if necessary.
References bind_service_timeout(), SOCKET_CONNECT_TIMEOUT, socket_connection(), socket_globals, and socket_client_globals::tcp_phone.
Referenced by socket().
static int socket_get_udp_phone | ( | void | ) | [static] |
Returns the UDP module phone.
Connects to the UDP module if necessary.
References bind_service_timeout(), SOCKET_CONNECT_TIMEOUT, socket_connection(), socket_globals, and socket_client_globals::udp_phone.
Referenced by socket().
void socket_initialize | ( | socket_ref | socket, | |
int | socket_id, | |||
int | phone, | |||
services_t | service | |||
) |
Initializes a new socket specific data.
[in,out] | socket | The socket to be initialized. |
[in] | socket_id | The new socket identifier. |
[in] | phone | The parent module phone. |
[in] | service | The parent module service. |
References accept_lock, accept_signal, accepted, dyn_fifo_initialize(), phone, receive_lock, receive_signal, received, sending_lock, service, socket_id, SOCKET_INITIAL_ACCEPTED_SIZE, and SOCKET_INITIAL_RECEIVED_SIZE.
Referenced by accept(), and socket().
int socket_port_add | ( | socket_ports_ref | global_sockets, | |
int | port, | |||
socket_core_ref | socket, | |||
const char * | key, | |||
size_t | key_length | |||
) |
Adds the socket to an already bound port.
[in] | global_sockets | The global sockets to be updated. |
[in] | port | The port number to be bound to. |
[in] | socket | The socket to be added. |
[in] | key | The socket key identifier. |
[in] | key_length | The socket key length. |
Referenced by tcp_process_listen().
int socket_port_add_core | ( | socket_port_ref | socket_port, | |
socket_core_ref | socket, | |||
const char * | key, | |||
size_t | key_length | |||
) |
Adds the socket to a socket port.
[in,out] | socket_port | The socket port structure. |
[in] | socket | The socket to be added. |
[in] | key | The socket key identifier. |
[in] | key_length | The socket key length. |
References socket_port::count, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, socket_core::key, socket_core::key_length, and socket_port::map.
Referenced by socket_bind_insert().
socket_core_ref socket_port_find | ( | socket_ports_ref | global_sockets, | |
int | port, | |||
const char * | key, | |||
size_t | key_length | |||
) |
Finds the bound port socket.
[in] | global_sockets | The global sockets to be searched. |
[in] | port | The port number. |
[in] | key | The socket key identifier. |
[in] | key_length | The socket key length. |
Referenced by tcp_process_listen(), tcp_process_packet(), tcp_release_after_timeout(), tcp_timeout(), and udp_process_packet().
void socket_port_release | ( | socket_ports_ref | global_sockets, | |
socket_core_ref | socket | |||
) |
Releases the socket port.
If the socket is bound the port entry is released. If there are no more port entries the port is release.
[in] | global_sockets | The global sockets to be updated. |
[in] | socket | The socket to be unbound. |
Referenced by socket_destroy_core().
int socket_reply_packets | ( | packet_t | packet, | |
size_t * | length | |||
) |
Replies the packet or the packet queue data to the application via the socket.
Uses the current message processing fibril.
Referenced by tcp_recvfrom_message(), and udp_recvfrom_message().
int socket_send_data | ( | int | socket_id, | |
ipcarg_t | message, | |||
ipcarg_t | arg2, | |||
const void * | data, | |||
size_t | datalength | |||
) |
Sends message to the socket parent module with specified data.
[in] | socket_id | Socket identifier. |
[in] | message | The action message. |
[in] | arg2 | The second message parameter. |
[in] | data | The data to be sent. |
[in] | datalength | The data length. |
References ENOTSOCK, socket_client_globals::lock, NO_DATA, phone, service, socket_get_sockets(), socket_globals, and socket_id.
Referenced by bind(), connect(), and setsockopt().
struct socket_client_globals socket_globals [static] |
Socket client library global data.
Referenced by accept(), closesocket(), getsockopt(), listen(), recvfrom_core(), sendto_core(), socket(), socket_connection(), socket_get_sockets(), socket_get_tcp_phone(), socket_get_udp_phone(), and socket_send_data().