Rev 4719 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4719 | Rev 4720 | ||
|---|---|---|---|
| Line 58... | Line 58... | ||
| 58 | }else{ |
58 | }else{ |
| 59 | return net_message( callid, call, answer, answer_count ); |
59 | return net_message( callid, call, answer, answer_count ); |
| 60 | } |
60 | } |
| 61 | } |
61 | } |
| 62 | 62 | ||
| 63 | int net_initialize( async_client_conn_t client_connection ){ |
63 | int net_initialize_build( async_client_conn_t client_connection ){ |
| 64 | ERROR_DECLARE; |
64 | ERROR_DECLARE; |
| 65 | 65 | ||
| 66 | task_id_t task_id; |
66 | task_id_t task_id; |
| 67 | 67 | ||
| 68 | netifs_initialize( & net_globals.netifs ); |
- | |
| 69 | char_map_initialize( & net_globals.netif_names ); |
- | |
| 70 | modules_initialize( & net_globals.modules ); |
- | |
| 71 | measured_strings_initialize( & net_globals.configuration ); |
- | |
| 72 | - | ||
| 73 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service )); |
- | |
| 74 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service )); |
- | |
| 75 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service )); |
- | |
| 76 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service )); |
- | |
| 77 | - | ||
| 78 | task_id = spawn( "/srv/ip" ); |
68 | task_id = spawn( "/srv/ip" ); |
| 79 | if( ! task_id ) return EINVAL; |
69 | if( ! task_id ) return EINVAL; |
| 80 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_id, ip_connect_module )); |
70 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_id, ip_connect_module )); |
| 81 | if( ! spawn( "/srv/icmp" )) return EINVAL; |
71 | if( ! spawn( "/srv/icmp" )) return EINVAL; |
| 82 | if( ! spawn( "/srv/udp" )) return EINVAL; |
72 | if( ! spawn( "/srv/udp" )) return EINVAL; |
| 83 | if( ! spawn( "/srv/tcp" )) return EINVAL; |
73 | if( ! spawn( "/srv/tcp" )) return EINVAL; |
| 84 | return EOK; |
74 | return EOK; |
| 85 | } |
75 | } |
| 86 | 76 | ||
| 87 | int read_netif_configuration( char * name, netif_ref netif ){ |
77 | int read_netif_configuration_build( char * name, netif_ref netif ){ |
| 88 | ERROR_DECLARE; |
78 | ERROR_DECLARE; |
| 89 | 79 | ||
| 90 | if( str_lcmp( name, "lo", 2 ) == 0 ){ |
80 | if( str_lcmp( name, "lo", 2 ) == 0 ){ |
| 91 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME )); |
- | |
| 92 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME )); |
- | |
| 93 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", NILDUMMY_NAME )); |
81 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", NILDUMMY_NAME )); |
| 94 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME )); |
- | |
| 95 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" )); |
- | |
| 96 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" )); |
- | |
| 97 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" )); |
- | |
| 98 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" )); |
- | |
| 99 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" )); |
- | |
| 100 | }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){ |
82 | }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){ |
| 101 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" )); |
- | |
| 102 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME )); |
- | |
| 103 | // standalone ethernet |
- | |
| 104 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", ETHERNET_NAME )); |
83 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", ETHERNET_NAME )); |
| 105 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_MODE", "DIX" )); //8023_2_LSAP( not supported ), 8023_2_SNAP |
- | |
| 106 | // ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_DUMMY", "yes" )); //anything else not starting with 'y' |
- | |
| 107 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME )); |
- | |
| 108 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" )); |
- | |
| 109 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" )); |
- | |
| 110 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "576" )); |
- | |
| 111 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" )); |
- | |
| 112 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" )); |
- | |
| 113 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" )); |
- | |
| 114 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.240" )); |
- | |
| 115 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" )); |
- | |
| 116 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" )); |
- | |
| 117 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" )); |
- | |
| 118 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" )); |
- | |
| 119 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" )); |
- | |
| 120 | } |
84 | } |
| 121 | return EOK; |
85 | return EOK; |
| 122 | } |
86 | } |
| 123 | 87 | ||
| 124 | /** @} |
88 | /** @} |