Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4755 → Rev 4756

/branches/network/uspace/srv/net/socket/socket_core.c
31,7 → 31,7
*/
 
/** @file
* \todo
* Socket common core implementation.
*/
 
#include "../err.h"
51,22 → 51,46
 
#include "socket_core.h"
 
/** \todo
/** Bound port sockets.
*/
struct socket_port{
/** The bound sockets map.
*/
socket_port_map_t map;
/** The bound sockets count.
*/
int count;
};
 
/** \todo
/** Binds the socket to the port.
* The SOCKET_MAP_KEY_LISTENING key identifier is used.
* @param[in] global_sockets The global sockets to be updated.
* @param[in] socket The socket to be added.
* @param[in] port The port number to be bound to.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
* @returns Other error codes as defined for the socket_ports_add() function.
*/
int socket_bind_insert( socket_ports_ref global_sockets, socket_core_ref socket, int port );
 
/** \todo
/** Destroys the socket.
* If the socket is bound, the port is released.
* Releases all buffered packets, calls the release function and removes the socket from the local sockets.
* @param[in] packet_phone The packet server phone to release buffered packets.
* @param[in] socket The socket to be destroyed.
* @param[in,out] local_sockets The local sockets to be updated.
* @param[in,out] global_sockets The global sockets to be updated.
* @param[in] socket_release The client release callback function.
*/
void socket_destroy_core( int packet_phone, socket_core_ref socket, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void ( * socket_release )( socket_core_ref socket ));
 
/** \todo
/** Adds the socket to a socket port.
* @param[in,out] socket_port The socket port structure.
* @param[in] socket The socket to be added.
* @param[in] key The socket key identifier.
* @param[in] key_length The socket key length.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
*/
int socket_port_add_core( socket_port_ref socket_port, socket_core_ref socket, const char * key, size_t key_length );
 
267,9 → 291,7
size_t * lengths;
size_t index;
 
if( ! length ){
return EINVAL;
}
if( ! length ) return EBADMEM;
next_packet = pq_next( packet );
if( ! next_packet ){
// write all if only one fragment