Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4719 → Rev 4720

/branches/network/uspace/srv/net/net/net_standalone.c
60,21 → 60,11
}
}
 
int net_initialize( async_client_conn_t client_connection ){
int net_initialize_build( async_client_conn_t client_connection ){
ERROR_DECLARE;
 
task_id_t task_id;
 
netifs_initialize( & net_globals.netifs );
char_map_initialize( & net_globals.netif_names );
modules_initialize( & net_globals.modules );
measured_strings_initialize( & net_globals.configuration );
 
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service ));
 
task_id = spawn( "/srv/ip" );
if( ! task_id ) return EINVAL;
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_id, ip_connect_module ));
84,39 → 74,13
return EOK;
}
 
int read_netif_configuration( char * name, netif_ref netif ){
int read_netif_configuration_build( char * name, netif_ref netif ){
ERROR_DECLARE;
 
if( str_lcmp( name, "lo", 2 ) == 0 ){
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", NILDUMMY_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" ));
}else if( str_lcmp( name, "ne2k", 4 ) == 0 ){
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME ));
// standalone ethernet
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", ETHERNET_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_MODE", "DIX" )); //8023_2_LSAP( not supported ), 8023_2_SNAP
// ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_DUMMY", "yes" )); //anything else not starting with 'y'
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "576" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.240" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" ));
}
return EOK;
}
/branches/network/uspace/srv/net/net/net_bundle.c
97,21 → 97,11
}
}
 
int net_initialize( async_client_conn_t client_connection ){
int net_initialize_build( async_client_conn_t client_connection ){
ERROR_DECLARE;
 
ipcarg_t phonehash;
 
netifs_initialize( & net_globals.netifs );
char_map_initialize( & net_globals.netif_names );
modules_initialize( & net_globals.modules );
measured_strings_initialize( & net_globals.configuration );
 
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service ));
 
ERROR_PROPAGATE( REGISTER_ME( SERVICE_IP, & phonehash ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_get_id(), ip_connect_module ));
ERROR_PROPAGATE( ip_initialize( client_connection ));
126,38 → 116,13
return EOK;
}
 
int read_netif_configuration( char * name, netif_ref netif ){
int read_netif_configuration_build( char * name, netif_ref netif ){
ERROR_DECLARE;
 
if( str_lcmp( name, "lo", 2 ) == 0 ){
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", NILDUMMY_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", LO_NAME ));
}else if( str_lcmp( name, "ne2k", 4 ) == 0 ){
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME ));
// ethernet bundled in dp8390
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", DP8390_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_MODE", "DIX" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "1492" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.240" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" ));
}
return EOK;
}
/branches/network/uspace/srv/net/net/net.c
129,6 → 129,21
*/
int net_get_conf( measured_strings_ref netif_conf, measured_string_ref configuration, size_t count, char ** data );
 
/** Initializes the networking module.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
*/
int net_initialize( async_client_conn_t client_connection );
 
/** 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 );
 
/** Networking module global data.
*/
net_globals_t net_globals;
160,6 → 175,26
return EOK;
}
 
int net_initialize( async_client_conn_t client_connection ){
ERROR_DECLARE;
 
netifs_initialize( & net_globals.netifs );
char_map_initialize( & net_globals.netif_names );
modules_initialize( & net_globals.modules );
measured_strings_initialize( & net_globals.configuration );
 
// TODO dynamic configuration
ERROR_PROPAGATE( read_configuration());
 
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service ));
 
// build specific initialization
return net_initialize_build( client_connection );
}
 
int net_get_device_conf_req( int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data ){
netif_ref netif;
 
313,9 → 348,45
// read general configuration
ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "IPV", "4" ));
ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "MTU", "1500" ));
ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "ICMP_ERROR_REPORTING", "yes" )); //anything else not starting with 'y'
ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "ICMP_ECHO_REPLYING", "yes" )); //anything else not starting with 'y'
return EOK;
}
 
int read_netif_configuration( char * name, netif_ref netif ){
ERROR_DECLARE;
 
if( str_lcmp( name, "lo", 2 ) == 0 ){
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" ));
}else if( str_lcmp( name, "ne2k", 4 ) == 0 ){
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_MODE", "DIX" )); //8023_2_LSAP( not supported ), 8023_2_SNAP
// ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_DUMMY", "yes" )); //anything else not starting with 'y'
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "576" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.240" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" ));
ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" ));
}
return read_netif_configuration_build( name, netif );
}
 
int start_device( netif_ref netif ){
ERROR_DECLARE;
 
389,9 → 460,6
int i;
measured_string_ref setting;
 
// TODO dynamic configuration
ERROR_PROPAGATE( read_configuration());
 
for( i = 0; i < count; ++ i ){
netif = ( netif_ref ) malloc( sizeof( netif_t ));
if( ! netif ) return ENOMEM;
/branches/network/uspace/srv/net/net/net.h
215,12 → 215,12
*/
int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
 
/** Initializes the networking module.
/** Initializes the networking module for the chosen subsystem build type.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
*/
int net_initialize( async_client_conn_t client_connection );
int net_initialize_build( async_client_conn_t client_connection );
 
/** Processes the module message.
* Distributes the message to the right bundled module.
234,13 → 234,13
*/
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
 
/** Reads the network interface specific configuration.
/** Reads the network interface specific configuration for the chosen subsystem build type.
* @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 );
int read_netif_configuration_build( char * name, netif_ref netif );
 
#endif