Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3908 → Rev 3886

/branches/network/uspace/srv/net/tl/tcp/tcp.c
42,7 → 42,7
#include "../../err.h"
#include "../../messages.h"
#include "../../modules.h"
#include "../../structures/packet/packet_client.h"
#include "../../structures/packet/packet.h"
 
#include "../../il/ip/ip_messages.h"
 
65,10 → 65,10
printf( "OK\n" );
 
printf( "\nTCP - testing to send packet to IP:\t" );
packet = packet_get_5( tcp_globals.networking_phone, SERVICE_TCP, 6, 20, 30, 20 );
packet = packet_create( 20, 30, 20 );
if( ! packet ) return ENOMEM;
packet_copy_data( packet, "Hi, this is TCP", 16 );
ip_send( tcp_globals.ip_phone, -1, packet );
ERROR_PROPAGATE( ip_send( tcp_globals.ip_phone, -1, packet ));
printf( "\tOK\n" );
return EOK;
}
/branches/network/uspace/srv/net/tl/tcp/tcp_module.c
42,8 → 42,6
#include "../../err.h"
#include "../../modules.h"
 
#include "../../structures/packet/packet.h"
 
#include "../../include/protocols.h"
 
#include "tcp.h"
68,7 → 66,6
async_set_client_connection( client_connection );
tcp_globals.networking_phone = connect_to_service( SERVICE_NETWORKING );
tcp_globals.ip_phone = bind_service( SERVICE_IP, IPPROTO_TCP, 0, 0, client_connection );
ERROR_PROPAGATE( pm_init());
ERROR_PROPAGATE( tcp_initialize());
ERROR_PROPAGATE( REGISTER_ME( SERVICE_TCP, & phonehash ));
 
/branches/network/uspace/srv/net/tl/tcp/Makefile
46,8 → 46,7
$(NAME).c \
../../module.c \
../../modules.c \
../../structures/packet/packet.c \
../../structures/packet/packet_client.c
../../structures/packet/packet.c
 
DEFS += -D TCP_BUNDLE=1 -D $(NAME)_message=module_message -D $(NAME)_start_module=module_start -D $(NAME)_print_name=module_print_name
 
/branches/network/uspace/srv/net/structures/generic_field.h
128,12 → 128,12
field->items = ( type ** ) malloc( sizeof( type * ) * field->size ); \
if( ! field->items ) return ENOMEM; \
field->items[ field->next ] = NULL; \
field->magic = GENERIC_FIELD_MAGIC_VALUE; \
field->magic = INT_MAP_MAGIC_VALUE; \
return EOK; \
} \
\
int name##_is_valid( name##_ref field ){ \
return field && ( field->magic == GENERIC_FIELD_MAGIC_VALUE ); \
return field && ( field->magic == INT_MAP_MAGIC_VALUE ); \
}
 
#endif
/branches/network/uspace/srv/net/structures/packet/packet_header.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/structures/packet/packet_client.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/structures/packet/packet_server.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/structures/packet/packet_client.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/structures/packet/packet_server.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/structures/packet/packet_queue.h
0,0 → 1,61
/*
* Copyright (c) 2008 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 net
* @{
*/
 
/** @file
*/
 
#ifndef __NET_PACKET_QUEUE__
#define __NET_PACKET_QUEUE__
 
#include "packet.h"
 
typedef struct pq_item pq_item_t;
typedef pq_item * pq_item_ref;
typedef pq_item_ref pq_head_t;
typedef pq_head * pq_head_ref;
 
struct pq_item{
int order;
size_t metric;
packet_t packet;
pq_item_ref previous;
pq_item_ref next;
};
 
pq_head_t pq_create( packet_t packet, int order, size_t metric );
pq_item_ref pq_add( pq_head_ref queue, packet_t packet, int order, size_t metric );
void pq_destroy( pq_head_t queue );
 
#endif
 
/** @}
*/
/branches/network/uspace/srv/net/structures/packet/packet.c
27,7 → 27,7
*/
 
/** @addtogroup net
* @{
* @{
*/
 
/** @file
34,167 → 34,124
*/
 
#include <errno.h>
#include <malloc.h>
//#include <stdio.h>
#include <unistd.h>
#include <string.h>
 
#include <ipc/ipc.h>
#include <sys/mman.h>
 
#include "../../err.h"
 
#include "../generic_field.h"
 
#include "packet_header.h"
#include "packet.h"
 
// TODO power of 2 aritmetic => div and mod speedup?
#define PACKET_MAP_SIZE 100
#define PACKET_MAGIC_VALUE 0x11227788
 
#define PACKET_MAP_PAGE( packet_id ) ((( packet_id ) - 1 ) / PACKET_MAP_SIZE )
#define PACKET_MAP_INDEX( packet_id ) ((( packet_id ) - 1 ) % PACKET_MAP_SIZE )
struct packet{
size_t length;
size_t max_prefix;
size_t max_content;
size_t data_start;
size_t data_end;
int magic_value;
};
 
int packet_is_valid( packet_t packet );
 
