55,6 → 55,11 |
|
netif_globals_t netif_globals; |
|
static struct lo_globals{ |
measured_string_ref addr; |
int mtu; |
} lo_globals; |
|
int change_state_message( device_id_t device_id, device_state_t state ); |
int create( device_id_t device_id, device_ref * device ); |
int initialize( void ); |
64,7 → 69,12 |
int send_message( device_id_t device_id, packet_t packet ); |
int start_message( device_id_t device_id ); |
int stop_message( device_id_t device_id ); |
measured_string_ref get_addr_message( device_id_t device_id ); |
|
measured_string_ref get_addr_message( device_id_t device_id ){ |
return lo_globals.addr; |
} |
|
int change_state_message( device_id_t device_id, device_state_t state ){ |
ERROR_DECLARE; |
|
74,6 → 84,7 |
if( device->state != state ){ |
device->state = state; |
nil_message( device, NET_NIL_DEVICE_STATE, device->state, NULL ); |
printf( "\nState changed to %s", ( state == NETIF_ACTIVE ) ? "ACTIVE" : "STOPPED" ); |
} |
return EOK; |
} |
91,8 → 102,6 |
( ** device ).specific = NULL; |
null_device_stats( &(( ** device ).stats )); |
( ** device ).state = NETIF_STOPPED; |
( ** device ).flags = NULL; |
( ** device ).mtu = DEFAULT_MTU; |
if( ERROR_OCCURRED( device_map_add( & netif_globals.device_map, ( ** device ).device_id, * device ))){ |
free( * device ); |
* device = NULL; |
105,6 → 114,8 |
int initialize( void ){ |
ipcarg_t phonehash; |
|
lo_globals.addr = measured_string_create_bulk( "\0\0\0\0\0\0", 0 ); |
if( ! lo_globals.addr ) return ENOMEM; |
return REGISTER_ME( SERVICE_LO, & phonehash ); |
} |
|
145,16 → 156,16 |
} |
// MTU is the first one |
if( settings && ( settings[ 0 ].value )){ |
device->mtu = strtoul( settings[ 0 ].value, NULL, 0 ); |
lo_globals.mtu = strtoul( settings[ 0 ].value, NULL, 0 ); |
}else{ |
device->mtu = DEFAULT_MTU; |
lo_globals.mtu = DEFAULT_MTU; |
} |
// print the settings |
printf("\n -MTU =\t%d", device->mtu ); |
free( settings ); |
free( data ); |
// end request |
async_wait_for( message, NULL ); |
// print the settings |
printf("\nNew device registered:\n\tid\t= %d\n\tMTU\t= %d", device->device_id, lo_globals.mtu ); |
return EOK; |
} |
|