Socket common core. More...
#include <sys/types.h>#include "../include/in.h"#include "../include/device.h"#include "../structures/generic_char_map.h"#include "../structures/dynamic_fifo.h"#include "../structures/int_map.h"#include "../structures/packet/packet.h"

Data Structures | |
| struct | socket_core |
| Socket core. More... | |
Defines | |
| #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 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. | |
Functions | |
| 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. | |
| 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. | |
Socket common core.
1.6.1