Rev 4192 | Rev 4261 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4192 | Rev 4243 | ||
---|---|---|---|
Line 44... | Line 44... | ||
44 | #include "../../messages.h" |
44 | #include "../../messages.h" |
45 | #include "../../modules.h" |
45 | #include "../../modules.h" |
46 | 46 | ||
47 | #include "../../include/sockaddr.h" |
47 | #include "../../include/sockaddr.h" |
48 | #include "../../include/socket.h" |
48 | #include "../../include/socket.h" |
49 | #include "../../netif/device.h" |
49 | #include "../../include/device.h" |
50 | #include "../../structures/measured_strings.h" |
50 | #include "../../structures/measured_strings.h" |
51 | #include "../../structures/module_map.h" |
51 | #include "../../structures/module_map.h" |
52 | #include "../../structures/packet/packet_client.h" |
52 | #include "../../structures/packet/packet_client.h" |
53 | 53 | ||
54 | #include "ip.h" |
54 | #include "ip.h" |
Line 274... | Line 274... | ||
274 | } |
274 | } |
275 | } |
275 | } |
276 | } |
276 | } |
277 | 277 | ||
278 | int ip_state_message( device_id_t device_id, device_state_t state ){ |
278 | int ip_state_message( device_id_t device_id, device_state_t state ){ |
- | 279 | ERROR_DECLARE; |
|
- | 280 | ||
- | 281 | ip_netif_ref netif; |
|
- | 282 | ||
- | 283 | aid_t message; |
|
- | 284 | ipc_call_t answer; |
|
- | 285 | measured_string_t address; |
|
- | 286 | measured_string_ref translation; |
|
- | 287 | char * data; |
|
- | 288 | ipcarg_t result; |
|
- | 289 | ||
- | 290 | netif = ip_netifs_find( & ip_globals.netifs, device_id ); |
|
- | 291 | if( ! netif ) return ENOENT; |
|
279 | // TODO state |
292 | // TODO state |
280 | printf( "\nip - device %d changed state to %d\n", device_id, state ); |
293 | printf( "\nip - device %d changed state to %d\n", device_id, state ); |
- | 294 | if( netif->arp ){ |
|
- | 295 | message = async_send_2( netif->arp->phone, NET_ARP_TRANSLATE, netif->device_id, SERVICE_IP, & answer ); |
|
- | 296 | address.value = ( char * ) & netif->gateway; |
|
- | 297 | address.length = CONVERT_SIZE( in_addr_t, char, 1 ); |
|
- | 298 | if( ERROR_OCCURRED( measured_strings_send( netif->arp->phone, & address, 1 )) |
|
- | 299 | || ERROR_OCCURRED( measured_strings_return( netif->arp->phone, & translation, & data, 1 ))){ |
|
- | 300 | async_wait_for( message, & result ); |
|
- | 301 | return result; |
|
- | 302 | } |
|
- | 303 | async_wait_for( message, & result ); |
|
- | 304 | if( ! ERROR_OCCURRED( result )){ |
|
- | 305 | printf( "\n\tgateway translated to\t= %X:%X:%X:%X:%X:%X", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] ); |
|
- | 306 | } |
|
- | 307 | free( translation ); |
|
- | 308 | free( data ); |
|
- | 309 | return result; |
|
- | 310 | } |
|
281 | return EOK; |
311 | return EOK; |
282 | } |
312 | } |
283 | 313 | ||
284 | int ip_register_message( int protocol, int phone ){ |
314 | int ip_register_message( int protocol, int phone ){ |
285 | ip_proto_ref proto; |
315 | ip_proto_ref proto; |