#include <assert.h>
#include <async.h>
#include <fibril_synch.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <task.h>
#include <ipc/services.h>
#include <ipc/socket.h>
#include <net/modules.h>
#include <net/in.h>
#include <net/socket.h>
#include <adt/dynamic_fifo.h>
#include <adt/int_map.h>
Go to the source code of this file.
Data Structures | |
struct | socket |
Socket specific data. More... | |
struct | socket_client_globals |
Socket client library global data. More... | |
Socket application programming interface | |
int | accept (int socket_id, struct sockaddr *cliaddr, socklen_t *addrlen) |
Accepts waiting socket. | |
int | bind (int socket_id, const struct sockaddr *my_addr, socklen_t addrlen) |
Binds the socket to a port address. | |
int | closesocket (int socket_id) |
Closes the socket. | |
int | connect (int socket_id, const struct sockaddr *serv_addr, socklen_t addrlen) |
Connects socket to the remote server. | |
int | getsockopt (int socket_id, int level, int optname, void *value, size_t *optlen) |
Gets socket option. | |
int | listen (int socket_id, int backlog) |
Sets the number of connections waiting to be accepted. | |
ssize_t | recv (int socket_id, void *data, size_t datalength, int flags) |
Receives data via the socket. | |
ssize_t | recvfrom (int socket_id, void *data, size_t datalength, int flags, struct sockaddr *fromaddr, socklen_t *addrlen) |
Receives data via 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 | setsockopt (int socket_id, int level, int optname, const void *value, size_t optlen) |
Sets socket option. | |
int | socket (int domain, int type, int protocol) |
Creates a new socket. | |
Defines | |
#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_INITIAL_ACCEPTED_SIZE 1 |
Initial waiting sockets queue size. | |
#define | SOCKET_INITIAL_RECEIVED_SIZE 4 |
Initial received packet queue size. | |
#define | SOCKET_MAX_ACCEPTED_SIZE 0 |
Maximum waiting sockets queue size. | |
#define | SOCKET_MAX_RECEIVED_SIZE 0 |
Maximum received packet queue size. | |
Typedefs | |
typedef socket | socket_t |
Type definition of the socket specific data. | |
Functions | |
INT_MAP_DECLARE (sockets, socket_t) | |
Sockets map. | |
static ssize_t | recvfrom_core (sysarg_t message, int socket_id, void *data, size_t datalength, int flags, struct sockaddr *fromaddr, socklen_t *addrlen) |
Receives data via the socket. | |
static int | sendto_core (sysarg_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. | |
static void | socket_connection (ipc_callid_t iid, ipc_call_t *icall) |
Default thread for new connections. | |
static void | socket_destroy (socket_t *socket) |
Clears and destroys the socket. | |
static int | socket_generate_new_id (void) |
Tries to find a new free socket identifier. | |
static sockets_t * | socket_get_sockets (void) |
Returns the active sockets. | |
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 void | socket_initialize (socket_t *socket, int socket_id, int phone, services_t service) |
Initializes a new socket specific data. | |
static int | socket_send_data (int socket_id, sysarg_t message, sysarg_t arg2, const void *data, size_t datalength) |
Sends message to the socket parent module with specified data. | |
Variables | |
static struct socket_client_globals | socket_globals |
Socket client library global data. |
Definition in file socket_client.c.