Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4750 → Rev 4756

/branches/network/uspace/srv/net/tl/tcp/tcp_module.h
42,7 → 42,7
#include <ipc/ipc.h>
 
/** Initializes the TCP module.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
*/
49,10 → 49,10
int tcp_initialize( async_client_conn_t client_connection );
 
/** Processes the TCP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @see tcp_interface.h
/branches/network/uspace/srv/net/tl/tcp/tcp_header.h
40,13 → 40,13
 
#include <sys/types.h>
 
/** Returns the actual TCP header length.
* @param header The TCP packet header. Input parameter.
/** Returns the actual TCP header length in bytes.
* @param[in] header The TCP packet header.
*/
#define TCP_HEADER_LENGTH( header ) (( header )->header_length * 4u )
 
/** Returns the actual TCP header length.
* @param header The TCP packet header. Input parameter.
/** Returns the TCP header length.
* @param[in] length The TCP header length in bytes.
*/
#define TCP_COMPUTE_HEADER_LENGTH( length ) (( uint8_t ) (( length ) / 4u ))
 
/branches/network/uspace/srv/net/tl/tcp/tcp.c
33,7 → 33,6
/** @file
* TCP module implementation.
* @see tcp.h
* \todo
*/
 
#include <assert.h>
81,11 → 80,11
*/
#define NET_DEFAULT_TCP_WINDOW 10240
 
/** \todo
/** Initial timeout for new connections.
*/
#define NET_DEFAULT_TCP_INITIAL_TIMEOUT 3000000L
 
/** \todo
/** Default timeout for closing.
*/
#define NET_DEFAULT_TCP_TIME_WAIT_TIMEOUT 2000L
 
105,7 → 104,7
*/
#define TCP_FREE_PORTS_END 65535
 
/** \todo
/** Timeout for connection initialization, SYN sent.
*/
#define TCP_SYN_SENT_TIMEOUT 1000000L
 
117,7 → 116,11
*/
#define TCP_FAST_RETRANSMIT_COUNT 3
 
/** \todo
/** Returns a value indicating whether the value is in the interval respecting the possible overflow.
* The high end and/or the value may overflow, be lower than the low value.
* @param[in] lower The last value before the interval.
* @param[in] value The value to be checked.
* @param[in] high_equal The last value in the interval.
*/
#define IS_IN_INTERVAL_OVERFLOW( lower, value, higher_equal ) (((( lower ) < ( value )) && ((( value ) <= ( higher_equal )) || (( higher_equal ) < ( lower )))) || ((( value ) <= ( higher_equal )) && (( higher_equal ) < ( lower ))))
 
166,8 → 169,8
};
 
/** Releases the packet and returns the result.
* @param packet The packet queue to be released. Input parameter.
* @param result The result to be returned. Input parameter.
* @param[in] packet The packet queue to be released.
* @param[in] result The result to be returned.
* @return The result parameter.
*/
int tcp_release_and_return( packet_t packet, int result );
/branches/network/uspace/srv/net/tl/tcp/tcp_module.c
66,7 → 66,7
 
/** Starts the TCP module.
* Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
* @returns EOK on successful module termination.
* @returns Other error codes as defined for the tcp_initialize() function.
* @returns Other error codes as defined for the REGISTER_ME() macro function.
74,10 → 74,10
int module_start( async_client_conn_t client_connection );
 
/** Processes the TCP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns Other error codes as defined for the tcp_message() function.
*/
/branches/network/uspace/srv/net/tl/icmp/icmp_module.h
42,7 → 42,7
#include <ipc/ipc.h>
 
/** Initializes the ICMP module.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
*/
49,10 → 49,10
int icmp_initialize( async_client_conn_t client_connection );
 
/** Processes the ICMP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @see icmp_interface.h
/branches/network/uspace/srv/net/tl/icmp/icmp_messages.h
79,42 → 79,42
/*@{*/
 
