/branches/network/uspace/srv/net/include/netdb.h |
---|
90,19 → 90,18 |
/*@}*/ |
/** Returns host entry by the host address. |
* \todo address type? |
* @param address The host address. Input parameter. |
* @param len The address length. Input parameter. |
* @param type The address type. Input parameter. |
* @param[in] address The host address. |
* @param[in] len The address length. |
* @param[in] type The address type. |
* @returns Host entry information. |
*/ |
struct hostent * gethostbyaddr( const void * address, int len, int type ); |
//struct hostent * gethostbyaddr( const void * address, int len, int type ); |
/** Returns host entry by the host name. |
* @param name The host name. Input parameter. |
* @param[in] name The host name. |
* @returns Host entry information. |
*/ |
struct hostent * gethostbyname( const char * name ); |
//struct hostent * gethostbyname( const char * name ); |
#endif |
/branches/network/uspace/srv/net/include/protocol_map.h |
---|
44,8 → 44,8 |
#include "hardware.h" |
/** Maps the internetwork layer service to the network interface layer type. |
* @param nil Network interface layer service. Input parameter. |
* @param il Internetwork layer service. Input parameter. |
* @param[in] nil Network interface layer service. |
* @param[in] il Internetwork layer service. |
* @returns Network interface layer type of the internetworking layer service. |
* @returns 0 if mapping is not found. |
*/ |
67,8 → 67,8 |
} |
/** Maps the network interface layer type to the internetwork layer service. |
* @param nil Network interface layer service. Input parameter. |
* @param protocol Network interface layer type. Input parameter. |
* @param[in] nil Network interface layer service. |
* @param[in] protocol Network interface layer type. |
* @returns Internetwork layer service of the network interface layer type. |
* @returns 0 if mapping is not found. |
*/ |
90,7 → 90,7 |
} |
/** Maps the link service access point identifier to the Ethernet protocol identifier. |
* @param lsap Link service access point identifier. Input parameter. |
* @param[in] lsap Link service access point identifier. |
* @returns Ethernet protocol identifier of the link service access point identifier. |
* @returns ETH_LSAP_NULL if mapping is not found. |
*/ |
106,7 → 106,7 |
} |
/** Maps the Ethernet protocol identifier to the link service access point identifier. |
* @param ethertype Ethernet protocol identifier. Input parameter. |
* @param[in] ethertype Ethernet protocol identifier. |
* @returns Link service access point identifier. |
* @returns 0 if mapping is not found. |
*/ |
122,7 → 122,7 |
} |
/** Maps the network interface layer services to the hardware types. |
* @param nil The network interface service. Input parameter. |
* @param[in] nil The network interface service. |
* @returns The hardware type of the network interface service. |
* @returns 0 if mapping is not found. |
*/ |
/branches/network/uspace/srv/net/include/tl_interface.h |
---|
56,11 → 56,11 |
/*@{*/ |
/** Notifies the remote transport layer modules about the received packet/s. |
* @param tl_phone The transport layer module phone used for remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param packet The received packet or the received packet queue. The packet queue is used to carry a~fragmented datagram. The first packet contains the headers, the others contain only data. Input parameter. |
* @param target The target transport layer module service to be delivered to. Input parameter. |
* @param error The packet error reporting service. Prefixes the received packet. Input parameter. |
* @param[in] tl_phone The transport layer module phone used for remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] packet The received packet or the received packet queue. The packet queue is used to carry a~fragmented datagram. The first packet contains the headers, the others contain only data. |
* @param[in] target The target transport layer module service to be delivered to. |
* @param[in] error The packet error reporting service. Prefixes the received packet. |
* @returns EOK on success. |
*/ |
inline static int tl_received_msg( int tl_phone, device_id_t device_id, packet_t packet, services_t target, services_t error ){ |
/branches/network/uspace/srv/net/include/byteorder.h |
---|
46,25 → 46,25 |
// Already in the network byte order. |
/** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ). |
* @param number The number in the host byte order to be converted. |
* @param[in] number The number in the host byte order to be converted. |
* @returns The number in the network byte order. |
*/ |
#define htons( number ) ( number ) |
/** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ). |
* @param number The number in the host byte order to be converted. |
* @param[in] number The number in the host byte order to be converted. |
* @returns The number in the network byte order. |
*/ |
#define htonl( number ) ( number ) |
/** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order. |
* @param number The number in the network byte order to be converted. |
* @param[in] number The number in the network byte order to be converted. |
* @returns The number in the host byte order. |
*/ |
#define ntohs( number ) ( number ) |
/** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order. |
* @param number The number in the network byte order to be converted. |
* @param[in] number The number in the network byte order to be converted. |
* @returns The number in the host byte order. |
*/ |
#define ntohl( number ) ( number ) |
74,25 → 74,25 |
// Has to be swapped. |
/** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ). |
* @param number The number in the host byte order to be converted. |
* @param[in] number The number in the host byte order to be converted. |
* @returns The number in the network byte order. |
*/ |
#define htons( number ) uint16_t_byteorder_swap(( uint16_t )( number )) |
/** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ). |
* @param number The number in the host byte order to be converted. |
* @param[in] number The number in the host byte order to be converted. |
* @returns The number in the network byte order. |
*/ |
#define htonl( number ) uint32_t_byteorder_swap( number ) |
/** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order. |
* @param number The number in the network byte order to be converted. |
* @param[in] number The number in the network byte order to be converted. |
* @returns The number in the host byte order. |
*/ |
#define ntohs( number ) uint16_t_byteorder_swap(( uint16_t )( number )) |
/** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order. |
* @param number The number in the network byte order to be converted. |
* @param[in] number The number in the network byte order to be converted. |
* @returns The number in the host byte order. |
*/ |
#define ntohl( number ) uint32_t_byteorder_swap( number ) |
/branches/network/uspace/srv/net/include/inet.h |
---|
52,10 → 52,10 |
typedef struct addrinfo addrinfo_t; |
/** Prints the address into the character buffer. |
* @param family The address family. Input parameter. |
* @param data The address data. Input parameter. |
* @param address The character buffer to be filled. Output parameter. |
* @param length The buffer length. Input parameter. |
* @param[in] family The address family. |
* @param[in] data The address data. |
* @param[out] address The character buffer to be filled. |
* @param[in] length The buffer length. |
* @returns EOK on success. |
* @returns EINVAL if the data or address parameter is NULL. |
* @returns ENOMEM if the character buffer is not long enough. |
65,9 → 65,9 |
/** Parses the character string into the address. |
* If the string is shorter than the full address, zero bytes are added. |
* @param family The address family. Input parameter. |
* @param address The character buffer to be parsed. Input parameter. |
* @param data The address data to be filled. Output parameter. |
* @param[in] family The address family. |
* @param[in] address The character buffer to be parsed. |
* @param[out] data The address data to be filled. |
* @returns EOK on success. |
* @returns EINVAL if the data parameter is NULL. |
* @returns ENOENT if the address parameter is NULL. |
87,25 → 87,25 |
uint8_t sa_data[ 14 ]; |
}; |
/** Address information. |
* \todo |
*/ |
struct addrinfo{ |
int ai_flags; // AI_PASSIVE, AI_CANONNAME, etc. |
uint16_t ai_family; // AF_INET, AF_INET6, AF_UNSPEC |
int ai_socktype; // SOCK_STREAM, SOCK_DGRAM |
int ai_protocol; // use 0 for "any" |
size_t ai_addrlen; // size of ai_addr in bytes |
struct sockaddr * ai_addr; // struct sockaddr_in or _in6 |
char * ai_canonname; // full canonical hostname |
struct addrinfo * ai_next; // linked list, next node |
}; |
// TODO define address information |
// /** Address information. |
// * \todo |
// */ |
//struct addrinfo{ |
// int ai_flags; // AI_PASSIVE, AI_CANONNAME, etc. |
// uint16_t ai_family; // AF_INET, AF_INET6, AF_UNSPEC |
// int ai_socktype; // SOCK_STREAM, SOCK_DGRAM |
// int ai_protocol; // use 0 for "any" |
// size_t ai_addrlen; // size of ai_addr in bytes |
// struct sockaddr * ai_addr; // struct sockaddr_in or _in6 |
// char * ai_canonname; // full canonical hostname |
// struct addrinfo * ai_next; // linked list, next node |
//}; |
/*int getaddrinfo(const char *node, // e.g. "www.example.com" or IP |
const char *service, // e.g. "http" or port number |
const struct addrinfo *hints, |
struct addrinfo **res); |
getnameinfo |
*/ |
/branches/network/uspace/srv/net/include/nil_interface.h |
---|
61,12 → 61,12 |
/*@{*/ |
/** Returns the device local hardware address. |
* @param nil_phone The network interface layer phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param address The device local hardware address. Output parameter. |
* @param data The address data. Output parameter. |
* @param[in] nil_phone The network interface layer phone. |
* @param[in] device_id The device identifier. |
* @param[out] address The device local hardware address. |
* @param[out] data The address data. |
* @returns EOK on success. |
* @returns EBADMEM if the address parameter is NULL. |
* @returns EBADMEM if the address parameter and/or the data parameter is NULL. |
* @returns ENOENT if there no such device. |
* @returns Other error codes as defined for the generic_get_addr_req() function. |
*/ |
74,10 → 74,10 |
generic_get_addr_req( nil_phone, NET_NIL_ADDR, device_id, address, data ) |
/** Returns the device broadcast hardware address. |
* @param nil_phone The network interface layer phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param address The device broadcast hardware address. Output parameter. |
* @param data The address data. Output parameter. |
* @param[in] nil_phone The network interface layer phone. |
* @param[in] device_id The device identifier. |
* @param[out] address The device broadcast hardware address. |
* @param[out] data The address data. |
* @returns EOK on success. |
* @returns EBADMEM if the address parameter is NULL. |
* @returns ENOENT if there no such device. |
87,10 → 87,10 |
generic_get_addr_req( nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data ) |
/** Sends the packet queue. |
* @param nil_phone The network interface layer phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param packet The packet queue. Input parameter. |
* @param sender The sending module service. Input parameter. |
* @param[in] nil_phone The network interface layer phone. |
* @param[in] device_id The device identifier. |
* @param[in] packet The packet queue. |
* @param[in] sender The sending module service. |
* @returns EOK on success. |
* @returns Other error codes as defined for the generic_send_msg() function. |
*/ |
98,12 → 98,12 |
generic_send_msg( nil_phone, NET_NIL_SEND, device_id, packet_get_id( packet ), sender, 0 ) |
/** Returns the device packet dimensions for sending. |
* @param nil_phone The network interface layer phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param addr_len The minimum reserved address length. Output parameter. |
* @param prefix The minimum reserved prefix size. Output parameter. |
* @param content The maximum content size. Output parameter. |
* @param suffix The minimum reserved suffix size. Output parameter. |
* @param[in] nil_phone The network interface layer phone. |
* @param[in] device_id The device identifier. |
* @param[out] addr_len The minimum reserved address length. |
* @param[out] prefix The minimum reserved prefix size. |
* @param[out] content The maximum content size. |
* @param[out] suffix The minimum reserved suffix size. |
* @returns EOK on success. |
* @returns EBADMEM if either one of the parameters is NULL. |
* @returns ENOENT if there is no such device. |
113,10 → 113,10 |
generic_packet_size_req( nil_phone, NET_NIL_PACKET_SPACE, device_id, addr_len, prefix, content, suffix ) |
/** Registers new device or updates the MTU of an existing one. |
* @param nil_phone The network interface layer phone. Input parameter. |
* @param device_id The new device identifier. Input parameter. |
* @param mtu The device maximum transmission unit. Input parameter. |
* @param netif_service The device driver service. Input parameter. |
* @param[in] nil_phone The network interface layer phone. |
* @param[in] device_id The new device identifier. |
* @param[in] mtu The device maximum transmission unit. |
* @param[in] netif_service The device driver service. |
* @returns EOK on success. |
* @returns EEXIST if the device with the different service exists. |
* @returns ENOMEM if there is not enough memory left. |
126,9 → 126,9 |
generic_device_req( nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service ) |
/** Notifies the network interface layer about the device state change. |
* @param nil_phone The network interface layer phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param state The new device state. Input parameter. |
* @param[in] nil_phone The network interface layer phone. |
* @param[in] device_id The device identifier. |
* @param[in] state The new device state. |
* @returns EOK on success. |
* @returns Other error codes as defined for each specific module device state function. |
*/ |
136,9 → 136,9 |
/** Passes the packet queue to the network interface layer. |
* Processes and redistributes the received packet queue to the registered upper layers. |
* @param nil_phone The network interface layer phone. Input parameter. |
* @param device_id The source device identifier. Input parameter. |
* @param packet The received packet or the received packet queue. Input parameter. |
* @param[in] nil_phone The network interface layer phone. |
* @param[in] device_id The source device identifier. |
* @param[in] packet The received packet or the received packet queue. |
* @param target The target service. Ignored parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for each specific module received function. |
146,10 → 146,10 |
int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target ); |
/** Creates bidirectional connection with the network interface layer module and registers the message receiver. |
* @param service The network interface layer module service. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param me The requesting module service. Input parameter. |
* @param receiver The message receiver. Input parameter. |
* @param[in] service The network interface layer module service. |
* @param[in] device_id The device identifier. |
* @param[in] me The requesting module service. |
* @param[in] receiver The message receiver. |
* @returns The phone of the needed service. |
* @returns EOK on success. |
* @returns Other error codes as defined for the bind_service() function. |
/branches/network/uspace/srv/net/include/arp_interface.h |
---|
52,11 → 52,11 |
/** Registers the new device and the requesting protocol service. |
* Connects to the network interface layer service. |
* Determines the device broadcast address, its address lengths and packet size. |
* @param arp_phone The ARP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The new device identifier. Input parameter. |
* @param protocol The requesting protocol service. Input parameter. |
* @param netif The underlying device network interface layer service. Input parameter. |
* @param address The local requesting protocol address of the device. Input parameter. |
* @param[in] arp_phone The ARP module phone used for (semi)remote calls. |
* @param[in] device_id The new device identifier. |
* @param[in] protocol The requesting protocol service. |
* @param[in] netif The underlying device network interface layer service. |
* @param[in] address The local requesting protocol address of the device. |
* @returns EOK on success. |
* @returns EEXIST if the device is already used. |
* @returns ENOMEM if there is not enough memory left. |
71,15 → 71,14 |
/** Translates the given protocol address to the network interface address. |
* Broadcasts the ARP request if the mapping is not found. |
* Allocates and returns the needed memory block as the data parameter. |
* @param arp_phone The ARP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param protocol The requesting protocol service. Input parameter. |
* @param address The local requesting protocol address. Input parameter. |
* @param translation The translation of the local protocol address. Output parameter. |
* @param data The allocated raw translation data container. Output parameter. |
* @param[in] arp_phone The ARP module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] protocol The requesting protocol service. |
* @param[in] address The local requesting protocol address. |
* @param[out] translation The translation of the local protocol address. |
* @param[out] data The allocated raw translation data container. |
* @returns EOK on success. |
* @returns EINVAL if the configuration parameter is NULL. |
* @returns EINVAL if the count parameter is zero (0). |
* @returns EINVAL if the address parameter is NULL. |
* @returns EBADMEM if the translation or the data parameters are NULL. |
* @returns ENOENT if the mapping is not found. |
*/ |
86,8 → 85,8 |
int arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data ); |
/** Clears the device cache. |
* @param arp_phone The ARP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param[in] arp_phone The ARP module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @returns EOK on success. |
* @returns ENOENT if the device is not found. |
*/ |
94,10 → 93,10 |
int arp_clear_device_req( int arp_phone, device_id_t device_id ); |
/** Clears the given protocol address from the cache. |
* @param arp_phone The ARP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param protocol The requesting protocol service. Input parameter. |
* @param address The protocol address to be cleared. Input parameter. |
* @param[in] arp_phone The ARP module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] protocol The requesting protocol service. |
* @param[in] address The protocol address to be cleared. |
* @returns EOK on success. |
* @returns ENOENT if the mapping is not found. |
*/ |
104,7 → 103,7 |
int arp_clear_address_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address ); |
/** Cleans the cache. |
* @param arp_phone The ARP module phone used for (semi)remote calls. Input parameter. |
* @param[in] arp_phone The ARP module phone used for (semi)remote calls. |
* @returns EOK on success. |
*/ |
int arp_clean_cache_req( int arp_phone ); |
/branches/network/uspace/srv/net/include/checksum.h |
---|
42,9 → 42,9 |
#include <sys/types.h> |
/** Computes CRC32 value. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bits. Input parameter. |
* @param[in] seed Initial value. Often used as 0 or ~0. |
* @param[in] data Pointer to the beginning of data to process. |
* @param[in] length Length of the data in bits. |
* @returns The computed CRC32 of the length bits of the data. |
*/ |
#ifdef ARCH_IS_BIG_ENDIAN |
54,17 → 54,17 |
#endif |
/** Computes CRC32 value in the little-endian environment. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bits. Input parameter. |
* @param[in] seed Initial value. Often used as 0 or ~0. |
* @param[in] data Pointer to the beginning of data to process. |
* @param[in] length Length of the data in bits. |
* @returns The computed CRC32 of the length bits of the data. |
*/ |
uint32_t compute_crc32_le( uint32_t seed, uint8_t * data, size_t length ); |
/** Computes CRC32 value in the big-endian environment. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bits. Input parameter. |
* @param[in] seed Initial value. Often used as 0 or ~0. |
* @param[in] data Pointer to the beginning of data to process. |
* @param[in] length Length of the data in bits. |
* @returns The computed CRC32 of the length bits of the data. |
*/ |
uint32_t compute_crc32_be( uint32_t seed, uint8_t * data, size_t length ); |
71,21 → 71,21 |
/** Computes sum of the 2 byte fields. |
* Padds one zero (0) byte if odd. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bytes. Input parameter. |
* @param[in] seed Initial value. Often used as 0 or ~0. |
* @param[in] data Pointer to the beginning of data to process. |
* @param[in] length Length of the data in bytes. |
* @returns The computed checksum of the length bytes of the data. |
*/ |
uint32_t compute_checksum( uint32_t seed, uint8_t * data, size_t length ); |
/** Compacts the computed checksum to the 16 bit number adding the carries. |
* @param sum Computed checksum. Input parameter. |
* @param[in] sum Computed checksum. |
* @returns Compacted computed checksum to the 16 bits. |
*/ |
uint16_t compact_checksum( uint32_t sum ); |
/** Returns or flips the checksum if zero. |
* @param checksum The computed checksum. Input parameter. |
* @param[in] checksum The computed checksum. |
* @returns The internet protocol header checksum. |
* @returns 0xFFFF if the computed checksum is zero. |
*/ |
95,8 → 95,8 |
* To compute the checksum of a new packet, the checksum header field must be zero. |
* To check the checksum of a received packet, the checksum may be left set. |
* The zero (0) value will be returned in this case if valid. |
* @param data The header data. Input parameter. |
* @param length The header length in bytes. Input parameter. |
* @param[in] data The header data. |
* @param[in] length The header length in bytes. |
* @returns The internet protocol header checksum. |
* @returns 0xFFFF if the computed checksum is zero. |
*/ |
/branches/network/uspace/srv/net/include/ip_client.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* \todo |
* IP client interface. |
*/ |
#ifndef __NET_IP_CLIENT_H__ |
45,22 → 45,67 |
#include "ip_interface.h" |
#include "socket_codes.h" |
/** Prepares the packet to be transfered via IP. |
* The IP header is prefixed. |
* @param[in,out] packet The packet to be prepared. |
* @param[in] protocol The transport protocol. |
* @param[in] ttl The time to live counter. The IPDEFTTL is set if zero (0). |
* @param[in] tos The type of service. |
* @param[in] dont_fragment The value indicating whether fragmentation is disabled. |
* @param[in] ipopt_length The prefixed IP options length in bytes. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left in the packet. |
*/ |
int ip_client_prepare_packet( packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length ); |
/** Processes the received IP packet. |
* Fills set header fields. |
* Returns the prefixed IP header length. |
* @param[in] packet The received packet. |
* @param[out] protocol The transport protocol. May be NULL if not desired. |
* @param[out] ttl The time to live counter. May be NULL if not desired. |
* @param[out] tos The type of service. May be NULL if not desired. |
* @param[out] dont_fragment The value indicating whether the fragmentation is disabled. May be NULL if not desired. |
* @param[out] ipopt_length The IP options length in bytes. May be NULL if not desired. |
* @returns The prefixed IP header length in bytes on success. |
* @returns ENOMEM if the packet is too short to contain the IP header. |
*/ |
int ip_client_process_packet( packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length ); |
/** Returns the IP header length. |
* @param packet The packet. Input parameter. |
* @param[in] packet The packet. |
* @returns The IP header length in bytes. |
* @returns Zero (0) if there is no IP header. |
*/ |
size_t ip_client_header_length( packet_t packet ); |
/** \todo |
/** Updates the IPv4 pseudo header data length field. |
* @param[in,out] header The IPv4 pseudo header to be updated. |
* @param[in] headerlen The length of the IP pseudo header in bytes. |
* @param[in] data_length The data length to be set. |
* @returns EOK on success. |
* @returns EBADMEM if the header parameter is NULL. |
* @returns EINVAL if the headerlen parameter is not IPv4 pseudo header length. |
*/ |
int ip_client_set_pseudo_header_data_length( ip_pseudo_header_ref header, size_t headerlen, size_t data_length ); |
/** \todo |
/** Constructs the IPv4 pseudo header. |
* @param[in] protocol The transport protocol. |
* @param[in] src The source address. |
* @param[in] srclen The source address length. |
* @param[in] dest The destination address. |
* @param[in] destlen The destination address length. |
* @param[in] data_length The data length to be set. |
* @param[out] header The constructed IPv4 pseudo header. |
* @param[out] headerlen The length of the IP pseudo header in bytes. |
* @returns EOK on success. |
* @returns EBADMEM if the header and/or the headerlen parameter is NULL. |
* @returns EINVAL if the source address and/or the destination address parameter is NULL. |
* @returns EINVAL if the source address length is less than struct sockaddr length. |
* @returns EINVAL if the source address length differs from the destination address length. |
* @returns EINVAL if the source address family differs from the destination family. |
* @returns EAFNOSUPPORT if the address family is not supported. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int ip_client_get_pseudo_header( ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen ); |
/branches/network/uspace/srv/net/include/net_interface.h |
---|
55,11 → 55,11 |
* Returns the global configuration if the device specific is not found. |
* The configuration names are read and the appropriate settings are set instead. |
* Call net_free_settings() function to release the returned configuration. |
* @param net_phone The networking module phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param configuration The requested device configuration. The names are read and the appropriate settings are set instead. Input/output parameter. |
* @param count The configuration entries count. Input parameter. |
* @param data The configuration and settings data. Input/output parameter. |
* @param[in] net_phone The networking module phone. |
* @param[in] device_id The device identifier. |
* @param[in,out] configuration The requested device configuration. The names are read and the appropriate settings are set instead. |
* @param[in] count The configuration entries count. |
* @param[in,out] data The configuration and settings data. |
* @returns EOK on success. |
* @returns EINVAL if the configuration is NULL. |
* @returns EINVAL if the count is zero (0). |
70,10 → 70,10 |
/** Returns the global configuration. |
* The configuration names are read and the appropriate settings are set instead. |
* Call net_free_settings() function to release the returned configuration. |
* @param net_phone The networking module phone. Input parameter. |
* @param configuration The requested configuration. The names are read and the appropriate settings are set instead. Input/output parameter. |
* @param count The configuration entries count. Input parameter. |
* @param data The configuration and settings data. Input/output parameter. |
* @param[in] net_phone The networking module phone. |
* @param[in,out] configuration The requested configuration. The names are read and the appropriate settings are set instead. |
* @param[in] count The configuration entries count. |
* @param[in,out] data The configuration and settings data. |
* @returns EOK on success. |
* @returns EINVAL if the configuration is NULL. |
* @returns EINVAL if the count is zero (0). |
82,8 → 82,8 |
int net_get_conf_req( int net_phone, measured_string_ref * configuration, size_t count, char ** data ); |
/** Frees the received settings. |
* @param settings The received settings. Input parameter. |
* @param data The received settings data. Input parameter. |
* @param[in] settings The received settings. |
* @param[in] data The received settings data. |
* @see net_get_device_conf_req() |
* @see net_get_conf_req() |
*/ |
/branches/network/uspace/srv/net/include/icmp_interface.h |
---|
62,10 → 62,10 |
/** Sends the Destination Unreachable error notification packet. |
* Beginning of the packet is sent as the notification packet data. |
* The source and the destination addresses should be set in the original packet. |
* @param icmp_phone The ICMP module phone used for (semi)remote calls. Input parameter. |
* @param code The error specific code. Input parameter. |
* @param mtu The error MTU value. Input parameter. |
* @param packet The original packet. |
* @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. |
* @param[in] code The error specific code. |
* @param[in] mtu The error MTU value. |
* @param[in] packet The original packet. |
* @returns EOK on success. |
* @returns EPERM if the ICMP error notifications are disabled. |
* @returns ENOMEM if there is not enough memory left. |
75,8 → 75,8 |
/** Sends the Source Quench error notification packet. |
* Beginning of the packet is sent as the notification packet data. |
* The source and the destination addresses should be set in the original packet. |
* @param icmp_phone The ICMP module phone used for (semi)remote calls. Input parameter. |
* @param packet The original packet. |
* @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. |
* @param[in] packet The original packet. |
* @returns EOK on success. |
* @returns EPERM if the ICMP error notifications are disabled. |
* @returns ENOMEM if there is not enough memory left. |
86,9 → 86,9 |
/** Sends the Time Exceeded error notification packet. |
* Beginning of the packet is sent as the notification packet data. |
* The source and the destination addresses should be set in the original packet. |
* @param icmp_phone The ICMP module phone used for (semi)remote calls. Input parameter. |
* @param code The error specific code. Input parameter. |
* @param packet The original packet. |
* @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. |
* @param[in] code The error specific code. |
* @param[in] packet The original packet. |
* @returns EOK on success. |
* @returns EPERM if the ICMP error notifications are disabled. |
* @returns ENOMEM if there is not enough memory left. |
98,10 → 98,10 |
/** Sends the Parameter Problem error notification packet. |
* Beginning of the packet is sent as the notification packet data. |
* The source and the destination addresses should be set in the original packet. |
* @param icmp_phone The ICMP module phone used for (semi)remote calls. Input parameter. |
* @param code The error specific code. Input parameter. |
* @param pointer The problematic parameter offset. Input parameter. |
* @param packet The original packet. |
* @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. |
* @param[in] code The error specific code. |
* @param[in] pointer The problematic parameter offset. |
* @param[in] packet The original packet. |
* @returns EOK on success. |
* @returns EPERM if the ICMP error notifications are disabled. |
* @returns ENOMEM if there is not enough memory left. |
/branches/network/uspace/srv/net/include/icmp_api.h |
---|
63,14 → 63,14 |
/** 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 icmp_phone The ICMP module phone used for (semi)remote calls. 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] icmp_phone The ICMP module phone used for (semi)remote calls. |
* @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. |
/branches/network/uspace/srv/net/include/il_interface.h |
---|
57,10 → 57,10 |
/*@{*/ |
/** Notifies the internetwork layer modules about the device state change. |
* @param il_phone The internetwork layer module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param state The new device state. Input parameter. |
* @param target The target internetwork module service to be delivered to. Input parameter. |
* @param[in] il_phone The internetwork layer module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] state The new device state. |
* @param[in] target The target internetwork module service to be delivered to. |
* @returns EOK on success. |
*/ |
static inline int il_device_state_msg( int il_phone, device_id_t device_id, device_state_t state, services_t target ){ |
68,10 → 68,10 |
} |
/** Notifies the internetwork layer modules about the received packet/s. |
* @param il_phone The internetwork layer module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param packet The received packet or the received packet queue. Input parameter. |
* @param target The target internetwork module service to be delivered to. Input parameter. |
* @param[in] il_phone The internetwork layer module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] packet The received packet or the received packet queue. |
* @param[in] target The target internetwork module service to be delivered to. |
* @returns EOK on success. |
*/ |
inline static int il_received_msg( int il_phone, device_id_t device_id, packet_t packet, services_t target ){ |
79,10 → 79,10 |
} |
/** Notifies the internetwork layer modules about the mtu change. |
* @param il_phone The internetwork layer module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param mtu The new mtu value. Input parameter. |
* @param target The target internetwork module service to be delivered to. Input parameter. |
* @param[in] il_phone The internetwork layer module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] mtu The new mtu value. |
* @param[in] target The target internetwork module service to be delivered to. |
* @returns EOK on success. |
*/ |
inline static int il_mtu_changed_msg( int il_phone, device_id_t device_id, size_t mtu, services_t target ){ |
/branches/network/uspace/srv/net/include/ip_codes.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* \todo |
* IP codes and definitions. |
*/ |
#ifndef __NET_IP_CODES_H__ |
39,98 → 39,335 |
#include <sys/types.h> |
/** IP time to live counter type definition. |
*/ |
typedef uint8_t ip_ttl_t; |
/** IP type of service type definition. |
*/ |
typedef uint8_t ip_tos_t; |
/** IP transport protocol type definition. |
*/ |
typedef uint8_t ip_protocol_t; |
/** Default IPVERSION. |
*/ |
#define IPVERSION 4 |
/** Maximum time to live counter. |
*/ |
#define MAXTTL 255 |
/** Default time to live counter. |
*/ |
#define IPDEFTTL 64 |
/** @name IP type of service definitions |
*/ |
/*@{*/ |
/** IP TOS mask. |
*/ |
#define IPTOS_TOS_MASK 0x1E |
/** Precedence shift. |
*/ |
#define IPTOS_PRECEDENCE_SHIFT 5 |
/** Delay shift. |
*/ |
#define IPTOS_DELAY_SHIFT 4 |
/** Throughput shift. |
*/ |
#define IPTOS_THROUGHPUT_SHIFT 3 |
/** Reliability shift. |
*/ |
#define IPTOS_RELIABILITY_SHIFT 2 |
/** Cost shift. |
*/ |
#define IPTOS_COST_SHIFT 1 |
/** Normal delay. |
*/ |
#define IPTOS_NORMALDELAY ( 0x0 << IPTOS_DELAY_SHIFT ) |
/** Low delay. |
*/ |
#define IPTOS_LOWDELAY ( 0x1 << IPTOS_DELAY_SHIFT ) |
/** Normal throughput. |
*/ |
#define IPTOS_NORMALTHROUGHPUT ( 0x0 << IPTOS_THROUGHPUT_SHIFT ) |
/** Throughput. |
*/ |
#define IPTOS_THROUGHPUT ( 0x1 << IPTOS_THROUGHPUT_SHIFT ) |
/** Normal reliability. |
*/ |
#define IPTOS_NORMALRELIABILITY ( 0x0 << IPTOS_RELIABILITY_SHIFT ) |
/** Reliability. |
*/ |
#define IPTOS_RELIABILITY ( 0x1 << IPTOS_RELIABILITY_SHIFT ) |
/** Normal cost. |
*/ |
#define IPTOS_NORMALCOST ( 0x0 << IPTOS_COST_SHIFT ) |
/** Minimum cost. |
*/ |
#define IPTOS_MICNCOST ( 0x1 << IPTOS_COST_SHIFT ) |
/*@}*/ |
/** @name IP TOS precedence definitions |
*/ |
/*@{*/ |
/** Precedence mask. |
*/ |
#define IPTOS_PREC_MASK 0xE0 |
/** Routine precedence. |
*/ |
#define IPTOS_PREC_ROUTINE ( 0x0 << IPTOS_PRECEDENCE_SHIFT ) |
/** Priority precedence. |
*/ |
#define IPTOS_PREC_PRIORITY ( 0x1 << IPTOS_PRECEDENCE_SHIFT ) |
/** Immediate precedence. |
*/ |
#define IPTOS_PREC_IMMEDIATE ( 0x2 << IPTOS_PRECEDENCE_SHIFT ) |
/** Flash precedence. |
*/ |
#define IPTOS_PREC_FLASH ( 0x3 << IPTOS_PRECEDENCE_SHIFT ) |
/** Flash override precedence. |
*/ |
#define IPTOS_PREC_FLASHOVERRIDE ( 0x4 << IPTOS_PRECEDENCE_SHIFT ) |
/** Critical precedence. |
*/ |
#define IPTOS_PREC_CRITIC_ECP ( 0x5 << IPTOS_PRECEDENCE_SHIFT ) |
/** Inter-network control precedence. |
*/ |
#define IPTOS_PREC_INTERNETCONTROL ( 0x6 << IPTOS_PRECEDENCE_SHIFT ) |
/** Network control precedence. |
*/ |
#define IPTOS_PREC_NETCONTROL ( 0x7 << IPTOS_PRECEDENCE_SHIFT ) |
/*@}*/ |
/** @name IP options definitions |
*/ |
/*@{*/ |
/** Copy shift. |
*/ |
#define IPOPT_COPY_SHIFT 7 |
/** Class shift. |
*/ |
#define IPOPT_CLASS_SHIFT 5 |
/** Number shift. |
*/ |
#define IPOPT_NUMBER_SHIFT 0 |
/** Class mask. |
*/ |
#define IPOPT_CLASS_MASK 0x60 |
/** Number mask. |
*/ |
#define IPOPT_NUMBER_MASK 0x1F |
/** Copy flag. |
*/ |
#define IPOPT_COPY ( 1 << IPOPT_COPY_SHIFT ) |
/** Returns IP option type. |
* @param[in] copy The value indication whether the IP option should be copied. |
* @param[in] class The IP option class. |
* @param[in] number The IP option number. |
*/ |
#define IPOPT_TYPE( copy, class, number ) ((( copy ) & IPOPT_COPY ) | (( class ) & IPOPT_CLASS_MASK ) | (( number << IPOPT_NUMBER_SHIFT ) & IPOPT_NUMBER_MASK )) |
/** Returns a value indicating whether the IP option should be copied. |
* @param[in] o The IP option. |
*/ |
#define IPOPT_COPIED( o ) (( o ) & IPOPT_COPY ) |
/** Returns an IP option class. |
* @param[in] o The IP option. |
*/ |
#define IPOPT_CLASS( o ) (( o ) & IPOPT_CLASS_MASK ) |
/** Returns an IP option number. |
* @param[in] o The IP option. |
*/ |
#define IPOPT_NUMBER( o ) (( o ) & IPOPT_NUMBER_MASK ) |
/*@}*/ |
/** @name IP option class definitions |
*/ |
/*@{*/ |
/** Control class. |
*/ |
#define IPOPT_CONTROL ( 0 << IPOPT_CLASS_SHIFT ) |
/** Reserved class 1. |
*/ |
#define IPOPT_RESERVED1 ( 1 << IPOPT_CLASS_SHIFT ) |
/** Measurement class. |
*/ |
#define IPOPT_MEASUREMENT ( 2 << IPOPT_CLASS_SHIFT ) |
/** Reserved class 2. |
*/ |
#define IPOPT_RESERVED2 ( 3 << IPOPT_CLASS_SHIFT ) |
/*@}*/ |
/** @name IP option type definitions |
*/ |
/*@{*/ |
/** End of list. |
*/ |
//#define IPOPT_END_OF_LIST 0x0 |
#define IPOPT_END IPOPT_TYPE( 0, IPOPT_CONTROL, 0 ) |
/** No operation. |
*/ |
//#define IPOPT_NO_OPERATION 0x1 |
#define IPOPT_NOOP IPOPT_TYPE( 0, IPOPT_CONTROL, 1 ) |
/** Security. |
*/ |
//#define IPOPT_SECURITY 0x82 |
#define IPOPT_SEC IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 2 ) |
#define IPOPT_SEC_LENGTH 11 |
#define IPOPT_SEC_UNCLASIFIED 0x0 |
#define IPOPT_SEC_CONFIDENTIAL 0xF035 |
#define IPOPT_SEC_EFTO 0x789A |
#define IPOPT_SEC_MMMM 0xBC4D |
#define IPOPT_SEC_PROG 0x5E26 |
#define IPOPT_SEC_RESTRICTED 0xAF13 |
#define IPOPT_SEC_SECRET 0xD788 |
#define IPOPT_SEC_TOP_SECRET 0x6BC5 |
/** Loose source. |
*/ |
//#define IPOPT_LOOSE_SOURCE 0x83 |
#define IPOPT_LSRR IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 3 ) |
/** Strict route. |
*/ |
//#define IPOPT_STRICT_SOURCE 0x89 |
#define IPOPT_SSRR IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 9 ) |
/** Record route. |
*/ |
//#define IPOPT_RECORD_ROUTE 0x07 |
#define IPOPT_RR IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 7 ) |
/** Stream identifier. |
*/ |
//#define IPOPT_STREAM_IDENTIFIER 0x88 |
#define IPOPT_SID IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 8 ) |
/** Stream identifier length. |
*/ |
#define IPOPT_SID_LENGTH 4 |
/** Internet timestamp. |
*/ |
//#define IPOPT_INTERNET_TIMESTAMP 0x44 |
#define IPOPT_TIMESTAMP IPOPT_TYPE( IPOPT_COPY, IPOPT_MEASUREMENT, 4 ) |
/** Commercial IP security option. |
*/ |
#define IPOPT_CIPSO IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 5 ) |
/** No operation variant. |
*/ |
#define IPOPT_NOP IPOPT_NOOP |
/** End of list variant. |
*/ |
#define IPOPT_EOL IPOPT_END |
/** Timestamp variant. |
*/ |
#define IPOPT_TS IPOPT_TIMESTAMP |
#define IPOPT_TS_TSONLY 0 /* timestamps only */ |
#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ |
#define IPOPT_TS_PRESPEC 3 /* specified modules only */ |
/*@}*/ |
/** @name IP security option definitions |
*/ |
/*@{*/ |
/** Security length. |
*/ |
#define IPOPT_SEC_LENGTH 11 |
/** Unclasified. |
*/ |
#define IPOPT_SEC_UNCLASIFIED 0x0 |
/** Confidential. |
*/ |
#define IPOPT_SEC_CONFIDENTIAL 0xF035 |
/** EFTO. |
*/ |
#define IPOPT_SEC_EFTO 0x789A |
/** MMMM. |
*/ |
#define IPOPT_SEC_MMMM 0xBC4D |
/** PROG. |
*/ |
#define IPOPT_SEC_PROG 0x5E26 |
/** Restricted. |
*/ |
#define IPOPT_SEC_RESTRICTED 0xAF13 |
/** Secret. |
*/ |
#define IPOPT_SEC_SECRET 0xD788 |
/** Top secret. |
*/ |
#define IPOPT_SEC_TOP_SECRET 0x6BC5 |
/*@}*/ |
/** @name IP timestamp option definitions |
*/ |
/*@{*/ |
/** Tiemstamp only. |
*/ |
#define IPOPT_TS_TSONLY 0 |
/** Timestamps and addresses. |
*/ |
#define IPOPT_TS_TSANDADDR 1 |
/** Specified modules only. |
*/ |
#define IPOPT_TS_PRESPEC 3 |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/include/netif_interface.h |
---|
55,10 → 55,10 |
/*@{*/ |
/** Returns the device local hardware address. |
* @param netif_phone The network interface phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param address The device local hardware address. Output parameter. |
* @param data The address data. Output parameter. |
* @param[in] netif_phone The network interface phone. |
* @param[in] device_id The device identifier. |
* @param[out] address The device local hardware address. |
* @param[out] data The address data. |
* @returns EOK on success. |
* @returns EBADMEM if the address parameter is NULL. |
* @returns ENOENT if there no such device. |
67,10 → 67,10 |
int netif_get_addr_req( int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data ); |
/** Probes the existence of the device. |
* @param netif_phone The network interface phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param irq The device interrupt number. Input parameter. |
* @param io The device input/output address. Input parameter. |
* @param[in] netif_phone The network interface phone. |
* @param[in] device_id The device identifier. |
* @param[in] irq The device interrupt number. |
* @param[in] io The device input/output address. |
* @returns EOK on success. |
* @returns Other errro codes as defined for the netif_probe_message(). |
*/ |
77,10 → 77,10 |
int netif_probe_req( int netif_phone, device_id_t device_id, int irq, int io ); |
/** Sends the packet queue. |
* @param netif_phone The network interface phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param packet The packet queue. Input parameter. |
* @param sender The sending module service. Input parameter. |
* @param[in] netif_phone The network interface phone. |
* @param[in] device_id The device identifier. |
* @param[in] packet The packet queue. |
* @param[in] sender The sending module service. |
* @returns EOK on success. |
* @returns Other error codes as defined for the generic_send_msg() function. |
*/ |
87,8 → 87,8 |
int netif_send_msg( int netif_phone, device_id_t device_id, packet_t packet, services_t sender ); |
/** Starts the device. |
* @param netif_phone The network interface phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param[in] netif_phone The network interface phone. |
* @param[in] device_id The device identifier. |
* @returns EOK on success. |
* @returns Other error codes as defined for the find_device() function. |
* @returns Other error codes as defined for the netif_start_message() function. |
96,8 → 96,8 |
int netif_start_req( int netif_phone, device_id_t device_id ); |
/** Stops the device. |
* @param netif_phone The network interface phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param[in] netif_phone The network interface phone. |
* @param[in] device_id The device identifier. |
* @returns EOK on success. |
* @returns Other error codes as defined for the find_device() function. |
* @returns Other error codes as defined for the netif_stop_message() function. |
105,18 → 105,18 |
int netif_stop_req( int netif_phone, device_id_t device_id ); |
/** Returns the device usage statistics. |
* @param netif_phone The network interface phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param stats The device usage statistics. Output parameter. |
* @param[in] netif_phone The network interface phone. |
* @param[in] device_id The device identifier. |
* @param[out] stats The device usage statistics. |
* @returns EOK on success. |
*/ |
int netif_stats_req( int netif_phone, device_id_t device_id, device_stats_ref stats ); |
/** Creates bidirectional connection with the network interface module and registers the message receiver. |
* @param service The network interface module service. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param me The requesting module service. Input parameter. |
* @param receiver The message receiver. Input parameter. |
* @param[in] service The network interface module service. |
* @param[in] device_id The device identifier. |
* @param[in] me The requesting module service. |
* @param[in] receiver The message receiver. |
* @returns The phone of the needed service. |
* @returns EOK on success. |
* @returns Other error codes as defined for the bind_service() function. |
/branches/network/uspace/srv/net/include/icmp_client.h |
---|
41,11 → 41,11 |
#include "../structures/packet/packet.h" |
/** Processes the received packet prefixed with an ICMP header. |
* @param packet The received packet. Input parameter. |
* @param type The ICMP header type. Output parameter. |
* @param code The ICMP header code. Output parameter. |
* @param pointer The ICMP header pointer. Output parameter. |
* @param mtu The ICMP header MTU. Output parameter. |
* @param[in] packet The received packet. |
* @param[out] type The ICMP header type. |
* @param[out] code The ICMP header code. |
* @param[out] pointer The ICMP header pointer. |
* @param[out] mtu The ICMP header MTU. |
* @returns The ICMP header length. |
* @returns Zero (0) if the packet contains no data. |
*/ |
52,7 → 52,7 |
int icmp_client_process_packet( packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu ); |
/** Returns the ICMP header length. |
* @param packet The packet. Input parameter. |
* @param[in] packet The packet. |
* @returns The ICMP header length in bytes. |
*/ |
size_t icmp_client_header_length( packet_t packet ); |
/branches/network/uspace/srv/net/include/ip_interface.h |
---|
63,20 → 63,20 |
/** The transport layer notification function type definition. |
* Notifies the transport layer modules about the received packet/s. |
* @param device_id The device identifier. Input parameter. |
* @param packet The received packet or the received packet queue. Input parameter. |
* @param receiver The receiving module service. Input parameter. |
* @param error The packet error reporting service. Prefixes the received packet. Input parameter. |
* @param[in] device_id The device identifier. |
* @param[in] packet The received packet or the received packet queue. |
* @param[in] receiver The receiving module service. |
* @param[in] error The packet error reporting service. Prefixes the received packet. |
* @returns EOK on success. |
*/ |
typedef int ( * tl_received_msg_t )( device_id_t device_id, packet_t packet, services_t receiver, services_t error ); |
/** Creates bidirectional connection with the ip module service and registers the message receiver. |
* @param service The IP module service. Input parameter. |
* @param protocol The transport layer protocol. Input parameter. |
* @param me The requesting module service. Input parameter. |
* @param receiver The message receiver. Used for remote connection. Input parameter. |
* @param tl_received_msg The message processing function. Used if bundled together. Input parameter. |
* @param[in] service The IP module service. |
* @param[in] protocol The transport layer protocol. |
* @param[in] me The requesting module service. |
* @param[in] receiver The message receiver. Used for remote connection. |
* @param[in] tl_received_msg The message processing function. Used if bundled together. |
* @returns The phone of the needed service. |
* @returns EOK on success. |
* @returns Other error codes as defined for the bind_service() function. |
86,9 → 86,9 |
/** Registers the new device. |
* Registers itself as the ip packet receiver. |
* If the device uses ARP registers also the new ARP device. |
* @param ip_phone The IP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The new device identifier. Input parameter. |
* @param netif The underlying device network interface layer service. Input parameter. |
* @param[in] ip_phone The IP module phone used for (semi)remote calls. |
* @param[in] device_id The new device identifier. |
* @param[in] netif The underlying device network interface layer service. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
* @returns EINVAL if the device configuration is invalid. |
101,11 → 101,11 |
/** Sends the packet queue. |
* The packets may get fragmented if needed. |
* @param ip_phone The IP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param packet The packet fragments as a~packet queue. All the packets have to have the same destination address. Input parameter. |
* @param sender The sending module service. Input parameter. |
* @param error The packet error reporting service. Prefixes the received packet. Input parameter. |
* @param[in] ip_phone The IP module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] packet The packet fragments as a~packet queue. All the packets have to have the same destination address. |
* @param[in] sender The sending module service. |
* @param[in] error The packet error reporting service. Prefixes the received packet. |
* @returns EOK on success. |
* @returns Other error codes as defined for the generic_send_msg() function. |
*/ |
120,29 → 120,29 |
/** Adds a route to the device routing table. |
* The target network is routed using this device. |
* @param ip_phone The IP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param address The target network address. Input parameter. |
* @param netmask The target network mask. Input parameter. |
* @param gateway The target network gateway. Not used if zero. Input parameter. |
* @param[in] ip_phone The IP module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] address The target network address. |
* @param[in] netmask The target network mask. |
* @param[in] gateway The target network gateway. Not used if zero. |
*/ |
int ip_add_route_req( int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway ); |
/** Sets the default gateway. |
* This gateway is used if no other route is found. |
* @param ip_phone The IP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param gateway The default gateway. Input parameter. |
* @param[in] ip_phone The IP module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] gateway The default gateway. |
*/ |
int ip_set_gateway_req( int ip_phone, device_id_t device_id, in_addr_t gateway ); |
/** Returns the device packet dimensions for sending. |
* @param ip_phone The IP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param addr_len The minimum reserved address length. Output parameter. |
* @param prefix The minimum reserved prefix size. Output parameter. |
* @param content The maximum content size. Output parameter. |
* @param suffix The minimum reserved suffix size. Output parameter. |
* @param[in] ip_phone The IP module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[out] addr_len The minimum reserved address length. |
* @param[out] prefix The minimum reserved prefix size. |
* @param[out] content The maximum content size. |
* @param[out] suffix The minimum reserved suffix size. |
* @returns EOK on success. |
* @returns EBADMEM if either one of the parameters is NULL. |
* @returns ENOENT if there is no such device. |
151,16 → 151,23 |
int ip_packet_size_req( int ip_phone, device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ); |
/** Notifies the IP module about the received error notification packet. |
* @param ip_phone The IP module phone used for (semi)remote calls. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param packet The received packet or the received packet queue. Input parameter. |
* @param target The target internetwork module service to be delivered to. Input parameter. |
* @param error The packet error reporting service. Prefixes the received packet. Input parameter. |
* @param[in] ip_phone The IP module phone used for (semi)remote calls. |
* @param[in] device_id The device identifier. |
* @param[in] packet The received packet or the received packet queue. |
* @param[in] target The target internetwork module service to be delivered to. |
* @param[in] error The packet error reporting service. Prefixes the received packet. |
* @returns EOK on success. |
*/ |
int ip_received_error_msg( int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error ); |
/** \todo |
/** Returns the device identifier and the IP pseudo header based on the destination address. |
* @param[in] ip_phone The IP module phone used for (semi)remote calls. |
* @param[in] protocol The transport protocol. |
* @param[in] destination The destination address. |
* @param[in] addrlen The destination address length. |
* @param[out] device_id The device identifier. |
* @param[out] header The constructed IP pseudo header. |
* @param[out] headerlen The IP pseudo header length. |
*/ |
int ip_get_route_req( int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen ); |
/branches/network/uspace/srv/net/include/socket.h |
---|
52,9 → 52,9 |
/*@{*/ |
/** Creates a new socket. |
* @param domain The socket protocol family. Input parameter. |
* @param type Socket type. Input parameter. |
* @param protocol Socket protocol. Input parameter. |
* @param[in] domain The socket protocol family. |
* @param[in] type Socket type. |
* @param[in] protocol Socket protocol. |
* @returns The socket identifier on success. |
* @returns EPFNOTSUPPORT if the protocol family is not supported. |
* @returns ESOCKNOTSUPPORT if the socket type is not supported. |
65,9 → 65,9 |
int socket( int domain, int type, int protocol ); |
/** Binds the socket to a port address. |
* @param socket_id Socket identifier. Input parameter. |
* @param my_addr The port address. Input parameter. |
* @param addrlen The address length. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @param[in] my_addr The port address. |
* @param[in] addrlen The address length. |
* @returns EOK on success. |
* @returns ENOTSOCK if the socket is not found. |
* @returns EBADMEM if the my_addr parameter is NULL. |
77,8 → 77,8 |
int bind( int socket_id, const struct sockaddr * my_addr, socklen_t addrlen ); |
/** Sets the number of connections waiting to be accepted. |
* @param socket_id Socket identifier. Input parameter. |
* @param backlog The maximum number of waiting sockets to be accepted. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @param[in] backlog The maximum number of waiting sockets to be accepted. |
* @returns EOK on success. |
* @returns EINVAL if the backlog parameter is not positive (<=0). |
* @returns ENOTSOCK if the socket is not found. |
88,9 → 88,9 |
/** Accepts waiting socket. |
* Blocks until such a socket exists. |
* @param socket_id Socket identifier. Input parameter. |
* @param cliaddr The remote client address. Output parameter. |
* @param addrlen The address length. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @param[out] cliaddr The remote client address. |
* @param[in] addrlen The address length. |
* @returns EOK on success. |
* @returns EBADMEM if the cliaddr or addrlen parameter is NULL. |
* @returns EINVAL if the backlog parameter is not positive (<=0). |
100,9 → 100,9 |
int accept( int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen ); |
/** Connects socket to the remote server. |
* @param socket_id Socket identifier. Input parameter. |
* @param serv_addr The remote server address. Input parameter. |
* @param addrlen The address length. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @param[in] serv_addr The remote server address. |
* @param[in] addrlen The address length. |
* @returns EOK on success. |
* @returns EBADMEM if the serv_addr parameter is NULL. |
* @returns NO_DATA if the addlen parameter is zero (0). |
112,7 → 112,7 |
int connect( int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen ); |
/** Closes the socket. |
* @param socket_id Socket identifier. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @returns EOK on success. |
* @returns ENOTSOCK if the socket is not found. |
* @returns EINPROGRESS if there is another blocking function in progress. |
121,10 → 121,10 |
int closesocket( int socket_id ); |
/** Sends data via the socket. |
* @param socket_id Socket identifier. Input parameter. |
* @param data The data to be sent. Input parameter. |
* @param datalength The data length. Input parameter. |
* @param flags Various send flags. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @param[in] data The data to be sent. |
* @param[in] datalength The data length. |
* @param[in] flags Various send flags. |
* @returns EOK on success. |
* @returns ENOTSOCK if the socket is not found. |
* @returns EBADMEM if the data parameter is NULL. |
135,12 → 135,12 |
/** Sends data via the socket to the remote address. |
* Binds the socket to a free port if not already connected/bound. |
* @param socket_id Socket identifier. Input parameter. |
* @param data The data to be sent. Input parameter. |
* @param datalength The data length. Input parameter. |
* @param flags Various send flags. Input parameter. |
* @param toaddr The destination address. Input parameter. |
* @param addrlen The address length. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @param[in] data The data to be sent. |
* @param[in] datalength The data length. |
* @param[in] flags Various send flags. |
* @param[in] toaddr The destination address. |
* @param[in] addrlen The address length. |
* @returns EOK on success. |
* @returns ENOTSOCK if the socket is not found. |
* @returns EBADMEM if the data or toaddr parameter is NULL. |
150,10 → 150,10 |
int sendto( int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen ); |
/** Receives data via the socket. |
* @param socket_id Socket identifier. Input parameter. |
* @param data The data buffer to be filled. Output parameter. |
* @param datalength The data length. Input parameter. |
* @param flags Various receive flags. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @param[out] data The data buffer to be filled. |
* @param[in] datalength The data length. |
* @param[in] flags Various receive flags. |
* @returns EOK on success. |
* @returns ENOTSOCK if the socket is not found. |
* @returns EBADMEM if the data parameter is NULL. |
163,12 → 163,12 |
int recv( int socket_id, void * data, size_t datalength, int flags ); |
/** Receives data via the socket. |
* @param socket_id Socket identifier. Input parameter. |
* @param data The data buffer to be filled. Output parameter. |
* @param datalength The data length. Input parameter. |
* @param flags Various receive flags. Input parameter. |
* @param fromaddr The source address. Output parameter. |
* @param addrlen The address length. The maximum address length is read. The actual address length is set. Input/output parameter. |
* @param[in] socket_id Socket identifier. |
* @param[out] data The data buffer to be filled. |
* @param[in] datalength The data length. |
* @param[in] flags Various receive flags. |
* @param[out] fromaddr The source address. |
* @param[in,out] addrlen The address length. The maximum address length is read. The actual address length is set. |
* @returns EOK on success. |
* @returns ENOTSOCK if the socket is not found. |
* @returns EBADMEM if the data or fromaddr parameter is NULL. |
178,11 → 178,11 |
int recvfrom( int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen ); |
/** Gets socket option. |
* @param socket_id Socket identifier. Input parameter. |
* @param level The socket options level. Input parameter. |
* @param optname The socket option to be get. Input parameter. |
* @param value The value buffer to be filled. Output parameter. |
* @param optlen The value buffer length. The maximum length is read. The actual length is set. Input/output parameter. |
* @param[in] socket_id Socket identifier. |
* @param[in] level The socket options level. |
* @param[in] optname The socket option to be get. |
* @param[out] value The value buffer to be filled. |
* @param[in,out] optlen The value buffer length. The maximum length is read. The actual length is set. |
* @returns EOK on success. |
* @returns ENOTSOCK if the socket is not found. |
* @returns EBADMEM if the value or optlen parameter is NULL. |
192,11 → 192,11 |
int getsockopt( int socket_id, int level, int optname, void * value, size_t * optlen ); |
/** Sets socket option. |
* @param socket_id Socket identifier. Input parameter. |
* @param level The socket options level. Input parameter. |
* @param optname The socket option to be set. Input parameter. |
* @param value The value to be set. Input parameter. |
* @param optlen The value length. Input parameter. |
* @param[in] socket_id Socket identifier. |
* @param[in] level The socket options level. |
* @param[in] optname The socket option to be set. |
* @param[in] value The value to be set. |
* @param[in] optlen The value length. |
* @returns EOK on success. |
* @returns ENOTSOCK if the socket is not found. |
* @returns EBADMEM if the value parameter is NULL. |