Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4703 → Rev 4704

/branches/network/uspace/srv/net/include/in6.h
31,7 → 31,7
*/
 
/** @file
*
* INET6 family common definitions.
*/
 
#ifndef __NET_IN6_H__
42,21 → 42,48
#include "ip_protocols.h"
#include "inet.h"
 
/** INET6 string address maximum length.
*/
#define INET6_ADDRSTRLEN ( 8 * 4 + 7 + 1 )
 
/** Type definition of the INET6 address.
* @see in6_addr
*/
typedef struct in6_addr in6_addr_t;
 
/** Type definition of the INET6 socket address.
* @see sockaddr_in6
*/
typedef struct sockaddr_in6 sockaddr_in6_t;
 
/** INET6 address.
*/
struct in6_addr{
unsigned char s6_addr[ 16 ]; // IPv6 address
/** 16 byte IPv6 address.
*/
unsigned char s6_addr[ 16 ];
};
 
/** INET6 socket address.
* @see sockaddr
*/
struct sockaddr_in6{
uint16_t sin6_family; // address family, AF_INET6
uint16_t sin6_port; // port number, Network Byte Order
uint32_t sin6_flowinfo; // IPv6 flow information
struct in6_addr sin6_addr; // IPv6 address
uint32_t sin6_scope_id; // Scope ID
/** Address family.
* Should be AF_INET6.
*/
uint16_t sin6_family;
/** Port number.
*/
uint16_t sin6_port;
/** IPv6 flow information.
*/
uint32_t sin6_flowinfo;
/** IPv6 address.
*/
struct in6_addr sin6_addr;
/** Scope identifier.
*/
uint32_t sin6_scope_id;
};
 
#endif
/branches/network/uspace/srv/net/include/netdb.h
63,13 → 63,45
#define h_addr h_addr_list[ 0 ]
};
 
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
/** @name Host entry address types definitions.
*/
/*@{*/
 
/** Authoritative Answer Host not found address type.
*/
#define HOST_NOT_FOUND 1
 
/** Non-Authoritive Host not found, or SERVERFAIL address type.
*/
#define TRY_AGAIN 2
 
/** Non recoverable errors, FORMERR, REFUSED, NOTIMP address type.
*/
#define NO_RECOVERY 3
 
/** Valid name, no data record of requested type address type.
*/
#define NO_DATA 4
 
/** No address, look for MX record address type.
*/
#define NO_ADDRESS NO_DATA
 
/*@}*/
 
/** 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.
* @returns Host entry information.
*/
struct hostent * gethostbyaddr( const void * address, int len, int type );
 
/** Returns host entry by the host name.
* @param name The host name. Input parameter.
* @returns Host entry information.
*/
struct hostent * gethostbyname( const char * name );
 
#endif
/branches/network/uspace/srv/net/include/socket_errno.h
40,6 → 40,10
 
#include <errno.h>
 
/** @name Socket error codes definitions
*/
/*@{*/
 
////#define EINTR (-10004)
////#define EBADF (-10009)
//#define EACCES (-10013)
47,23 → 51,41
////#define EINVAL (-10022)
////#define EMFILE (-10024)
//#define EWOULDBLOCK (-10035)
/** If any API function is called while a blocking function is in progress.
/* If any API function is called while a blocking function is in progress.
*/
//#define EINPROGRESS (-10036)
//#define EALREADY (-10037)
 
/** The socket identifier is not valid.
*/
#define ENOTSOCK (-10038)
//#define EDESTADDRREQ (-10039)
//#define EMSGSIZE (-10040)
//#define EPROTOTYPE (-10041)
//#define ENOPROTOOPT (-10042)
 
/** Protocol is not supported.
*/
#define EPROTONOSUPPORT (-10043)
 
/** Socket type is not supported.
*/
#define ESOCKTNOSUPPORT (-10044)
//#define EOPNOTSUPP (-10045)
 
/** Protocol family is not supported.
*/
#define EPFNOSUPPORT (-10046)
 
/** Address family is not supported.
*/
#define EAFNOSUPPORT (-10047)
 
/** Address is already in use.
*/
#define EADDRINUSE (-10048)
//#define EADDRNOTAVAIL (-10049)
/** May be reported at any time if the implementation detects an underlying failure.
/* May be reported at any time if the implementation detects an underlying failure.
*/
//#define ENETDOWN (-10050)
//#define ENETUNREACH (-10051)
72,6 → 94,9
//#define ECONNRESET (-10054)
//#define ENOBUFS (-10055)
//#define EISCONN (-10056)
 
