Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4695 → Rev 4696

/branches/network/uspace/srv/net/netif/lo/lo.c
58,10 → 58,6
#include "../netif.h"
#include "../netif_module.h"
 
/** Default maximum transmission unit.
*/
#define DEFAULT_MTU 1500
 
/** Default hardware address.
*/
#define DEFAULT_ADDR "\0\0\0\0\0\0"
78,12 → 74,6
*/
netif_globals_t netif_globals;
 
/** Loopback module global data.
*/
static struct lo_globals{
unsigned int mtu;
} lo_globals;
 
/** Changes the loopback state.
* @param device The device structure. Input parameter.
* @param state The new device state. Input parameter.
107,17 → 97,7
void module_print_name( void );
 
int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
switch( IPC_GET_METHOD( * call )){
case NET_NIL_PACKET_SPACE:
* IPC_SET_ADDR( answer ) = 0;
* IPC_SET_PREFIX( answer ) = 0;
* IPC_SET_CONTENT( answer ) = lo_globals.mtu;
* IPC_SET_SUFFIX( answer ) = 0;
* answer_count = 4;
return EOK;
default:
return ENOTSUP;
}
return ENOTSUP;
}
 
int netif_get_addr_message( device_id_t device_id, measured_string_ref address ){
199,25 → 179,11
ERROR_DECLARE;
 
device_ref device;
measured_string_t names[ 1 ] = {{ "MTU", 3 }};
measured_string_ref configuration;
size_t count = sizeof( names ) / sizeof( measured_string_t );
char * data;
 
configuration = & names[ 0 ];
// create a new device
ERROR_PROPAGATE( create( device_id, & device ));
// get configuration
ERROR_PROPAGATE( net_get_device_conf_req( netif_globals.net_phone, device->device_id, & configuration, count, & data ));
// MTU is the first one
if( configuration && configuration[ 0 ].value ){
lo_globals.mtu = strtoul( configuration[ 0 ].value, NULL, 0 );
net_free_settings( configuration, data );
}else{
lo_globals.mtu = DEFAULT_MTU;
}
// print the settings
printf("New device registered:\n\tid\t= %d\n\tMTU\t= %d\n", device->device_id, lo_globals.mtu );
printf("New device created:\n\tid\t= %d\n", device->device_id );
return EOK;
}
 
/branches/network/uspace/srv/net/netif/lo/Makefile
31,6 → 31,8
NET_BASE = ../../
STRUCTURES = $(NET_BASE)structures/
 
include $(NET_BASE)../../../Makefile.config
 
## Sources
#
 
44,8 → 46,18
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c \
$(NET_BASE)nil/nil_remote.c \
../$(NAME)_standalone.c \
$(NET_BASE)net/net_remote.c
 
ifeq ($(NETWORKING), module)
 
SOURCES += ../$(NAME)_nil_bundle.c \
$(NET_BASE)nil/nildummy/nildummy.c
 
else
 
SOURCES += ../$(NAME)_standalone.c \
$(NET_BASE)nil/nil_remote.c
 
endif
 
include $(NET_BASE)Makefile.module