/branches/network/uspace/srv/net/include/socket_errno.h |
---|
40,10 → 40,6 |
#include <errno.h> |
/** @name Socket error codes definitions |
*/ |
/*@{*/ |
////#define EINTR (-10004) |
////#define EBADF (-10009) |
//#define EACCES (-10013) |
51,41 → 47,23 |
////#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) |
94,9 → 72,6 |
//#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) |
109,12 → 84,8 |
//#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/il_interface.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* Internetwork layer module interface for the underlying network interface layer. |
* Internetwork layer interface for the underlying network interface layer. |
* This interface is always called by the standalone remote modules. |
*/ |
51,11 → 51,6 |
#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. |
89,8 → 84,6 |
return generic_device_state_msg( il_phone, NET_IL_MTU_CHANGED, device_id, mtu, target ); |
} |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/include/arp_interface.h |
---|
44,11 → 44,6 |
#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. |
120,8 → 115,6 |
*/ |
task_id_t arp_task_get_id( void ); |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/include/ip_interface.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* IP module interface. |
* Internet protocol 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,11 → 50,6 |
#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. |
65,7 → 60,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. |
93,7 → 88,7 |
int ip_device_req( int ip_phone, device_id_t device_id, services_t netif ); |
/** Sends the packet queue. |
* @param ip_phone The IP module phone used for (semi)remote calls. Input parameter. |
* @param ip_phone The internet protocol 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. |
111,7 → 106,7 |
/** 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 ip_phone The internet protocol phone. 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. |
121,7 → 116,7 |
/** 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 ip_phone The internet protocol phone. Input parameter. |
* @param device_id The device identifier. Input parameter. |
* @param gateway The default gateway. Input parameter. |
*/ |
128,7 → 123,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 IP module phone used for (semi)remote calls. Input parameter. |
* @param ip_phone The internet protocol 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. |
141,8 → 136,6 |
*/ |
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 |
/** @} |
/branches/network/uspace/srv/net/include/ip_client.h |
---|
30,8 → 30,8 |
* @{ |
*/ |
/** @file |
* \todo |
/** |
* @file |
*/ |
#ifndef __NET_IP_CLIENT_H__ |
/branches/network/uspace/srv/net/include/netdb.h |
---|
63,45 → 63,13 |
#define h_addr h_addr_list[ 0 ] |
}; |
/** @name Host entry address types definitions. |
*/ |
/*@{*/ |
#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 */ |
/** 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/in6.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* INET6 family common definitions. |
* |
*/ |
#ifndef __NET_IN6_H__ |
42,48 → 42,21 |
#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{ |
/** 16 byte IPv6 address. |
*/ |
unsigned char s6_addr[ 16 ]; |
unsigned char s6_addr[ 16 ]; // IPv6 address |
}; |
/** INET6 socket address. |
* @see sockaddr |
*/ |
struct sockaddr_in6{ |
/** 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; |
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 |
}; |
#endif |
/branches/network/uspace/srv/net/include/inet.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* Internet common definitions. |
* |
*/ |
#ifndef __NET_INET_H__ |
41,55 → 41,17 |
#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{ |
/** Address family. |
* @see socket.h |
*/ |
uint16_t sa_family; |
/** 14 byte protocol address. |
*/ |
uint8_t sa_data[ 14 ]; |
uint16_t sa_family; // address family, AF_xxx |
uint8_t sa_data[ 14 ]; // 14 bytes of protocol address |
}; |
/** 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/in.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* INET family common definitions. |
* |
*/ |
#ifndef __NET_IN_H__ |
42,45 → 42,20 |
#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{ |
/** 4 byte IP address. |
*/ |
uint32_t s_addr; |
uint32_t s_addr; // that's a 32-bit int (4 bytes) |
}; |
/** INET socket address. |
* @see sockaddr |
*/ |
struct sockaddr_in{ |
/** 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 ]; |
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 |
}; |
#endif |
/branches/network/uspace/srv/net/include/ethernet_lsap.h |
---|
39,14 → 39,8 |
#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 |
129,8 → 123,6 |
*/ |
#define ETH_LSAP_GLSAP 0xFF |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/include/hardware.h |
---|
40,14 → 40,8 |
#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 |
188,8 → 182,6 |
*/ |
#define HW_Pure_IP 35 |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/include/ethernet_protocols.h |
---|
40,14 → 40,8 |
#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. |
*/ |
1005,8 → 999,6 |
*/ |
#define ETH_P_ISC_Bunker_Ramo_MAX 0xFF0F |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/include/net_interface.h |
---|
46,11 → 46,6 |
#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. |
92,8 → 87,6 |
*/ |
int net_connect_module( services_t service ); |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/include/tl_interface.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* Transport layer module interface for the underlying internetwork layer. |
* Transport layer interface for the underlying internetwork layer. |
*/ |
#ifndef __NET_TL_INTERFACE_H__ |
50,11 → 50,6 |
#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. |
66,8 → 61,6 |
return generic_received_msg( tl_phone, NET_TL_RECEIVED, device_id, packet_get_id( packet ), target ); |
} |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/include/nil_interface.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* Network interface layer module interface. |
* Network interface layer 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,11 → 55,6 |
#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. |
145,8 → 140,6 |
*/ |
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/ip_protocols.h |
---|
38,10 → 38,6 |
#ifndef __NET_IPPROTOCOLS_H__ |
#define __NET_IPPROTOCOLS_H__ |
/** @name IP protocols definitions |
*/ |
/*@{*/ |
/** IPv6 Hop-by-Hop Option internet protocol number. |
*/ |
#define IPPROTO_HOPOPT 0 |
612,8 → 608,6 |
*/ |
#define IPPROTO_MAX ( IPPROTO_RAW + 1 ) |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/il/arp/arp_messages.h |
---|
67,17 → 67,11 |
NET_ARP_CLEAN_CACHE, |
} arp_messages; |
/** @name ARP specific message parameters definitions |
*/ |
/*@{*/ |
/** Returns the protocol service message parameter. |
* @param call The message call structure. Input parameter. |
*/ |
#define ARP_GET_NETIF( call ) ( services_t ) IPC_GET_ARG2( * call ) |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/il/arp/arp.h |
---|
127,10 → 127,10 |
/** Broadcast device hardware address data. |
*/ |
char * broadcast_data; |
/** Device module service. |
/** Device driver service. |
*/ |
services_t service; |
/** Device module phone. |
/** Driver phone. |
*/ |
int phone; |
/** Protocol map. |
/branches/network/uspace/srv/net/il/arp/arp_oc.h |
---|
38,10 → 38,6 |
#ifndef __NET_ARP_ARPOP_H__ |
#define __NET_ARP_ARPOP_H__ |
/** @name ARP operation codes definitions |
*/ |
/*@{*/ |
/** REQUEST operation code. |
*/ |
#define ARPOP_REQUEST 1 |
134,8 → 130,6 |
*/ |
#define ARPOP_MAPOS_UNARP 23 |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/il/ip/ip.h |
---|
30,8 → 30,8 |
* @{ |
*/ |
/** @file |
* IP module. |
/** |
* @file |
*/ |
#ifndef __NET_IP_H__ |
50,97 → 50,35 |
#include "../../structures/generic_field.h" |
#include "../../structures/module_map.h" |
/** Type definition of the IP global data. |
* @see ip_globals |
*/ |
typedef struct ip_globals ip_globals_t; |
/** Type definition of the IP network interface specific data. |
* @see ip_netif |
*/ |
typedef struct ip_netif ip_netif_t; |
/** Type definition of the IP network interface specific data pointer. |
* @see ip_netif |
*/ |
typedef ip_netif_t * ip_netif_ref; |
/** Type definition of the IP protocol specific data. |
* @see ip_proto |
*/ |
typedef struct ip_proto ip_proto_t; |
/** Type definition of the IP protocol specific data pointer. |
* @see ip_proto |
*/ |
typedef ip_proto_t * ip_proto_ref; |
/** Type definition of the IP route specific data. |
* @see ip_route |
*/ |
typedef struct ip_route ip_route_t; |
/** Type definition of the IP route specific data pointer. |
* @see ip_route |
*/ |
typedef ip_route_t * ip_route_ref; |
/** IP network interfaces. |
* Maps devices to the IP network interface specific data. |
* @see device.h |
*/ |
typedef struct ip_globals ip_globals_t; |
DEVICE_MAP_DECLARE( ip_netifs, ip_netif_t ) |
/** IP registered protocols. |
* Maps protocols to the IP protocol specific data. |
* @see int_map.h |
*/ |
INT_MAP_DECLARE( ip_protos, ip_proto_t ) |
/** IP routing table. |
* @see generic_field.h |
*/ |
GENERIC_FIELD_DECLARE( ip_routes, ip_route_t ) |
/** IP network interface specific data. |
*/ |
struct ip_netif{ |
/** Device identifier. |
*/ |
device_id_t device_id; |
/** Netif module service. |
*/ |
services_t service; |
/** Netif module phone. |
*/ |
int phone; |
/** ARP module. |
* Assigned if using ARP. |
*/ |
module_ref arp; |
/** IP version. |
*/ |
int ipv; |
/** Indicates whether using DHCP. |
*/ |
int dhcp; |
/** Indicates whether IP routing is enabled. |
*/ |
int routing; |
/** Device state. |
*/ |
device_state_t state; |
/** Broadcast address. |
*/ |
in_addr_t broadcast; |
/** First DNS address. |
*/ |
in_addr_t dns1; |
/** Second DNS address. |
*/ |
in_addr_t dns2; |
/** Routing table. |
*/ |
ip_routes_t routes; |
/** Reserved packet prefix length. |
*/ |
157,72 → 95,30 |
size_t addr_len; |
}; |
/** IP protocol specific data. |
*/ |
struct ip_proto{ |
/** Protocol number. |
*/ |
int protocol; |
/** Protocol module service. |
*/ |
services_t service; |
/** Protocol module phone. |
*/ |
int phone; |
/** Protocol packet receiving function. |
*/ |
tl_received_msg_t received_msg; |
}; |
/** IP route specific data. |
*/ |
struct ip_route{ |
/** Target address. |
*/ |
in_addr_t address; |
/** Target network mask. |
*/ |
in_addr_t netmask; |
/** Gateway. |
*/ |
in_addr_t gateway; |
/** Parent netif. |
*/ |
ip_netif_ref netif; |
}; |
/** IP global data. |
*/ |
struct ip_globals{ |
/** Networking module phone. |
*/ |
int net_phone; |
/** Registered network interfaces. |
*/ |
ip_netifs_t netifs; |
/** Netifs safeyt lock. |
*/ |
fibril_rwlock_t netifs_lock; |
/** Registered protocols. |
*/ |
ip_protos_t protos; |
/** Protocols safety lock. |
*/ |
fibril_rwlock_t protos_lock; |
/** Default gateway. |
*/ |
ip_route_t gateway; |
/** Known support modules. |
*/ |
modules_t modules; |
/** Default client connection function for support modules. |
*/ |
async_client_conn_t client_connection; |
/** Packet counter. |
*/ |
uint16_t packet_counter; |
/** Safety lock. |
*/ |
fibril_rwlock_t lock; |
}; |
/branches/network/uspace/srv/net/il/ip/ip_messages.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* IP module messages. |
* Internet protocol layer module messages. |
* @see ip_interface.h |
*/ |
40,7 → 40,7 |
#include <ipc/ipc.h> |
/** IP module messages. |
/** Internet protocol layer module messages. |
*/ |
typedef enum{ |
/** Adds the routing entry. |
53,10 → 53,6 |
NET_IP_SET_GATEWAY |
} ip_messages; |
/** @name IP specific message parameters definitions |
*/ |
/*@{*/ |
/** Returns the gateway message parameter. |
* @param call The message call structure. Input parameter. |
*/ |
72,8 → 68,6 |
*/ |
#define IP_GET_NETMASK( call ) ({ in_addr_t addr; addr.s_addr = IPC_GET_ARG4( * call ); addr; }) |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/il/ip/ip_client.c |
---|
30,9 → 30,8 |
* @{ |
*/ |
/** @file |
* IP client interface implementation. |
* @see ip_client.h |
/** |
* @file |
*/ |
#include <errno.h> |
/branches/network/uspace/srv/net/il/ip/ip_remote.c |
---|
31,9 → 31,6 |
*/ |
/** @file |
* IP interface implementation for standalone remote modules. |
* @see ip_interface.h |
* @see il_interface.h |
*/ |
#include <ipc/services.h> |
/branches/network/uspace/srv/net/il/ip/ip_header.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* IP header and options definitions. |
* Internet protocol header and options definitions. |
* Names according to the linux src/include/linux/ip.h header file. |
*/ |
87,7 → 87,6 |
uint16_t identification; |
#ifdef ARCH_IS_BIG_ENDIAN |
/** Various control flags. |
* @see |
*/ |
uint16_t flags:3; |
/** This field indicates where in the datagram this fragment belongs. |
166,40 → 165,15 |
#endif |
} __attribute__ ((packed)); |
/** @name IP flags definitions |
*/ |
/*@{*/ |
/** Fragment flag field shift. |
*/ |
#define IPFLAG_FRAGMENT_SHIFT 1 |
/** Fragmented flag field shift. |
*/ |
#define IPFLAG_FRAGMENTED_SHIFT 0 |
/** May fragment flag value. |
* Allows the packet fragmentation. |
*/ |
#define IPFLAG_MAY_FRAGMENT ( 0x0 << IPFLAG_FRAGMENT_SHIFT ) |
/** Don't fragment flag value. |
* Permits the packet fragmentation. |
*/ |
#define IPFLAG_DONT_FRAGMENT ( 0x1 << IPFLAG_FRAGMENT_SHIFT ) |
/** Last fragment flag value. |
* Indicates the last packet fragment. |
*/ |
#define IPFLAG_LAST_FRAGMENT ( 0x0 << IPFLAG_FRAGMENTED_SHIFT ) |
/** More fragments flag value. |
* Indicates that more packet fragments follow. |
*/ |
#define IPFLAG_MORE_FRAGMENTS ( 0x1 << IPFLAG_FRAGMENTED_SHIFT ) |
/*@}*/ |
/* |
#define IPOPT_OPTVAL 0 |
#define IPOPT_OLEN 1 |
/branches/network/uspace/srv/net/il/ip/ip_module.h |
---|
31,8 → 31,6 |
*/ |
/** @file |
* IP module functions. |
* The functions are used as IP module entry points. |
*/ |
#ifndef __NET_IP_MODULE_H__ |
40,24 → 38,7 |
#include <ipc/ipc.h> |
/** Initializes the IP module. |
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int ip_initialize( async_client_conn_t client_connection ); |
/** Processes the IP 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. |
* @returns EOK on success. |
* @returns ENOTSUP if the message is not known. |
* @see ip_interface.h |
* @see il_interface.h |
* @see IS_NET_IP_MESSAGE() |
*/ |
int ip_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
#endif |
/branches/network/uspace/srv/net/il/ip/ip_module.c |
---|
31,10 → 31,6 |
*/ |
/** @file |
* IP standalone module implementation. |
* Contains skeleton module functions mapping. |
* The functions are used by the module skeleton as module specific entry points. |
* @see module.c |
*/ |
#include <async.h> |
53,36 → 49,12 |
#include "ip.h" |
#include "ip_module.h" |
/** IP module name. |
*/ |
#define NAME "IP protocol" |
/** Prints the module name. |
* @see NAME |
*/ |
void module_print_name( void ); |
/** Starts the IP 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. |
* @returns EOK on successful module termination. |
* @returns Other error codes as defined for the ip_initialize() function. |
* @returns Other error codes as defined for the REGISTER_ME() macro function. |
*/ |
int module_start( async_client_conn_t client_connection ); |
/** Processes the IP 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. |
* @returns EOK on success. |
* @returns Other error codes as defined for the ip_message() function. |
*/ |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** IP module global data. |
*/ |
extern ip_globals_t ip_globals; |
void module_print_name( void ){ |
/branches/network/uspace/srv/net/il/il_messages.h |
---|
70,10 → 70,6 |
NET_IL_MTU_CHANGED |
} il_messages; |
/** @name Internetwork layer specific message parameters definitions |
*/ |
/*@{*/ |
/** Returns the protocol number message parameter. |
* @param call The message call structure. Input parameter. |
*/ |
84,8 → 80,6 |
*/ |
#define IL_GET_SERVICE( call ) ( services_t ) IPC_GET_ARG2( * call ) |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/tl/udp/udp.h |
---|
31,7 → 31,6 |
*/ |
/** @file |
* UDP module. |
*/ |
#ifndef __NET_UDP_H__ |
41,40 → 40,17 |
#include "../../socket/socket_core.h" |
/** Type definition of the UDP global data. |
* @see udp_globals |
*/ |
typedef struct udp_globals udp_globals_t; |
/** UDP global data. |
*/ |
struct udp_globals{ |
/** IP module phone. |
*/ |
int ip_phone; |
/** Reserved packet prefix length. |
*/ |
size_t prefix; |
/** Maximal packet content length. |
*/ |
size_t content; |
/** Reserved packet suffix length. |
*/ |
size_t suffix; |
/** Packet address length. |
*/ |
size_t addr_len; |
/** Networking module phone. |
*/ |
size_t addr_len; |
size_t prefix; |
size_t content; |
size_t suffix; |
int net_phone; |
/** Last used free port. |
*/ |
int last_used_port; |
/** Active sockets. |
*/ |
socket_ports_t sockets; |
/** Safety lock. |
*/ |
fibril_rwlock_t lock; |
}; |
/branches/network/uspace/srv/net/tl/udp/udp_header.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* UDP header definition. |
* User datagram protocol header and options definitions. |
* Names according to the linux src/include/linux/udp.h header file. |
*/ |
/branches/network/uspace/srv/net/tl/udp/udp_module.c |
---|
31,10 → 31,6 |
*/ |
/** @file |
* UDP standalone module implementation. |
* Contains skeleton module functions mapping. |
* The functions are used by the module skeleton as module specific entry points. |
* @see module.c |
*/ |
#include <async.h> |
53,36 → 49,12 |
#include "udp.h" |
#include "udp_module.h" |
/** UDP module name. |
*/ |
#define NAME "UDP protocol" |
/** Prints the module name. |
* @see NAME |
*/ |
void module_print_name( void ); |
/** 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. |
* @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. |
*/ |
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. |
* @returns EOK on success. |
* @returns Other error codes as defined for the udp_message() function. |
*/ |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** UDP module global data. |
*/ |
extern udp_globals_t udp_globals; |
void module_print_name( void ){ |
/branches/network/uspace/srv/net/tl/udp/udp_module.h |
---|
31,8 → 31,6 |
*/ |
/** @file |
* UDP module functions. |
* The functions are used as UDP module entry points. |
*/ |
#ifndef __NET_UDP_MODULE_H__ |
41,23 → 39,7 |
#include <async.h> |
#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. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
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. |
* @returns EOK on success. |
* @returns ENOTSUP if the message is not known. |
* @see udp_interface.h |
* @see IS_NET_UDP_MESSAGE() |
*/ |
int udp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
#endif |
/branches/network/uspace/srv/net/tl/tcp/tcp.c |
---|
31,7 → 31,6 |
*/ |
/** @file |
* \todo |
*/ |
#include <async.h> |
/branches/network/uspace/srv/net/tl/tcp/tcp_module.h |
---|
31,8 → 31,6 |
*/ |
/** @file |
* TCP module functions. |
* The functions are used as TCP module entry points. |
*/ |
#ifndef __NET_TCP_MODULE_H__ |
41,23 → 39,7 |
#include <async.h> |
#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. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
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. |
* @returns EOK on success. |
* @returns ENOTSUP if the message is not known. |
* @see tcp_interface.h |
* @see IS_NET_TCP_MESSAGE() |
*/ |
int tcp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
#endif |
/branches/network/uspace/srv/net/tl/tcp/tcp_module.c |
---|
31,10 → 31,6 |
*/ |
/** @file |
* TCP standalone module implementation. |
* Contains skeleton module functions mapping. |
* The functions are used by the module skeleton as module specific entry points. |
* @see module.c |
*/ |
#include <async.h> |
55,36 → 51,12 |
#include "tcp.h" |
#include "tcp_module.h" |
/** TCP module name. |
*/ |
#define NAME "TCP protocol" |
/** Prints the module name. |
* @see NAME |
*/ |
void module_print_name( void ); |
/** 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. |
* @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. |
*/ |
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. |
* @returns EOK on success. |
* @returns Other error codes as defined for the tcp_message() function. |
*/ |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** TCP module global data. |
*/ |
extern tcp_globals_t tcp_globals; |
void module_print_name( void ){ |
/branches/network/uspace/srv/net/tl/tcp/tcp.h |
---|
31,7 → 31,6 |
*/ |
/** @file |
* \todo |
*/ |
#ifndef __NET_TCP_H__ |
/branches/network/uspace/srv/net/socket/socket_core.c |
---|
31,7 → 31,6 |
*/ |
/** @file |
* \todo |
*/ |
#include "../err.h" |
124,7 → 123,7 |
socket_core_ref * socket_pointer; |
// create a wrapper |
socket_pointer = ( socket_core_ref * ) malloc( sizeof( socket_core_ref )); |
socket_pointer = ( socket_core_ref * ) malloc( sizeof( * socket_pointer )); |
if( ! socket_pointer ) return ENOMEM; |
* socket_pointer = socket; |
// register the incomming port |
/branches/network/uspace/srv/net/socket/socket_core.h |
---|
31,7 → 31,6 |
*/ |
/** @file |
* \todo |
*/ |
#ifndef __NET_SOCKET_CORE_H__ |
/branches/network/uspace/srv/net/socket/socket_messages.h |
---|
31,12 → 31,8 |
*/ |
/** @file |
* Socket messages. |
* @see socket.h |
* \todo |
*/ |
#ifndef __NET_SOCKET_MESSAGES_H__ |
#define __NET_SOCKET_MESSAGES_H__ |
62,32 → 58,28 |
NET_SOCKET_DATA_FRAGMENT_SIZE |
} socket_messages; |
/** @name Socket specific message parameters definitions |
*/ |
/*@{*/ |
#define SOCKET_SET_SOCKET_ID( call ) ( int * ) & IPC_GET_ARG1( * call ) |
#define SOCKET_GET_SOCKET_ID( call ) ( int ) IPC_GET_ARG1( * call ) |
#define SOCKET_SET_READ_DATA_LENGTH( call ) ( int * ) & IPC_GET_ARG1( * call ) |
#define SOCKET_GET_READ_DATA_LENGTH( call ) ( int ) IPC_GET_ARG1( * call ) |
#define SOCKET_SET_SOCKET_ID( call ) ( int * ) & IPC_GET_ARG1( call ) |
#define SOCKET_GET_SOCKET_ID( call ) ( int ) IPC_GET_ARG1( call ) |
#define SOCKET_SET_READ_DATA_LENGTH( call ) ( int * ) & IPC_GET_ARG1( call ) |
#define SOCKET_GET_READ_DATA_LENGTH( call ) ( int ) IPC_GET_ARG1( call ) |
#define SOCKET_SET_HEADER_SIZE( call ) ( int * ) & IPC_GET_ARG2( * call ) |
#define SOCKET_GET_HEADER_SIZE( call ) ( int ) IPC_GET_ARG2( * call ) |
#define SOCKET_GET_BACKLOG( call ) ( int ) IPC_GET_ARG2( * call ) |
#define SOCKET_GET_OPT_LEVEL( call ) ( int ) IPC_GET_ARG2( * call ) |
#define SOCKET_SET_DATA_FRAGMENTS( call ) ( int * ) & IPC_GET_ARG2( * call ) |
#define SOCKET_GET_DATA_FRAGMENTS( call ) ( int ) IPC_GET_ARG2( * call ) |
#define SOCKET_SET_ADDRESS_LENGTH( call ) ( size_t * ) & IPC_GET_ARG2( * call ) |
#define SOCKET_GET_ADDRESS_LENGTH( call ) ( size_t ) IPC_GET_ARG2( * call ) |
#define SOCKET_SET_HEADER_SIZE( call ) ( int * ) & IPC_GET_ARG2( call ) |
#define SOCKET_GET_HEADER_SIZE( call ) ( int ) IPC_GET_ARG2( call ) |
#define SOCKET_GET_BACKLOG( call ) ( int ) IPC_GET_ARG2( call ) |
#define SOCKET_GET_OPT_LEVEL( call ) ( int ) IPC_GET_ARG2( call ) |
#define SOCKET_SET_DATA_FRAGMENTS( call ) ( int * ) & IPC_GET_ARG2( call ) |
#define SOCKET_GET_DATA_FRAGMENTS( call ) ( int ) IPC_GET_ARG2( call ) |
#define SOCKET_SET_ADDRESS_LENGTH( call ) ( size_t * ) & IPC_GET_ARG2( call ) |
#define SOCKET_GET_ADDRESS_LENGTH( call ) ( size_t ) IPC_GET_ARG2( call ) |
#define SOCKET_SET_DATA_FRAGMENT_SIZE( call ) ( int * ) & IPC_GET_ARG3( * call ) |
#define SOCKET_GET_DATA_FRAGMENT_SIZE( call ) ( int ) IPC_GET_ARG3( * call ) |
#define SOCKET_SET_DATA_FRAGMENT_SIZE( call ) ( int * ) & IPC_GET_ARG3( call ) |
#define SOCKET_GET_DATA_FRAGMENT_SIZE( call ) ( int ) IPC_GET_ARG3( call ) |
#define SOCKET_GET_FLAGS( call ) ( int ) IPC_GET_ARG4( * call ) |
#define SOCKET_GET_FLAGS( call ) ( int ) IPC_GET_ARG4( call ) |
#define SOCKET_GET_OPT_NAME( call ) ( int ) IPC_GET_ARG4( * call ) |
#define SOCKET_GET_OPT_NAME( call ) ( int ) IPC_GET_ARG4( call ) |
/*@}*/ |
#endif |
/branches/network/uspace/srv/net/app/echo/echo.c |
---|
31,8 → 31,6 |
*/ |
/** @file |
* Echo application. |
* Answers received packets. |
*/ |
#include <malloc.h> |
58,10 → 56,6 |
*/ |
int main( int argc, char * argv[] ); |
/** @name Output printing functions |
*/ |
/*@{*/ |
/** Prints the application help. |
*/ |
void print_help( void ); |
72,12 → 66,6 |
*/ |
void print_unrecognized( int index, const char * parameter ); |
/*@}*/ |
/** @name Command line argumets parsing functions |
*/ |
/*@{*/ |
/** Parses the next parameter as an integral number. |
* Uses the offseted actual parameter if the offset is set or the next one if not. |
* @param argc The total number of the parameters. Input parameter. |
133,8 → 121,6 |
*/ |
int parse_socket_type( const char * name ); |
/*@}*/ |
void print_help( void ){ |
printf( |
"Network Echo aplication\n" \ |
/branches/network/uspace/srv/net/nil/nildummy/nildummy.c |
---|
68,10 → 68,6 |
*/ |
nildummy_globals_t nildummy_globals; |
/** @name Message processing functions |
*/ |
/*@{*/ |
/** Processes IPC messages from the registered device driver modules in an infinite loop. |
* @param iid The message identifier. Input parameter. |
* @param icall The message parameters. Input/output parameter. |
132,8 → 128,6 |
*/ |
int nildummy_addr_message( device_id_t device_id, measured_string_ref * address ); |
/*@}*/ |
DEVICE_MAP_IMPLEMENT( nildummy_devices, nildummy_device_t ) |
int nil_device_state_msg( int nil_phone, device_id_t device_id, int state ){ |
/branches/network/uspace/srv/net/nil/nildummy/nildummy_module.c |
---|
31,7 → 31,7 |
*/ |
/** @file |
* Dummy network interface layer module stub. |
* Dummy nil module stub. |
* @see module.c |
*/ |
/branches/network/uspace/srv/net/nil/eth/eth.c |
---|
171,10 → 171,6 |
*/ |
eth_globals_t eth_globals; |
/** @name Message processing functions |
*/ |
/*@{*/ |
/** Processes IPC messages from the registered device driver modules in an infinite loop. |
* @param iid The message identifier. Input parameter. |
* @param icall The message parameters. Input/output parameter. |
238,8 → 234,6 |
*/ |
int eth_send_message( device_id_t device_id, packet_t packet, services_t sender ); |
/*@}*/ |
/** Processes the received packet and chooses the target registered module. |
* @param flags The device flags. Input parameter. |
* @param packet The packet. Input parameter. |
/branches/network/uspace/srv/net/nil/nil_messages.h |
---|
75,16 → 75,10 |
NET_NIL_BROADCAST_ADDR, |
} nil_messages; |
/** @name Network interface layer specific message parameters definitions |
*/ |
/*@{*/ |
/** Returns the protocol service message parameter. |
*/ |
#define NIL_GET_PROTO( call ) ( services_t ) IPC_GET_ARG2( * call ) |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/nil/nil_remote.c |
---|
31,7 → 31,7 |
*/ |
/** @file |
* Network interface layer interface implementation for standalone remote modules. |
* Nil interface implementation for standalone remote modules. |
* @see nil_interface.h |
*/ |
/branches/network/uspace/srv/net/net/net.h |
---|
47,10 → 47,6 |
#include "../structures/module_map.h" |
#include "../structures/packet/packet.h" |
/** @name Modules definitions |
*/ |
/*@{*/ |
/** Loopback network interface module name. |
*/ |
#define LO_NAME "lo" |
83,20 → 79,14 |
*/ |
#define NILDUMMY_FILENAME "/srv/nildummy" |
/** IP module name. |
/** Internet protocol module name. |
*/ |
#define IP_NAME "ip" |
/** IP module full path filename. |
/** Internet protocol module full path filename. |
*/ |
#define IP_FILENAME "/srv/ip" |
/*@}*/ |
/** @name Configuration setting names definitions |
*/ |
/*@{*/ |
/** Network interface name configuration label. |
*/ |
#define CONF_NAME "NAME" |
125,8 → 115,6 |
*/ |
#define CONF_MTU "MTU" |
/*@}*/ |
/** Type definition of the network interface specific data. |
* @see netif |
*/ |
/branches/network/uspace/srv/net/net/start/netstart.c |
---|
31,8 → 31,8 |
*/ |
/** @file |
* Starts the networking subsystem. |
* Performs self test if configured to. |
* Starts the net subsystem. |
* Performs self test if configured so. |
* @see configuration.h |
*/ |
/branches/network/uspace/srv/net/structures/dynamic_fifo.c |
---|
31,7 → 31,6 |
*/ |
/** @file |
* Dynamic first in first out positive integer queue implementation. |
*/ |
#include <errno.h> |
40,22 → 39,10 |
#include "dynamic_fifo.h" |
/** Internal magic value for a consistency check. |
*/ |
#define DYN_FIFO_MAGIC_VALUE 0x58627659 |
/** Returns the next queue index. |
* The queue field is circular. |
* @param fifo The dynamic queue. Input parameter. |
* @param index The actual index to be shifted. Input parameter. |
*/ |
#define NEXT_INDEX( fifo, index ) ((( index ) + 1 ) % (( fifo )->size + 1 )) |
/** Checks if the queue is valid. |
* @param fifo The dynamic queue. Input parameter. |
* @returns TRUE if the queue is valid. |
* @returns FALSE otherwise. |
*/ |
int dyn_fifo_is_valid( dyn_fifo_ref fifo ); |
int dyn_fifo_is_valid( dyn_fifo_ref fifo ){ |
/branches/network/uspace/srv/net/structures/dynamic_fifo.h |
---|
31,86 → 31,32 |
*/ |
/** @file |
* Dynamic first in first out positive integer queue. |
* Possitive integer values only. |
*/ |
#ifndef __NET_DYNAMIC_FIFO_H__ |
#define __NET_DYNAMIC_FIFO_H__ |
/** Type definition of the dynamic fifo queue. |
* @see dyn_fifo |
*/ |
/* For possitive values only */ |
typedef struct dyn_fifo dyn_fifo_t; |
/** Type definition of the dynamic fifo queue pointer. |
* @see dyn_fifo |
*/ |
typedef dyn_fifo_t * dyn_fifo_ref; |
/** Dynamic first in first out positive integer queue. |
* Possitive integer values only. |
* The queue automatically resizes if needed. |
*/ |
struct dyn_fifo{ |
/** Stored item field. |
*/ |
int * items; |
/** Actual field size. |
*/ |
int size; |
/** First item in the queue index. |
*/ |
int head; |
/** Last item in the queue index. |
*/ |
int tail; |
/** Consistency check magic value. |
*/ |
int magic_value; |
}; |
/** Initializes the dynamic queue. |
* @param fifo The dynamic queue. Input/output parameter. |
* @param size The initial queue size. Input parameter. |
* @returns EOK on success. |
* @returns EINVAL if the queue is not valid. |
* @returns EBADMEM if the fifo parameter is NULL. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int dyn_fifo_initialize( dyn_fifo_ref fifo, int size ); |
/** Appends a new item to the queue end. |
* @param fifo The dynamic queue. Input/output parameter. |
* @param value The new item value. Should be positive. Input parameter. |
* @param max_size The maximum queue size. The queue is not resized beyound this limit. May be zero or negative (<=0) to indicate no limit. Input parameter. |
* @returns EOK on success. |
* @returns EINVAL if the queue is not valid. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int dyn_fifo_push( dyn_fifo_ref fifo, int value, int max_size ); |
/** Returns and excludes the first item in the queue. |
* @param fifo The dynamic queue. Input/output parameter. |
* @returns Value of the first item in the queue. |
* @returns EINVAL if the queue is not valid. |
* @returns ENOENT if the queue is empty. |
*/ |
int dyn_fifo_pop( dyn_fifo_ref fifo ); |
/** Returns and keeps the first item in the queue. |
* @param fifo The dynamic queue. Input/output parameter. |
* @returns Value of the first item in the queue. |
* @returns EINVAL if the queue is not valid. |
* @returns ENOENT if the queue is empty. |
*/ |
int dyn_fifo_value( dyn_fifo_ref fifo ); |
/** Clears and destroys the queue. |
* @param fifo The dynamic queue. Input/output parameter. |
* @returns EOK on success. |
* @returns EINVAL if the queue is not valid. |
*/ |
int dyn_fifo_destroy( dyn_fifo_ref fifo ); |
#endif |
/branches/network/uspace/srv/net/structures/packet/packet_server.c |
---|
91,10 → 91,6 |
0 |
}; |
/** @name Packet server support functions |
*/ |
/*@{*/ |
/** Returns the packet of dimensions at least as given. |
* Tries to reuse free packets first. |
* Creates a new packet aligned to the memory page size if none available. |
152,8 → 148,6 |
*/ |
int packet_reply( const packet_t packet ); |
/*@}*/ |
int packet_translate( int phone, packet_ref packet, packet_id_t packet_id ){ |
if( ! packet ) return EINVAL; |
* packet = pm_find( packet_id ); |
/branches/network/uspace/srv/net/structures/packet/packet.h |
---|
69,10 → 69,6 |
PACKET_OTHERHOST |
}; |
/** @name Packet management system interface |
*/ |
/*@{*/ |
/** Finds the packet mapping. |
* @param packet_id The packet identifier to be found. Input parameter. |
* @returns The found packet reference. |
157,8 → 153,6 |
*/ |
packet_t pq_previous( packet_t packet ); |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/structures/packet/packet_client.h |
---|
46,10 → 46,6 |
#include "packet.h" |
/** @name Packet client interface |
*/ |
/*@{*/ |
/** Allocates the specified type right before the actual packet content and returns its pointer. |
* The wrapper of the packet_prepend() function. |
* @param packet The packet to be used. Input parameter. |
203,8 → 199,6 |
*/ |
void pq_release( int phone, packet_id_t packet_id ); |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/structures/int_map.h |
---|
31,7 → 31,6 |
*/ |
/** @file |
* Integer to generic type map. |
*/ |
#ifndef __NET_INT_MAP_H__ |
42,18 → 41,9 |
#include <mem.h> |
#include <unistd.h> |
/** Internal magic value for a map consistency check. |
*/ |
#define INT_MAP_MAGIC_VALUE 0x11223344 |
/** Internal magic value for an item consistency check. |
*/ |
#define INT_MAP_ITEM_MAGIC_VALUE 0x55667788 |
/** Integer to generic type map declaration. |
* @param name Name of the map. Input parameter. |
* @param type Inner object type. Input parameter |
*/ |
#define INT_MAP_DECLARE( name, type ) \ |
\ |
typedef struct name name##_t; \ |
87,11 → 77,6 |
void name##_item_destroy( name##_item_ref item ); \ |
int name##_item_is_valid( name##_item_ref item ); |
/** Integer to generic type map implementation. |
* Should follow declaration with the same parameters. |
* @param name Name of the map. Input parameter. |
* @param type Inner object type. Input parameter |
*/ |
#define INT_MAP_IMPLEMENT( name, type ) \ |
\ |
int name##_add( name##_ref map, int key, type * value ){ \ |
/branches/network/uspace/srv/net/structures/generic_char_map.h |
---|
31,7 → 31,6 |
*/ |
/** @file |
* Character string to generic type map. |
*/ |
#ifndef __GENERIC_CHAR_MAP_H__ |
45,14 → 44,8 |
#include "char_map.h" |
#include "generic_field.h" |
/** Internal magic value for a map consistency check. |
*/ |
#define GENERIC_CHAR_MAP_MAGIC_VALUE 0x12345622 |
/** Character string to generic type map declaration. |
* @param name Name of the map. Input parameter. |
* @param type Inner object type. Input parameter |
*/ |
#define GENERIC_CHAR_MAP_DECLARE( name, type ) \ |
\ |
GENERIC_FIELD_DECLARE( name##_items, type ) \ |
75,11 → 68,6 |
int name##_initialize( name##_ref map ); \ |
int name##_is_valid( name##_ref map ); |
/** Character string to generic type map implementation. |
* Should follow declaration with the same parameters. |
* @param name Name of the map. Input parameter. |
* @param type Inner object type. Input parameter |
*/ |
#define GENERIC_CHAR_MAP_IMPLEMENT( name, type ) \ |
\ |
GENERIC_FIELD_IMPLEMENT( name##_items, type ) \ |
/branches/network/uspace/srv/net/structures/module_map.c |
---|
74,6 → 74,7 |
module_ref module; |
module = modules_find( modules, name, 0 ); |
// TODO register the unknown one? |
if( ! module ) return NULL; |
if( ! module->task_id ){ |
module->task_id = spawn( module->filename ); |
/branches/network/uspace/srv/net/structures/generic_field.h |
---|
31,7 → 31,6 |
*/ |
/** @file |
* Generic type field. |
*/ |
#ifndef __GENERIC_FIELD_H__ |
42,14 → 41,8 |
#include <mem.h> |
#include <unistd.h> |
/** Internal magic value for a field consistency check. |
*/ |
#define GENERIC_FIELD_MAGIC_VALUE 0x55667788 |
/** Generic type field declaration. |
* @param name Name of the field. Input parameter. |
* @param type Inner object type. Input parameter |
*/ |
#define GENERIC_FIELD_DECLARE( name, type ) \ |
\ |
typedef struct name name##_t; \ |
71,11 → 64,6 |
int name##_initialize( name##_ref field ); \ |
int name##_is_valid( name##_ref field ); |
/** Generic type field implementation. |
* Should follow declaration with the same parameters. |
* @param name Name of the field. Input parameter. |
* @param type Inner object type. Input parameter |
*/ |
#define GENERIC_FIELD_IMPLEMENT( name, type ) \ |
\ |
int name##_add( name##_ref field, type * value ){ \ |
/branches/network/uspace/srv/net/configuration.h |
---|
37,58 → 37,52 |
#ifndef __NET_CONFIGURATION_H__ |
#define __NET_CONFIGURATION_H__ |
/** Activates the self test. |
/** Activate the self test. |
*/ |
#define NET_SELF_TEST 0 |
/** @name Specific self tests switches |
*/ |
/*@{*/ |
/** Activates the measured strings self test. |
/** Activate the measured strings self test. |
* The NET_SELF_TEST has to be activated. |
* @see measured_strings.h |
*/ |
#define NET_SELF_TEST_MEASURED_STRINGS 0 |
/** Activates the char map self test. |
/** Activate the char map self test. |
* The NET_SELF_TEST has to be activated. |
* @see char_map.h |
*/ |
#define NET_SELF_TEST_CHAR_MAP 0 |
/** Activates the integral map self test. |
/** Activate the integral map self test. |
* The NET_SELF_TEST has to be activated. |
* @see int_map.h |
*/ |
#define NET_SELF_TEST_INT_MAP 0 |
/** Activates the generic field self test. |
/** Activate the generic field self test. |
* The NET_SELF_TEST has to be activated. |
* @see generic_field.h |
*/ |
#define NET_SELF_TEST_GENERIC_FIELD 0 |
/** Activates the generic char map self test. |
/** Activate the generic char map self test. |
* The NET_SELF_TEST has to be activated. |
* @see generic_char_map.h |
*/ |
#define NET_SELF_TEST_GENERIC_CHAR_MAP 0 |
/** Activates the CRC computation self test. |
/** Activate the CRC computation self test. |
* The NET_SELF_TEST has to be activated. |
* @see crc.h |
*/ |
#define NET_SELF_TEST_CRC 0 |
/** Activates the dynamic fifo self test. |
/** Activate the dynamic fifo self test. |
* The NET_SELF_TEST has to be activated. |
* @see dynamic_fifo.h |
*/ |
#define NET_SELF_TEST_DYNAMIC_FIFO 0 |
/*@}*/ |
#endif |
/** @} |
/branches/network/uspace/srv/net/module.c |
---|
42,11 → 42,6 |
#include "err.h" |
/** @name External module functions. |
* This functions have to be implemented in every module. |
*/ |
/*@{*/ |
/** External message processing function. |
* Should process the messages. |
* The function has to be defined in each module. |
69,12 → 64,10 |
/** External module startup function. |
* Should start and initialize the module and register the given client connection function. |
* The function has to be defined in each module. |
* @param client_connection The client connection function to be registered. Input parameter. |
* @param client_connection The client connection functio to be registered. Input parameter. |
*/ |
extern int module_start( async_client_conn_t client_connection ); |
/*@}*/ |
/** Default thread for new connections. |
* @param iid The initial message identifier. Input parameter. |
* @param icall The initial message call structure. Input parameter. |
/branches/network/uspace/srv/net/self_test.h |
---|
32,7 → 32,6 |
/** @file |
* Self tests. |
* @see configuration.h |
*/ |
#ifndef __SELF_TEST_H__ |