/** Returns the ICMP code message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define ICMP_GET_CODE( call ) ( icmp_code_t ) IPC_GET_ARG1( * call )
 
/** Returns the ICMP link MTU message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define ICMP_GET_MTU( call ) ( icmp_param_t ) IPC_GET_ARG3( * call )
 
/** Returns the pointer message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define ICMP_GET_POINTER( call ) ( icmp_param_t ) IPC_GET_ARG3( * call )
 
/** Returns the size message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define ICMP_GET_SIZE( call ) ( size_t ) IPC_GET_ARG1( call )
 
/** Returns the timeout message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define ICMP_GET_TIMEOUT( call ) (( suseconds_t ) IPC_GET_ARG2( call ))
 
/** Returns the time to live message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define ICMP_GET_TTL( call ) ( ip_ttl_t ) IPC_GET_ARG3( call )
 
/** Returns the type of service message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define ICMP_GET_TOS( call ) ( ip_tos_t ) IPC_GET_ARG4( call )
 
/** Returns the dont fragment message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define ICMP_GET_DONT_FRAGMENT( call ) ( int ) IPC_GET_ARG5( call )
 
/branches/network/uspace/srv/net/tl/icmp/icmp.c
96,8 → 96,8
#define ICMP_FREE_IDS_END MAX_UINT16
 
/** Computes the ICMP datagram checksum.
* @param header The ICMP datagram header. Input/output parameter.
* @param length The total datagram length. Input parameter.
* @param[in,out] header The ICMP datagram header.
* @param[in] length The total datagram length.
* @returns The computed checksum.
*/
#define ICMP_CHECKSUM( header, length ) htons( ip_checksum(( uint8_t * ) ( header ), ( length )))
107,8 → 107,8
#define ICMP_ECHO_TEXT "Hello from HelenOS."
 
/** Computes an ICMP reply data key.
* @param id The message identifier. Input parameter.
* @param sequence The message sequence number. Input parameter.
* @param[in] id The message identifier.
* @param[in] sequence The message sequence number.
* @returns The computed ICMP reply data key.
*/
#define ICMP_GET_REPLY_KEY( id, sequence ) ((( id ) << 16 ) | ( sequence & 0xFFFF ))
140,9 → 140,9
* Is used as an entry point from the underlying IP module.
* Releases the packet on error.
* @param device_id The device identifier. Ignored parameter.
* @param packet The received packet. Input/output parameter.
* @param[in,out] packet The received packet.
* @param receiver The target service. Ignored parameter.
* @param error The packet error reporting service. Prefixes the received packet. Input parameter.
* @param[in] error The packet error reporting service. Prefixes the received packet.
* @returns EOK on success.
* @returns Other error codes as defined for the icmp_process_packet() function.
*/
150,8 → 150,8
 
