46,7 → 46,7 |
|
#include "../../include/sockaddr.h" |
#include "../../include/socket.h" |
#include "../../netif/device.h" |
#include "../../include/device.h" |
#include "../../structures/measured_strings.h" |
#include "../../structures/module_map.h" |
#include "../../structures/packet/packet_client.h" |
276,8 → 276,38 |
} |
|
int ip_state_message( device_id_t device_id, device_state_t state ){ |
ERROR_DECLARE; |
|
ip_netif_ref netif; |
|
aid_t message; |
ipc_call_t answer; |
measured_string_t address; |
measured_string_ref translation; |
char * data; |
ipcarg_t result; |
|
netif = ip_netifs_find( & ip_globals.netifs, device_id ); |
if( ! netif ) return ENOENT; |
// TODO state |
printf( "\nip - device %d changed state to %d\n", device_id, state ); |
if( netif->arp ){ |
message = async_send_2( netif->arp->phone, NET_ARP_TRANSLATE, netif->device_id, SERVICE_IP, & answer ); |
address.value = ( char * ) & netif->gateway; |
address.length = CONVERT_SIZE( in_addr_t, char, 1 ); |
if( ERROR_OCCURRED( measured_strings_send( netif->arp->phone, & address, 1 )) |
|| ERROR_OCCURRED( measured_strings_return( netif->arp->phone, & translation, & data, 1 ))){ |
async_wait_for( message, & result ); |
return result; |
} |
async_wait_for( message, & result ); |
if( ! ERROR_OCCURRED( result )){ |
printf( "\n\tgateway translated to\t= %X:%X:%X:%X:%X:%X", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] ); |
} |
free( translation ); |
free( data ); |
return result; |
} |
return EOK; |
} |
|