Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4755 → Rev 4756

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