/** Processes the received ICMP packet.
* Notifies the destination socket application.
* @param packet The received packet. Input/output parameter.
* @param error The packet error reporting service. Prefixes the received packet. Input parameter.
* @param[in,out] packet The received packet.
* @param[in] error The packet error reporting service. Prefixes the received packet.
* @returns EOK on success.
* @returns EINVAL if the packet is not valid.
* @returns EINVAL if the stored packet address is not the an_addr_t.
166,8 → 166,8
/** Processes the client messages.
* Remembers the assigned identifier and sequence numbers.
* Runs until the client module disconnects.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @returns EOK.
* @see icmp_interface.h
* @see icmp_api.h
175,7 → 175,7
int icmp_process_client_messages( ipc_callid_t callid, ipc_call_t call );
 
/** Processes the generic client messages.
* @param call The message parameters. Input parameter.
* @param[in] call The message parameters.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @returns Other error codes as defined for the packet_translate() function.
188,8 → 188,8
int icmp_process_message( ipc_call_t * call );
 
/** Releases the packet and returns the result.
* @param packet The packet queue to be released. Input parameter.
* @param result The result to be returned. Input parameter.
* @param[in] packet The packet queue to be released.
* @param[in] result The result to be returned.
* @returns The result parameter.
*/
int icmp_release_and_return( packet_t packet, int result );
197,15 → 197,15
/** Requests an echo message.
* Sends a packet with specified parameters to the target host and waits for the reply upto the given timeout.
* Blocks the caller until the reply or the timeout occurres.
* @param id The message identifier. Input parameter.
* @param sequence The message sequence parameter. Input parameter.
* @param size The message data length in bytes. Input parameter.
* @param timeout The timeout in miliseconds. Input parameter.
* @param ttl The time to live. Input parameter.
* @param tos The type of service. Input parameter.
* @param dont_fragment The value indicating whether the datagram must not be fragmented. Is used as a MTU discovery. Input parameter.
* @param addr The target host address. Input parameter.
* @param addrlen The torget host address length. Input parameter.
* @param[in] id The message identifier.
* @param[in] sequence The message sequence parameter.
* @param[in] size The message data length in bytes.
* @param[in] timeout The timeout in miliseconds.
* @param[in] ttl The time to live.
* @param[in] tos The type of service.
* @param[in] dont_fragment The value indicating whether the datagram must not be fragmented. Is used as a MTU discovery.
* @param[in] addr The target host address.
* @param[in] addrlen The torget host address length.
* @returns ICMP_ECHO on success.
* @returns ETIMEOUT if the reply has not arrived before the timeout.
* @returns ICMP type of the received error notification.
218,7 → 218,7
/** Prepares the ICMP error packet.
* Truncates the original packet if longer than ICMP_KEEP_LENGTH bytes.
* Prefixes and returns the ICMP header.
* @param packet The original packet. Input/output parameter.
* @param[in,out] packet The original packet.
* @returns The prefixed ICMP header.
* @returns NULL on errors.
*/
228,14 → 228,14
* Sets the message type and code and computes the checksum.
* Error messages are sent only if allowed in the configuration.
* Releases the packet on errors.
* @param type The message type. Input parameter.
* @param code The message code. Input parameter.
* @param packet The message packet to be sent. Input parameter.
* @param header The ICMP header. Input parameter.
* @param error The error service to be announced. Should be SERVICE_ICMP or zero (0). Input parametr.
* @param ttl The time to live. Input parameter.
* @param tos The type of service. Input parameter.
* @param dont_fragment The value indicating whether the datagram must not be fragmented. Is used as a MTU discovery. Input parameter.
* @param[in] type The message type.
* @param[in] code The message code.
* @param[in] packet The message packet to be sent.
* @param[in] header The ICMP header.
* @param[in] error The error service to be announced. Should be SERVICE_ICMP or zero (0).
* @param[in] ttl The time to live.
* @param[in] tos The type of service.
* @param[in] dont_fragment The value indicating whether the datagram must not be fragmented. Is used as a MTU discovery.
* @returns EOK on success.
* @returns EPERM if the error message is not allowed.
*/
245,10 → 245,10
* If the reply data are still present, the reply timeouted and the parent fibril is awaken.
* The global lock is not released in this case to be reused by the parent fibril.
* Releases the packet.
* @param packet The received reply message. Input parameter.
* @param header The ICMP message header. Input parameter.
* @param type The received reply message type. Input parameter.
* @param code The received reply message code. Input parameter.
* @param[in] packet The received reply message.
* @param[in] header The ICMP message header.
* @param[in] type The received reply message type.
* @param[in] code The received reply message code.
* @returns EOK.
*/
int icmp_process_echo_reply( packet_t packet, icmp_header_ref header, icmp_type_t type, icmp_code_t code );
258,7 → 258,7
* If the reply data are still present, the reply timeouted and the parent fibril is awaken.
* The global lock is not released in this case to be reused by the parent fibril.
* Should run in a searate fibril.
* @param data The icmp_reply_timeout structure. Input parameter.
* @param[in] data The icmp_reply_timeout structure.
* @returns EOK on success.
* @returns EINVAL if the data parameter is NULL.
*/
266,7 → 266,7
 
