Rev 4271 | Rev 4327 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4271 | Rev 4307 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | 42 | ||
43 | #include "../../err.h" |
43 | #include "../../err.h" |
44 | #include "../../messages.h" |
44 | #include "../../messages.h" |
45 | #include "../../modules.h" |
45 | #include "../../modules.h" |
46 | 46 | ||
- | 47 | #include "../../include/net_interface.h" |
|
47 | #include "../../include/sockaddr.h" |
48 | #include "../../include/sockaddr.h" |
48 | #include "../../include/socket.h" |
49 | #include "../../include/socket.h" |
49 | #include "../../include/device.h" |
50 | #include "../../include/device.h" |
50 | #include "../../include/arp_messages.h" |
51 | #include "../../include/arp_interface.h" |
51 | #include "../../include/nil_messages.h" |
52 | #include "../../include/nil_interface.h" |
- | 53 | #include "../../include/il_interface.h" |
|
- | 54 | #include "../../include/ip_interface.h" |
|
52 | #include "../../structures/measured_strings.h" |
55 | #include "../../structures/measured_strings.h" |
53 | #include "../../structures/module_map.h" |
56 | #include "../../structures/module_map.h" |
54 | #include "../../structures/packet/packet_client.h" |
57 | #include "../../structures/packet/packet_client.h" |
55 | 58 | ||
- | 59 | #include "../../nil/nil_messages.h" |
|
- | 60 | ||
- | 61 | #include "../il_messages.h" |
|
- | 62 | ||
56 | #include "ip.h" |
63 | #include "ip.h" |
57 | #include "ip_messages.h" |
- | |
58 | #include "ip_module.h" |
64 | #include "ip_module.h" |
59 | 65 | ||
60 | #define DEFAULT_IPV 4 |
66 | #define DEFAULT_IPV 4 |
61 | 67 | ||
62 | #define ARP_NAME "arp" |
68 | #define ARP_NAME "arp" |
63 | #define ARP_FILENAME "/srv/arp" |
69 | #define ARP_FILENAME "/srv/arp" |
64 | 70 | ||
65 | #define IPC_GET_PROTO( call ) ( int ) IPC_GET_ARG1( * call ) |
- | |
66 | #define IPC_GET_STATE( call ) ( device_state_t ) IPC_GET_ARG2( * call ) |
- | |
67 | #define IPC_GET_PHONE( call ) ( int ) IPC_GET_ARG5( * call ) |
- | |
68 | - | ||
69 | ip_globals_t ip_globals; |
71 | ip_globals_t ip_globals; |
70 | 72 | ||
71 | DEVICE_MAP_IMPLEMENT( ip_netifs, ip_netif_t ) |
73 | DEVICE_MAP_IMPLEMENT( ip_netifs, ip_netif_t ) |
72 | 74 | ||
73 | INT_MAP_IMPLEMENT( ip_protos, ip_proto_t ) |
75 | INT_MAP_IMPLEMENT( ip_protos, ip_proto_t ) |
74 | 76 | ||
75 | int ip_register_message( int protocol, int phone ); |
- | |
76 | int ip_state_message( device_id_t device_id, device_state_t state ); |
- | |
77 | void ip_driver_receiver( ipc_callid_t iid, ipc_call_t * icall ); |
77 | void ip_driver_receiver( ipc_callid_t iid, ipc_call_t * icall ); |
- | 78 | int ip_device_state_msg( int il_phone, device_id_t device_id, device_state_t state ); |
|
- | 79 | int ip_register( int il_phone, int protocol, int phone ); |
|
78 | 80 | ||
79 | /** Initializes the module. |
81 | /** Initializes the module. |
80 | */ |
82 | */ |
81 | int ip_initialize( void ){ |
83 | int ip_initialize( void ){ |
82 | ERROR_DECLARE; |
84 | ERROR_DECLARE; |
83 | 85 | ||
84 | ERROR_PROPAGATE( ip_netifs_initialize( & ip_globals.netifs )); |
86 | ERROR_PROPAGATE( ip_netifs_initialize( & ip_globals.netifs )); |
85 | ERROR_PROPAGATE( ip_protos_initialize( & ip_globals.protos )); |
87 | ERROR_PROPAGATE( ip_protos_initialize( & ip_globals.protos )); |
86 | ERROR_PROPAGATE( modules_initialize( & ip_globals.modules )); |
88 | ERROR_PROPAGATE( modules_initialize( & ip_globals.modules )); |
87 | ERROR_PROPAGATE( add_module( NULL, & ip_globals.modules, ARP_NAME, ARP_FILENAME, SERVICE_ARP, 0 )); |
89 | ERROR_PROPAGATE( add_module( NULL, & ip_globals.modules, ARP_NAME, ARP_FILENAME, SERVICE_ARP, arp_task_get_id(), arp_connect_module )); |
88 | return EOK; |
- | |
89 | } |
- | |
90 | - | ||
91 | int ip_echo_message( ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t * answer1, ipcarg_t * answer2, ipcarg_t * answer3, ipcarg_t * answer4, ipcarg_t * answer5 ){ |
- | |
92 | if( answer1 ) * answer1 = arg1; |
- | |
93 | if( answer2 ) * answer2 = arg2; |
- | |
94 | if( answer3 ) * answer3 = arg3; |
- | |
95 | if( answer4 ) * answer4 = arg4; |
- | |
96 | if( answer5 ) * answer5 = arg5; |
- | |
97 | return EOK; |
90 | return EOK; |
98 | } |
91 | } |
99 | 92 | ||
100 | int ip_device_message( device_id_t device_id, services_t service ){ |
93 | int ip_device_req( int il_phone, device_id_t device_id, services_t service ){ |
101 | ERROR_DECLARE; |
94 | ERROR_DECLARE; |
102 | 95 | ||
103 | ip_netif_ref ip_netif; |
96 | ip_netif_ref ip_netif; |
104 | aid_t message; |
- | |
105 | ipc_call_t answer; |
- | |
106 | measured_string_t configuration[ 9 ] = {{ "IPV", 3 }, { "IP_CONFIG", 9 }, { "IP_ADDR", 7 }, { "NETMASK", 7 }, { "GATEWAY", 7 }, { "BROADCAST", 9 }, { "DNS1", 4 }, { "DNS2", 4 }, { "ARP", 3 }}; |
97 | measured_string_t names[ 9 ] = {{ "IPV", 3 }, { "IP_CONFIG", 9 }, { "IP_ADDR", 7 }, { "NETMASK", 7 }, { "GATEWAY", 7 }, { "BROADCAST", 9 }, { "DNS1", 4 }, { "DNS2", 4 }, { "ARP", 3 }}; |
107 | int count = 9; |
- | |
108 | measured_string_ref settings; |
98 | measured_string_ref configuration; |
109 | char * data; |
99 | int count = 9; |
110 | ipcarg_t result; |
100 | char * data; |
111 | int index; |
101 | int index; |
112 | 102 | ||
- | 103 | configuration = & names[ 0 ]; |
|
113 | ip_netif = ( ip_netif_ref ) malloc( sizeof( ip_netif_t )); |
104 | ip_netif = ( ip_netif_ref ) malloc( sizeof( ip_netif_t )); |
114 | if( ! ip_netif ) return ENOMEM; |
105 | if( ! ip_netif ) return ENOMEM; |
115 | ip_netif->device_id = device_id; |
106 | ip_netif->device_id = device_id; |
116 | // get configuration |
107 | // get configuration |
117 | // TODO mapping |
- | |
118 | message = async_send_2( ip_globals.networking_phone, NET_NET_GET_DEVICE_CONF, ip_netif->device_id, count, & answer ); |
- | |
119 | // send names and get settings |
- | |
120 | if( ERROR_OCCURRED( measured_strings_send( ip_globals.networking_phone, configuration, count )) |
108 | ERROR_PROPAGATE( net_get_device_conf_req( ip_globals.net_phone, ip_netif->device_id, & configuration, count, & data )); |
121 | || ERROR_OCCURRED( measured_strings_return( ip_globals.networking_phone, & settings, & data, count ))){ |
- | |
122 | async_wait_for( message, NULL ); |
- | |
123 | free( ip_netif ); |
- | |
124 | return ERROR_CODE; |
- | |
125 | } |
- | |
126 | async_wait_for( message, & result ); |
- | |
127 | if( ERROR_OCCURRED( result )){ |
- | |
128 | if( settings ){ |
- | |
129 | free( settings ); |
- | |
130 | free( data ); |
- | |
131 | }; |
- | |
132 | free( ip_netif ); |
- | |
133 | return ERROR_CODE; |
- | |
134 | } |
- | |
135 | if( settings ){ |
109 | if( configuration ){ |
136 | if( settings[ 0 ].value ){ |
110 | if( configuration[ 0 ].value ){ |
137 | ip_netif->ipv = strtol( settings[ 0 ].value, NULL, 0 ); |
111 | ip_netif->ipv = strtol( configuration[ 0 ].value, NULL, 0 ); |
138 | }else{ |
112 | }else{ |
139 | ip_netif->ipv = DEFAULT_IPV; |
113 | ip_netif->ipv = DEFAULT_IPV; |
140 | } |
114 | } |
141 | ip_netif->dhcp = ! strncmp( settings[ 1 ].value, "dhcp", 4 ); |
115 | ip_netif->dhcp = ! strncmp( configuration[ 1 ].value, "dhcp", 4 ); |
142 | if( ip_netif->dhcp ){ |
116 | if( ip_netif->dhcp ){ |
143 | // TODO dhcp |
117 | // TODO dhcp |
144 | free( settings ); |
118 | net_free_settings( configuration, data ); |
145 | free( data ); |
- | |
146 | free( ip_netif ); |
119 | free( ip_netif ); |
147 | return ENOTSUP; |
120 | return ENOTSUP; |
148 | }else if( ip_netif->ipv == 4 ){ |
121 | }else if( ip_netif->ipv == 4 ){ |
149 | if( ERROR_OCCURRED( inet_pton( AF_INET, settings[ 2 ].value, ( uint8_t * ) & ip_netif->address )) |
122 | if( ERROR_OCCURRED( inet_pton( AF_INET, configuration[ 2 ].value, ( uint8_t * ) & ip_netif->address )) |
150 | || ERROR_OCCURRED( inet_pton( AF_INET, settings[ 3 ].value, ( uint8_t * ) & ip_netif->netmask )) |
123 | || ERROR_OCCURRED( inet_pton( AF_INET, configuration[ 3 ].value, ( uint8_t * ) & ip_netif->netmask )) |
151 | || ( inet_pton( AF_INET, settings[ 4 ].value, ( uint8_t * ) & ip_netif->gateway ) == EINVAL ) |
124 | || ( inet_pton( AF_INET, configuration[ 4 ].value, ( uint8_t * ) & ip_netif->gateway ) == EINVAL ) |
152 | || ( inet_pton( AF_INET, settings[ 5 ].value, ( uint8_t * ) & ip_netif->broadcast ) == EINVAL ) |
125 | || ( inet_pton( AF_INET, configuration[ 5 ].value, ( uint8_t * ) & ip_netif->broadcast ) == EINVAL ) |
153 | || ( inet_pton( AF_INET, settings[ 6 ].value, ( uint8_t * ) & ip_netif->dns1 ) == EINVAL ) |
126 | || ( inet_pton( AF_INET, configuration[ 6 ].value, ( uint8_t * ) & ip_netif->dns1 ) == EINVAL ) |
154 | || ( inet_pton( AF_INET, settings[ 7 ].value, ( uint8_t * ) & ip_netif->dns2 ) == EINVAL )){ |
127 | || ( inet_pton( AF_INET, configuration[ 7 ].value, ( uint8_t * ) & ip_netif->dns2 ) == EINVAL )){ |
155 | free( settings ); |
128 | net_free_settings( configuration, data ); |
156 | free( data ); |
- | |
157 | free( ip_netif ); |
129 | free( ip_netif ); |
158 | return EINVAL; |
130 | return EINVAL; |
159 | } |
131 | } |
160 | }else{ |
132 | }else{ |
161 | // TODO ipv6 |
133 | // TODO ipv6 |
162 | free( settings ); |
134 | net_free_settings( configuration, data ); |
163 | free( data ); |
- | |
164 | free( ip_netif ); |
135 | free( ip_netif ); |
165 | return ENOTSUP; |
136 | return ENOTSUP; |
166 | } |
137 | } |
167 | if( settings[ 8 ].value ){ |
138 | if( configuration[ 8 ].value ){ |
168 | ip_netif->arp = get_running_module( & ip_globals.modules, settings[ 8 ].value ); |
139 | ip_netif->arp = get_running_module( & ip_globals.modules, configuration[ 8 ].value ); |
169 | if( ! ip_netif->arp ){ |
140 | if( ! ip_netif->arp ){ |
170 | printf( "\nFailed to start the arp %s", settings[ 8 ].value ); |
141 | printf( "Failed to start the arp %s\n", configuration[ 8 ].value ); |
171 | free( settings ); |
142 | net_free_settings( configuration, data ); |
172 | free( data ); |
- | |
173 | free( ip_netif ); |
143 | free( ip_netif ); |
174 | return EINVAL; |
144 | return EINVAL; |
175 | } |
145 | } |
176 | }else{ |
146 | }else{ |
177 | ip_netif->arp = NULL; |
147 | ip_netif->arp = NULL; |
178 | } |
148 | } |
179 | free( settings ); |
149 | net_free_settings( configuration, data ); |
180 | free( data ); |
- | |
181 | } |
150 | } |
182 | ip_netif->phone = bind_service( service, ip_netif->device_id, SERVICE_IP, 0, ip_driver_receiver ); |
151 | ip_netif->phone = bind_service( service, ip_netif->device_id, SERVICE_IP, 0, ip_driver_receiver ); |
183 | if( ip_netif->phone < 0 ){ |
152 | if( ip_netif->phone < 0 ){ |
184 | printf( "\nFailed to contact the nil service %d", service ); |
153 | printf( "Failed to contact the nil service %d\n", service ); |
185 | free( ip_netif ); |
154 | free( ip_netif ); |
186 | return ip_netif->phone; |
155 | return ip_netif->phone; |
187 | } |
156 | } |
188 | if( ip_netif->arp ){ |
157 | if( ip_netif->arp ){ |
189 | configuration[ 0 ].value = ( char * ) & ip_netif->address; |
158 | configuration[ 0 ].value = ( char * ) & ip_netif->address; |
Line 198... | Line 167... | ||
198 | free( ip_netif ); |
167 | free( ip_netif ); |
199 | return index; |
168 | return index; |
200 | } |
169 | } |
201 | if( ip_netif->arp ) ++ ip_netif->arp->usage; |
170 | if( ip_netif->arp ) ++ ip_netif->arp->usage; |
202 | // print the settings |
171 | // print the settings |
203 | printf( "\nNew device registered:\n\tid\t= %d\n\tphone\t= %d\n\tIPV\t= %d", ip_netif->device_id, ip_netif->phone, ip_netif->ipv ); |
172 | printf( "New device registered:\n\tid\t= %d\n\tphone\t= %d\n\tIPV\t= %d\n", ip_netif->device_id, ip_netif->phone, ip_netif->ipv ); |
204 | printf( "\n\tconfiguration\t= %s", ip_netif->dhcp ? "dhcp" : "static" ); |
173 | printf( "\tconfiguration\t= %s\n", ip_netif->dhcp ? "dhcp" : "static" ); |
205 | // TODO ipv6 addresses |
174 | // TODO ipv6 addresses |
206 | data = malloc( INET_ADDRSTRLEN ); |
175 | data = malloc( INET_ADDRSTRLEN ); |
207 | if( data ){ |
176 | if( data ){ |
208 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->address, data, INET_ADDRSTRLEN ); |
177 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->address, data, INET_ADDRSTRLEN ); |
209 | printf( "\n\taddress\t= %s", data ); |
178 | printf( "\taddress\t= %s\n", data ); |
210 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->netmask, data, INET_ADDRSTRLEN ); |
179 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->netmask, data, INET_ADDRSTRLEN ); |
211 | printf( "\n\tnetmask\t= %s", data ); |
180 | printf( "\tnetmask\t= %s\n", data ); |
212 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->gateway, data, INET_ADDRSTRLEN ); |
181 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->gateway, data, INET_ADDRSTRLEN ); |
213 | printf( "\n\tgateway\t= %s", data ); |
182 | printf( "\tgateway\t= %s\n", data ); |
214 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->broadcast, data, INET_ADDRSTRLEN ); |
183 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->broadcast, data, INET_ADDRSTRLEN ); |
215 | printf( "\n\tbroadcast\t= %s", data ); |
184 | printf( "\tbroadcast\t= %s\n", data ); |
216 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns1, data, INET_ADDRSTRLEN ); |
185 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns1, data, INET_ADDRSTRLEN ); |
217 | printf( "\n\tdns1\t= %s", data ); |
186 | printf( "\tdns1\t= %s\n", data ); |
218 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns2, data, INET_ADDRSTRLEN ); |
187 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns2, data, INET_ADDRSTRLEN ); |
219 | printf( "\n\tdns2\t= %s", data ); |
188 | printf( "\tdns2\t= %s\n", data ); |
220 | free( data ); |
189 | free( data ); |
221 | } |
190 | } |
222 | return EOK; |
191 | return EOK; |
223 | } |
192 | } |
224 | 193 | ||
Line 252... | Line 221... | ||
252 | */ |
221 | */ |
253 | callid = async_get_call( & call ); |
222 | callid = async_get_call( & call ); |
254 | switch( IPC_GET_METHOD( call )){ |
223 | switch( IPC_GET_METHOD( call )){ |
255 | case NET_IL_DEVICE_STATE: |
224 | case NET_IL_DEVICE_STATE: |
256 | case NET_NIL_DEVICE_STATE: |
225 | case NET_NIL_DEVICE_STATE: |
257 | result = ip_state_message( IPC_GET_DEVICE( & call ), IPC_GET_STATE( & call )); |
226 | result = ip_device_state_msg( 0, IPC_GET_DEVICE( & call ), IPC_GET_STATE( & call )); |
258 | ipc_answer_0( callid, result ); |
227 | ipc_answer_0( callid, result ); |
- | 228 | break; |
|
259 | // TODO packer received |
229 | // TODO packer received |
260 | case NET_IL_RECEIVED: |
230 | case NET_IL_RECEIVED: |
261 | case NET_NIL_RECEIVED: |
231 | case NET_NIL_RECEIVED: |
262 | if( ! ERROR_OCCURRED( result = packet_translate( ip_globals.networking_phone, & packet, IPC_GET_PACKET( & call )))){ |
232 | if( ! ERROR_OCCURRED( result = packet_translate( ip_globals.net_phone, & packet, IPC_GET_PACKET( & call )))){ |
263 | //result = ip_receive_message( IPC_GET_DEVICE( call ), packet ); |
233 | //result = il_receive_msg( 0, IPC_GET_DEVICE( call ), packet ); |
264 | } |
234 | } |
265 | ipc_answer_0( callid, result ); |
235 | ipc_answer_0( callid, result ); |
- | 236 | break; |
|
266 | } |
237 | } |
267 | } |
238 | } |
268 | } |
239 | } |
269 | 240 | ||
270 | int ip_state_message( device_id_t device_id, device_state_t state ){ |
241 | int ip_device_state_msg( int il_phone, device_id_t device_id, device_state_t state ){ |
271 | ERROR_DECLARE; |
242 | ERROR_DECLARE; |
272 | 243 | ||
273 | ip_netif_ref netif; |
244 | ip_netif_ref netif; |
274 | 245 | ||
275 | measured_string_t address; |
246 | measured_string_t address; |
Line 277... | Line 248... | ||
277 | char * data; |
248 | char * data; |
278 | 249 | ||
279 | netif = ip_netifs_find( & ip_globals.netifs, device_id ); |
250 | netif = ip_netifs_find( & ip_globals.netifs, device_id ); |
280 | if( ! netif ) return ENOENT; |
251 | if( ! netif ) return ENOENT; |
281 | // TODO state |
252 | // TODO state |
282 | printf( "\nip - device %d changed state to %d\n", device_id, state ); |
253 | printf( "ip - device %d changed state to %d\n\n", device_id, state ); |
283 | if( netif->arp ){ |
254 | if( netif->arp ){ |
284 | address.value = ( char * ) & netif->gateway; |
255 | address.value = ( char * ) & netif->gateway; |
285 | address.length = CONVERT_SIZE( in_addr_t, char, 1 ); |
256 | address.length = CONVERT_SIZE( in_addr_t, char, 1 ); |
286 | ERROR_PROPAGATE( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address, & translation, & data )); |
257 | ERROR_PROPAGATE( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address, & translation, & data )); |
287 | printf( "\n\tgateway translated to\t= %X:%X:%X:%X:%X:%X", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] ); |
258 | printf( "\tgateway translated to\t= %X:%X:%X:%X:%X:%X\n", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] ); |
288 | free( translation ); |
259 | free( translation ); |
289 | free( data ); |
260 | free( data ); |
290 | } |
261 | } |
291 | return EOK; |
262 | return EOK; |
292 | } |
263 | } |
293 | 264 | ||
- | 265 | int ip_bind_service( services_t service, services_t me, async_client_conn_t receiver ){ |
|
- | 266 | //TODO receive function |
|
- | 267 | return EOK; |
|
- | 268 | } |
|
- | 269 | ||
- | 270 | int ip_connect_module( services_t service ){ |
|
- | 271 | return EOK; |
|
- | 272 | } |
|
- | 273 | ||
294 | int ip_register_message( int protocol, int phone ){ |
274 | int ip_register( int il_phone, int protocol, int phone ){ |
295 | ip_proto_ref proto; |
275 | ip_proto_ref proto; |
296 | int index; |
276 | int index; |
297 | 277 | ||
298 | proto = ( ip_proto_ref ) malloc( sizeof( ip_protos_t )); |
278 | proto = ( ip_proto_ref ) malloc( sizeof( ip_protos_t )); |
299 | if( ! proto ) return ENOMEM; |
279 | if( ! proto ) return ENOMEM; |
Line 302... | Line 282... | ||
302 | index = ip_protos_add( & ip_globals.protos, proto->protocol, proto ); |
282 | index = ip_protos_add( & ip_globals.protos, proto->protocol, proto ); |
303 | if( index < 0 ){ |
283 | if( index < 0 ){ |
304 | free( proto ); |
284 | free( proto ); |
305 | return index; |
285 | return index; |
306 | } |
286 | } |
307 | printf( "\nNew protocol registered:\n\tprotocol\t= %d\n\tphone\t= %d", proto->protocol, proto->phone ); |
287 | printf( "New protocol registered:\n\tprotocol\t= %d\n\tphone\t= %d\n", proto->protocol, proto->phone ); |
308 | return EOK; |
288 | return EOK; |
309 | } |
289 | } |
310 | 290 | ||
311 | int ip_send_message( device_id_t device_id, packet_t packet ){ |
291 | int ip_send_msg( int il_phone, device_id_t device_id, packet_t packet, services_t target ){ |
312 | // TODO send packet |
292 | // TODO send packet |
313 | printf( "Packet to send via %d: %s", device_id, packet_get_data( packet )); |
293 | printf( "Packet to send via %d: %s\n", device_id, packet_get_data( packet )); |
314 | pq_release( ip_globals.networking_phone, packet_get_id( packet )); |
294 | pq_release( ip_globals.net_phone, packet_get_id( packet )); |
315 | return EOK; |
295 | return EOK; |
316 | } |
296 | } |
317 | 297 | ||
318 | int ip_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
298 | int ip_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
319 | ERROR_DECLARE; |
299 | ERROR_DECLARE; |
Line 322... | Line 302... | ||
322 | 302 | ||
323 | * answer_count = 0; |
303 | * answer_count = 0; |
324 | switch( IPC_GET_METHOD( * call )){ |
304 | switch( IPC_GET_METHOD( * call )){ |
325 | case IPC_M_PHONE_HUNGUP: |
305 | case IPC_M_PHONE_HUNGUP: |
326 | return EOK; |
306 | return EOK; |
327 | case NET_IP_ECHO: |
- | |
328 | * answer_count = 5; |
- | |
329 | return ip_echo_message( IPC_GET_ARG1( * call ), IPC_GET_ARG2( * call ), IPC_GET_ARG3( * call ), IPC_GET_ARG4( * call ), IPC_GET_ARG5( * call ), & IPC_GET_ARG1( * answer ), & IPC_GET_ARG2( * answer ), & IPC_GET_ARG3( * answer ), & IPC_GET_ARG4( * answer ), & IPC_GET_ARG5( * answer ) ); |
- | |
330 | case NET_IL_DEVICE: |
307 | case NET_IL_DEVICE: |
331 | return ip_device_message( IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call )); |
308 | return ip_device_req( 0, IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call )); |
332 | case IPC_M_CONNECT_TO_ME: |
309 | case IPC_M_CONNECT_TO_ME: |
333 | return ip_register_message( IPC_GET_PROTO( call ), IPC_GET_PHONE( call )); |
310 | return ip_register( 0, IL_GET_PROTO( call ), IPC_GET_PHONE( call )); |
334 | case NET_IP_SEND: |
311 | case NET_IL_SEND: |
335 | ERROR_PROPAGATE( packet_translate( ip_globals.networking_phone, & packet, IPC_GET_PACKET( call ))); |
312 | ERROR_PROPAGATE( packet_translate( ip_globals.net_phone, & packet, IPC_GET_PACKET( call ))); |
336 | return ip_send_message( IPC_GET_DEVICE( call ), packet ); |
313 | return ip_send_msg( 0, IPC_GET_DEVICE( call ), packet, 0 ); |
337 | } |
314 | } |
338 | return ENOTSUP; |
315 | return ENOTSUP; |
339 | } |
316 | } |
340 | 317 | ||
341 | /** @} |
318 | /** @} |