/** The socket is not connected or bound.
*/
#define ENOTCONN (-10057)
//#define ESHUTDOWN (-10058)
//#define ETOOMANYREFS (-10059)
84,8 → 109,12
//#define HOST_NOT_FOUND (-11001)
//#define TRY_AGAIN (-11002)
//#define NO_RECOVERY (-11003)
/** No data.
*/
#define NO_DATA (-11004)
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/ethernet_lsap.h
39,8 → 39,14
 
#include <sys/types.h>
 
/** Ethernet LSAP type definition.
*/
typedef uint8_t eth_lsap_t;
 
/** @name Ethernet LSAP values definitions
*/
/*@{*/
 
/** Null LSAP LSAP identifier.
*/
#define ETH_LSAP_NULL 0x00
123,6 → 129,8
*/
#define ETH_LSAP_GLSAP 0xFF
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/hardware.h
40,8 → 40,14
 
#include <sys/types.h>
 
/** Network interface layer type type definition.
*/
typedef uint8_t hw_type_t;
 
/** @name Network interface layer types definitions
*/
/*@{*/
 
/** Ethernet (10Mb) hardware type.
*/
#define HW_ETHER 1
182,6 → 188,8
*/
#define HW_Pure_IP 35
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/tl_interface.h
31,7 → 31,7
*/
 
/** @file
* Transport layer interface for the underlying internetwork layer.
* Transport layer module interface for the underlying internetwork layer.
*/
 
#ifndef __NET_TL_INTERFACE_H__
50,6 → 50,11
 
#include "../tl/tl_messages.h"
 
/** @name Transport layer module interface
* This interface is used by other modules.
*/
/*@{*/
 
/** 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.
61,6 → 66,8
return generic_received_msg( tl_phone, NET_TL_RECEIVED, device_id, packet_get_id( packet ), target );
}
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/inet.h
31,7 → 31,7
*/
 
/** @file
*
* Internet common definitions.
*/
 
#ifndef __NET_INET_H__
41,17 → 41,55
 
#include "byteorder.h"
 
/** Type definition of the socket address.
* @see sockaddr
*/
typedef struct sockaddr sockaddr_t;
 
/** Type definition of the address information.
* @see addrinfo
*/
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.
* @returns EOK on success.
* @returns EINVAL if the data or address parameter is NULL.
* @returns ENOMEM if the character buffer is not long enough.
* @returns ENOTSUP if the address family is not supported.
*/
int inet_ntop( uint16_t family, const uint8_t * data, char * address, size_t length );
 
/** 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.
* @returns EOK on success.
* @returns EINVAL if the data parameter is NULL.
* @returns ENOENT if the address parameter is NULL.
* @returns ENOTSUP if the address family is not supported.
*/
int inet_pton( uint16_t family, const char * address, uint8_t * data );
 
/** Socket address.
*/
struct sockaddr{
uint16_t sa_family; // address family, AF_xxx
uint8_t sa_data[ 14 ]; // 14 bytes of protocol address
/** Address family.
* @see socket.h
*/
uint16_t sa_family;
/** 14 byte protocol address.
*/
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
/branches/network/uspace/srv/net/include/nil_interface.h
31,7 → 31,7
*/
 
/** @file
* Network interface layer interface.
* Network interface layer module interface.
* The same interface is used for standalone remote device modules as well as for bundle device modules.
* The standalone remote device modules have to be compiled with the nil_remote.c source file.
* The bundle device modules with the appropriate network interface layer source file (eth.c etc.).
55,6 → 55,11
 
#include "device.h"
 
/** @name Network interface layer module interface
* This interface is used by other modules.
*/
/*@{*/
 
/** Returns the device local hardware address.
* @param nil_phone The network interface layer phone. Input parameter.
* @param device_id The device identifier. Input parameter.
140,6 → 145,8
*/
int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target );
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/arp_interface.h
44,6 → 44,11
 
#include "device.h"
 
/** @name ARP module interface
* This interface is used by other modules.
*/
/*@{*/
 
/** Registers the new device and the requesting protocol 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.
115,6 → 120,8
*/
task_id_t arp_task_get_id( void );
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/in.h
31,7 → 31,7
*/
 
/** @file
*
* INET family common definitions.
*/
 
#ifndef __NET_IN_H__
42,20 → 42,45
#include "ip_protocols.h"
#include "inet.h"
 
/** INET string address maximum length.
*/
#define INET_ADDRSTRLEN ( 4 * 3 + 3 + 1 )
 
/** Type definition of the INET address.
* @see in_addr
*/
typedef struct in_addr in_addr_t;
 
