Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4349 → Rev 4350

/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