Rev 4574 | Rev 4707 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4574 | Rev 4695 | ||
|---|---|---|---|
| Line 33... | Line 33... | ||
| 33 | /** @file |
33 | /** @file |
| 34 | * Wrapper for the bundled networking and TCP/IP stact modules. |
34 | * Wrapper for the bundled networking and TCP/IP stact modules. |
| 35 | * Distributes messages and initializes all module parts. |
35 | * Distributes messages and initializes all module parts. |
| 36 | */ |
36 | */ |
| 37 | 37 | ||
| 38 | #include <stdio.h> |
38 | #include <string.h> |
| 39 | 39 | ||
| 40 | #include <ipc/ipc.h> |
40 | #include <ipc/ipc.h> |
| 41 | 41 | ||
| 42 | #include "../messages.h" |
42 | #include "../messages.h" |
| 43 | 43 | ||
| Line 73... | Line 73... | ||
| 73 | case SERVICE_TCP: |
73 | case SERVICE_TCP: |
| 74 | return tcp_message( callid, call, answer, answer_count ); |
74 | return tcp_message( callid, call, answer, answer_count ); |
| 75 | default: |
75 | default: |
| 76 | return EINVAL; |
76 | return EINVAL; |
| 77 | } |
77 | } |
| 78 | }else if( IS_NET_IP_MESSAGE( call ) || IS_NET_NIL_MESSAGE( call )){ |
78 | }else if( IS_NET_IP_MESSAGE( call )){ |
| 79 | return ip_message( callid, call, answer, answer_count ); |
79 | return ip_message( callid, call, answer, answer_count ); |
| 80 | }else if( IS_NET_ARP_MESSAGE( call )){ |
80 | }else if( IS_NET_ARP_MESSAGE( call )){ |
| 81 | return arp_message( callid, call, answer, answer_count ); |
81 | return arp_message( callid, call, answer, answer_count ); |
| 82 | /* }else if( IS_NET_RARP_MESSAGE( call )){ |
82 | /* }else if( IS_NET_RARP_MESSAGE( call )){ |
| 83 | return rarp_message( callid, call, answer, answer_count ); |
83 | return rarp_message( callid, call, answer, answer_count ); |
| Line 109... | Line 109... | ||
| 109 | // run self tests |
109 | // run self tests |
| 110 | // ERROR_PROPAGATE( self_test()); |
110 | // ERROR_PROPAGATE( self_test()); |
| 111 | 111 | ||
| 112 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service )); |
112 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service )); |
| 113 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service )); |
113 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service )); |
| - | 114 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service )); |
|
| - | 115 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service )); |
|
| 114 | 116 | ||
| 115 | ERROR_PROPAGATE( REGISTER_ME( SERVICE_IP, & phonehash )); |
117 | ERROR_PROPAGATE( REGISTER_ME( SERVICE_IP, & phonehash )); |
| 116 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_get_id(), ip_connect_module )); |
118 | ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_get_id(), ip_connect_module )); |
| 117 | ERROR_PROPAGATE( ip_initialize( client_connection )); |
119 | ERROR_PROPAGATE( ip_initialize( client_connection )); |
| 118 | ERROR_PROPAGATE( REGISTER_ME( SERVICE_ARP, & phonehash )); |
120 | ERROR_PROPAGATE( REGISTER_ME( SERVICE_ARP, & phonehash )); |
| Line 132... | Line 134... | ||
| 132 | ERROR_DECLARE; |
134 | ERROR_DECLARE; |
| 133 | 135 | ||
| 134 | if( str_lcmp( name, "lo", 2 ) == 0 ){ |
136 | if( str_lcmp( name, "lo", 2 ) == 0 ){ |
| 135 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME )); |
137 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME )); |
| 136 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME )); |
138 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME )); |
| - | 139 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", NILDUMMY_NAME )); |
|
| 137 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME )); |
140 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME )); |
| 138 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" )); |
141 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" )); |
| 139 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" )); |
142 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" )); |
| - | 143 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" )); |
|
| 140 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" )); |
144 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" )); |
| 141 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" )); |
145 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" )); |
| 142 | }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){ |
146 | }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){ |
| 143 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" )); |
147 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" )); |
| 144 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME )); |
148 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME )); |
| Line 149... | Line 153... | ||
| 149 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" )); |
153 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" )); |
| 150 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" )); |
154 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" )); |
| 151 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "1492" )); |
155 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "1492" )); |
| 152 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" )); |
156 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" )); |
| 153 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" )); |
157 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" )); |
| - | 158 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" )); |
|
| 154 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.240" )); |
159 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.240" )); |
| 155 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" )); |
160 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" )); |
| 156 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" )); |
161 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" )); |
| 157 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" )); |
162 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" )); |
| 158 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" )); |
163 | ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" )); |