/** Type definition of the INET socket address.
* @see sockaddr_in
*/
typedef struct sockaddr_in sockaddr_in_t;
 
/** INET address.
*/
struct in_addr{
uint32_t s_addr; // that's a 32-bit int (4 bytes)
/** 4 byte IP address.
*/
uint32_t s_addr;
};
 
/** INET socket address.
* @see sockaddr
*/
struct sockaddr_in{
uint16_t sin_family; // Address family, AF_INET
uint16_t sin_port; // Port number
struct in_addr sin_addr; // Internet address
uint8_t sin_zero[ 8 ]; // Same size as struct sockaddr
/** Address family.
* Should be AF_INET.
*/
uint16_t sin_family;
/** Port number.
*/
uint16_t sin_port;
/** Internet address.
*/
struct in_addr sin_addr;
/** Padding to meet the sockaddr size.
*/
uint8_t sin_zero[ 8 ];
};
 
#endif
/branches/network/uspace/srv/net/include/ip_client.h
30,8 → 30,8
* @{
*/
 
/**
* @file
/** @file
* \todo
*/
 
#ifndef __NET_IP_CLIENT_H__
/branches/network/uspace/srv/net/include/net_interface.h
46,6 → 46,11
 
#include "../structures/measured_strings.h"
 
/** @name Networking module interface
* This interface is used by other modules.
*/
/*@{*/
 
/** Returns the device specific configuration.
* Returns the global configuration if the device specific is not found.
* @param net_phone The networking module phone. Input parameter.
87,6 → 92,8
*/
int net_connect_module( services_t service );
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/ip_protocols.h
38,6 → 38,10
#ifndef __NET_IPPROTOCOLS_H__
#define __NET_IPPROTOCOLS_H__
 
/** @name IP protocols definitions
*/
/*@{*/
 
/** IPv6 Hop-by-Hop Option internet protocol number.
*/
#define IPPROTO_HOPOPT 0
608,6 → 612,8
*/
#define IPPROTO_MAX ( IPPROTO_RAW + 1 )
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/ethernet_protocols.h
40,8 → 40,14
 
#include <sys/types.h>
 
/** Ethernet protocol type definition.
*/
typedef uint16_t eth_type_t;
 
/** @name Ethernet protocols definitions
*/
/*@{*/
 
/** Ethernet minimal protocol number.
* According to the IEEE 802.3 specification.
*/
999,6 → 1005,8
*/
#define ETH_P_ISC_Bunker_Ramo_MAX 0xFF0F
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/il_interface.h
31,7 → 31,7
*/
 
/** @file
* Internetwork layer interface for the underlying network interface layer.
* Internetwork layer module interface for the underlying network interface layer.
* This interface is always called by the standalone remote modules.
*/
 
51,6 → 51,11
 
#include "../il/il_messages.h"
 
/** @name Internetwork layer module interface
* This interface is used by other modules.
*/
/*@{*/
 
/** 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.
84,6 → 89,8
return generic_device_state_msg( il_phone, NET_IL_MTU_CHANGED, device_id, mtu, target );
}
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/include/ip_interface.h
31,7 → 31,7
*/
 
/** @file
* Internet protocol interface.
* IP module interface.
* The same interface is used for standalone remote modules as well as for bundle modules.
* The standalone remote modules have to be compiled with the ip_remote.c source file.
* The bundle modules with the ip.c source file.
50,6 → 50,11
 
#include "in.h"
 
/** @name IP module interface
* This interface is used by other modules.
*/
/*@{*/
 
/** 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.
60,7 → 65,7
typedef int ( * tl_received_msg_t )( device_id_t device_id, packet_t packet, services_t receiver );
 
/** Creates bidirectional connection with the ip module service and registers the message receiver.
* @param service The ip module service. Input parameter.
* @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.
88,7 → 93,7
int ip_device_req( int ip_phone, device_id_t device_id, services_t netif );
 
/** Sends the packet queue.
* @param ip_phone The internet protocol phone. Input parameter.
* @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 queue. Input parameter.
* @param sender The sending module service. Input parameter.
106,7 → 111,7
 
/** Adds a route to the device routing table.
* The target network is routed using this device.
* @param ip_phone The internet protocol phone. Input parameter.
* @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.
116,7 → 121,7
 
/** Sets the default gateway.
* This gateway is used if no other route is found.
* @param ip_phone The internet protocol phone. Input parameter.
* @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.
*/
123,7 → 128,7
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 internet protocol phone. Input parameter.
* @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.
136,6 → 141,8
*/
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 );
 
/*@}*/
 
#endif
 
/** @}