221,6 → 221,8 |
ip_route_ref route; |
in_addr_t gateway; |
|
ip_netif->arp = 0; |
route = NULL; |
configuration = & names[ 0 ]; |
// get configuration |
ERROR_PROPAGATE( net_get_device_conf_req( ip_globals.net_phone, ip_netif->device_id, & configuration, count, & data )); |
284,9 → 286,13 |
} |
// MUST BE AFTER the bind_service up there! |
if( ip_netif->arp ){ |
configuration[ 0 ].value = ( char * ) & route->address.s_addr; |
configuration[ 0 ].length = CONVERT_SIZE( in_addr_t, char, 1 ); |
ERROR_PROPAGATE( arp_device_req( ip_netif->arp->phone, ip_netif->device_id, SERVICE_IP, ip_netif->service, & configuration[ 0 ] )); |
if( route ){ |
configuration[ 0 ].value = ( char * ) & route->address.s_addr; |
configuration[ 0 ].length = CONVERT_SIZE( in_addr_t, char, 1 ); |
ERROR_PROPAGATE( arp_device_req( ip_netif->arp->phone, ip_netif->device_id, SERVICE_IP, ip_netif->service, & configuration[ 0 ] )); |
}else{ |
ip_netif->arp = 0; |
} |
} |
// get packet dimensions |
ERROR_PROPAGATE( nil_packet_size_req( ip_netif->phone, ip_netif->device_id, & ip_netif->addr_len, & ip_netif->prefix, & ip_netif->content, & ip_netif->suffix )); |
307,15 → 313,15 |
} |
|
int ip_device_state_msg( int il_phone, device_id_t device_id, device_state_t state ){ |
ERROR_DECLARE; |
// ERROR_DECLARE; |
|
/* measured_string_t address; |
measured_string_ref translation; |
char * data; |
*/ |
packet_t packet; |
/* packet_t packet; |
in_addr_t destination; |
|
*/ |
ip_netif_ref netif; |
|
netif = ip_netifs_find( & ip_globals.netifs, device_id ); |
323,7 → 329,7 |
netif->state = state; |
// TODO state |
printf( "ip - device %d changed state to %d\n\n", device_id, state ); |
if( netif->arp ){ |
// if( netif->arp ){ |
/* address.value = ( char * ) & ip_globals.gateway.gateway.s_addr; |
address.length = CONVERT_SIZE( ip_globals.gateway.gateway.s_addr, char, 1 ); |
if( ERROR_OCCURRED( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address, & translation, & data ))){ |
341,7 → 347,7 |
printf( "\tgateway translated to\t= %X:%X:%X:%X:%X:%X\n", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] ); |
free( translation ); |
free( data ); |
*/ printf( "IP - testing to send packet:\n" ); |
*//* printf( "IP - testing to send packet:\n" ); |
ERROR_PROPAGATE( inet_pton( AF_INET, "90.182.101.18", ( uint8_t * ) & destination.s_addr )); |
packet = packet_get_4( ip_globals.net_phone, 30, netif->addr_len, netif->prefix + sizeof( ip_header_t ), netif->suffix ); |
if( ! packet ) return ENOMEM; |
364,7 → 370,7 |
ERROR_CODE = ip_send_msg( 0, 0, packet, SERVICE_IP ); |
printf( "send returned %d\n", ERROR_CODE ); |
} |
return EOK; |
*/ return EOK; |
} |
|
int ip_connect_module( services_t service ){ |