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 ); |
} |