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