socket.c File Reference

Component interface, socket implementation. More...

Go to the source code of this file.

Defines

#define SOCKET_FLAGS_USER   0x0FFFFFFFUL
 socket->flags contains various types of flags, the upper 4 bits are used for internal stuff.

Functions

void dsi_init_sockets (void)
 Initialize socket table.
static int __allocate_socket (void)
 Find and allocate unused socket in socket table.
int dsi_is_valid_socket (dsi_socket_t *socket)
 Check if socket is valid socket descriptor.
int dsi_socket_create (dsi_jcp_stream_t jcp_stream, dsi_stream_cfg_t cfg, l4dm_dataspace_t *ctrl_ds, l4dm_dataspace_t *data_ds, l4_threadid_t work_id, l4_threadid_t *sync_id, l4_uint32_t flags, dsi_socket_t **socket)
 Create new send/receive socket.

This function allocates the necessary dataspaces, maps them, and creates the synchronisation thread using dsi_create_sync_thread(). The dataspace for the data area can be defined by the caller. Specify DSI_PACKET_MAP to indicate a preallocated dataspace. If no (invalid) control area or synchronization thread are specified, they are created.

int dsi_socket_close (dsi_socket_t *socket)
 Close a socket.

This function stops the synchronisation thread and frees the allocated dataspaces. If the data dataspace was allocated prior to calling dsi_socket_create(), it will not be deleted.

int dsi_socket_stop (dsi_socket_t *socket)
 Stop a socket.

This function stops the synchronisation thread. This ensures that the synchronization thread does not touch the control area any longer. This would be a problem if the sender sends a commit-message and destroys the control area afterwards: The receiver is scheduled (depending on the priorities), sees the received message and tries to access the (unmapped) control area.

int dsi_socket_connect (dsi_socket_t *socket, const dsi_socket_ref_t *remote_socket)
 Connect the socket to a partner

This function enters the data describing a remote endpoint into the socket structure. No start IPC or similar things are performed here.

int dsi_socket_set_sync_callback (dsi_socket_t *socket, dsi_sync_callback_fn_t func)
 Set callback for syncronisation events.

The specified function will be called if synchronisation IPC is necessary due to blocking. The call will be performed inside packet_get(), immediately before the request for sync-IPC is sent to the peer.

int dsi_socket_set_release_callback (dsi_socket_t *socket, dsi_release_callback_fn_t func)
 Set callback for release events.

The specified function will be called if the release event is triggered. The release event will be triggered when the partner commits a packet with dsi_packet_commit() and release notification is set for this packet or the entire stream (flag DSI_PACKET_RELEASE_CALLBACK).

int dsi_socket_get_ref (dsi_socket_t *socket, dsi_socket_ref_t *ref)
 Obtain a reference to a socket

This function returns a reference to a socket which can be passed to another task. The other task can use the reference to communicate with this socket (see dsi_socket_connect()).

int dsi_socket_get_descriptor (dsi_socketid_t id, dsi_socket_t **socket)
 Get the socket of a given socket-ID.

To get the socket of a socket reference x (dsi_socket_ref_t), use dsi_socket_get_descriptor(x.socket,&s). Note, the socket reference must refer to a socket in the own task.

int dsi_socket_get_data_area (dsi_socket_t *socket, void **data_area, l4_size_t *area_size)
 Return start address and size of data area.

On socket creation, the data area is mapped into the local address space. Use this function should be used to get a pointer to the mapped area.

int dsi_socket_set_flags (dsi_socket_t *socket, l4_uint32_t flags)
 Set socket flags.
int dsi_socket_clear_flags (dsi_socket_t *socket, l4_uint32_t flags)
 Clear socket flags.
int dsi_socket_test_flag (dsi_socket_t *socket, l4_uint32_t flag)
 Test socket flag.
int dsi_socket_set_event (dsi_socket_t *socket, l4_uint32_t events)
 Set event.
int dsi_socket_get_packet_num (dsi_socket_t *socket)
 Return number of packets in ring list.
int dsi_socket_get_num_committed_packets (dsi_socket_t *socket)
 Return number of committed send packets in ring list.

Variables

static dsi_socket_t sockets [DSI_MAX_SOCKETS]
static int next_socket = 0
 next index to search for unused socket


Detailed Description

Component interface, socket implementation.

Author:
Lars Reuther <reuther@os.inf.tu-dresden.de>
Date:
07/01/2000

Definition in file socket.c.


Generated on Wed Apr 11 06:40:14 2012 for DSI - Drops Streaming Interface by  doxygen 1.5.6