Rev 4327 | Rev 4350 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4327 | Rev 4332 | ||
---|---|---|---|
Line 111... | Line 111... | ||
111 | if( configuration[ 0 ].value ){ |
111 | if( configuration[ 0 ].value ){ |
112 | ip_netif->ipv = strtol( configuration[ 0 ].value, NULL, 0 ); |
112 | ip_netif->ipv = strtol( configuration[ 0 ].value, NULL, 0 ); |
113 | }else{ |
113 | }else{ |
114 | ip_netif->ipv = DEFAULT_IPV; |
114 | ip_netif->ipv = DEFAULT_IPV; |
115 | } |
115 | } |
116 | ip_netif->dhcp = ! str_lcmp( configuration[ 1 ].value, "dhcp", 4 ); |
116 | ip_netif->dhcp = ! str_lcmp( configuration[ 1 ].value, "dhcp", configuration[ 1 ].length ); |
117 | if( ip_netif->dhcp ){ |
117 | if( ip_netif->dhcp ){ |
118 | // TODO dhcp |
118 | // TODO dhcp |
119 | net_free_settings( configuration, data ); |
119 | net_free_settings( configuration, data ); |
120 | free( ip_netif ); |
120 | free( ip_netif ); |
121 | return ENOTSUP; |
121 | return ENOTSUP; |
Line 238... | Line 238... | ||
238 | } |
238 | } |
239 | } |
239 | } |
240 | } |
240 | } |
241 | 241 | ||
242 | int ip_device_state_msg( int il_phone, device_id_t device_id, device_state_t state ){ |
242 | int ip_device_state_msg( int il_phone, device_id_t device_id, device_state_t state ){ |
243 | ERROR_DECLARE; |
243 | // ERROR_DECLARE; |
244 | 244 | ||
245 | ip_netif_ref netif; |
245 | ip_netif_ref netif; |
246 | 246 | ||
247 | measured_string_t address; |
247 | /* measured_string_t address; |
248 | measured_string_ref translation; |
248 | measured_string_ref translation; |
249 | char * data; |
249 | char * data; |
250 | 250 | */ |
|
251 | netif = ip_netifs_find( & ip_globals.netifs, device_id ); |
251 | netif = ip_netifs_find( & ip_globals.netifs, device_id ); |
252 | if( ! netif ) return ENOENT; |
252 | if( ! netif ) return ENOENT; |
253 | // TODO state |
253 | // TODO state |
254 | printf( "ip - device %d changed state to %d\n\n", device_id, state ); |
254 | printf( "ip - device %d changed state to %d\n\n", device_id, state ); |
255 | if( netif->arp ){ |
255 | /* if( netif->arp ){ |
256 | address.value = ( char * ) & netif->gateway; |
256 | address.value = ( char * ) & netif->gateway; |
257 | address.length = CONVERT_SIZE( in_addr_t, char, 1 ); |
257 | address.length = CONVERT_SIZE( in_addr_t, char, 1 ); |
258 | if( ERROR_OCCURRED( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address, & translation, & data ))){ |
258 | if( ERROR_OCCURRED( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address, & translation, & data ))){ |
259 | sleep( 2 ); |
259 | sleep( 2 ); |
260 | ERROR_PROPAGATE( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address, & translation, & data )); |
260 | ERROR_PROPAGATE( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address, & translation, & data )); |
261 | } |
261 | } |
262 | printf( "\tgateway translated to\t= %X:%X:%X:%X:%X:%X\n", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] ); |
262 | printf( "\tgateway translated to\t= %X:%X:%X:%X:%X:%X\n", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] ); |
263 | free( translation ); |
263 | free( translation ); |
264 | free( data ); |
264 | free( data ); |
265 | } |
265 | } |
266 | return EOK; |
266 | */ return EOK; |
267 | } |
267 | } |
268 | 268 | ||
269 | int ip_bind_service( services_t service, services_t me, async_client_conn_t receiver ){ |
269 | int ip_bind_service( services_t service, services_t me, async_client_conn_t receiver ){ |
270 | //TODO receive function |
270 | //TODO receive function |
271 | return EOK; |
271 | return EOK; |