/** Assigns a new identifier for the connection.
* Fills the echo data parameter with the assigned values.
* @param echo_data The echo data to be bound. Input/output parameter.
* @param[in,out] echo_data The echo data to be bound.
* @returns Index of the inserted echo data.
* @returns EBADMEM if the echo_data parameter is NULL.
* @returns ENOTCONN if no free identifier have been found.
/branches/network/uspace/srv/net/tl/icmp/icmp_module.c
64,7 → 64,7
 
/** Starts the ICMP module.
* Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
* @returns EOK on successful module termination.
* @returns Other error codes as defined for the arp_initialize() function.
* @returns Other error codes as defined for the REGISTER_ME() macro function.
72,10 → 72,10
int module_start( async_client_conn_t client_connection );
 
/** Processes the ICMP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns Other error codes as defined for the icmp_message() function.
*/
/branches/network/uspace/srv/net/tl/udp/udp_module.h
42,7 → 42,7
#include <ipc/ipc.h>
 
/** Initializes the UDP module.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
*/
49,10 → 49,10
int udp_initialize( async_client_conn_t client_connection );
 
/** Processes the UDP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @see udp_interface.h
/branches/network/uspace/srv/net/tl/udp/udp.c
97,9 → 97,9
* Is used as an entry point from the underlying IP module.
* Locks the global lock and calls udp_process_packet() function.
* @param device_id The device identifier. Ignored parameter.
* @param packet The received packet queue. Input/output parameter.
* @param[in,out] packet The received packet queue.
* @param receiver The target service. Ignored parameter.
* @param error The packet error reporting service. Prefixes the received packet. Input parameter.
* @param[in] error The packet error reporting service. Prefixes the received packet.
* @returns EOK on success.
* @returns Other error codes as defined for the udp_process_packet() function.
*/
108,8 → 108,8
/** Processes the received UDP packet queue.
* Notifies the destination socket application.
* Releases the packet on error or sends an ICMP error notification..
* @param packet The received packet queue. Input/output parameter.
* @param error The packet error reporting service. Prefixes the received packet. Input parameter.
* @param[in,out] packet The received packet queue.
* @param[in] error The packet error reporting service. Prefixes the received packet.
* @returns EOK on success.
* @returns EINVAL if the packet is not valid.
* @returns EINVAL if the stored packet address is not the an_addr_t.
122,8 → 122,8
int udp_process_packet( packet_t packet, services_t error );
 
/** Releases the packet and returns the result.
* @param packet The packet queue to be released. Input parameter.
* @param result The result to be returned. Input parameter.
* @param[in] packet The packet queue to be released.
* @param[in] result The result to be returned.
* @return The result parameter.
*/
int udp_release_and_return( packet_t packet, int result );
134,8 → 134,8
 
/** Processes the socket client messages.
* Runs until the client module disconnects.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @returns EOK on success.
* @see socket.h
*/
145,13 → 145,13
* Binds the socket to a free port if not already connected/bound.
* Handles the NET_SOCKET_SENDTO message.
* Supports AF_INET and AF_INET6 address families.
* @param local_sockets The application local sockets. Input/output parameter.
* @param socket_id Socket identifier. Input parameter.
* @param addr The destination address. Input parameter.
* @param addrlen The address length. Input parameter.
* @param fragments The number of data fragments. Input parameter.
* @param data_fragment_size The data fragment size in bytes. Input parameter.
* @param flags Various send flags. Input parameter.
* @param[in,out] local_sockets The application local sockets.
* @param[in] socket_id Socket identifier.
* @param[in] addr The destination address.
* @param[in] addrlen The address length.
* @param[in] fragments The number of data fragments.
* @param[in] data_fragment_size The data fragment size in bytes.
* @param[in] flags Various send flags.
* @returns EOK on success.
* @returns EAFNOTSUPPORT if the address family is not supported.
* @returns ENOTSOCK if the socket is not found.
167,10 → 167,10
/** Receives data to the socket.
* Handles the NET_SOCKET_RECVFROM message.
* Replies the source address as well.
* @param local_sockets The application local sockets. Input parameter.
* @param socket_id Socket identifier. Input parameter.
* @param flags Various receive flags. Input parameter.
* @param addrlen The source address length. Output parameter.
* @param[in] local_sockets The application local sockets.
* @param[in] socket_id Socket identifier.
* @param[in] flags Various receive flags.
* @param[out] addrlen The source address length.
* @returns The number of bytes received.
* @returns ENOTSOCK if the socket is not found.
* @returns NO_DATA if there are no received packets or data.
/branches/network/uspace/srv/net/tl/udp/udp_module.c
64,7 → 64,7
 
/** Starts the UDP module.
* Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
* @returns EOK on successful module termination.
* @returns Other error codes as defined for the udp_initialize() function.
* @returns Other error codes as defined for the REGISTER_ME() macro function.
72,10 → 72,10
int module_start( async_client_conn_t client_connection );
 
/** Processes the UDP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns Other error codes as defined for the udp_message() function.
*/
/branches/network/uspace/srv/net/tl/tl_common.h
78,9 → 78,9
 