int packet_destroy( packet_t packet );
packet_t packet_create( size_t max_prefix, size_t max_content, size_t max_sufix ){
size_t length;
packet_t packet;
 
typedef packet_t packet_map_t[ PACKET_MAP_SIZE ];
typedef packet_map_t * packet_map_ref;
length = max_prefix + max_content + max_sufix;
packet = ( packet_t ) mmap( NULL, sizeof( struct packet ) + length, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0 );
if( packet == MAP_FAILED ) return NULL;
packet->length = length;
packet->max_prefix = max_prefix;
packet->max_content = max_content;
packet->data_start = sizeof( struct packet ) + packet->max_prefix;
packet->data_end = packet->data_start;
packet->magic_value = PACKET_MAGIC_VALUE;
return packet;
}
 
GENERIC_FIELD_DECLARE( gpm, packet_map_t );
int packet_is_valid( packet_t packet ){
return packet && ( packet->magic_value == PACKET_MAGIC_VALUE );
}
 
GENERIC_FIELD_IMPLEMENT( gpm, packet_map_t );
packet_t packet_copy( packet_t packet ){
packet_t new;
 
static struct{
// TODO lock
gpm_t map;
} pm_globals;
if( ! packet_is_valid( packet )) return NULL;
new = ( packet_t ) mmap( NULL, packet->length, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0 );
if( new == MAP_FAILED ) return NULL;
memcpy( new, packet, packet->length );
return new;
}
 
