socket_client.c File Reference

Socket application program interface (API) implementation. More...

#include <assert.h>
#include <async.h>
#include <fibril_synch.h>
#include <limits.h>
#include <stdlib.h>
#include <ipc/services.h>
#include "../err.h"
#include "../modules.h"
#include "../include/in.h"
#include "../include/socket.h"
#include "../include/socket_errno.h"
#include "../structures/dynamic_fifo.h"
#include "../structures/int_map.h"
#include "socket_messages.h"
Include dependency graph for socket_client.c:

Data Structures

struct  socket
 Socket specific data. More...
struct  socket_client_globals
 Socket client library global data. More...

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.

Typedefs

typedef struct socket socket_t
 Type definition of the socket specific data.
typedef socket_tsocket_ref
 Type definition of the socket specific data pointer.

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.
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.

Variables

static struct socket_client_globals socket_globals
 Socket client library global data.

Detailed Description

Socket application program interface (API) implementation.

See also:
socket.h for more information. This is a part of the network application library.

Generated on Thu Mar 11 20:46:14 2010 for Networking and TCP/IP stack for HelenOS system by  doxygen 1.6.1