socket_core.c File Reference

Socket common core implementation. More...

#include <socket_core.h>
#include <packet_client.h>
#include <packet_remote.h>
#include <net/socket_codes.h>
#include <net/in.h>
#include <net/inet.h>
#include <net/packet.h>
#include <net/modules.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <adt/dynamic_fifo.h>
#include <adt/int_map.h>

Go to the source code of this file.

Data Structures

struct  socket_port
 Bound port sockets. More...

Defines

#define SOCKET_ID_TRIES   100
 Maximum number of random attempts to find a new socket identifier before switching to the sequence.

Functions

int socket_bind (socket_cores_t *local_sockets, socket_ports_t *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_t *global_sockets, socket_core_t *socket, int free_ports_start, int free_ports_end, int last_used_port)
 Binds the socket to a free port.
static int socket_bind_insert (socket_ports_t *global_sockets, socket_core_t *socket, int port)
 Binds the socket to the port.
void socket_cores_release (int packet_phone, socket_cores_t *local_sockets, socket_ports_t *global_sockets, void(*socket_release)(socket_core_t *socket))
 Destroys local sockets.
int socket_create (socket_cores_t *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_t *local_sockets, socket_ports_t *global_sockets, void(*socket_release)(socket_core_t *socket))
 Destroys the socket.
static void socket_destroy_core (int packet_phone, socket_core_t *socket, socket_cores_t *local_sockets, socket_ports_t *global_sockets, void(*socket_release)(socket_core_t *socket))
 Destroys the socket.
static int socket_generate_new_id (socket_cores_t *local_sockets, int positive)
 Tries to find a new free socket identifier.
int socket_port_add (socket_ports_t *global_sockets, int port, socket_core_t *socket, const uint8_t *key, size_t key_length)
 Adds the socket to an already bound port.
static int socket_port_add_core (socket_port_t *socket_port, socket_core_t *socket, const uint8_t *key, size_t key_length)
 Adds the socket to a socket port.
socket_core_tsocket_port_find (socket_ports_t *global_sockets, int port, const uint8_t *key, size_t key_length)
 Finds the bound port socket.
void socket_port_release (socket_ports_t *global_sockets, socket_core_t *socket)
 Releases the socket port.
int socket_reply_packets (packet_t *packet, size_t *length)
 Replies the packet or the packet queue data to the application via the socket.


Detailed Description

Socket common core implementation.

Definition in file socket_core.c.


Generated on Thu Jun 2 07:45:54 2011 for HelenOS/USB by  doxygen 1.4.7