int packet_destroy( packet_t packet ){
int packet_copy_data( packet_t packet, void * data, size_t length ){
if( ! packet_is_valid( packet )) return EINVAL;
return munmap( packet, packet->length );
if( packet->data_start + length >= (( size_t ) packet ) + packet->length ) return ENOMEM;
memcpy( packet + packet->data_start, data, length );
if( packet->data_start + length > packet->data_end ){
packet->data_end = packet->data_start + length;
}
return EOK;
}
 
int pm_init( void ){
return gpm_initialize( & pm_globals.map );
void * packet_prepend( packet_t packet, size_t length ){
if(( ! packet_is_valid( packet )) || ( packet->data_start - sizeof( struct packet ) < length )) return NULL;
packet->data_start -= length;
return packet + packet->data_start;
}
 
packet_t pm_find( packet_id_t packet_id ){
packet_map_ref map;
 
if( ! packet_id ) return NULL;
if( packet_id > PACKET_MAP_SIZE * gpm_count( & pm_globals.map )) return NULL;
map = gpm_get_index( & pm_globals.map, PACKET_MAP_PAGE( packet_id ));
if( ! map ) return NULL;
return ( * map )[ PACKET_MAP_INDEX( packet_id ) ];
void * packet_append( packet_t packet, size_t length ){
if(( ! packet_is_valid( packet )) || ( packet->data_end + length >= (( size_t ) packet ) + packet->length )) return NULL;
packet->data_end += length;
return packet + packet->data_end - length;
}
 
int pm_add( packet_t packet ){
ERROR_DECLARE;
 
packet_map_ref map;
 
if(( ! packet_is_valid( packet )) || ( gpm_count( & pm_globals.map ) < -1 )) return EINVAL;
if( PACKET_MAP_PAGE( packet->packet_id ) < gpm_count( & pm_globals.map )){
map = gpm_get_index( & pm_globals.map, PACKET_MAP_PAGE( packet->packet_id ));
}else{
do{
map = ( packet_map_ref ) malloc( sizeof( packet_map_t ));
if( ! map ) return ENOMEM;
memset( map, 0, sizeof( packet_map_t ));
if(( ERROR_CODE = gpm_add( & pm_globals.map, map )) < 0 ){
free( map );
return ERROR_CODE;
}
}while( PACKET_MAP_PAGE( packet->packet_id ) >= gpm_count( & pm_globals.map ));
}
( * map )[ PACKET_MAP_INDEX( packet->packet_id ) ] = packet;
int packet_trim( packet_t packet, size_t prefix, size_t sufix ){
if(( ! packet_is_valid( packet )) || ( prefix + sufix > packet->data_end - packet->data_start )) return EINVAL;
packet->data_start += prefix;
packet->data_end -= sufix;
return EOK;
}
 
void pm_destroy( void ){
int count;
int index;
packet_map_ref map;
packet_t packet;
 
count = gpm_count( & pm_globals.map );
while( count > 0 ){
map = gpm_get_index( & pm_globals.map, count - 1 );
for( index = PACKET_MAP_SIZE - 1; index >= 0; -- index ){
packet = ( * map )[ index ];
if( packet_is_valid( packet )){
munmap( packet, packet->length );
}
}
}
gpm_destroy( & pm_globals.map );
int packet_send( packet_t packet, int phone ){
if( ! packet_is_valid( packet )) return EINVAL;
return ipc_share_out_start( phone, packet, PROTO_READ | PROTO_WRITE );
}
 
packet_t pq_add( packet_t first, packet_t packet, int order, size_t metric ){
packet_t item;
int packet_receive( packet_ref packet ){
ERROR_DECLARE;
 
if( ! packet_is_valid( packet )) return NULL;
pq_set( packet, order, metric );
if( packet_is_valid( first )){
item = first;
do{
if( item->order < order ){
if( item->next ){
item = pm_find( item->next );
}else{
item->next = packet->packet_id;
packet->previous = item->packet_id;
return first;
}
}else{
packet->previous = item->previous;
packet->next = item->packet_id;
item->previous = packet->packet_id;
item = pm_find( packet->previous );
if( item ) item->next = packet->packet_id;
return item;
}
}while( packet_is_valid( item ));
}
return packet;
}
ipc_callid_t callid;
size_t size;
int flags;
 
packet_t pq_detach( packet_t packet ){
packet_t next;
packet_t previous;
 
if( ! packet_is_valid( packet )) return NULL;
next = pm_find( packet->next );
if( next ){
next->previous = packet->previous;
previous = pm_find( next->previous );
if( previous ){
previous->next = next->packet_id;
}
if( ! packet ) return EINVAL;
if( ! ipc_share_out_receive( & callid, & size, & flags )) return EINVAL;
* packet = ( packet_t ) as_get_mappable_page( size );
if( !( * packet )) return ENOMEM;
if( ERROR_OCCURED( ipc_share_out_finalize( callid, * packet ))){
munmap( * packet, size );
return ERROR_CODE;
}
packet->previous = 0;
packet->next = 0;
return next;
return EOK;
}
 
int pq_set( packet_t packet, int order, size_t metric ){
int packet_destroy( packet_t packet ){
if( ! packet_is_valid( packet )) return EINVAL;
packet->order = order;
packet->metric = metric;
return EOK;
return munmap( packet, sizeof( struct packet ) + packet->length );
}
 
void pq_destroy( packet_t first, void ( * packet_release )( packet_t packet )){
packet_t actual;
packet_t next;
size_t packet_get_data_length( packet_t packet ){
if( ! packet_is_valid( packet )) return 0;
return packet->data_end - packet->data_start;
}
 
actual = first;
while( packet_is_valid( actual )){
next = pm_find( actual->next );
actual->next = 0;
actual->previous = 0;
if( packet_release ) packet_release( actual );
actual = next;
}
void * packet_get_data( packet_t packet ){
if( ! packet_is_valid( packet )) return NULL;
return packet + packet->data_start;
}
 
/** @}
/branches/network/uspace/srv/net/structures/packet/packet_queue.c
0,0 → 1,110
/*
* Copyright (c) 2008 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 net
* @{
*/
 
/** @file
*/
 
#include <malloc.h>
 
#include "../../configuration.h"
 
#include "packet.h"
#include "packet_queue.h"
 
#define PQ_MAGIC_VALUE 0x23465968;
 
static inline int pq_is_valid( pq_item_ref item );
 
pq_item_ref pq_add( pq_head * queue, packet_t packet, int order, size_t metric ){
pq_item_ref item;
pq_item_ref tmp;
 
tmp = pq_create( packet, order, metric );
if( ! tmp ) return NULL;
item = queue;
while( pq_is_valid( item )){
if( item->order < order ){
if( item->next && pq_is_valid( item->next )){
item = item->next;
}else{
item->next = tmp;
tmp->previous = item;
return tmp;
}
}else{
tmp->previous = item->previous;
tmp->next = item;
item->previous = tmp;
if( tmp->previous ){
tmp->previous->next = tmp;
}else{
* queue = tmp;
}
return tmp;
}
}
}
 
 
pq_head pq_create( packet_t packet, int order, size_t metric ){
pq_item_ref item;
 
item = ( pq_item_ref ) malloc( sizeof( pq_item_t ));
if( ! item ) return NULL;
item->order = order;
item->metric = metric;
item->packet = packet;
item->previous = NULL;
item->next = NULL;
item->magic_value = PQ_MAGIC_VALUE;
return item;
}
 
void pq_destroy( pq_head queue ){
pq_item_ref actual;
pq_item_ref next;
 
actual = queue;
while( pq_is_valid( actual )){
next = actual->next;
actual->magic_value = 0;
free( actual );
actual = next;
}
}
 
static inline int pq_is_valid( pq_item_ref item ){
return item && ( item->magic_value == PQ_MAGIC_VALUE );
}
 
/** @}
*/
/branches/network/uspace/srv/net/structures/packet/packet.h
27,7 → 27,7
*/
 
/** @addtogroup net
* @{
* @{
*/
 
/** @file
36,28 → 36,26
#ifndef __NET_PACKET_H__
#define __NET_PACKET_H__
 
typedef unsigned int packet_id_t;
#define PACKET_PREPEND( packet, type ) ( type * ) packet_prepend(( packet ), sizeof( type ))
#define PACKET_APPEND( packet, type ) ( type * ) packet_append(( packet ), sizeof( type ))
#define PACKET_TRIM( packet, prefix, sufix ) packet_trim(( packet ), sizeof( prefix ), sizeof( sufix ))
 
typedef struct packet * packet_t;
typedef packet_t * packet_ref;
 
typedef enum packet_mode packet_mode_t;
packet_t packet_create( size_t max_prefix, size_t max_content, size_t max_sufix );
void * packet_prepend( packet_t packet, size_t length );
void * packet_append( packet_t packet, size_t length );
packet_t packet_copy( packet_t packet );
int packet_copy_data( packet_t packet, void * data, size_t length );
// TODO protocol identification?
int packet_send( packet_t packet, int phone );
int packet_receive( packet_ref packet );
int packet_trim( packet_t packet, size_t prefix, size_t sufix );
int packet_destroy( packet_t packet );
size_t packet_get_data_length( packet_t packet );
void * packet_get_data( packet_t packet );
 
enum packet_mode{
PM_ONEWAY,
PM_RETURN
};
 
packet_t pm_find( packet_id_t packet_id );
int pm_add( packet_t packet );
int pm_init( void );
void pm_destroy( void );
 
packet_t pq_add( packet_t first, packet_t packet, int order, size_t metric );
packet_t pq_detach( packet_t packet );
int pq_set( packet_t packet, int order, size_t metric );
void pq_destroy( packet_t first, void ( * packet_release )( packet_t packet ));
 
#endif
 
/** @}
/branches/network/uspace/srv/net/networking/networking.c
52,8 → 52,6
#include "../structures/char_map.h"
#include "../structures/generic_char_map.h"
#include "../structures/measured_strings.h"
#include "../structures/packet/packet.h"
#include "../structures/packet/packet_server.h"
 
#include "../il/ip/ip_messages.h"
#include "../netif/device.h"
70,8 → 68,6
 
#endif
 
#define NAME "Networking"
 
#define LO_NAME "lo"
#define LO_FILENAME "/sbin/lo"
#define DP8390_ISA_NAME "dp8390_isa"
81,9 → 77,6
#define IP_NAME "ip"
#define IP_FILENAME "/sbin/ip"
 
#define IPC_GET_DEVICE( call ) ( device_id_t ) IPC_GET_ARG1( * call )
#define IPC_GET_COUNT( call ) ( int ) IPC_GET_ARG2( * call )
 
typedef struct module_struct module_t;
typedef module_t * module_ref;
 
147,14 → 140,12
measured_strings_t configuration;
};
 
void networking_print_name( void );
int add_module( module_ref * module, modules_ref modules, const char const * name, const char const * filename, services_t service, task_id_t task_id );
static void client_connection( ipc_callid_t iid, ipc_call_t * icall );
measured_string_ref configuration_find( measured_strings_ref configuration, const char * name );
int networking_start_module( async_client_conn_t client_connection );
int main( int argc, char * argv[] );
int networking_initialize( void );
int networking_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
int networking_message( ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t * result1, ipcarg_t * result2, ipcarg_t * result3 );
//int parse_line( measured_strings_ref configuration, char * line );
int add_configuration( measured_strings_ref configuration, const char * name, const char * value );
int read_configuration( void );
170,10 → 161,6
 
GENERIC_CHAR_MAP_IMPLEMENT( modules, module_t )
 
void networking_print_name( void ){
printf( NAME );
}
 
int add_module( module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id ){
ERROR_DECLARE;
 
195,46 → 182,63
return EOK;
}
 
int networking_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
static void client_connection( ipc_callid_t iid, ipc_call_t * icall ){
ipc_callid_t callid;
ipc_call_t call;
ipcarg_t arg1, arg2, arg3;
int res;
 
/*
* Accept the connection
* - Answer the first IPC_M_CONNECT_ME_TO call.
*/
// printf( "\nNET-%d got %d on %x from %x", fibril_get_id(), IPC_GET_METHOD( * icall ), icall->in_phone_hash, iid );
ipc_answer_0( iid, EOK );
 
while( true ){
callid = async_get_call( & call );
arg1 = 0;
arg2 = 0;
arg3 = 0;
// printf( "\nNET-%d got %d on %x from %x", fibril_get_id(), IPC_GET_METHOD( call ), call.in_phone_hash, callid );
#ifdef NETWORKING_module
//TODO map to *_message
if( IS_NET_IL_MESSAGE( call ) || IS_NET_IP_MESSAGE( call )){
return ip_message( callid, call, answer, answer_count );
res = ip_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
/* }else if( IS_NET_ARP_MESSAGE( call )){
return arp_message( callid, call, answer, answer_count );
res = arp_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
*//* }else if( IS_NET_RARP_MESSAGE( call )){
return rarp_message( callid, call, answer, answer_count );
res = rarp_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
*//* }else if( IS_NET_ICMP_MESSAGE( call )){
return icmp_message( callid, call, answer, answer_count );
res = icmp_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
*//* }else if( IS_NET_UDP_MESSAGE( call )){
return udp_message( callid, call, answer, answer_count );
res = udp_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
*/ }else if( IS_NET_TCP_MESSAGE( call )){
return tcp_message( callid, call, answer, answer_count );
res = tcp_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
/* }else if( IS_NET_SOCKET_MESSAGE( call )){
return socket_message( callid, call, answer, answer_count );
res = socket_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
*//* }else if( IS_NET_NIL_MESSAGE( call ) || IS_NET_ETHERNET_MESSAGE( call )){
return ethernet_message( callid, call, answer, answer_count );
res = ethernet_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
*/ }else{
#endif
if( IS_NET_PACKET_MESSAGE( call )){
return packet_server_message( callid, call, answer, answer_count );
}else{
return net_message( callid, call, answer, answer_count );
}
res = networking_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
#ifdef NETWORKING_module
}
#endif
ipc_answer_2( callid, res, arg1, arg2 );
}
}
 
int networking_start_module( async_client_conn_t client_connection ){
int main( int argc, char * argv[] ){
ERROR_DECLARE;
 
ipcarg_t phonehash;
 
printf("\nTask %d - HelenOS Networking subsystem", task_get_id());
 
async_set_client_connection( client_connection );
ERROR_PROPAGATE( networking_initialize());
ERROR_PROPAGATE( REGISTER_ME( SERVICE_NETWORKING, & phonehash ));
ERROR_PROPAGATE( pm_init());
 
async_manager();
 
return EOK;
296,8 → 300,7
return EOK;
}
 
//TODO as ip.c
int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
int networking_message( ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t * result1, ipcarg_t * result2, ipcarg_t * result3 ){
ERROR_DECLARE;
 
measured_string_ref strings;
307,23 → 310,25
measured_strings_ref configuration;
netif_ref netif;
 
* answer_count = 0;
switch( IPC_GET_METHOD( * call )){
switch( method ){
case IPC_M_PHONE_HUNGUP:
return EOK;
case NET_NET_DEVICE:
// TODO configure, register
printf( "\nNetworking: new netif %d", IPC_GET_DEVICE( call ));
// arg1 = netif id
printf( "\nNetworking: new netif %d", arg1 );
return EOK;
case NET_NET_GET_DEVICE_CONF:
ERROR_PROPAGATE( measured_strings_receive( & strings, & data, IPC_GET_COUNT( call )));
netif = netifs_find( & networking_globals.netifs, IPC_GET_DEVICE( call ));
// arg1 = netif id
// arg2 = count
ERROR_PROPAGATE( measured_strings_receive( & strings, & data, arg2 ));
netif = netifs_find( & networking_globals.netifs, arg1 );
if( netif ){
configuration = & netif->configuration;
}else{
configuration = NULL;
}
for( index = 0; index < IPC_GET_COUNT( call ); ++ index ){
for( index = 0; index < arg2; ++ index ){
setting = measured_strings_find( configuration, strings[ index ].value, 0 );
if( ! setting ){
setting = measured_strings_find( & networking_globals.configuration, strings[ index ].value, 0 );
338,13 → 343,13
}
// strings should not contain received data anymore
free( data );
ERROR_CODE = measured_strings_reply( strings, IPC_GET_COUNT( call ));
ERROR_CODE = measured_strings_reply( strings, arg2 );
free( strings );
return ERROR_CODE;
case NET_NET_GET_CONF:
// arg1 = count
ERROR_PROPAGATE( measured_strings_receive( & strings, & data, IPC_GET_COUNT( call )));
for( index = 0; index < IPC_GET_COUNT( call ); ++ index ){
ERROR_PROPAGATE( measured_strings_receive( & strings, & data, arg1 ));
for( index = 0; index < arg1; ++ index ){
setting = measured_strings_find( & networking_globals.configuration, strings[ index ].value, 0 );
if( setting ){
strings[ index ].length = setting->length;
356,7 → 361,7
}
// strings should not contain received data anymore
free( data );
ERROR_CODE = measured_strings_reply( strings, IPC_GET_COUNT( call ));
ERROR_CODE = measured_strings_reply( strings, arg1 );
free( strings );
return ERROR_CODE;
case NET_NET_STARTUP:
/branches/network/uspace/srv/net/networking/Makefile
26,8 → 26,6
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
NAME = networking
 
## Setup toolchain
#
 
41,19 → 39,14
## Sources
#
 
OUTPUT = $(NAME)
OUTPUT = networking
SOURCES = \
$(NAME).c \
../module.c \
networking.c \
../modules.c \
../structures/char_map.c \
../structures/measured_strings.c \
../structures/packet/packet.c \
../structures/packet/packet_server.c
../structures/measured_strings.c
# ../self_test.c
 
DEFS += -D $(NAME)_message=module_message -D $(NAME)_start_module=module_start -D $(NAME)_print_name=module_print_name
 
DEFS += -D NETWORKING_$(NETWORKING)
 
ifeq ($(NETWORKING), module)
/branches/network/uspace/srv/net/il/arp/arp.c
51,7 → 51,6
 
#include "../../structures/measured_strings.h"
#include "../../structures/packet/packet.h"
#include "../../structures/packet/packet_client.h"
 
#include "arp.h"
#include "arp_header.h"
60,7 → 59,6
#include "arp_module.h"
 
#define IPC_GET_DEVICE( call ) ( device_id_t ) IPC_GET_ARG1( * call )
#define IPC_GET_PACKET( call ) ( packet_id_t ) IPC_GET_ARG2( * call )
#define IPC_GET_PROTO( call ) ( services_t ) IPC_GET_ARG2( * call )
#define IPC_GET_SERVICE( call ) ( services_t ) IPC_GET_ARG3( * call )
 
149,7 → 147,7
// bind the new one
device->phone = bind_service( device->service, device->device_id, SERVICE_ARP, 0, arp_receiver );
// get packet dimensions
if( ERROR_OCCURED( async_req_1_4( device->phone, NET_NIL_PACKET_SPACE, device_id, & device->addr_len, & device->prefix, & device->content, & device->sufix ))){
if( ERROR_OCCURED( async_req_1_3( device->phone, NET_NIL_PACKET_SPACE, device_id, & device->prefix, & device->content, & device->sufix ))){
arp_protos_destroy( & device->protos );
free( device );
return ERROR_CODE;
218,7 → 216,7
if( length > device->content ){
return NULL;
}
packet = packet_get_5( arp_globals.networking_phone, SERVICE_ARP, device->addr_len, device->prefix, length, device->sufix );
packet = packet_create( device->prefix, length, device->sufix );
if( ! packet ) return NULL;
header = ( arp_header_ref ) packet_append( packet, length );
header->hardware = device->hardware;
235,7 → 233,7
length += device->addr->length;
memcpy((( uint8_t * ) header ) + length, target->value, target->length );
// TODO send to the device->broadcast_addr as arp protocol
async_msg_3( device->phone, NET_NETIF_SEND, device_id, SERVICE_ARP, packet_get_id( packet ));
packet_send( packet, device->phone );
return NULL;
}
 
313,9 → 311,7
memcpy( src_hw, des_hw, header->hardware_length );
memcpy( des_hw, hw_source->value, hw_source->length );
// TODO send to the hw_source as arp protocol
async_msg_3( device->phone, NET_NETIF_SEND, device_id, SERVICE_ARP, packet_get_id( packet ));
}else{
packet_release( arp_globals.networking_phone, packet_get_id( packet ));
packet_send( packet, device->phone );
}
}
return EOK;
418,7 → 414,7
//TODO clear device if off?
break;
case NET_IL_RECEIVED:
if( ! ERROR_OCCURED( packet_translate( arp_globals.networking_phone, & packet, IPC_GET_PACKET( & call )))){
if( ! ERROR_OCCURED( packet_receive( & packet ))){
ERROR_CODE = arp_receive_message( IPC_GET_DEVICE( & call ), packet );
}
ipc_answer_0( callid, ERROR_CODE );
/branches/network/uspace/srv/net/il/arp/arp.h
64,7 → 64,6
ipcarg_t prefix;
ipcarg_t content;
ipcarg_t sufix;
ipcarg_t addr_len;
measured_string_ref addr;
char * addr_data;
measured_string_ref broadcast_addr;
/branches/network/uspace/srv/net/il/arp/Makefile
48,8 → 48,7
../../modules.c \
../../structures/char_map.c \
../../structures/measured_strings.c \
../../structures/packet/packet.c \
../../structures/packet/packet_client.c
../../structures/packet/packet.c
 
DEFS += -D ARP_BUNDLE=1 -D $(NAME)_message=module_message -D $(NAME)_start_module=module_start -D $(NAME)_print_name=module_print_name
 
/branches/network/uspace/srv/net/il/ip/ip_messages.h
37,8 → 37,6
#ifndef __NET_IP_MESSAGES_H__
#define __NET_IP_MESSAGES_H__
 
#include <async.h>
 
#include <ipc/ipc.h>
 
#include "../../err.h"
69,7 → 67,22
async_req_5_5( ip_phone, NET_IP_ECHO, ( arg1 ), ( arg2 ), ( arg3 ), ( arg4 ), ( arg5 ), ( answer1 ), ( answer2 ), ( answer3 ), ( answer4 ), ( answer5 ))
 
#define ip_send( ip_phone, device_id, packet ) \
async_msg_1( ip_phone, NET_IP_SEND, packet_get_id( packet ))
{ \
ERROR_DECLARE; \
\
aid_t message; \
ipc_call_t answer; \
ipcarg_t result; \
\
message = async_send_1(( ip_phone ), NET_IP_SEND, ( device_id ), & answer ); \
if( ERROR_OCCURED( packet_send(( packet ), ( ip_phone )))){ \
async_wait_for( message, NULL ); \
result = ERROR_CODE; \
}else{ \
async_wait_for( message, & result ); \
} \
result; \
}
 
#endif
 
/branches/network/uspace/srv/net/il/ip/ip.c
49,7 → 49,7
#include "../../include/socket.h"
#include "../../netif/device.h"
#include "../../structures/measured_strings.h"
#include "../../structures/packet/packet_client.h"
#include "../../structures/packet/packet.h"
 
#include "ip.h"
#include "ip_messages.h"
58,7 → 58,6
#define DEFAULT_IPV 4
 
#define IPC_GET_DEVICE( call ) ( device_id_t ) IPC_GET_ARG1( * call )
#define IPC_GET_PACKET( call ) ( packet_id_t ) IPC_GET_ARG1( * call )
#define IPC_GET_PROTO( call ) ( int ) IPC_GET_ARG1( * call )
#define IPC_GET_SERVICE( call ) ( services_t ) IPC_GET_ARG2( * call )
#define IPC_GET_STATE( call ) ( device_state_t ) IPC_GET_ARG2( * call )
214,9 → 213,12
// TODO packer received
case NET_IL_RECEIVED:
case NET_NIL_RECEIVED:
if( ! ERROR_OCCURED( result = packet_translate( ip_globals.networking_phone, & packet, IPC_GET_PACKET( & call )))){
//result = ip_receive_message( IPC_GET_DEVICE( call ), packet );
if( ERROR_OCCURED( result = packet_receive( & packet ))){
ipc_answer_0( callid, ERROR_CODE );
continue;
}
//result = ip_receive_message( IPC_GET_DEVICE( call ), packet );
packet_destroy( packet );
ipc_answer_0( callid, result );
}
}
247,7 → 249,6
int ip_send_message( device_id_t device_id, packet_t packet ){
// TODO send packet
printf( "Packet to send via %d: %s", device_id, packet_get_data( packet ));
packet_release( ip_globals.networking_phone, packet_get_id( packet ));
return EOK;
}
 
268,10 → 269,7
case IPC_M_CONNECT_TO_ME:
return ip_register_message( IPC_GET_PROTO( call ), IPC_GET_PHONE( call ));
case NET_IP_SEND:
if( ERROR_OCCURED( packet_translate( ip_globals.networking_phone, & packet, IPC_GET_PACKET( call )))){
printf( "\nIP send E %d", ERROR_CODE );
return ERROR_CODE;
}
ERROR_PROPAGATE( packet_receive( & packet ));
return ip_send_message( IPC_GET_DEVICE( call ), packet );
}
return ENOTSUP;
/branches/network/uspace/srv/net/il/ip/Makefile
48,7 → 48,6
../../modules.c \
../../structures/measured_strings.c \
../../structures/packet/packet.c \
../../structures/packet/packet_client.c \
../../sockaddr.c
 
DEFS += -D IP_BUNDLE=1 -D $(NAME)_message=module_message -D $(NAME)_start_module=module_start -D $(NAME)_print_name=module_print_name
/branches/network/uspace/srv/net/il/ip/ip_module.c
42,8 → 42,6
#include "../../err.h"
#include "../../modules.h"
 
#include "../../structures/packet/packet.h"
 
#include "ip.h"
#include "ip_module.h"
 
65,7 → 63,6
 
async_set_client_connection( client_connection );
ip_globals.networking_phone = connect_to_service( SERVICE_NETWORKING );
ERROR_PROPAGATE( pm_init());
ERROR_PROPAGATE( ip_initialize());
ERROR_PROPAGATE( REGISTER_ME( SERVICE_IP, & phonehash ));
 
/branches/network/uspace/srv/net/netif/netif.c
45,13 → 45,11
#include "../modules.h"
 
#include "../structures/packet/packet.h"
#include "../structures/packet/packet_client.h"
 
#include "device.h"
#include "netif.h"
 
#define IPC_GET_DEVICE( call ) ( device_id_t ) IPC_GET_ARG1( * call )
#define IPC_GET_PACKET( call ) ( packet_id_t ) IPC_GET_ARG2( * call )
#define IPC_GET_IRQ( call ) ( int ) IPC_GET_ARG2( * call )
#define IPC_GET_IO( call ) ( int ) IPC_GET_ARG3( * call )
#define IPC_GET_PHONE( call ) ( int ) IPC_GET_ARG5( * call )
148,7 → 146,7
case IPC_M_CONNECT_TO_ME:
return register_message( IPC_GET_DEVICE( call ), IPC_GET_PHONE( call ));
case NET_NETIF_SEND:
ERROR_PROPAGATE( packet_translate( netif_globals.networking_phone, & packet, IPC_GET_PACKET( call )));
ERROR_PROPAGATE( packet_receive( & packet ));
return send_message( IPC_GET_DEVICE( call ), packet );
case NET_NETIF_START:
return start_message( IPC_GET_DEVICE( call ));
170,7 → 168,7
netif_globals.networking_phone = connect_to_service( SERVICE_NETWORKING );
device_map_initialize( & netif_globals.device_map );
ERROR_PROPAGATE( initialize());
ERROR_PROPAGATE( pm_init());
 
async_manager();
 
return EOK;
/branches/network/uspace/srv/net/netif/lo/lo.c
45,7 → 45,7
#include "../../modules.h"
 
#include "../../structures/measured_strings.h"
#include "../../structures/packet/packet_client.h"
#include "../../structures/packet/packet.h"
 
#include "../netif.h"
 
163,6 → 163,9
 
device_ref device;
size_t length;
aid_t message;
ipc_call_t answer;
ipcarg_t result;
packet_t received;
 
ERROR_PROPAGATE( find_device( device_id, & device ));
172,18 → 175,18
length = packet_get_data_length( packet );
device->stats.tx_bytes += length;
device->stats.rx_bytes += length;
received = packet_copy( netif_globals.networking_phone, SERVICE_LO, packet );
packet_release( netif_globals.networking_phone, packet_get_id( packet ));
received = packet_copy( packet );
packet_destroy( packet );
if( ! received ){
++ device->stats.rx_dropped;
return EOK;
}
async_msg_2( device->nil_phone, NET_NIL_RECEIVED, device_id, packet_get_id( received ));
// message = async_send_1( device->nil_phone, NET_NIL_RECEIVED, ( device_id ), & answer );
// if( ERROR_OCCURED( packet_send( received, device->nil_phone ))){
// ++ device->stats.rx_dropped;
// }
// if( result != EOK ) ++ device->stats.rx_dropped;
message = async_send_1( device->nil_phone, NET_NIL_RECEIVED, ( device_id ), & answer );
if( ERROR_OCCURED( packet_send( received, device->nil_phone ))){
++ device->stats.rx_dropped;
}
async_wait_for( message, & result );
if( result != EOK ) ++ device->stats.rx_dropped;
return EOK;
}
 
/branches/network/uspace/srv/net/netif/lo/Makefile
46,7 → 46,6
../../module.c \
../../modules.c \
../../structures/measured_strings.h \
../../structures/packet/packet_client.c \
../../structures/packet/packet.c
 
DEFS += -D $(NETIF)_message=module_message -D $(NETIF)_start_module=module_start -D $(NETIF)_print_name=module_print_name
/branches/network/uspace/srv/net/messages.h
47,7 → 47,6
#define NET_ICMP_COUNT 0
#define NET_UDP_COUNT 0
#define NET_TCP_COUNT 0
#define NET_PACKET_COUNT 5
#define NET_SOCKET_COUNT 0
 
#define NET_FIRST 2000
82,27 → 81,23
#define NET_SOCKET_FIRST ( NET_TCP_LAST + 0 )
#define NET_SOCKET_LAST ( NET_SOCKET_FIRST + NET_SOCKET_COUNT )
 
#define NET_PACKET_FIRST ( NET_SOCKET_LAST + 0 )
#define NET_PACKET_LAST ( NET_PACKET_FIRST + NET_PACKET_COUNT )
#define NET_LAST NET_SOCKET_LAST
 
#define NET_LAST NET_PACKET_LAST
 
#define NET_COUNT ( NET_LAST - NET_FIRST )
 
#define IS_IN_INTERVAL( item, first_inclusive, last_exclusive ) ((( item ) >= ( first_inclusive )) && (( item ) < ( last_exclusive )))
 
#define IS_NET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_FIRST, NET_LAST )
#define IS_NET_NET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NET_FIRST, NET_NET_LAST )
#define IS_NET_NIL_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NIL_FIRST, NET_NIL_LAST )
#define IS_NET_ETH_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ETH_FIRST, NET_ETH_LAST )
#define IS_NET_IL_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IL_FIRST, NET_IL_LAST )
#define IS_NET_IP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IP_FIRST, NET_IP_LAST )
#define IS_NET_ARP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ARP_FIRST, NET_ARP_LAST )
#define IS_NET_RARP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_RARP_FIRST, NET_RARP_LAST )
#define IS_NET_UDP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_UDP_FIRST, NET_UDP_LAST )
#define IS_NET_TCP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_TCP_FIRST, NET_TCP_LAST )
#define IS_NET_SOCKET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_SOCKET_FIRST, NET_SOCKET_LAST )
#define IS_NET_PACKET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_PACKET_FIRST, NET_PACKET_LAST )
#define IS_NET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_FIRST, NET_LAST )
#define IS_NET_NET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_NET_FIRST, NET_NET_LAST )
#define IS_NET_NIL_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_NIL_FIRST, NET_NIL_LAST )
#define IS_NET_ETH_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_ETH_FIRST, NET_ETH_LAST )
#define IS_NET_IL_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_IL_FIRST, NET_IL_LAST )
#define IS_NET_IP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_IP_FIRST, NET_IP_LAST )
#define IS_NET_ARP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_ARP_FIRST, NET_ARP_LAST )
#define IS_NET_RARP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_RARP_FIRST, NET_RARP_LAST )
#define IS_NET_UDP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_UDP_FIRST, NET_UDP_LAST )
#define IS_NET_TCP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_TCP_FIRST, NET_TCP_LAST )
#define IS_NET_SOCKET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_SOCKET_FIRST, NET_SOCKET_LAST )
 
typedef enum {
/* ( device_id, irq, io ) */
109,7 → 104,7
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 ) */
/* ( device_id ), packet_send */
NET_NETIF_SEND,
/* ( device_id ) */
NET_NETIF_START,
119,13 → 114,13
NET_NETIF_STOP,
/* () not supported, registers new device */
NET_NET_DEVICE = NET_NET_FIRST,
/* ( NULL, count ), measured_strings_send( names ), measured_strings_return( values ) */
/* (), measured_strings_send( names ), measured_strings_return( values ) */
NET_NET_GET_CONF,
/* ( device_id, count ), measured_strings_send( names ), measured_strings_return( values ) */
/* ( device_id ), measured_strings_send( names ), measured_strings_return( values ) */
NET_NET_GET_DEVICE_CONF,
/* () not supported, measured_strings_send( names ), measured_strings_send( values ) */
NET_NET_SET_CONF,
/* ( device_id, count ) not supported, measured_strings_send( names ), measured_strings_send( values ) */
/* ( device_id ) not supported, measured_strings_send( names ), measured_strings_send( values ) */
NET_NET_SET_DEVICE_CONF,
/* () */
NET_NET_STARTUP,
162,7 → 157,6
/* ( device_id ), measured_strings_send( address ) */
// NET_IL_MY_ADDR,
NET_IP_ECHO = NET_IP_FIRST,
/* ( packet_id ) */
NET_IP_SEND,
/* ( device_id, nil_service, proto ), measured_strings_send( proto_addr ) */
NET_ARP_DEVICE = NET_ARP_FIRST,
171,13 → 165,8
/* ( device_id ) */
NET_ARP_CLEAR_DEVICE,
/* () */
NET_ARP_CLEAN_CACHE,
NET_PACKET_CREATE_1 = NET_PACKET_FIRST,
NET_PACKET_CREATE_5,
NET_PACKET_GET,
NET_PACKET_GET_SIZE,
NET_PACKET_RELEASE
} net_messages;
NET_ARP_CLEAN_CACHE
} net_message;
 
#endif