/** Gets the address port.
* Supports AF_INET and AF_INET6 address families.
* @param addr The address to be updated. Input/output parameter.
* @param addrlen The address length. Input parameter.
* @param port The set port. Output parameter.
* @param[in,out] addr The address to be updated.
* @param[in] addrlen The address length.
* @param[out] port The set port.
* @returns EOK on success.
* @returns EINVAL if the address length does not match the address family.
* @returns EAFNOSUPPORT if the address family is not supported.
93,7 → 93,7
* @param[in] ip_phone The IP moduel phone for (semi)remote calls.
* @param[in] packet_dimensions The packet dimensions cache.
* @param[in] device_id The device identifier.
* @param[out] packet_dimention The IP packet dimensions.
* @param[out] packet_dimension The IP packet dimensions.
* @returns EOK on success.
* @returns EBADMEM if the packet_dimension parameter is NULL.
* @return ENOMEM if there is not enough memory left.
104,9 → 104,9
 
/** Sets the address port.
* Supports AF_INET and AF_INET6 address families.
* @param addr The address to be updated. Input/output parameter.
* @param addrlen The address length. Input parameter.
* @param port The port to be set. Input parameter.
* @param[in,out] addr The address to be updated.
* @param[in] addrlen The address length.
* @param[in] port The port to be set.
* @returns EOK on success.
* @returns EINVAL if the address length does not match the address family.
* @returns EAFNOSUPPORT if the address family is not supported.
116,10 → 116,10
/** Prepares the packet for ICMP error notification.
* Keeps the first packet and releases all the others.
* Releases all the packets on error.
* @param packet_phone The packet server module phone. Input parameter.
* @param icmp_phone The ICMP module phone. Input parameter.
* @param packet The packet to be send. Input parameter.
* @param error The packet error reporting service. Prefixes the received packet. Input parameter.
* @param[in] packet_phone The packet server module phone.
* @param[in] icmp_phone The ICMP module phone.
* @param[in] packet The packet to be send.
* @param[in] error The packet error reporting service. Prefixes the received packet.
* @returns EOK on success.
* @returns ENOENT if no packet may be sent.
*/
126,12 → 126,12
int tl_prepare_icmp_packet( int packet_phone, int icmp_phone, packet_t packet, services_t error );
 
/** Receives data from the socket into a packet.
* @param packet_phone The packet server module phone. Input parameter.
* @param packet The new created packet. Output parameter.
* @param prefix Reserved packet data prefix length. Input parameter.
* @param dimension The packet dimension. Input parameter.
* @param addr The destination address. Input parameter.
* @param addrlen The address length. Input parameter.
* @param[in] packet_phone The packet server module phone.
* @param[out] packet The new created packet.
* @param[in] prefix Reserved packet data prefix length.
* @param[in] dimension The packet dimension.
* @param[in] addr The destination address.
* @param[in] addrlen The address length.
* @returns Number of bytes received.
* @returns EINVAL if the client does not send data.
* @returns ENOMEM if there is not enough memory left.