/branches/network/uspace/srv/net/netif/netif_interface.h |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/branches/network/uspace/srv/net/netif/netif_wrappers.h |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/branches/network/uspace/srv/net/netif/netif_module.h |
---|
0,0 → 1,57 |
/* |
* Copyright (c) 2009 Lukas Mejdrech |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup netif |
* @{ |
*/ |
#ifndef __NET_NETIF_MODULE_H__ |
#define __NET_NETIF_MODULE_H__ |
#include <ipc/ipc.h> |
#include <ipc/services.h> |
#include "../structures/measured_strings.h" |
#include "../structures/packet/packet.h" |
#include "../include/device.h" |
int netif_initialize( void ); |
int netif_probe_auto_message( void ); |
int netif_probe_message( device_id_t device_id, int irq, int io ); |
int netif_send_message( device_id_t device_id, packet_t packet, services_t sender ); |
int netif_start_message( device_ref device ); |
int netif_stop_message( device_ref device ); |
int netif_get_addr_message( device_id_t device_id, measured_string_ref address ); |
int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
int netif_get_device_stats( device_id_t device_id, device_stats_ref stats ); |
#endif |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:mergeinfo |
/branches/network/uspace/srv/net/netif/netif_nil_bundle.c |
---|
0,0 → 1,70 |
/* |
* Copyright (c) 2009 Lukas Mejdrech |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup netif |
* @{ |
*/ |
#include <async.h> |
#include <ipc/ipc.h> |
#include "../messages.h" |
#include "../structures/packet/packet.h" |
#include "../nil/nil_module.h" |
#include "netif.h" |
extern netif_globals_t netif_globals; |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
int module_start( async_client_conn_t client_connection ); |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
if( IS_NET_NIL_MESSAGE( call ) || ( IPC_GET_METHOD( * call ) == IPC_M_CONNECT_TO_ME )){ |
return nil_message( callid, call, answer, answer_count ); |
}else{ |
return netif_message( callid, call, answer, answer_count ); |
} |
} |
int module_start( async_client_conn_t client_connection ){ |
ERROR_DECLARE; |
ERROR_PROPAGATE( netif_init_module( client_connection )); |
if( ERROR_OCCURRED( nil_initialize( netif_globals.net_phone ))){ |
pm_destroy(); |
return ERROR_CODE; |
} |
return netif_run_module(); |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/netif/netif_remote.c |
---|
0,0 → 1,71 |
/* |
* Copyright (c) 2009 Lukas Mejdrech |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup netif |
* @{ |
*/ |
#include <ipc/services.h> |
#include "../modules.h" |
#include "../structures/measured_strings.h" |
#include "../structures/packet/packet.h" |
#include "../structures/packet/packet_client.h" |
#include "../include/device.h" |
#include "../include/netif_interface.h" |
#include "netif_messages.h" |
int netif_get_addr( int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data ){ |
return generic_get_addr( netif_phone, NET_NETIF_GET_ADDR, device_id, address, data ); |
} |
int netif_probe_req( int netif_phone, device_id_t device_id, int irq, int io ){ |
return async_req_3_0( netif_phone, NET_NETIF_PROBE, device_id, irq, io ); |
} |
int netif_send_msg( int netif_phone, device_id_t device_id, packet_t packet, services_t sender ){ |
return generic_send_msg( netif_phone, NET_NETIF_SEND, device_id, packet_get_id( packet ), sender ); |
} |
int netif_start_req( int netif_phone, device_id_t device_id ){ |
return async_req_1_0( netif_phone, NET_NETIF_START, device_id ); |
} |
int netif_stop_req( int netif_phone, device_id_t device_id ){ |
return async_req_1_0( netif_phone, NET_NETIF_STOP, device_id ); |
} |
int netif_bind_service( services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver ){ |
return bind_service( service, device_id, me, 0, receiver ); |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:mergeinfo |
/branches/network/uspace/srv/net/netif/netif_messages.h |
---|
0,0 → 1,70 |
/* |
* Copyright (c) 2009 Lukas Mejdrech |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup netif |
* @{ |
*/ |
/** |
* @file |
*/ |
#ifndef __NET_NETIF_MESSAGES_H__ |
#define __NET_NETIF_MESSAGES_H__ |
#include <ipc/ipc.h> |
#include "../messages.h" |
typedef enum { |
/* ( device_id, irq, io ) */ |
NET_NETIF_PROBE = NET_NETIF_FIRST, |
/* () not supported, should ask networking for a name and register device */ |
NET_NETIF_PROBE_AUTO, |
/* ( device_id, packet_id ) */ |
NET_NETIF_SEND, |
/* ( device_id ) */ |
NET_NETIF_START, |
/* ( device_id ), ipc_data_read( stats ) */ |
NET_NETIF_STATS, |
/* ( device_id ) */ |
NET_NETIF_STOP, |
/* */ |
NET_NETIF_SET_ADDR, |
/* */ |
NET_NETIF_GET_ADDR, |
} netif_messages; |
#define NETIF_GET_IRQ( call ) ( int ) IPC_GET_ARG2( * call ) |
#define NETIF_GET_IO( call ) ( int ) IPC_GET_ARG3( * call ) |
#endif |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/netif/netif.c |
---|
50,28 → 50,20 |
#include "../structures/measured_strings.h" |
#include "../include/device.h" |
#include "../include/netif_messages.h" |
#include "../include/nil_messages.h" |
#include "../include/netif_interface.h" |
#include "../include/nil_interface.h" |
#include "netif.h" |
#include "netif_interface.h" |
#include "netif_wrappers.h" |
#include "netif_messages.h" |
#include "netif_module.h" |
#if NIL_BUNDLE |
#include "../nil/nil_module.h" |
#endif |
extern netif_globals_t netif_globals; |
DEVICE_MAP_IMPLEMENT( device_map, device_t ) |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
int netif_start_module( async_client_conn_t client_connection ); |
int register_message( device_id_t device_id, int phone ); |
int netif_probe_wrapper( device_id_t device_id, int irq, int io ){ |
int netif_probe_req( int netif_phone, device_id_t device_id, int irq, int io ){ |
int result; |
rwlock_write_lock( & netif_globals.lock ); |
80,7 → 72,7 |
return result; |
} |
int netif_send_wrapper( device_id_t device_id, packet_t packet, services_t sender ){ |
int netif_send_msg( int netif_phone, device_id_t device_id, packet_t packet, services_t sender ){ |
int result; |
rwlock_write_lock( & netif_globals.lock ); |
89,7 → 81,7 |
return result; |
} |
int netif_start_wrapper( device_id_t device_id ){ |
int netif_start_req( int netif_phone, device_id_t device_id ){ |
ERROR_DECLARE; |
device_ref device; |
113,7 → 105,7 |
return result; |
} |
int netif_stop_wrapper( device_id_t device_id ){ |
int netif_stop_req( int netif_phone, device_id_t device_id ){ |
ERROR_DECLARE; |
device_ref device; |
137,7 → 129,7 |
return result; |
} |
int netif_get_addr_wrapper( device_id_t device_id, measured_string_ref * address, char ** data ){ |
int netif_get_addr( int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data ){ |
ERROR_DECLARE; |
measured_string_t translation; |
149,9 → 141,14 |
ERROR_CODE = ( * address ) ? EOK : ENOMEM; |
} |
rwlock_read_unlock( & netif_globals.lock ); |
* data = ( ** address ).value; |
return ERROR_CODE; |
} |
int netif_bind_service( services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver ){ |
return EOK; |
} |
int find_device( device_id_t device_id, device_ref * device ){ |
if( ! device ) return EBADMEM; |
* device = device_map_find( & netif_globals.device_map, device_id ); |
172,7 → 169,7 |
ERROR_PROPAGATE( find_device( device_id, & device )); |
if( device->nil_phone > 0 ) return ELIMIT; |
device->nil_phone = phone; |
printf( "\nNew receiver of the device %d registered:\n\tphone\t= %d", device->device_id, device->nil_phone ); |
printf( "New receiver of the device %d registered:\n\tphone\t= %d\n", device->device_id, device->nil_phone ); |
return EOK; |
} |
184,12 → 181,7 |
packet_t packet; |
measured_string_t address; |
// printf( "\nmessage %d - %d", IPC_GET_METHOD( * call ), NET_NETIF_FIRST ); |
#if NIL_BUNDLE |
if( IS_NET_NIL_MESSAGE( call )){ |
return nil_message( callid, call, answer, answer_count ); |
} |
#endif |
// printf( "message %d - %d\n", IPC_GET_METHOD( * call ), NET_NETIF_FIRST ); |
* answer_count = 0; |
switch( IPC_GET_METHOD( * call )){ |
case IPC_M_PHONE_HUNGUP: |
200,22 → 192,18 |
rwlock_write_unlock( & netif_globals.lock ); |
return ERROR_CODE; |
case NET_NETIF_PROBE: |
return netif_probe_wrapper( IPC_GET_DEVICE( call ), NETIF_GET_IRQ( call ), NETIF_GET_IO( call )); |
return netif_probe_req( 0, IPC_GET_DEVICE( call ), NETIF_GET_IRQ( call ), NETIF_GET_IO( call )); |
case IPC_M_CONNECT_TO_ME: |
#if NIL_BUNDLE |
return nil_register_message( NIL_GET_PROTO( call ), IPC_GET_PHONE( call )); |
#else |
rwlock_write_lock( & netif_globals.lock ); |
ERROR_CODE = register_message( IPC_GET_DEVICE( call ), IPC_GET_PHONE( call )); |
rwlock_write_unlock( & netif_globals.lock ); |
return ERROR_CODE; |
#endif |
case NET_NETIF_SEND: |
case NET_NIL_SEND: |
ERROR_PROPAGATE( packet_translate( netif_globals.networking_phone, & packet, IPC_GET_PACKET( call ))); |
return netif_send_wrapper( IPC_GET_DEVICE( call ), packet, IPC_GET_SENDER( call )); |
ERROR_PROPAGATE( packet_translate( netif_globals.net_phone, & packet, IPC_GET_PACKET( call ))); |
return netif_send_msg( 0, IPC_GET_DEVICE( call ), packet, IPC_GET_SENDER( call )); |
case NET_NETIF_START: |
return netif_start_wrapper( IPC_GET_DEVICE( call )); |
return netif_start_req( 0, IPC_GET_DEVICE( call )); |
case NET_NETIF_STATS: |
rwlock_read_lock( & netif_globals.lock ); |
if( ! ERROR_OCCURRED( ipc_data_read_receive( & callid, & length ))){ |
230,7 → 218,7 |
rwlock_read_unlock( & netif_globals.lock ); |
return ERROR_CODE; |
case NET_NETIF_STOP: |
return netif_stop_wrapper( IPC_GET_DEVICE( call )); |
return netif_stop_req( 0, IPC_GET_DEVICE( call )); |
case NET_NETIF_GET_ADDR: |
case NET_NIL_ADDR: |
rwlock_read_lock( & netif_globals.lock ); |
243,11 → 231,11 |
return netif_specific_message( callid, call, answer, answer_count ); |
} |
int netif_start_module( async_client_conn_t client_connection ){ |
int netif_init_module( async_client_conn_t client_connection ){ |
ERROR_DECLARE; |
async_set_client_connection( client_connection ); |
netif_globals.networking_phone = connect_to_service( SERVICE_NETWORKING ); |
netif_globals.net_phone = connect_to_service( SERVICE_NETWORKING ); |
device_map_initialize( & netif_globals.device_map ); |
ERROR_PROPAGATE( pm_init()); |
rwlock_initialize( & netif_globals.lock ); |
255,13 → 243,10 |
pm_destroy(); |
return ERROR_CODE; |
} |
#if NIL_BUNDLE |
if( ERROR_OCCURRED( nil_initialize( netif_globals.networking_phone ))){ |
pm_destroy(); |
return ERROR_CODE; |
} |
#endif |
return EOK; |
} |
int netif_run_module( void ){ |
async_manager(); |
pm_destroy(); |
269,11 → 254,11 |
} |
void netif_pq_release( packet_id_t packet_id ){ |
pq_release( netif_globals.networking_phone, packet_id ); |
pq_release( netif_globals.net_phone, packet_id ); |
} |
packet_t netif_packet_get_1( size_t content ){ |
return packet_get_1( netif_globals.networking_phone, content ); |
return packet_get_1( netif_globals.net_phone, content ); |
} |
/** @} |
/branches/network/uspace/srv/net/netif/dp8390/dp8390.c |
---|
1447,7 → 1447,7 |
dep->de_locmem = (char *)-dep->de_ramsize; /* trap errors */ |
return; |
}else{ |
printf( "map_hw_buffer: no buffer!" ); |
printf( "map_hw_buffer: no buffer!\n" ); |
} |
// size = dep->de_ramsize + PAGE_SIZE; /* Add PAGE_SIZE for |
/branches/network/uspace/srv/net/netif/dp8390/Makefile |
---|
37,27 → 37,28 |
# |
OUTPUT = dp8390 |
REBUILD = $(OUTPUT)_module.c \ |
../$(NAME).c |
SOURCES = \ |
$(OUTPUT).c \ |
$(REBUILD) \ |
$(OUTPUT)_module.c \ |
../$(NAME).c \ |
ne2000.c \ |
$(NET_BASE)module.c \ |
$(NET_BASE)modules.c \ |
$(STRUCTURES)measured_strings.c \ |
$(STRUCTURES)packet/packet.c \ |
$(STRUCTURES)packet/packet_client.c \ |
$(STRUCTURES)packet/packet.c |
$(STRUCTURES)packet/packet_remote.c |
NET_DEFS += -D NETIF_BUNDLE=1 |
ifeq ($(NETWORKING), module) |
SOURCES += $(NET_BASE)crc.c |
SOURCES += ../$(NAME)_nil_bundle.c \ |
$(NET_BASE)crc.c \ |
$(NET_BASE)nil/eth/eth.c |
REBUILD += $(NET_BASE)nil/eth/eth.c |
else |
NET_DEFS += -D NIL_BUNDLE=1 |
SOURCES += ../$(NAME)_standalone.c \ |
$(NET_BASE)nil/nil_remote.c |
endif |
/branches/network/uspace/srv/net/netif/dp8390/dp8390_module.c |
---|
49,10 → 49,10 |
#include "../../structures/measured_strings.h" |
#include "../../include/device.h" |
#include "../../include/nil_messages.h" |
#include "../../include/nil_interface.h" |
#include "../netif.h" |
#include "../netif_interface.h" |
#include "../netif_module.h" |
#include "dp8390.h" |
#include "dp8390_drv.h" |
89,7 → 89,7 |
netif_globals_t netif_globals; |
void netif_print_name( void ); |
void module_print_name( void ); |
void irq_handler( ipc_callid_t iid, ipc_call_t * call ); |
int change_state( device_ref device, device_state_t state ); |
123,7 → 123,7 |
return EOK; |
} |
void netif_print_name( void ){ |
void module_print_name( void ){ |
printf( "%s", NAME ); |
} |
149,7 → 149,7 |
int phone; |
device_id = IRQ_GET_DEVICE( call ); |
// printf( "\ndevice %d - irq %x", device_id, IPC_GET_ISR( call )); |
// printf( "device %d - irq %x\n", device_id, IPC_GET_ISR( call )); |
rwlock_write_lock( & netif_globals.lock ); |
if( find_device( device_id, & device ) != EOK ){ |
rwlock_write_unlock( & netif_globals.lock ); |
156,7 → 156,7 |
return; |
} |
dep = ( dpeth_t * ) device->specific; |
// printf( "\ndev %d, irq %x\n", device->device_id, IPC_GET_ISR( call )); |
// printf( "dev %d, irq %x\n\n", device->device_id, IPC_GET_ISR( call )); |
if ( dep->de_mode != DEM_ENABLED){ |
// continue; |
rwlock_write_unlock( & netif_globals.lock ); |
199,7 → 199,6 |
device_ref device; |
dpeth_t * dep; |
printf( "\n" ); |
device = ( device_ref ) malloc( sizeof( device_t )); |
if( ! device ) return ENOMEM; |
dep = ( dpeth_t * ) malloc( sizeof( dpeth_t )); |
239,7 → 238,7 |
uint8_t * data; |
data = packet_get_data( packet ); |
printf( "\nSending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id( packet ), packet_get_data_length( packet ), data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ], data[ 16 ], data[ 17 ], data[ 18 ], data[ 19 ], data[ 20 ], data[ 21 ], data[ 22 ], data[ 23 ], data[ 24 ], data[ 25 ], data[ 26 ], data[ 27 ], data[ 28 ], data[ 29 ], data[ 30 ], data[ 31 ], data[ 32 ], data[ 33 ], data[ 34 ], data[ 35 ], data[ 36 ], data[ 37 ], data[ 38 ], data[ 39 ], data[ 40 ], data[ 41 ], data[ 42 ], data[ 43 ], data[ 44 ], data[ 45 ], data[ 46 ], data[ 47 ], data[ 48 ], data[ 49 ], data[ 50 ], data[ 51 ], data[ 52 ], data[ 53 ], data[ 54 ], data[ 55 ], data[ 56 ], data[ 57 ], data[ 58 ], data[ 59 ] ); |
printf( "Sending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id( packet ), packet_get_data_length( packet ), data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ], data[ 16 ], data[ 17 ], data[ 18 ], data[ 19 ], data[ 20 ], data[ 21 ], data[ 22 ], data[ 23 ], data[ 24 ], data[ 25 ], data[ 26 ], data[ 27 ], data[ 28 ], data[ 29 ], data[ 30 ], data[ 31 ], data[ 32 ], data[ 33 ], data[ 34 ], data[ 35 ], data[ 36 ], data[ 37 ], data[ 38 ], data[ 39 ], data[ 40 ], data[ 41 ], data[ 42 ], data[ 43 ], data[ 44 ], data[ 45 ], data[ 46 ], data[ 47 ], data[ 48 ], data[ 49 ], data[ 50 ], data[ 51 ], data[ 52 ], data[ 53 ], data[ 54 ], data[ 55 ], data[ 56 ], data[ 57 ], data[ 58 ], data[ 59 ] ); |
ERROR_PROPAGATE( find_device( device_id, & device )); |
dep = ( dpeth_t * ) device->specific; |
287,7 → 286,7 |
int change_state( device_ref device, device_state_t state ){ |
device->state = state; |
printf( "\nState changed to %s", ( state == NETIF_ACTIVE ) ? "ACTIVE" : "STOPPED" ); |
printf( "State changed to %s\n", ( state == NETIF_ACTIVE ) ? "ACTIVE" : "STOPPED" ); |
return state; |
} |
/branches/network/uspace/srv/net/netif/lo/lo.c |
---|
48,10 → 48,11 |
#include "../../structures/packet/packet_client.h" |
#include "../../include/device.h" |
#include "../../include/nil_messages.h" |
#include "../../include/nil_interface.h" |
#include "../../include/net_interface.h" |
#include "../netif.h" |
#include "../netif_interface.h" |
#include "../netif_module.h" |
#define DEFAULT_MTU 1500 |
63,12 → 64,12 |
netif_globals_t netif_globals; |
static struct lo_globals{ |
int mtu; |
unsigned int mtu; |
} lo_globals; |
static int change_state_message( device_ref device, device_state_t state ); |
static int create( device_id_t device_id, device_ref * device ); |
void netif_print_name( void ); |
void module_print_name( void ); |
int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
//TODO nil send message |
96,7 → 97,7 |
static int change_state_message( device_ref device, device_state_t state ){ |
if( device->state != state ){ |
device->state = state; |
printf( "\nState changed to %s", ( state == NETIF_ACTIVE ) ? "ACTIVE" : "STOPPED" ); |
printf( "State changed to %s\n", ( state == NETIF_ACTIVE ) ? "ACTIVE" : "STOPPED" ); |
return state; |
} |
return EOK; |
136,7 → 137,7 |
return REGISTER_ME( SERVICE_LO, & phonehash ); |
} |
void netif_print_name( void ){ |
void module_print_name( void ){ |
printf( "%s", NAME ); |
} |
146,7 → 147,7 |
device_ref device; |
ERROR_PROPAGATE( create( arg1, & device )); |
ipc_call_sync_3_3( netif_globals.networking_phone, NET_NET_DEVICE, device->device_id, NULL, NULL, NULL, NULL, NULL ); |
ipc_call_sync_3_3( netif_globals.net_phone, NET_NET_DEVICE, device->device_id, NULL, NULL, NULL, NULL, NULL ); |
*/ return ENOTSUP; |
} |
153,44 → 154,26 |
int netif_probe_message( device_id_t device_id, int irq, int io ){ |
ERROR_DECLARE; |
device_ref device; |
aid_t message; |
ipc_call_t answer; |
measured_string_t configuration[ 1 ] = {{ "MTU", 3 }}; |
int count = 1; |
measured_string_ref settings; |
char * data; |
ipcarg_t result; |
device_ref device; |
measured_string_t names[ 1 ] = {{ "MTU", 3 }}; |
measured_string_ref configuration; |
int count = 1; |
char * data; |
configuration = & names[ 0 ]; |
// create a new device |
ERROR_PROPAGATE( create( device_id, & device )); |
// get configuration |
message = async_send_2( netif_globals.networking_phone, NET_NET_GET_DEVICE_CONF, device->device_id, count, & answer ); |
// send names and get settings |
if( ERROR_OCCURRED( measured_strings_send( netif_globals.networking_phone, configuration, count )) |
|| ERROR_OCCURRED( measured_strings_return( netif_globals.networking_phone, & settings, & data, count ))){ |
async_wait_for( message, NULL ); |
return ERROR_CODE; |
} |
// end request |
async_wait_for( message, & result ); |
if( ERROR_OCCURRED( result )){ |
if( settings ){ |
free( settings ); |
free( data ); |
} |
return ERROR_CODE; |
} |
ERROR_PROPAGATE( net_get_device_conf_req( netif_globals.net_phone, device->device_id, & configuration, count, & data )); |
// MTU is the first one |
if( settings && ( settings[ 0 ].value )){ |
lo_globals.mtu = strtoul( settings[ 0 ].value, NULL, 0 ); |
free( settings ); |
free( data ); |
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("\nNew device registered:\n\tid\t= %d\n\tMTU\t= %d", device->device_id, lo_globals.mtu ); |
printf("New device registered:\n\tid\t= %d\n\tMTU\t= %d\n", device->device_id, lo_globals.mtu ); |
return EOK; |
} |
/branches/network/uspace/srv/net/netif/lo/Makefile |
---|
35,16 → 35,17 |
# |
OUTPUT = lo |
REBUILD = ../$(NAME).c |
SOURCES = \ |
$(OUTPUT).c \ |
$(REBUILD) \ |
../$(NAME).c \ |
$(NET_BASE)module.c \ |
$(NET_BASE)modules.c \ |
$(STRUCTURES)measured_strings.c \ |
$(STRUCTURES)packet/packet.c \ |
$(STRUCTURES)packet/packet_client.c \ |
$(STRUCTURES)packet/packet.c |
$(STRUCTURES)packet/packet_remote.c \ |
$(NET_BASE)nil/nil_remote.c \ |
../$(NAME)_standalone.c \ |
$(NET_BASE)net/net_remote.c |
NET_DEFS += -D NETIF_BUNDLE=1 |
include $(NET_BASE)Makefile.module |
/branches/network/uspace/srv/net/netif/netif.h |
---|
37,10 → 37,17 |
#ifndef __NET_NETIF_H__ |
#define __NET_NETIF_H__ |
#include <async.h> |
#include <rwlock.h> |
#include <ipc/ipc.h> |
#include "../err.h" |
#include "../include/device.h" |
#include "../structures/packet/packet.h" |
/** Network interface module skeleton global data. |
*/ |
typedef struct netif_globals netif_globals_t; |
83,7 → 90,7 |
struct netif_globals{ |
/** Networking module phone. |
*/ |
int networking_phone; |
int net_phone; |
/** Device map. |
*/ |
device_map_t device_map; |
115,6 → 122,10 |
*/ |
packet_t netif_packet_get_1( size_t content ); |
int netif_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
int netif_init_module( async_client_conn_t client_connection ); |
int netif_run_module( void ); |
#endif |
/** @} |
/branches/network/uspace/srv/net/netif/netif_standalone.c |
---|
0,0 → 1,58 |
/* |
* Copyright (c) 2009 Lukas Mejdrech |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup netif |
* @{ |
*/ |
#include <async.h> |
#include <ipc/ipc.h> |
#include "netif.h" |
extern netif_globals_t netif_globals; |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
int module_start( async_client_conn_t client_connection ); |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
return netif_message( callid, call, answer, answer_count ); |
} |
int module_start( async_client_conn_t client_connection ){ |
ERROR_DECLARE; |
ERROR_PROPAGATE( netif_init_module( client_connection )); |
return netif_run_module(); |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |