/branches/network/uspace/srv/net/nil/nil_messages.h |
---|
30,8 → 30,9 |
* @{ |
*/ |
/** |
* @file |
/** @file |
* Network interface layer module messages. |
* @see nil_interface.h |
*/ |
#ifndef __NET_NIL_MESSAGES_H__ |
41,20 → 42,36 |
#include "../messages.h" |
/** Network interface layer module messages. |
*/ |
typedef enum { |
/* ( device_id, driver_service, mtu ) */ |
/** New device or update MTU message. |
* @see nil_device_req() |
*/ |
NET_NIL_DEVICE = NET_NIL_FIRST, |
/* ( device_id, state ) */ |
/** New device state message. |
* @see nil_device_state_msg() |
*/ |
NET_NIL_DEVICE_STATE, |
/* ( device_id ), packet_send */ |
/** Received packet queue message. |
* @see nil_received_msg() |
*/ |
NET_NIL_RECEIVED, |
/* ( device_id ), packet_send */ |
/** Send packet queue message. |
* @see nil_send_msg() |
*/ |
NET_NIL_SEND, |
/* ( device_id ) -> addr, prefix, content, suffix */ |
/** Packet size message. |
* @see nil_packet_size_req() |
*/ |
NET_NIL_PACKET_SPACE, |
/* ( device_id ), measured_strings_return( hardware address ) */ |
/** Device local hardware address message. |
* @see nil_get_addr() |
*/ |
NET_NIL_ADDR, |
/* ( device_id ), measured_strings_return( broadcast address ) */ |
/** Device broadcast hardware address message. |
* @see nil_get_broadcast_addr() |
*/ |
NET_NIL_BROADCAST_ADDR, |
} nil_messages; |
62,6 → 79,8 |
*/ |
#define NIL_GET_PROTO( call ) ( services_t ) IPC_GET_ARG2( * call ) |
/** Returns the maximum transmission unit message parameter. |
*/ |
#define NIL_GET_MTU( call ) ( size_t ) IPC_GET_ARG2( * call ) |
#endif |
/branches/network/uspace/srv/net/nil/eth/eth.c |
---|
66,14 → 66,36 |
#include "eth.h" |
#include "eth_header.h" |
/** Reserved packet prefix length. |
*/ |
#define ETH_PREFIX ( sizeof( eth_header_t ) + sizeof( eth_header_lsap_t ) + sizeof( eth_header_snap_t )) |
/** Reserved packet suffix length. |
*/ |
#define ETH_SUFFIX sizeof( eth_fcs_t ) |
/** Maximum packet content length. |
*/ |
#define ETH_MAX_CONTENT 1500 |
/** Minimum packet content length. |
*/ |
#define ETH_MIN_CONTENT 46 |
/** Maximum tagged packet content length. |
*/ |
#define ETH_MAX_TAGGED_CONTENT( flags ) ( ETH_MAX_CONTENT - (( IS_8023_2_LSAP( flags ) || IS_8023_2_SNAP( flags )) ? sizeof( eth_header_lsap_t ) : 0 ) - ( IS_8023_2_SNAP( flags ) ? sizeof( eth_header_snap_t ) : 0 )) |
/** Minimum tagged packet content length. |
*/ |
#define ETH_MIN_TAGGED_CONTENT( flags ) ( ETH_MIN_CONTENT - (( IS_8023_2_LSAP( flags ) || IS_8023_2_SNAP( flags )) ? sizeof( eth_header_lsap_t ) : 0 ) - ( IS_8023_2_SNAP( flags ) ? sizeof( eth_header_snap_t ) : 0 )) |
/** Dummy flag shift value. |
*/ |
#define ETH_DUMMY_SHIFT 0 |
/** Mode flag shift value. |
*/ |
#define ETH_MODE_SHIFT 1 |
/** Dummy device flag. |
80,6 → 102,10 |
* Preamble and FCS are mandatory part of the packets. |
*/ |
#define ETH_DUMMY ( 1 << ETH_DUMMY_SHIFT ) |
/** Returns the dummy flag. |
* @see ETH_DUMMY |
*/ |
#define IS_DUMMY( flags ) (( flags ) & ETH_DUMMY ) |
/** Device mode flags. |
88,22 → 114,59 |
* @see ETH_8023_2_SNAP |
*/ |
#define ETH_MODE_MASK ( 3 << ETH_MODE_SHIFT ) |
/** DIX Ethernet mode flag. |
*/ |
#define ETH_DIX ( 1 << ETH_MODE_SHIFT ) |
/** Returns whether the DIX Ethernet mode flag is set. |
* @param flags The ethernet flags. Input parameter. |
* @see ETH_DIX |
*/ |
#define IS_DIX( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_DIX ) |
/** 802.3 + 802.2 + LSAP mode flag. |
*/ |
#define ETH_8023_2_LSAP ( 2 << ETH_MODE_SHIFT ) |
/** Returns whether the 802.3 + 802.2 + LSAP mode flag is set. |
* @param flags The ethernet flags. Input parameter. |
* @see ETH_8023_2_LSAP |
*/ |
#define IS_8023_2_LSAP( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_8023_2_LSAP ) |
/** 802.3 + 802.2 + LSAP + SNAP mode flag. |
*/ |
#define ETH_8023_2_SNAP ( 3 << ETH_MODE_SHIFT ) |
/** Returns whether the 802.3 + 802.2 + LSAP + SNAP mode flag is set. |
* @param flags The ethernet flags. Input parameter. |
* @see ETH_8023_2_SNAP |
*/ |
#define IS_8023_2_SNAP( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_8023_2_SNAP ) |
/** Type definition of the ethernet address type. |
* @see eth_addr_type |
*/ |
typedef enum eth_addr_type eth_addr_type_t; |
/** Type definition of the ethernet address type pointer. |
* @see eth_addr_type |
*/ |
typedef eth_addr_type_t * eth_addr_type_ref; |
/** Ethernet address type. |
*/ |
enum eth_addr_type{ |
/** Local address. |
*/ |
ETH_LOCAL_ADDR, |
/** Broadcast address. |
*/ |
ETH_BROADCAST_ADDR |
}; |
/** Ethernet global data. |
/** Ethernet module global data. |
*/ |
eth_globals_t eth_globals; |
113,19 → 176,92 |
*/ |
void eth_receiver( ipc_callid_t iid, ipc_call_t * icall ); |
DEVICE_MAP_IMPLEMENT( eth_devices, eth_device_t ) |
/** Registers new device or updates the MTU of an existing one. |
* Determines the device local hardware address. |
* @param device_id The new device identifier. Input parameter. |
* @param service The device driver service. Input parameter. |
* @param mtu The device maximum transmission unit. Input parameter. |
* @returns EOK on success. |
* @returns EEXIST if the device with the different service exists. |
* @returns ENOMEM if there is not enough memory left. |
* @returns Other error codes as defined for the net_get_device_conf_req() function. |
* @returns Other error codes as defined for the netif_bind_service() function. |
* @returns Other error codes as defined for the netif_get_addr() function. |
*/ |
int eth_device_message( device_id_t device_id, services_t service, size_t mtu ); |
INT_MAP_IMPLEMENT( eth_protos, eth_proto_t ) |
/** Registers receiving module service. |
* Passes received packets for this service. |
* @param service The module service. Input parameter. |
* @param phone The service phone. Input parameter. |
* @returns EOK on success. |
* @returns ENOENT if the service is not known. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int nil_register_message( services_t service, int phone ); |
int eth_device_message( device_id_t device_id, services_t service, size_t mtu ); |
int nil_receive_msg( int nil_phone, device_id_t device_id, packet_t packet ); |
int nil_register_message( services_t service, int phone ); |
/** Returns the device packet dimensions for sending. |
* @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. |
* @returns EOK on success. |
* @returns EBADMEM if either one of the parameters is NULL. |
* @returns ENOENT if there is no such device. |
*/ |
int eth_packet_space_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ); |
/** Returns the device hardware address. |
* @param device_id The device identifier. Input parameter. |
* @param type Type of the desired address. Input parameter |
* @param address The device hardware address. Output parameter. |
* @returns EOK on success. |
* @returns EBADMEM if the address parameter is NULL. |
* @returns ENOENT if there no such device. |
*/ |
int eth_addr_message( device_id_t device_id, eth_addr_type_t type, measured_string_ref * address ); |
/** Sends the packet queue. |
* Sends only packet successfully processed by the eth_prepare_packet() function. |
* @param device_id The device identifier. Input parameter. |
* @param packet The packet queue. Input parameter. |
* @param sender The sending module service. Input parameter. |
* @returns EOK on success. |
* @returns ENOENT if there no such device. |
* @returns EINVAL if the service parameter is not known. |
*/ |
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. |
* @returns The target registered module. |
* @returns NULL if the packet is not long enough. |
* @returns NULL if the packet is too long. |
* @returns NULL if the raw ethernet protocol is used. |
* @returns NULL if the dummy device FCS checksum is invalid. |
* @returns NULL if the packet address length is not big enough. |
*/ |
eth_proto_ref eth_process_packet( int flags, packet_t packet ); |
/** Prepares the packet for sending. |
* @param flags The device flags. Input parameter. |
* @param packet The packet. Input parameter. |
* @param src_addr The source hardware address. Input parameter. |
* @param ethertype The ethernet protocol type. Input parameter. |
* @param mtu The device maximum transmission unit. Input parameter. |
* @returns EOK on success. |
* @returns EINVAL if the packet addresses length is not long enough. |
* @returns EINVAL if the packet is bigger than the device MTU. |
* @returns ENOMEM if there is not enough memory in the packet. |
*/ |
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype ); |
DEVICE_MAP_IMPLEMENT( eth_devices, eth_device_t ) |
INT_MAP_IMPLEMENT( eth_protos, eth_proto_t ) |
int nil_device_state_msg( int nil_phone, device_id_t device_id, int state ){ |
int index; |
eth_proto_ref proto; |
331,7 → 467,7 |
int eth_packet_space_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ){ |
eth_device_ref device; |
if( !( addr_len && prefix && content && suffix )) return EINVAL; |
if( !( addr_len && prefix && content && suffix )) return EBADMEM; |
rwlock_read_lock( & eth_globals.devices_lock ); |
device = eth_devices_find( & eth_globals.devices, device_id ); |
if( ! device ){ |
349,7 → 485,7 |
int eth_addr_message( device_id_t device_id, eth_addr_type_t type, measured_string_ref * address ){ |
eth_device_ref device; |
if( ! address ) return EINVAL; |
if( ! address ) return EBADMEM; |
if( type == ETH_BROADCAST_ADDR ){ |
* address = eth_globals.broadcast_addr; |
}else{ |
414,6 → 550,7 |
if( length < 0 ) return length; |
if( length < ETH_ADDR ) return EINVAL; |
length = packet_get_data_length( packet ); |
//TODO smaller than MTU! |
if( length > ETH_MAX_TAGGED_CONTENT( flags )) return EINVAL; |
if( length < ETH_MIN_TAGGED_CONTENT( flags )){ |
padding = packet_suffix( packet, ETH_MIN_TAGGED_CONTENT( flags ) - length ); |
/branches/network/uspace/srv/net/nil/eth/eth.h |
---|
30,8 → 30,8 |
* @{ |
*/ |
/** |
* @file |
/** @file |
* Ethernet module. |
*/ |
#ifndef __NET_ETH_H__ |
/branches/network/uspace/srv/net/nil/eth/eth_module.c |
---|
31,6 → 31,8 |
*/ |
/** @file |
* Ethernet moduel stub. |
* @see module.c |
*/ |
#include <async.h> |
50,12 → 52,37 |
#include "eth.h" |
/** The module name. |
*/ |
#define NAME "Ethernet protocol" |
/** Prints the module name. |
*/ |
void module_print_name( void ); |
/** Starts the Ethernet 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 success. |
* @returns Other error codes as defined for the pm_init() function. |
* @returns Other error codes as defined for the nil_initialize() function. |
* @returns Other error codes as defined for the REGISTER_ME() macro function. |
*/ |
int module_start( async_client_conn_t client_connection ); |
/** Passes the parameters to the module specific nil_message() function. |
* @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. |
* @returns Other error codes as defined for each specific module message function. |
*/ |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** Ethernet module global data. |
*/ |
extern eth_globals_t eth_globals; |
void module_print_name( void ){ |
/branches/network/uspace/srv/net/nil/eth/eth_header.h |
---|
40,10 → 40,16 |
#include <sys/types.h> |
/** Ethernet address length. |
*/ |
#define ETH_ADDR 6 |
/** Ethernet header preamble value. |
*/ |
#define ETH_PREAMBLE 0x55 |
/** Ethernet header start of frame value. |
*/ |
#define ETH_SFD 0xD5 |
/** Type definition of the Ethernet header with all the extensions. |
/branches/network/uspace/srv/net/nil/nil_module.h |
---|
31,6 → 31,8 |
*/ |
/** @file |
* Network interface layer modules common skeleton. |
* All network interface layer modules have to implement this interface. |
*/ |
#ifndef __NET_ETH_MODULE_H__ |
38,7 → 40,25 |
#include <ipc/ipc.h> |
int nil_initialize( int networking_phone ); |
/** Module initialization. |
* Is called by the module_start() function. |
* @param net_phone The networking moduel phone. Input parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for each specific module initialize function. |
*/ |
int nil_initialize( int net_phone ); |
/** Message processing function. |
* @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. |
* @returns Other error codes as defined for each specific module message function. |
* @see nil_interface.h |
* @see IS_NET_NIL_MESSAGE() |
*/ |
int nil_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
#endif |
/branches/network/uspace/srv/net/nil/nil_remote.c |
---|
30,6 → 30,11 |
* @{ |
*/ |
/** @file |
* Nil interface implementation for standalone remote modules. |
* @see nil_interface.h |
*/ |
#include "../messages.h" |
#include "../include/device.h" |
/branches/network/uspace/srv/net/structures/module_map.c |
---|
30,8 → 30,8 |
* @{ |
*/ |
/** |
* @file |
/** @file |
* Character string to module map implementation. |
*/ |
#include <malloc.h> |
/branches/network/uspace/srv/net/structures/packet/packet_remote.c |
---|
30,8 → 30,9 |
* @{ |
*/ |
/** |
* @file |
/** @file |
* Packet client interface implementation for standalone remote modules. |
* @see packet_client.h |
*/ |
#include <async.h> |
/branches/network/uspace/srv/net/structures/packet/packet_messages.h |
---|
31,6 → 31,7 |
*/ |
/** @file |
* Packet server module messages. |
*/ |
#ifndef __NET_PACKET_MESSAGES__ |
40,11 → 41,28 |
#include "../../messages.h" |
/** Packet server module messages. |
*/ |
typedef enum { |
/** Create packet message with specified content length. |
* @see packet_get_1() |
*/ |
NET_PACKET_CREATE_1 = NET_PACKET_FIRST, |
/** Create packet message with specified address length, prefix, content and suffix. |
* @see packet_get_4() |
*/ |
NET_PACKET_CREATE_4, |
/** Get packet message. |
* @see packet_return() |
*/ |
NET_PACKET_GET, |
/** Get packet size message. |
* @see packet_translate() |
*/ |
NET_PACKET_GET_SIZE, |
/** Release packet message. |
* @see pq_release() |
*/ |
NET_PACKET_RELEASE |
} packet_messages; |
/branches/network/uspace/srv/net/structures/module_map.h |
---|
30,8 → 30,8 |
* @{ |
*/ |
/** |
* @file |
/** @file |
* Character string to module map. |
*/ |
#ifndef __NET_MODULES_MAP_H__ |
45,23 → 45,76 |
#include "generic_char_map.h" |
/** Type definition of the module structure. |
* @see module_struct |
*/ |
typedef struct module_struct module_t; |
/** Type definition of the module structure pointer. |
* @see module_struct |
*/ |
typedef module_t * module_ref; |
/** Module map. |
* Sorted by module names. |
* @see generic_char_map.h |
*/ |
GENERIC_CHAR_MAP_DECLARE( modules, module_t ) |
/** Module structure. |
*/ |
struct module_struct{ |
/** Module task identifier if running. |
*/ |
task_id_t task_id; |
/** Module service identifier. |
*/ |
services_t service; |
/** Module phone if running and connected. |
*/ |
int phone; |
/** Usage counter. |
*/ |
int usage; |
/** Module name. |
*/ |
char * name; |
/** Module full path filename. |
*/ |
char * filename; |
/** Connecting function. |
*/ |
connect_module_t * connect_module; |
}; |
/** Adds module to the module map. |
* @param module The module structure added. Output parameter. |
* @param modules The module map. Input parameter. |
* @param name The module name. Input parameter. |
* @param filename The full path filename. Input parameter. |
* @param service The module service. Input parameter. |
* @param task_id The module current task identifier. Zero (0) means not running. Input parameter. |
* @param connect_module The module connecting function. Input parameter. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int add_module( module_ref * module, modules_ref modules, char * name, char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module ); |
/** Searches and returns the specified module. |
* If the module is not running, the module filaname is spawned. |
* If the module is not connected, the connect_function is called. |
* @param modules The module map. Input parameter. |
* @param name The module name. Input parameter. |
* @returns The running module found. It does not have to be connected. |
* @returns NULL if there is no such module. |
*/ |
module_ref get_running_module( modules_ref modules, char * name ); |
/** Starts the given module. |
* @param fname The module full or relative path filename. Input parameter. |
* @returns The new module task identifier on success. |
* @returns 0 if there is no such module. |
*/ |
task_id_t spawn( char * fname ); |
#endif |
/branches/network/uspace/srv/net/Doxyfile |
---|
138,11 → 138,10 |
*.MM \ |
*.PY |
RECURSIVE = YES |
EXCLUDE = netif/include \ |
netif/ne2k_isa |
EXCLUDE = |
EXCLUDE_SYMLINKS = NO |
EXCLUDE_PATTERNS = *.svn* |
EXCLUDE_SYMBOLS = |
EXCLUDE_SYMBOLS = packed |
EXAMPLE_PATH = |
EXAMPLE_PATTERNS = * |
EXAMPLE_RECURSIVE = NO |
/branches/network/uspace/srv/net/include/protocol_map.h |
---|
103,7 → 103,10 |
} |
} |
/** \todo |
/** Maps the network interface layer services to the hardware types. |
* @param nil The network interface service. Input parameter. |
* @returns The hardware type of the network interface service. |
* @returns 0 if mapping is not found. |
*/ |
static inline int hardware_map( services_t nil ){ |
switch( nil ){ |
/branches/network/uspace/srv/net/include/device.h |
---|
77,15 → 77,6 |
NETIF_CARRIER_LOST |
}; |
/** \todo |
*/ |
#define NIFF_UP ( 1 << 0 ) |
#define NIFF_NOARP ( 1 << 1 ) |
#define NIFF_LOOPBACK ( 1 << 2 ) |
#define NIFF_BROADCAST ( 1 << 3 ) |
#define NIFF_PROMISC ( 1 << 4 ) |
#define NIFF_MULTICAST ( 1 << 5 ) |
/** Device usage statistics. |
* Based on linux_kernel/include/linux/netdevice.h. |
*/ |
/branches/network/uspace/srv/net/include/arp_interface.h |
---|
31,6 → 31,10 |
*/ |
/** @file |
* ARP 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 arp_remote.c source file. |
* The bundle modules with the arp.c source file. |
*/ |
#ifndef __NET_ARP_INTERFACE_H__ |
40,11 → 44,65 |
#include "device.h" |
/** 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. |
* @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. |
* @returns EOK on success. |
* @returns EEXIST if the device is already used. |
* @returns ENOMEM if there is not enough memory left. |
* @returns ENOENT if the network interface service is not known. |
* @returns EREFUSED if the network interface service is not responding. |
* @returns Other error codes as defined for the nil_packet_get_size() function. |
* @returns Other error codes as defined for the nil_get_addr() function. |
* @returns Other error codes as defined for the nil_get_broadcast_addr() function. |
*/ |
int arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address ); |
/** Translates the given protocol address to the network interface address. |
* Broadcasts the ARP request if the mapping is not found. |
* @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 raw translation data container. Output parameter. |
* @returns EOK on success. |
* @returns EINVAL if the configuration parameter is NULL. |
* @returns EINVAL if the count parameter is zero (0). |
* @returns EBADMEM if the translation or the data parameters are NULL. |
* @returns ENOENT if the mapping is not found. |
*/ |
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. |
* @returns EOK on success. |
* @returns ENOENT if the device is not found. |
*/ |
int arp_clear_device_req( int arp_phone, device_id_t device_id ); |
/** Cleans the cache. |
* @param arp_phone The ARP module phone used for (semi)remote calls. Input parameter. |
* @returns EOK on success. |
*/ |
int arp_clean_cache_req( int arp_phone ); |
/** Connects to the ARP module. |
* @param service The ARP module service. Ignored parameter. |
* @returns The ARP module phone on success. |
* @returns 0 if called by the bundle module. |
*/ |
int arp_connect_module( services_t service ); |
/** Returns the ARP task identifier. |
* @returns The current task identifier if called by the bundle module. |
* @returns 0 if called by the remote module. |
*/ |
int arp_task_get_id( void ); |
#endif |
/branches/network/uspace/srv/net/include/nil_interface.h |
---|
30,8 → 30,12 |
* @{ |
*/ |
/** |
* @file |
/** @file |
* 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.). |
* The upper layers cannot be bundled with the network interface layer. |
*/ |
#ifndef __NET_NIL_INTERFACE_H__ |
51,23 → 55,89 |
#include "device.h" |
/** 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. |
* @returns EOK on success. |
* @returns EBADMEM if the address parameter is NULL. |
* @returns ENOENT if there no such device. |
* @returns Other error codes as defined for the generic_get_addr() function. |
*/ |
#define nil_get_addr( nil_phone, device_id, address, data ) \ |
generic_get_addr( 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. |
* @returns EOK on success. |
* @returns EBADMEM if the address parameter is NULL. |
* @returns ENOENT if there no such device. |
* @returns Other error codes as defined for the generic_get_addr() function. |
*/ |
#define nil_get_broadcast_addr( nil_phone, device_id, address, data ) \ |
generic_get_addr( 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. |
* @returns EOK on success. |
* @returns Other error codes as defined for the generic_send_msg() function. |
*/ |
#define nil_send_msg( nil_phone, device_id, packet, sender ) \ |
generic_send_msg( nil_phone, NET_NIL_SEND, device_id, packet_get_id( packet ), sender ) |
/** 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. |
* @returns EOK on success. |
* @returns EBADMEM if either one of the parameters is NULL. |
* @returns ENOENT if there is no such device. |
* @returns Other error codes as defined for the generic_packet_size_req() function. |
*/ |
#define nil_packet_size_req( nil_phone, device_id, addr_len, prefix, content, suffix ) \ |
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. |
* @returns EOK on success. |
* @returns EEXIST if the device with the different service exists. |
* @returns ENOMEM if there is not enough memory left. |
* @returns Other error codes as defined for the generic_device_req() function. |
*/ |
#define nil_device_req( nil_phone, device_id, mtu, netif_service ) \ |
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. |
* @returns EOK on success. |
* @returns Other error codes as defined for each specific module device state function. |
*/ |
int nil_device_state_msg( int nil_phone, device_id_t device_id, int state ); |
/** 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 target The target service. Ignored parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for each specific module received function. |
*/ |
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/net_interface.h |
---|
31,13 → 31,15 |
*/ |
/** @file |
* Networking 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 net_remote.c source file. |
* The bundle networking module is compiled with the net_bundle.c source file and the choosen bundle module implementation source files. |
*/ |
#ifndef __NET_NET_INTERFACE_H__ |
#define __NET_NET_INTERFACE_H__ |
//#include <async.h> |
#include <ipc/services.h> |
#include "../include/device.h" |
44,9 → 46,45 |
#include "../structures/measured_strings.h" |
/** 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. |
* @param device_id The device identifier. Input parameter. |
* @param configuration The configuration and settings. Input/output parameter. |
* @param count The configuration entries count. Input parameter. |
* @param data The configuration and settings data. Input/output parameter. |
* @returns EOK on success. |
* @returns EINVAL if the configuration is NULL. |
* @returns EINVAL if the count is zero (0). |
* @returns Other error codes as defined for the generic_translate_req() function. |
*/ |
int net_get_device_conf_req( int net_phone, device_id_t device_id, measured_string_ref * configuration, int count, char ** data ); |
/** Returns the global configuration. |
* @param net_phone The networking module phone. Input parameter. |
* @param configuration The configuration and settings. Input/output parameter. |
* @param count The configuration entries count. Input parameter. |
* @param data The configuration and settings data. Input/output parameter. |
* @returns EOK on success. |
* @returns EINVAL if the configuration is NULL. |
* @returns EINVAL if the count is zero (0). |
* @returns Other error codes as defined for the generic_translate_req() function. |
*/ |
int net_get_conf_req( int net_phone, measured_string_ref * configuration, int count, char ** data ); |
/** Frees the received settings. |
* @param settings The received settings. Input parameter. |
* @param data The received settings data. Input parameter. |
* @see net_get_device_conf_req() |
* @see net_get_conf_req() |
*/ |
void net_free_settings( measured_string_ref settings, char * data ); |
/** Connects to the networking module. |
* @param service The networking module service. Ignored parameter. |
* @returns The networking module phone on success. |
* @returns 0 if called by the bundle module. |
*/ |
int net_connect_module( services_t service ); |
#endif |
/branches/network/uspace/srv/net/include/il_interface.h |
---|
31,6 → 31,8 |
*/ |
/** @file |
* Internetwork layer interface for the underlying network interface layer. |
* This interface is always called by the standalone remote modules. |
*/ |
#ifndef __NET_IL_INTERFACE_H__ |
49,10 → 51,23 |
#include "../il/il_messages.h" |
/** 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. |
* @returns EOK on success. |
*/ |
static inline int il_device_state_msg( int il_phone, device_id_t device_id, device_state_t state ){ |
return generic_device_state_msg( il_phone, NET_IL_DEVICE_STATE, device_id, state ); |
} |
/** 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. |
* @returns EOK on success. |
*/ |
inline static int il_received_msg( int il_phone, device_id_t device_id, packet_t packet, services_t target ){ |
return generic_received_msg( il_phone, NET_IL_RECEIVED, device_id, packet_get_id( packet ), target ); |
} |
/branches/network/uspace/srv/net/include/netif_interface.h |
---|
30,8 → 30,11 |
* @{ |
*/ |
/** |
* @file |
/** @file |
* Network interface module interface. |
* The same interface is used for standalone remote modules as well as for bundle network interface layer modules. |
* The standalone remote modules have to be compiled with the netif_remote.c source file. |
* The bundle network interface layer modules are compiled with the netif_nil_bundle.c source file and the choosen network interface layer implementation source file. |
*/ |
#ifndef __NET_NETIF_INTERFACE_H__ |
46,11 → 49,65 |
#include "device.h" |
/** 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. |
* @returns EOK on success. |
* @returns EBADMEM if the address parameter is NULL. |
* @returns ENOENT if there no such device. |
* @returns Other error codes as defined for the netif_get_addr() function. |
*/ |
int netif_get_addr( 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. |
* @returns EOK on success. |
* @returns Other errro codes as defined for the netif_probe_message(). |
*/ |
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. |
* @returns EOK on success. |
* @returns Other error codes as defined for the generic_send_msg() function. |
*/ |
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. |
* @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. |
*/ |
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. |
* @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. |
*/ |
int netif_stop_req( int netif_phone, device_id_t device_id ); |
/** Creates bidirectional connection with the network interface module service 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. |
* @returns The phone of the needed service. |
* @returns EOK on success. |
* @returns Other error codes as defined for the bind_service() function. |
*/ |
int netif_bind_service( services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver ); |
#endif |
/branches/network/uspace/srv/net/include/ip_interface.h |
---|
31,6 → 31,10 |
*/ |
/** @file |
* 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. |
*/ |
#ifndef __NET_IP_INTERFACE_H__ |
44,9 → 48,35 |
#include "../structures/packet/packet.h" |
/** \todo |
*/ |
int ip_bind_service( services_t service, services_t me, async_client_conn_t receiver ); |
int ip_device_req( int ip_phone, device_id_t device_id, services_t service ); |
/** 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. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
* @returns EINVAL if the device configuration is invalid. |
* @returns ENOTSUP if the device uses IPv6. |
* @returns ENOTSUP if the device uses DHCP. |
* @returns Other error codes as defined for the net_get_device_conf_req() function. |
* @returns Other error codes as defined for the arp_device_req() function. |
*/ |
int ip_device_req( int ip_phone, device_id_t device_id, services_t netif ); |
/** \todo |
*/ |
int ip_send_msg( int ip_phone, device_id_t device_id, packet_t packet, services_t sender ); |
/** Connects to the IP module. |
* @param service The IP module service. Ignored parameter. |
* @returns The IP module phone on success. |
* @returns 0 if called by the bundle module. |
*/ |
int ip_connect_module( services_t service ); |
#endif |
/branches/network/uspace/srv/net/net/net_standalone.c |
---|
31,7 → 31,7 |
*/ |
/** @file |
* |
* Wrapper for the standalone networking module. |
*/ |
#include <string.h> |
48,6 → 48,8 |
#include "net.h" |
/** Networking module global data. |
*/ |
extern net_globals_t net_globals; |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
/branches/network/uspace/srv/net/net/net_bundle.c |
---|
31,7 → 31,8 |
*/ |
/** @file |
* |
* Wrapper for the bundled networking and TCP/IP stact modules. |
* Distributes messages and initializes all module parts. |
*/ |
#include <stdio.h> |
51,6 → 52,8 |
#include "net.h" |
/** Networking module global data. |
*/ |
extern net_globals_t net_globals; |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
58,6 → 61,8 |
switch( IPC_GET_TARGET( call )){ |
case SERVICE_IP: |
return ip_message( callid, call, answer, answer_count ); |
case SERVICE_ARP: |
return arp_message( callid, call, answer, answer_count ); |
default: |
return EINVAL; |
} |
/branches/network/uspace/srv/net/net/net_remote.c |
---|
31,6 → 31,8 |
*/ |
/** @file |
* Networking interface implementation for standalone remote modules. |
* @see net_interface.h |
*/ |
#include <ipc/services.h> |
/branches/network/uspace/srv/net/net/net.c |
---|
31,6 → 31,7 |
*/ |
/** @file |
* Networking subsystem central module implementation. |
*/ |
#include <async.h> |
63,18 → 64,73 |
#include "net.h" |
/** Networking module name. |
*/ |
#define NAME "Networking" |
/** Prints the module name. |
* @see NAME |
*/ |
void module_print_name( void ); |
measured_string_ref configuration_find( measured_strings_ref configuration, const char * name ); |
/** Starts the networking 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 net_initialize() function. |
* @returns Other error codes as defined for the REGISTER_ME() macro function. |
*/ |
int module_start( async_client_conn_t client_connection ); |
//int parse_line( measured_strings_ref configuration, char * line ); |
/** Reads the networking subsystem global configuration. |
* @returns EOK on success. |
* @returns Other error codes as defined for the add_configuration() function. |
*/ |
int read_configuration( void ); |
/** Starts the network interface according to its configuration. |
* Registers the network interface with the subsystem modules. |
* Starts the needed subsystem modules. |
* @param netif The network interface specific data. |
* @returns EOK on success. |
* @returns EINVAL if there are some settings missing. |
* @returns ENOENT if the internet protocol module is not known. |
* @returns Other error codes as defined for the netif_probe_req() function. |
* @returns Other error codes as defined for the nil_device_req() function. |
* @returns Other error codes as defined for the needed internet layer registering function. |
*/ |
int start_device( netif_ref netif ); |
/** Reads the configuration and starts all network interfaces. |
* @returns EOK on success. |
* @returns EXDEV if there is no available system-unique device identifier. |
* @returns EINVAL if any of the network interface names are not configured. |
* @returns ENOMEM if there is not enough memory left. |
* @returns Other error codes as defined for the read_configuration() function. |
* @returns Other error codes as defined for the read_netif_configuration() function. |
* @returns Other error codes as defined for the start_device() function. |
*/ |
int startup( void ); |
/** Generates new system-unique device identifier. |
* @returns The system-unique devic identifier. |
*/ |
device_id_t generate_new_device_id( void ); |
int net_get_conf( measured_strings_ref device_conf, measured_string_ref configuration, int count, char ** data ); |
/** Returns the configured values. |
* The network interface configuration is searched first. |
* @param netif_conf The network interface configuration setting. Input parameter. |
* @param configuration The found configured values. Output parameter. |
* @param count The desired settings count. Input parameter. |
* @param data The found configuration settings data. Output parameter. |
* @returns EOK. |
*/ |
int net_get_conf( measured_strings_ref netif_conf, measured_string_ref configuration, int count, char ** data ); |
/** Networking module global data. |
*/ |
net_globals_t net_globals; |
DEVICE_MAP_IMPLEMENT( netifs, netif_t ) |
121,13 → 177,13 |
return net_get_conf( NULL, * configuration, count, data ); |
} |
int net_get_conf( measured_strings_ref device_conf, measured_string_ref configuration, int count, char ** data ){ |
int net_get_conf( measured_strings_ref netif_conf, measured_string_ref configuration, int count, char ** data ){ |
measured_string_ref setting; |
int index; |
if( data ) * data = NULL; |
for( index = 0; index < count; ++ index ){ |
setting = measured_strings_find( device_conf, configuration[ index ].value, 0 ); |
setting = measured_strings_find( netif_conf, configuration[ index ].value, 0 ); |
if( ! setting ){ |
setting = measured_strings_find( & net_globals.configuration, configuration[ index ].value, 0 ); |
} |
/branches/network/uspace/srv/net/net/net.h |
---|
31,7 → 31,7 |
*/ |
/** @file |
* Networking subsystem compilation configuration. |
* Networking subsystem central module. |
*/ |
#ifndef __NET_NET_H__ |
47,48 → 47,109 |
#include "../structures/module_map.h" |
#include "../structures/packet/packet.h" |
/** Loopback network interface module name. |
*/ |
#define LO_NAME "lo" |
/** Loopback network interface module full path filename. |
*/ |
#define LO_FILENAME "/srv/lo" |
/** DP8390 network interface module name. |
*/ |
#define DP8390_NAME "dp8390" |
/** DP8390 network interface module full path filename. |
*/ |
#define DP8390_FILENAME "/srv/dp8390" |
/** Ethernet module name. |
*/ |
#define ETHERNET_NAME "ethernet" |
/** Ethernet module full path filename. |
*/ |
#define ETHERNET_FILENAME "/srv/eth" |
/** Internet protocol module name. |
*/ |
#define IP_NAME "ip" |
/** Internet protocol module full path filename. |
*/ |
#define IP_FILENAME "/srv/ip" |
/** Network interface name configuration label. |
*/ |
#define CONF_NAME "NAME" |
/** Network interface module name configuration label. |
*/ |
#define CONF_NETIF "NETIF" |
/** Network interface layer module name configuration label. |
*/ |
#define CONF_NIL "NIL" |
/** Internet protocol module name configuration label. |
*/ |
#define CONF_IL "IL" |
/** Interrupt number configuration label. |
*/ |
#define CONF_IRQ "IRQ" |
/** Device input/output address configuration label. |
*/ |
#define CONF_IO "IO" |
/** Maximum transmission unit configuration label. |
*/ |
#define CONF_MTU "MTU" |
/** Type definition of the network interface specific data. |
* @see netif |
*/ |
typedef struct netif netif_t; |
/** Type definition of the network interface specific data pointer. |
* @see netif |
*/ |
typedef netif_t * netif_ref; |
/** Type definition of the networking module global data. |
* @see net_globals |
*/ |
typedef struct net_globals net_globals_t; |
/** Present network interfaces. |
* Maps devices to the networking device specific data. |
* @see device.h |
*/ |
DEVICE_MAP_DECLARE( netifs, netif_t ) |
/** Configuration settings. |
* Maps setting names to the values. |
* @see generic_char_map.h |
*/ |
GENERIC_CHAR_MAP_DECLARE( measured_strings, measured_string_t ) |
/** A present network interface device. |
/** Present network interface device. |
*/ |
struct netif{ |
/** A system-unique network interface identifier. |
/** System-unique network interface identifier. |
*/ |
device_id_t id; |
/** A serving network interface driver module index. |
/** Serving network interface driver module index. |
*/ |
module_ref driver; |
/** A serving link layer module index. |
/** Serving link layer module index. |
*/ |
module_ref nil; |
/** A serving internet layer module index. |
/** Serving internet layer module index. |
*/ |
module_ref il; |
/** A system-unique network interface name. |
/** System-unique network interface name. |
*/ |
char * name; |
/** Configuration. |
96,7 → 157,7 |
measured_strings_t configuration; |
}; |
/** A net module global variables. |
/** Networking module global variables. |
*/ |
struct net_globals{ |
/** Present network interfaces. |
113,10 → 174,51 |
measured_strings_t configuration; |
}; |
/** Adds the configured setting to the configuration map. |
* @param configuration The configuration map. Input parameter. |
* @param name The setting name. Input parameter. |
* @param value The setting value. Input parameter. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int add_configuration( measured_strings_ref configuration, const char * name, const char * value ); |
/** Processes the networking 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 net_interface.h |
* @see IS_NET_NET_MESSAGE() |
*/ |
int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** Initializes the networking module. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int net_initialize( void ); |
/** Processes the module message. |
* Distributes the message to the right bundled module. |
* @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. |
* @returns Other error codes as defined for each bundled module message function. |
*/ |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** Reads the network interface specific configuration. |
* @param name The network interface name. Input parameter. |
* @param netif The network interface structure. Input/output parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for the add_configuration() function. |
*/ |
int read_netif_configuration( char * name, netif_ref netif ); |
#endif |
/branches/network/uspace/srv/net/modules.c |
---|
31,6 → 31,7 |
*/ |
/** @file |
* Generic module functions implementation. |
*/ |
#include <async.h> |
40,6 → 41,8 |
#include "err.h" |
#include "modules.h" |
/** The time between connect requests. |
*/ |
#define MODULE_WAIT_TIME 10000 |
int connect_to_service( services_t need ){ |
46,6 → 49,7 |
int phone; |
int res; |
//TODO timeout version? |
res = async_req_3_5( PHONE_NS, IPC_M_CONNECT_ME_TO, need, 0, 0, NULL, NULL, NULL, NULL, ( ipcarg_t * ) & phone ); |
while(( res < 0 ) || ( phone < 0 )){ |
usleep( MODULE_WAIT_TIME ); |
/branches/network/uspace/srv/net/modules.h |
---|
31,6 → 31,7 |
*/ |
/** @file |
* Generic module functions. |
*/ |
#ifndef __NET_MODULES_H__ |
48,11 → 49,33 |
*/ |
#define CONVERT_SIZE( type_from, type_to, count ) (( sizeof( type_from ) / sizeof( type_to )) * ( count )) |
/** Registers the module service at the name server. |
* @param me The module service. Input parameter. |
* @param phonehash The created phone hash. Output parameter. |
*/ |
#define REGISTER_ME( me, phonehash ) ipc_connect_to_me( PHONE_NS, ( me ), 0, 0, ( phonehash )) |
/** Connect to the needed module function type definition. |
* @param need The needed module service. Input parameter. |
* @returns The phone of the needed service. |
*/ |
typedef int connect_module_t( services_t need ); |
connect_module_t connect_to_service; |
/** Connects to the needed module. |
* @param need The needed module service. Input parameter. |
* @returns The phone of the needed service. |
*/ |
int connect_to_service( services_t need ); |
/** Creates bidirectional connection with the needed module service and registers the message receiver. |
* @param need The needed module service. Input parameter. |
* @param arg1 The first parameter. Input parameter. |
* @param arg2 The second parameter. Input parameter. |
* @param arg3 The third parameter. Input parameter. |
* @param client_receiver The message receiver. Input parameter. |
* @returns The phone of the needed service. |
* @returns Other error codes as defined for the ipc_connect_to_me() function. |
*/ |
int bind_service( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver ); |
#endif |
/branches/network/uspace/srv/net/il/il_messages.h |
---|
31,6 → 31,9 |
*/ |
/** @file |
* Internetwork layer modules messages. |
* @see il_interface.h |
* @see ip_interface.h |
*/ |
#ifndef __NET_IL_MESSAGES_H__ |
38,19 → 41,30 |
#include <ipc/ipc.h> |
/** Internet layer modules messages. |
*/ |
typedef enum{ |
/* ( device_id, nil_service ) */ |
/** New device message. |
* @see ip_device_req() |
*/ |
NET_IL_DEVICE = NET_IL_FIRST, |
/* ( device_id, state ) */ |
/** Device state changed message. |
* @see il_device_state_msg() |
*/ |
NET_IL_DEVICE_STATE, |
/* ( device_id ), packet_send */ |
/** Packet received message. |
* @see il_received_msg() |
*/ |
NET_IL_RECEIVED, |
/* ( device_id ), measured_strings_send( address ) */ |
// NET_IL_MY_ADDR, |
/* ( packet_id ) */ |
/** Packet send message. |
* @see ip_send_msg() |
*/ |
NET_IL_SEND, |
} il_messages; |
/** Returns the ip protocol number message parameter. |
* @param call The message call structure. Input parameter. |
*/ |
#define IL_GET_PROTO( call ) ( int ) IPC_GET_ARG1( * call ) |
#endif |
/branches/network/uspace/srv/net/il/arp/arp_messages.h |
---|
31,6 → 31,8 |
*/ |
/** @file |
* ARP module messages. |
* @see arp_interface.h |
*/ |
#ifndef __NET_ARP_MESSAGES__ |
40,18 → 42,29 |
#include "../../messages.h" |
/** ARP module messages. |
*/ |
typedef enum{ |
/* ( device_id, nil_service, proto ), measured_strings_send( proto_addr ) */ |
/** New device message. |
* @see arp_device_req() |
*/ |
NET_ARP_DEVICE = NET_ARP_FIRST, |
/* ( device_id, protocol ), measured_strings_send( target ), measured_strings_return( translation ) */ |
/** Address translation message. |
* @see arp_translate_req() |
*/ |
NET_ARP_TRANSLATE, |
/* ( device_id ) */ |
/** Clear device cache message. |
* @see arp_clear_device_req() |
*/ |
NET_ARP_CLEAR_DEVICE, |
/* () */ |
/** Clean cache message. |
* @see arp_clean_cache() |
*/ |
NET_ARP_CLEAN_CACHE, |
} arp_messages; |
/** 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 ) |
/branches/network/uspace/srv/net/il/arp/arp.c |
---|
72,9 → 72,6 |
*/ |
arp_globals_t arp_globals; |
int arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address ); |
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 whole cache. |
* @returns EOK on success. |
*/ |
81,6 → 78,7 |
int arp_clean_cache_req( int arp_phone ); |
/** Clears the device specific data 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. |
* @returns EOK on success. |
* @returns ENOENT if the device is not found in the cache. |
/branches/network/uspace/srv/net/il/arp/arp_module.c |
---|
70,6 → 70,15 |
* @returns Other error codes as defined for the REGISTER_ME() macro function. |
*/ |
int module_start( async_client_conn_t client_connection ); |
/** Processes the ARP 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 arp_message() function. |
*/ |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** ARP module global data. |
/branches/network/uspace/srv/net/il/arp/arp_module.h |
---|
51,9 → 51,9 |
* @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. |
* \todo all possible message returns? |
* @returns EOK on success. |
* @returns ENOTSUP if the message is not known. |
* @see arp_interface.h |
* @see IS_NET_ARP_MESSAGE() |
*/ |
int arp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/branches/network/uspace/srv/net/il/arp/arp_remote.c |
---|
31,6 → 31,8 |
*/ |
/** @file |
* ARP interface implementation for standalone remote modules. |
* @see arp_interface.h |
*/ |
#include <async.h> |
/branches/network/uspace/srv/net/il/ip/ip_header.h |
---|
110,7 → 110,7 |
/** This field indicates the next level protocol used in the data portion of the internet datagram. |
*/ |
uint8_t protocol; |
/** A checksum on the header only. |
/** A checksum of the header only. |
* Since some header fields change (e.g., time to live), this is recomputed and verified at each point that the internet header is processed. |
* The checksum algorithm is: The checksum field is the 16~bit one's complement of the one's complement sum of all 16~bit words in the header. |
* For purposes of computing the checksum, the value of the checksum field is zero. |
124,7 → 124,14 |
uint32_t destination_address; |
} __attribute__ ((packed)); |
/** Type definition of the internet option header. |
* @see ip_header |
*/ |
typedef struct ip_option ip_option_t; |
/** Type definition of the internet option header pointer. |
* @see ip_header |
*/ |
typedef ip_option * ip_option_ref; |
/** Internet option header. |
/branches/network/uspace/srv/net/il/ip/ip.c |
---|
91,7 → 91,7 |
return EOK; |
} |
int ip_device_req( int il_phone, device_id_t device_id, services_t service ){ |
int ip_device_req( int il_phone, device_id_t device_id, services_t netif ){ |
ERROR_DECLARE; |
ip_netif_ref ip_netif; |
149,9 → 149,9 |
} |
net_free_settings( configuration, data ); |
} |
ip_netif->phone = bind_service( service, ip_netif->device_id, SERVICE_IP, 0, ip_driver_receiver ); |
ip_netif->phone = bind_service( netif, ip_netif->device_id, SERVICE_IP, 0, ip_driver_receiver ); |
if( ip_netif->phone < 0 ){ |
printf( "Failed to contact the nil service %d\n", service ); |
printf( "Failed to contact the nil service %d\n", netif ); |
free( ip_netif ); |
return ip_netif->phone; |
} |
158,7 → 158,7 |
if( ip_netif->arp ){ |
configuration[ 0 ].value = ( char * ) & ip_netif->address; |
configuration[ 0 ].length = CONVERT_SIZE( in_addr_t, char, 1 ); |
if( ERROR_OCCURRED( arp_device_req( ip_netif->arp->phone, ip_netif->device_id, SERVICE_IP, service, & configuration[ 0 ] ))){ |
if( ERROR_OCCURRED( arp_device_req( ip_netif->arp->phone, ip_netif->device_id, SERVICE_IP, netif, & configuration[ 0 ] ))){ |
free( ip_netif ); |
return ERROR_CODE; |
} |
/branches/network/uspace/srv/net/netif/netif_module.h |
---|
30,6 → 30,12 |
* @{ |
*/ |
/** @file |
* Network interface module interface. |
* The interface has to be implemented by each network interface module. |
* The interface is used by the network interface module skeleton. |
*/ |
#ifndef __NET_NETIF_MODULE_H__ |
#define __NET_NETIF_MODULE_H__ |
41,14 → 47,70 |
#include "../include/device.h" |
/** Initializes the specific module. |
*/ |
int netif_initialize( void ); |
/** Automatically probes all known devices. |
*/ |
int netif_probe_auto_message( void ); |
/** Probes the existence of the device. |
* @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. |
* @returns EOK on success. |
* @returns Other error codes as defined for the find_device() function. |
* @returns Other error codes as defined for the specific module message implementation. |
*/ |
int netif_probe_message( device_id_t device_id, int irq, int io ); |
/** Sends the packet queue. |
* @param device_id The device identifier. Input parameter. |
* @param packet The packet queue. Input parameter. |
* @param sender The sending module service. Input parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for the find_device() function. |
* @returns Other error codes as defined for the specific module message implementation. |
*/ |
int netif_send_message( device_id_t device_id, packet_t packet, services_t sender ); |
/** Starts the device. |
* @param device The device structure. Input parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for the find_device() function. |
* @returns Other error codes as defined for the specific module message implementation. |
*/ |
int netif_start_message( device_ref device ); |
/** Stops the device. |
* @param device The device structure. Input parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for the find_device() function. |
* @returns Other error codes as defined for the specific module message implementation. |
*/ |
int netif_stop_message( device_ref device ); |
/** Returns the device local hardware address. |
* @param device_id The device identifier. Input parameter. |
* @param address The device local hardware address. Output parameter. |
* @returns EOK on success. |
* @returns EBADMEM if the address parameter is NULL. |
* @returns ENOENT if there no such device. |
* @returns Other error codes as defined for the find_device() function. |
* @returns Other error codes as defined for the specific module message implementation. |
*/ |
int netif_get_addr_message( device_id_t device_id, measured_string_ref address ); |
int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** Returns the device usage statistics. |
* @param device_id The device identifier. Input parameter. |
* @param stats The device usage statistics. Output parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for the find_device() function. |
* @returns Other error codes as defined for the specific module message implementation. |
*/ |
int netif_get_device_stats( device_id_t device_id, device_stats_ref stats ); |
#endif |
/branches/network/uspace/srv/net/netif/netif_nil_bundle.c |
---|
30,6 → 30,11 |
* @{ |
*/ |
/** @file |
* Wrapper for the bundled network interface and network interface layer module. |
* Distributes messages and initializes both module parts. |
*/ |
#include <async.h> |
#include <ipc/ipc.h> |
42,9 → 47,27 |
#include "netif.h" |
/** Network interface module global data. |
*/ |
extern netif_globals_t netif_globals; |
/** Distributes the messages between the module parts. |
* @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. |
* @returns Other error codes as defined for each specific module message function. |
*/ |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** Starts the bundle network interface module. |
* Initializes the client connection serving function, initializes both module parts, 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 success. |
* @returns Other error codes as defined for each specific module message function. |
*/ |
int module_start( async_client_conn_t client_connection ); |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
/branches/network/uspace/srv/net/netif/netif_remote.c |
---|
30,6 → 30,11 |
* @{ |
*/ |
/** @file |
* Network interface module interface implementation for standalone remote modules. |
* @see netif_interface.h |
*/ |
#include <ipc/services.h> |
#include "../modules.h" |
/branches/network/uspace/srv/net/netif/netif.c |
---|
31,6 → 31,8 |
*/ |
/** @file |
* Network interface module skeleton implementation. |
* @see netif.h |
*/ |
#include <async.h> |
57,10 → 59,19 |
#include "netif_messages.h" |
#include "netif_module.h" |
/** Network interface module global data. |
*/ |
extern netif_globals_t netif_globals; |
DEVICE_MAP_IMPLEMENT( device_map, device_t ) |
/** Registers the device notification receiver, the network interface layer module. |
* @param device_id The device identifier. Input parameter. |
* @param phone The network interface layer module phone. Input parameter. |
* @returns EOK on success. |
* @returns ENOENT if there is no such device. |
* @returns ELIMIT if there is another module registered. |
*/ |
int register_message( device_id_t device_id, int phone ); |
int netif_probe_req( int netif_phone, device_id_t device_id, int irq, int io ){ |
/branches/network/uspace/srv/net/netif/dp8390/local.h |
---|
21,7 → 21,7 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* Changes: |
* 2009 Lukas Medjrech ported to HelenOS |
* 2009 Lukas Mejdrech ported to HelenOS |
*/ |
/** @addtogroup dp8390 |
/branches/network/uspace/srv/net/netif/dp8390/ne2000.c |
---|
21,7 → 21,7 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* Changes: |
* 2009 Lukas Medjrech ported to HelenOS |
* 2009 Lukas Mejdrech ported to HelenOS |
*/ |
/** @addtogroup ne2k |
28,6 → 28,10 |
* @{ |
*/ |
/** @file |
* |
*/ |
#include <stdio.h> |
#include <unistd.h> |
/branches/network/uspace/srv/net/netif/dp8390/ne2000.h |
---|
21,7 → 21,7 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* Changes: |
* 2009 Lukas Medjrech ported to HelenOS |
* 2009 Lukas Mejdrech ported to HelenOS |
*/ |
/* |
/branches/network/uspace/srv/net/netif/dp8390/Makefile |
---|
52,8 → 52,9 |
ifeq ($(NETWORKING), module) |
SOURCES += ../$(NAME)_nil_bundle.c \ |
$(NET_BASE)nil/eth/eth.c \ |
$(NET_BASE)crc.c \ |
$(NET_BASE)nil/eth/eth.c |
$(NET_BASE)net/net_remote.c |
else |
/branches/network/uspace/srv/net/netif/dp8390/dp8390.h |
---|
21,7 → 21,7 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* Changes: |
* 2009 Lukas Medjrech ported to HelenOS |
* 2009 Lukas Mejdrech ported to HelenOS |
*/ |
/** @addtogroup dp8390 |
/branches/network/uspace/srv/net/netif/lo/lo.c |
---|
31,6 → 31,7 |
*/ |
/** @file |
* Loopback network interface implementation. |
*/ |
#include <async.h> |
54,21 → 55,52 |
#include "../netif.h" |
#include "../netif_module.h" |
/** Default maximum transmission unit. |
*/ |
#define DEFAULT_MTU 1500 |
/** Default hardware address. |
*/ |
#define DEFAULT_ADDR "\0\0\0\0\0\0" |
/** Default address length. |
*/ |
#define DEFAULT_ADDR_LEN ( sizeof( DEFAULT_ADDR ) / sizeof( char )) |
/** Loopback module name. |
*/ |
#define NAME "lo - loopback interface" |
/** Network interface global data. |
*/ |
netif_globals_t netif_globals; |
/** Loopback module global data. |
*/ |
static struct lo_globals{ |
unsigned int mtu; |
} lo_globals; |
static int change_state_message( device_ref device, device_state_t state ); |
static int create( device_id_t device_id, device_ref * device ); |
/** Changes the loopback state. |
* @param device The device structure. Input parameter. |
* @param state The new device state. Input parameter. |
* @returns The new state if changed. |
* @returns EOK otherwise. |
*/ |
int change_state_message( device_ref device, device_state_t state ); |
/** Creates and returns the loopback network interface structure. |
* @param device_id The new devce identifier. Input parameter. |
* @param device The device structure. Output parameter. |
* @returns EOK on success. |
* @returns EXDEV if one loopback network interface already exists. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int create( device_id_t device_id, device_ref * device ); |
/** Prints the module name. |
* @see NAME |
*/ |
void module_print_name( void ); |
int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
94,7 → 126,7 |
return EOK; |
} |
static int change_state_message( device_ref device, device_state_t state ){ |
int change_state_message( device_ref device, device_state_t state ){ |
if( device->state != state ){ |
device->state = state; |
printf( "State changed to %s\n", ( state == NETIF_ACTIVE ) ? "ACTIVE" : "STOPPED" ); |
103,7 → 135,7 |
return EOK; |
} |
static int create( device_id_t device_id, device_ref * device ){ |
int create( device_id_t device_id, device_ref * device ){ |
int index; |
if( device_map_count( & netif_globals.device_map ) > 0 ){ |
/branches/network/uspace/srv/net/netif/netif.h |
---|
32,6 → 32,8 |
/** @file |
* Network interface module skeleton. |
* The skeleton has to be part of each network interface module. |
* The skeleton can be also part of the module bundled with the network interface layer. |
*/ |
#ifndef __NET_NETIF_H__ |
114,16 → 116,42 |
void null_device_stats( device_stats_ref stats ); |
// prepared for future optimalizations |
/** \todo |
/** Releases the given packet. |
* @param packet_id The packet identifier. Input parameter. |
*/ |
void netif_pq_release( packet_id_t packet ); |
void netif_pq_release( packet_id_t packet_id ); |
/** \todo |
/** Allocates new packet to handle the given content size. |
* @param content The minimum content size. Input parameter. |
* @returns The allocated packet. |
* @returns NULL if there is an error. |
*/ |
packet_t netif_packet_get_1( size_t content ); |
/** Processes the netif module messages. |
* @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. |
* @returns Other error codes as defined for each specific module message function. |
* @see netif_interface.h |
* @see IS_NET_NETIF_MESSAGE() |
*/ |
int netif_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** Initializes the netif module. |
* The function has to be defined in each module. |
* @param client_connection The client connection functio to be registered. Input parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for each specific module message function. |
*/ |
int netif_init_module( async_client_conn_t client_connection ); |
/** Starts and maintains the netif module until terminated. |
* @returns EOK after the module is terminated. |
*/ |
int netif_run_module( void ); |
#endif |
/branches/network/uspace/srv/net/netif/netif_standalone.c |
---|
30,6 → 30,10 |
* @{ |
*/ |
/** @file |
* Wrapper for the standalone network interface module. |
*/ |
#include <async.h> |
#include <ipc/ipc.h> |
36,9 → 40,23 |
#include "netif.h" |
extern netif_globals_t netif_globals; |
/** Delegates the messages to the netif_message() function. |
* @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. |
* @returns Other error codes as defined for each specific module message function. |
*/ |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** Starts the network interface 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 success. |
* @returns Other error codes as defined for each specific module message function. |
*/ |
int module_start( async_client_conn_t client_connection ); |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
/branches/network/uspace/srv/net/module.c |
---|
31,6 → 31,7 |
*/ |
/** @file |
* Generic module skeleton implementation. |
*/ |
#include <async.h> |
41,15 → 42,46 |
#include "err.h" |
/** External message processing function. |
* Should process the messages. |
* The function has to be defined in each module. |
* @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. |
* @returns Other error codes as defined for each specific module message function. |
*/ |
extern int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
/** External function to print the module name. |
* Should print the module name. |
* The function has to be defined in each module. |
*/ |
extern void module_print_name( void ); |
/** 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 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. |
*/ |
void client_connection( ipc_callid_t iid, ipc_call_t * icall ); |
/** Starts the module. |
* @param argc The count of the command line arguments. Ignored parameter. |
* @param argv The command line parameters. Ignored parameter. |
* @returns EOK on success. |
* @returns Other error codes as defined for each specific module start function. |
*/ |
int main( int argc, char * argv[] ); |
/** Default thread for new connections. |
*/ |
void client_connection( ipc_callid_t iid, ipc_call_t * icall ){ |
ipc_callid_t callid; |
ipc_call_t call; |
95,9 → 127,6 |
} |
} |
/** Starts the module. |
* Parameters are ignored. |
*/ |
int main( int argc, char * argv[] ){ |
ERROR_DECLARE; |
/branches/network/uspace/srv/net/self_test.c |
---|
31,6 → 31,7 |
*/ |
/** @file |
* Self tests implementation. |
*/ |
#include "configuration.h" |
49,6 → 50,11 |
#include "self_test.h" |
/** Tests the function, compares the result and remembers if the result differs. |
* @param name The test name. Input parameter. |
* @param function_call The function to be called and checked. Input parameter. |
* @param result The expected result. Input parameter. |
*/ |
#define TEST( name, function_call, result ); { \ |
printf( "\n\t%s", ( name )); \ |
if(( function_call ) != ( result )){ \ |
/branches/network/uspace/srv/net/sockaddr.c |
---|
31,7 → 31,7 |
*/ |
/** @file |
* |
* Internet protocol address conversion functions implementation. |
*/ |
#include <errno.h> |
81,9 → 81,7 |
do{ |
// like little endian |
data[ index + shift ] = value; |
// data[ index ] = value; |
value >>= 8; |
// ++ index; |
}while( shift -- ); |
index += bytes; |
}else{ |
/branches/network/uspace/srv/net/self_test.h |
---|
31,6 → 31,7 |
*/ |
/** @file |
* Self tests. |
*/ |
#ifndef __SELF_TEST_H__ |
38,6 → 39,12 |
#include "configuration.h" |
/** Self test start function. |
* Runs all the configured self tests. |
* @see configuration.h |
* @returns EOK on success. |
* @returns The first error occurred. |
*/ |
#if NET_SELF_TEST |
int self_test( void ); |