Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3666 → Rev 3665

/branches/network/uspace/app/init/init.c
107,7 → 107,7
// FIXME: spawn("/sbin/pci");
spawn("/sbin/fb");
spawn("/sbin/kbd");
spawn("/sbin/networking_startup");
spawn("/sbin/networking");
spawn("/sbin/console");
console_wait();
/branches/network/uspace/lib/libc/include/ipc/services.h
45,9 → 45,6
SERVICE_VFS,
SERVICE_DEVMAP,
SERVICE_NETWORKING,
SERVICE_LO,
SERVICE_DP8390_ISA,
SERVICE_ETHERNET,
SERVICE_IP,
SERVICE_ARP,
SERVICE_RARP,
54,7 → 51,8
SERVICE_ICMP,
SERVICE_UDP,
SERVICE_TCP,
SERVICE_SOCKET
SERVICE_SOCKET,
SERVICE_ETHERNET
} services_t;
 
/* Memory area to be received from NS */
/branches/network/uspace/srv/net/module.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/self_test.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/err.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/measured_strings.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/netif/lo.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/netif/netif.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/netif/Makefile
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/netif/netif.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/netif/netif_device_id_type.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/measured_strings.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/int_map.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/generic_field.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/char_map.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/configuration.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/char_map.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/generic_char_map.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/networking_startup/networking_startup.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/networking_startup/Makefile
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/packet.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/packet.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/Makefile
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/self_test.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/tcp/tcp.c
40,27 → 40,25
#include <ipc/services.h>
//#include <sys/mman.h>
 
#include "../err.h"
#include "../messages.h"
#include "../modules.h"
 
#include "tcp.h"
 
tcp_globals_t tcp_globals;
struct {
int ip_phone;
} tcp_globals;
 
/** Initializes the module.
*/
int tcp_initialize( void ){
ipcarg_t arg1, arg2;
ERROR_DECLARE;
 
ipcarg_t arg1, arg2;
 
// printf( "TCP - testing to send IP:\t" );
// ERROR_PROPAGATE( ip_message( NET_IP_ECHO, 12, 34, NULL, & arg1, & arg2, NULL ));
// if(( arg1 != 12 ) || ( arg2 != 34 )) return EINVAL;
// printf( "OK\n" );
 
// ERROR_PROPAGATE( ip_message( NET_IP_TCP_REGISTER, NULL, NULL, NULL, NULL, NULL, NULL ));
printf( "TCP - testing to send IP:\t" );
ERROR_PROPAGATE( ip_message( NET_IP_ECHO, 12, 34, NULL, & arg1, & arg2, NULL ));
if(( arg1 != 12 ) || ( arg2 != 34 )) return EINVAL;
printf( "OK\n" );
return EOK;
}
 
68,9 → 66,8
return EOK;
}
 
int tcp_message( ipc_callid_t callid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t * result1, ipcarg_t * result2, ipcarg_t * result3 ){
int tcp_message( ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3 ){
switch( method ){
// case IPC_M_CONNECT_ME_TO:
case IPC_M_PHONE_HUNGUP:
return EOK;
}
/branches/network/uspace/srv/net/tcp/tcp.h
47,17 → 47,10
#endif
#endif
 
typedef struct tcp_globals tcp_globals_t;
int tcp_initialize( void );
int tcp_call( ipc_callid_t callid );
int tcp_message( ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3 );
 
struct tcp_globals{
int ip_phone;
int networking_phone;
};
 
int tcp_initialize( void );
int tcp_call( ipc_callid_t callid );
int tcp_message( ipc_callid_t callid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t * result1, ipcarg_t * result2, ipcarg_t * result3 );
 
#endif
 
/** @}
/branches/network/uspace/srv/net/tcp/tcp_module.c
34,35 → 34,61
*/
 
#include <async.h>
#include <errno.h>
#include <stdio.h>
#include <ipc/ipc.h>
#include <ipc/services.h>
//#include <sys/mman.h>
 
#include "../modules.h"
 
#include "tcp.h"
 
#define NAME "TCP protocol"
extern struct {
int ip_phone;
} tcp_globals;
 
void tcp_print_name( void );
int tcp_start_module( void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall ));
static void client_connection( ipc_callid_t iid, ipc_call_t * icall );
int main( int argc, char * argv[] );
 
extern tcp_globals_t tcp_globals;
/** Default thread for new connections.
*/
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;
 
void tcp_print_name( void ){
printf( NAME );
/* Accept the connection */
ipc_answer_0( iid, EOK );
 
while( true ){
callid = async_get_call( & call );
arg1 = 0;
arg2 = 0;
arg3 = 0;
res = tcp_call( callid );
if( res == EOK ){
res = tcp_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
}
ipc_answer_2( callid, EOK, arg1, arg2 );
}
}
 
int tcp_start_module( void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall )){
services_t need[ 3 ];
int * need_phone[ 3 ];
/** Starts the module.
* Parameters are ignored.
*/
int main( int argc, char * argv[] ){
services_t need[ 2 ];
int * need_phone[ 2 ];
 
printf("tcp : HelenOS TCP network protocol\n");
 
need[ 0 ] = SERVICE_IP;
need[ 1 ] = SERVICE_NETWORKING;
need[ 2 ] = NULL;
need[ 1 ] = NULL;
need_phone[ 0 ] = & tcp_globals.ip_phone;
need_phone[ 1 ] = & tcp_globals.networking_phone;
need_phone[ 2 ] = NULL;
need_phone[ 1 ] = NULL;
 
return start_service( SERVICE_TCP, need, need_phone, client_connection, tcp_initialize );
}
 
/branches/network/uspace/srv/net/tcp/Makefile
44,11 → 44,8
SOURCES = \
$(NAME)_module.c \
$(NAME).c \
../module.c \
../modules.c
 
DEFS += -D NETWORKING_$(NETWORKING) -D $(NAME)_call=module_call -D $(NAME)_message=module_message -D $(NAME)_start_module=module_start -D $(NAME)_print_name=module_print_name
 
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
 
.PHONY: all clean depend disasm
78,4 → 75,4
$(AS) $(AFLAGS) $< -o $@
 
%.o: %.c
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
$(CC) $(DEFS) $(CFLAGS) -D NETWORKING_$(NETWORKING) -c $< -o $@
/branches/network/uspace/srv/net/networking/networking.c
34,27 → 34,16
*/
 
#include <async.h>
#include <ctype.h>
#include <errno.h>
#include <malloc.h>
#include <stdio.h>
#include <task.h>
//#include <thread.h>
#include <unistd.h>
#include <ipc/ipc.h>
#include <ipc/services.h>
//#include <sys/mman.h>
 
#include "../char_map.h"
#include "../err.h"
#include "../generic_char_map.h"
#include "../measured_strings.h"
#include "../modules.h"
#include "../messages.h"
#include "../modules.h"
//#include "../self_test.h"
 
#include "../netif/netif_device_id_type.h"
 
#ifdef NETWORKING_module
 
#include "../ip/ip.h"
62,126 → 51,101
 
#endif
 
#define LO_NAME "lo"
#define LO_FILENAME "/sbin/lo"
#define DP8390_ISA_NAME "dp8390_isa"
#define DP8390_ISA_FILENAME "/sbin/dp8380_isa"
#define ETHERNET_NAME "ethernet"
#define ETHERNET_FILENAME "/sbin/ethernet"
#define IP_NAME "ip"
#define IP_FILENAME "/sbin/ip"
#define IS_IN_INTERVAL( item, first_inclusive, last_exclusive ) ((( item ) >= ( first_inclusive )) && (( item ) < ( last_exclusive )))
 
typedef struct module_struct module_t;
typedef module_t * module_ref;
#define IS_NET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_FIRST, NET_LAST )
#define IS_NET_NETWORKING_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_NETWORKING_FIRST, NET_NETWORKING_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_ETHERNET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_ETHERNET_FIRST, NET_SOCKET_LAST )
 
typedef struct netif netif_t;
typedef netif_t * netif_ref;
int networking_initialize( void );
static void client_connection( ipc_callid_t iid, ipc_call_t * icall );
int main( int argc, char * argv[] );
int spawn( const char * fname );
int networking_call( ipc_callid_t callid );
int networking_message( ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3 );
 
typedef struct networking_globals networking_globals_t;
int networking_call( ipc_callid_t callid ){
return EOK;
}
 
DEVICE_MAP_DECLARE( netifs, netif_t )
int networking_message( ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3 ){
switch( method ){
case IPC_M_PHONE_HUNGUP:
return EOK;
}
return ENOTSUP;
}
 
GENERIC_CHAR_MAP_DECLARE( measured_strings, measured_string_t )
int spawn(const char *fname)
{
const char *argv[2];
int res;
 
GENERIC_CHAR_MAP_DECLARE( modules, module_t )
printf("Spawning %s\n", fname);
 
struct module_struct{
task_id_t task_id;
services_t service;
int phone;
int usage;
const char * name;
const char * filename;
};
argv[0] = fname;
argv[1] = NULL;
 
/** A present network interface device.
*/
struct netif{
/** A system-unique network interface identifier.
*/
netif_device_id_t id;
/** A serving network interface driver module index.
*/
module_ref driver_module;
/** A serving link layer module index.
*/
module_ref link_layer_module;
/** A serving internet layer module index.
*/
module_ref internet_layer_module;
/** A system-unique network interface name.
*/
char * name;
/** Configuration.
*/
measured_strings_t configuration;
};
res = task_spawn(fname, argv);
if( res != 0 ){
/* Success */
sleep(1);
}else return EINVAL;
 
/** A networking module global variables.
return EOK;
}
 
/** Initializes the module.
*/
struct networking_globals{
/** Present network interfaces.
*/
netifs_t netifs;
/** Network interface structure indices by names.
*/
char_map_t netif_names;
/** Available modules.
*/
modules_t modules;
/** Global configuration.
*/
measured_strings_t configuration;
};
 
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 main( int argc, char * argv[] );
int networking_call( ipc_callid_t callid );
int networking_initialize( void );
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 );
task_id_t spawn( const char * fname );
int startup( void );
netif_device_id_t generate_new_device_id( void );
 
static networking_globals_t networking_globals;
 
DEVICE_MAP_IMPLEMENT( netifs, netif_t )
 
GENERIC_CHAR_MAP_IMPLEMENT( measured_strings, measured_string_t )
 
GENERIC_CHAR_MAP_IMPLEMENT( modules, module_t )
 
int add_module( module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id ){
int networking_initialize( void ){
ERROR_DECLARE;
 
module_ref tmp_module;
#ifdef NETWORKING_modular
ERROR_PROPAGATE( spawn("/sbin/ip"));
// ERROR_PROPAGATE( spawn("/sbin/arp"));
// ERROR_PROPAGATE( spawn("/sbin/rarp"));
// ERROR_PROPAGATE( spawn("/sbin/icmp"));
// ERROR_PROPAGATE( spawn("/sbin/udp"));
ERROR_PROPAGATE( spawn("/sbin/tcp"));
// ERROR_PROPAGATE( spawn("/sbin/socket"));
#else
#ifdef NETWORKING_module
ipcarg_t phonehash;
 
tmp_module = ( module_ref ) malloc( sizeof( module_t ));
if( ! tmp_module ) return ENOMEM;
tmp_module->task_id = task_id;
tmp_module->phone = 0;
tmp_module->usage = 0;
tmp_module->name = name;
tmp_module->filename = filename;
tmp_module->service = service;
if( ERROR_OCCURED( modules_add( modules, tmp_module->name, tmp_module ))){
free( tmp_module );
return ERROR_CODE;
}
if( module ) * module = tmp_module;
ERROR_PROPAGATE( REGISTER_ME( SERVICE_IP, & phonehash ));
ERROR_PROPAGATE( ip_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_ARP, & phonehash ));
// ERROR_PROPAGATE( arp_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_RARP, & phonehash ));
// ERROR_PROPAGATE( rarp_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_ICMP, & phonehash ));
// ERROR_PROPAGATE( icmp_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_UDP, & phonehash ));
// ERROR_PROPAGATE( udp_initialize());
ERROR_PROPAGATE( REGISTER_ME( SERVICE_TCP, & phonehash ));
ERROR_PROPAGATE( tcp_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_SOCKET, & phonehash ));
// ERROR_PROPAGATE( socket_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_ETHERNET, & phonehash ));
// ERROR_PROPAGATE( ethernet_initialize());
#endif
#endif
return EOK;
}
 
/** Default thread for new connections.
*/
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;
ipc_callid_t callid;
ipc_call_t call;
ipcarg_t arg1, arg2, arg3;
int res;
 
/* Accept the connection */
ipc_answer_0( iid, EOK );
192,7 → 156,7
arg2 = 0;
arg3 = 0;
#ifdef NETWORKING_module
if( IS_NET_IL_MESSAGE( call ) || IS_NET_IP_MESSAGE( call )){
if( IS_NET_IP_MESSAGE( call )){
res = ip_call( callid );
if( res == EOK ){
res = ip_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
227,7 → 191,7
if( res == EOK ){
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_LL_MESSAGE( call ) || IS_NET_ETHERNET_MESSAGE( call )){
*//* }else if( IS_NET_ETHERNET_MESSAGE( call )){
res = ethernet_call( callid );
if( res == EOK ){
res = ethernet_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
241,406 → 205,19
#ifdef NETWORKING_module
}
#endif
ipc_answer_2( callid, res, arg1, arg2 );
ipc_answer_2( callid, EOK, arg1, arg2 );
}
}
 
/** Starts the module.
* Parameters are ignored.
*/
int main( int argc, char * argv[] ){
 
printf("\nTask %d - Networking: HelenOS Networking subsystem\n", task_get_id());
printf("networking : HelenOS Networking subsystem\n");
 
return start_service( SERVICE_NETWORKING, NULL, NULL, client_connection, networking_initialize );
}
 
int networking_call( ipc_callid_t callid ){
return EOK;
}
 
int networking_initialize( void ){
ERROR_DECLARE;
 
task_id_t task_id;
 
netifs_initialize( & networking_globals.netifs );
char_map_initialize( & networking_globals.netif_names );
modules_initialize( & networking_globals.modules );
measured_strings_initialize( & networking_globals.configuration );
 
// run self tests
// ERROR_PROPAGATE( self_test());
 
ERROR_PROPAGATE( add_module( NULL, & networking_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0 ));
ERROR_PROPAGATE( add_module( NULL, & networking_globals.modules, DP8390_ISA_NAME, DP8390_ISA_FILENAME, SERVICE_DP8390_ISA, 0 ));
ERROR_PROPAGATE( add_module( NULL, & networking_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0 ));
 
#ifdef NETWORKING_modular
task_id = spawn( "/sbin/ip" );
if( ! task_id ) return EINVAL;
ERROR_PROPAGATE( add_module( NULL, & networking_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_id ));
// if( ! spawn( "/sbin/udp" )) return EINVAL;
if( ! spawn( "/sbin/tcp" )) return EINVAL;
// if( ! spawn( "/sbin/socket" )) return EINVAL;
// not always necesssary
// if( ! spawn( "/sbin/arp" )) return EINVAL;
// if( ! spawn( "/sbin/rarp" )) return EINVAL;
// if( ! spawn( "/sbin/icmp" )) return EINVAL;
 
#else
#ifdef NETWORKING_module
ipcarg_t phonehash;
 
ERROR_PROPAGATE( REGISTER_ME( SERVICE_IP, & phonehash ));
ERROR_PROPAGATE( add_module( NULL, & networking_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_get_id()));
ERROR_PROPAGATE( ip_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_ARP, & phonehash ));
// ERROR_PROPAGATE( arp_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_RARP, & phonehash ));
// ERROR_PROPAGATE( rarp_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_ICMP, & phonehash ));
// ERROR_PROPAGATE( icmp_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_UDP, & phonehash ));
// ERROR_PROPAGATE( udp_initialize());
ERROR_PROPAGATE( REGISTER_ME( SERVICE_TCP, & phonehash ));
ERROR_PROPAGATE( tcp_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_SOCKET, & phonehash ));
// ERROR_PROPAGATE( socket_initialize());
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_ETHERNET, & phonehash ));
// ERROR_PROPAGATE( ethernet_initialize());
#endif
#endif
 
return EOK;
}
 
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;
char * data;
int index;
measured_string_ref setting;
measured_strings_ref configuration;
netif_ref netif;
 
// printf( "\nNetworking message: %d\n", method );
switch( method ){
// case IPC_M_CONNECT_ME_TO:
case IPC_M_PHONE_HUNGUP:
return EOK;
case NET_NETWORKING_DEVICE:
// TODO configure, register
// arg1 = netif id
printf( "\nNetworking: new netif %d", arg1 );
return EOK;
case NET_NETWORKING_GET_DEVICE_CONFIGURATION:
// 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 < arg2; ++ index ){
setting = measured_strings_find( configuration, strings[ index ].value );
if( ! setting ){
setting = measured_strings_find( & networking_globals.configuration, strings[ index ].value );
}
if( setting ){
strings[ index ].length = setting->length;
strings[ index ].value = setting->value;
}else{
strings[ index ].length = 0;
strings[ index ].value = NULL;
}
}
// strings should not contain received data anymore
free( data );
ERROR_CODE = measured_strings_reply( strings, arg2 );
free( strings );
return ERROR_CODE;
case NET_NETWORKING_GET_CONFIGURATION:
// arg1 = count
ERROR_PROPAGATE( measured_strings_receive( & strings, & data, arg1 ));
for( index = 0; index < arg1; ++ index ){
setting = measured_strings_find( & networking_globals.configuration, strings[ index ].value );
if( setting ){
strings[ index ].length = setting->length;
strings[ index ].value = setting->value;
}else{
strings[ index ].length = 0;
strings[ index ].value = NULL;
}
}
// strings should not contain received data anymore
free( data );
ERROR_CODE = measured_strings_reply( strings, arg1 );
free( strings );
return ERROR_CODE;
case NET_NETWORKING_STARTUP:
return startup();
}
return ENOTSUP;
}
 
/*
int parse_line( measured_strings_ref configuration, char * line ){
ERROR_DECLARE;
 
measured_string_ref setting;
char * name;
char * value;
 
// from the beginning
name = line;
// skip spaces
while( isspace( * name )) ++ name;
// remember the name start
value = name;
// skip the name
while( isalnum( * value ) || ( * value == '_' )){
// make uppercase
// * value = toupper( * value );
++ value;
}
if( * value == '=' ){
// terminate the name
* value = '\0';
}else{
// terminate the name
* value = '\0';
// skip until '='
++ value;
while(( * value ) && ( * value != '=' )) ++ value;
// not found?
if( * value != '=' ) return EINVAL;
}
++ value;
// skip spaces
while( isspace( * value )) ++ value;
// create a bulk measured string till the end
setting = measured_string_create_bulk( value, -1 );
if( ! setting ) return ENOMEM;
// add the configuration setting
if( ERROR_OCCURED( measured_strings_add( configuration, name, setting ))){
free( setting );
return ERROR_CODE;
}
return EOK;
}
*/
 
int add_configuration( measured_strings_ref configuration, const char * name, const char * value ){
ERROR_DECLARE;
 
measured_string_ref setting;
 
setting = measured_string_create_bulk( value, 0 );
if( ! setting ) return ENOMEM;
// add the configuration setting
if( ERROR_OCCURED( measured_strings_add( configuration, name, setting ))){
free( setting );
return ERROR_CODE;
}
return EOK;
}
 
netif_device_id_t generate_new_device_id( void ){
return netifs_count( & networking_globals.netifs ) + 1;
}
 
int read_configuration( void ){
ERROR_DECLARE;
 
netif_ref netif;
measured_string_ref setting;
services_t internet_service;
 
// read general configuration
ERROR_PROPAGATE( add_configuration( & networking_globals.configuration, "IPV", "4" ));
 
// read network interfaces configuration
 
// static loopback initialization
printf( "\nloopback initialization" );
netif = ( netif_ref ) malloc( sizeof( netif_t ));
if( ! netif ) return ENOMEM;
netif->id = generate_new_device_id();
ERROR_PROPAGATE( measured_strings_initialize( & netif->configuration ));
if( ERROR_OCCURED( add_configuration( & netif->configuration, "NAME", LO_NAME ))
|| ERROR_OCCURED( add_configuration( & netif->configuration, "NETIF", LO_NAME ))
|| ERROR_OCCURED( add_configuration( & netif->configuration, "IL", IP_NAME ))
|| ERROR_OCCURED( add_configuration( & netif->configuration, "IP_CONFIG", "STATIC" ))
|| ERROR_OCCURED( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" ))
|| ERROR_OCCURED( add_configuration( & netif->configuration, "NETMASK", "255.255.255.255" ))
){
measured_strings_destroy( & netif->configuration );
free( netif );
return ERROR_CODE;
}
// mandatory name
printf( "\n\tname" );
setting = measured_strings_find( & netif->configuration, "NAME" );
if( ! setting ){
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
netif->name = setting->value;
printf( " %s OK", netif->name );
// mandatory netif
printf( "\n\tnetif" );
setting = measured_strings_find( & netif->configuration, "NETIF" );
if( ! setting ){
printf( " unknown" );
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
// printf( " find %s in %d?", setting->value, modules_count( & networking_globals.modules ));
netif->driver_module = modules_find( & networking_globals.modules, setting->value );
if( ! netif->driver_module ){
printf( " not found" );
// TODO register the unknown one
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
printf( " found" );
if( ! netif->driver_module->task_id ){
netif->driver_module->task_id = spawn( netif->driver_module->filename );
if( ! netif->driver_module->task_id ){
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
}
if( ! netif->driver_module->phone ){
printf( " connect?" );
netif->driver_module->phone = connect_to_service( netif->driver_module->service );
}
printf( " connected" );
if( ERROR_OCCURED( ipc_call_sync_1_0( netif->driver_module->phone, NET_NETIF_PROBE, netif->id ))){
measured_strings_destroy( & netif->configuration );
free( netif );
return ERROR_CODE;
}
++ netif->driver_module->usage;
printf( " OK" );
// optional link layer
printf( "\n\tlink layer" );
setting = measured_strings_find( & netif->configuration, "LL" );
if( setting ){
netif->link_layer_module = modules_find( & networking_globals.modules, setting->value );
if( ! netif->link_layer_module ){
// TODO register the unknown one
-- netif->driver_module->usage;
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
if( ! netif->link_layer_module->task_id ){
netif->link_layer_module->task_id = spawn( netif->link_layer_module->filename );
if( ! netif->link_layer_module->task_id ){
-- netif->driver_module->usage;
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
}
if( ! netif->link_layer_module->phone ){
netif->link_layer_module->phone = connect_to_service( netif->link_layer_module->service );
}
if( ERROR_OCCURED( ipc_call_sync_2_0( netif->link_layer_module->phone, NET_LL_DEVICE, netif->id, netif->driver_module->service ))){
-- netif->driver_module->usage;
measured_strings_destroy( & netif->configuration );
free( netif );
return ERROR_CODE;
}
++ netif->link_layer_module->usage;
internet_service = netif->link_layer_module->service;
printf( " OK" );
}else{
internet_service = netif->driver_module->service;
printf( " none" );
}
// mandatory internet layer
printf( "\n\tinternet layer" );
setting = measured_strings_find( & netif->configuration, "IL" );
if( ! setting ){
-- netif->driver_module->usage;
-- netif->link_layer_module->usage;
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
printf( " set %s", setting->value );
netif->internet_layer_module = modules_find( & networking_globals.modules, setting->value );
if( ! netif->internet_layer_module ){
// TODO register the unknown one
-- netif->driver_module->usage;
-- netif->link_layer_module->usage;
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
printf( " found" );
if( ! netif->internet_layer_module->task_id ){
netif->internet_layer_module->task_id = spawn( netif->internet_layer_module->filename );
if( ! netif->internet_layer_module->task_id ){
-- netif->driver_module->usage;
-- netif->link_layer_module->usage;
measured_strings_destroy( & netif->configuration );
free( netif );
return EINVAL;
}
}
if( ! netif->internet_layer_module->phone ){
printf( " connect" );
netif->internet_layer_module->phone = connect_to_service( netif->internet_layer_module->service );
}
if( ERROR_OCCURED( ipc_call_sync_2_0( netif->internet_layer_module->phone, NET_IL_DEVICE, netif->id, internet_service ))){
measured_strings_destroy( & netif->configuration );
free( netif );
return ERROR_CODE;
}
++ netif->internet_layer_module->usage;
printf( " OK" );
if( ERROR_OCCURED( netifs_add( & networking_globals.netifs, netif->id, netif ))){
free( netif );
return ERROR_CODE;
}
printf( "\nloopback OK" );
// end of static loopback initialization
return EOK;
}
 
task_id_t spawn( const char * fname ){
const char * argv[ 2 ];
task_id_t res;
 
// printf( "Spawning %s\n", fname );
argv[ 0 ] = fname;
argv[ 1 ] = NULL;
res = task_spawn( fname, argv );
if( res != 0 ){
/* Success */
usleep( 50000 );
}
return res;
}
 
int startup( void ){
ERROR_DECLARE;
 
// read configuration files
if( ERROR_OCCURED( read_configuration())) return ERROR_CODE;
 
// start network interfaces and needed modules
// start_device( "/sbin/lo", "/sbin/dummy_link_layer" );
return EOK;
}
 
/** @}
*/
/branches/network/uspace/srv/net/networking/Makefile
32,7 → 32,6
LIBC_PREFIX = ../../../lib/libc
SOFTINT_PREFIX = ../../../lib/softint
include $(LIBC_PREFIX)/Makefile.toolchain
include ../../../../Makefile.config
 
LIBS = $(LIBC_PREFIX)/libc.a
 
42,10 → 41,7
OUTPUT = networking
SOURCES = \
networking.c \
../char_map.c \
../measured_strings.c \
../modules.c
# ../self_test.c
 
ifeq ($(NETWORKING), module)
SOURCES += ../ip/ip.c \
52,8 → 48,6
../tcp/tcp.c
endif
 
DEFS += -D NETWORKING_$(NETWORKING)
 
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
 
.PHONY: all clean depend disasm
83,4 → 77,4
$(AS) $(AFLAGS) $< -o $@
 
%.o: %.c
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
$(CC) $(DEFS) $(CFLAGS) -D NETWORKING_$(NETWORKING) -c $< -o $@
/branches/network/uspace/srv/net/ip/ip.c
32,7 → 32,6
 
/** @file
*/
 
#include <async.h>
#include <errno.h>
#include <stdio.h>
40,37 → 39,28
#include <ipc/services.h>
//#include <sys/mman.h>
 
#include "../err.h"
#include "../messages.h"
#include "../modules.h"
#include "../netif/netif_device_id_type.h"
 
#include "ip.h"
 
ip_globals_t ip_globals;
struct {
ipc_callid_t tcp_accepted;
} ip_globals;
 
DEVICE_MAP_IMPLEMENT( ip_netifs, ip_netif_t )
 
/** Initializes the module.
*/
int ip_initialize( void ){
ip_netifs_initialize( & ip_globals.netifs );
return EOK;
}
 
int ip_call( ipc_callid_t callid ){
ip_globals.tcp_accepted = callid;
return EOK;
}
 
int ip_message( ipc_callid_t callid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t * result1, ipcarg_t * result2, ipcarg_t * result3 ){
ERROR_DECLARE;
 
ip_netif_ref ip_netif;
 
// printf( "\nIP message %d", method );
int ip_message( ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3 ){
switch( method ){
// case IPC_M_CONNECT_ME_TO:
// case IPC_M_CONNECT_TO_ME:
case IPC_M_PHONE_HUNGUP:
return EOK;
case NET_IP_ECHO:
78,23 → 68,6
if( result2 ) * result2 = arg2;
if( result3 ) * result3 = arg3;
return EOK;
case NET_IL_DEVICE:
ip_netif = ( ip_netif_ref ) malloc( sizeof( ip_netif_t ));
if( ! ip_netif ) return ENOMEM;
ip_netif->device_id = arg1;
ip_netif->phone = connect_to_service( arg2 );
if( ERROR_OCCURED( ipc_call_sync_1_0( ip_netif->phone, NET_LL_REGISTER, arg1 ))){
free( ip_netif );
return ERROR_CODE;
}
if( ERROR_OCCURED( ip_netifs_add( & ip_globals.netifs, ip_netif->device_id, ip_netif ))){
free( ip_netif );
return ERROR_CODE;
}
return EOK;
case NET_IP_TCP_REGISTER:
ip_globals.tcp_phone = ipc_connect_to_me( callid, 0, 0, 0, 0 );
return EOK;
}
return ENOTSUP;
}
/branches/network/uspace/srv/net/ip/Makefile
44,11 → 44,8
SOURCES = \
$(NAME)_module.c \
$(NAME).c \
../module.c \
../modules.c
 
DEFS += -D NETWORKING_$(NETWORKING) -D $(NAME)_call=module_call -D $(NAME)_message=module_message -D $(NAME)_start_module=module_start -D $(NAME)_print_name=module_print_name
 
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
 
.PHONY: all clean depend disasm
78,4 → 75,4
$(AS) $(AFLAGS) $< -o $@
 
%.o: %.c
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
$(CC) $(DEFS) $(CFLAGS) -D NETWORKING_$(NETWORKING) -c $< -o $@
/branches/network/uspace/srv/net/ip/ip.h
39,31 → 39,10
 
#include <ipc/ipc.h>
 
#include "../netif/netif_device_id_type.h"
int ip_initialize( void );
int ip_call( ipc_callid_t callid );
int ip_message( ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3 );
 
typedef struct ip_netif ip_netif_t;
typedef ip_netif_t * ip_netif_ref;
 
typedef struct ip_globals ip_globals_t;
 
DEVICE_MAP_DECLARE( ip_netifs, ip_netif_t )
 
struct ip_netif{
netif_device_id_t device_id;
int phone;
// TODO configuration
};
 
struct ip_globals{
int networking_phone;
int tcp_phone;
ip_netifs_t netifs;
};
 
int ip_initialize( void );
int ip_call( ipc_callid_t callid );
int ip_message( ipc_callid_t callid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t * result1, ipcarg_t * result2, ipcarg_t * result3 );
 
#endif
 
/** @}
/branches/network/uspace/srv/net/ip/ip_module.c
32,36 → 32,52
 
/** @file
*/
 
#include <async.h>
#include <errno.h>
#include <stdio.h>
#include <ipc/ipc.h>
#include <ipc/services.h>
//#include <sys/mman.h>
 
#include "../modules.h"
 
#include "ip.h"
 
#define NAME "IP protocol"
static void client_connection( ipc_callid_t iid, ipc_call_t * icall );
int main( int argc, char * argv[] );
 
void ip_print_name( void );
int ip_start_module( void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall ));
/** Default thread for new connections.
*/
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;
 
extern ip_globals_t ip_globals;
/* Accept the connection */
ipc_answer_0( iid, EOK );
 
void ip_print_name( void ){
printf( NAME );
while( true ){
callid = async_get_call( & call );
arg1 = 0;
arg2 = 0;
arg3 = 0;
res = ip_call( callid );
if( res == EOK ){
res = ip_message( IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 );
}
ipc_answer_2( callid, res, arg1, arg2 );
}
}
 
int ip_start_module( void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall )){
services_t need[ 2 ];
int * need_phone[ 2 ];
/** Starts the module.
* Parameters are ignored.
*/
int main( int argc, char * argv[] ){
 
need[ 0 ] = SERVICE_NETWORKING;
need[ 1 ] = NULL;
need_phone[ 0 ] = & ip_globals.networking_phone;
need_phone[ 1 ] = NULL;
return start_service( SERVICE_IP, need, need_phone, client_connection, ip_initialize );
printf("ip : HelenOS IP network protocol\n");
 
return start_service( SERVICE_IP, NULL, NULL, client_connection, ip_initialize );
}
 
/** @}
/branches/network/uspace/srv/net/modules.c
33,10 → 33,12
/** @file
*/
#include <async.h>
#include <errno.h>
#include <ipc/ipc.h>
#include <ipc/services.h>
 
#include "err.h"
#include <stdio.h>
 
#include "modules.h"
 
#define MODULE_WAIT_TIME 10000
58,7 → 60,7
ipcarg_t phonehash;
ERROR_DECLARE;
 
if( ! client_connection ) return EINVAL;
if(( ! me ) || ( ! client_connection )) return EINVAL;
async_set_client_connection( client_connection );
 
if( need ){
77,7 → 79,7
if( initialize_me ) ERROR_PROPAGATE( initialize_me());
 
/* Register service at NS */
if( me ) ERROR_PROPAGATE( REGISTER_ME( me, & phonehash ));
ERROR_PROPAGATE( REGISTER_ME( me, & phonehash ));
 
async_manager();
 
/branches/network/uspace/srv/net/messages.h
33,92 → 33,29
/** @file
*/
 
#define NET_NETIF_COUNT 7
#define NET_NETWORKING_COUNT 4
#define NET_LL_COUNT 5
#define NET_ETHERNET_COUNT 0
#define NET_IL_COUNT 2
#define NET_IP_COUNT 4
#define NET_ARP_COUNT 0
#define NET_RARP_COUNT 0
#define NET_ICMP_COUNT 0
#define NET_UDP_COUNT 0
#define NET_TCP_COUNT 0
#define NET_SOCKET_COUNT 0
 
#define NET_FIRST 2000
 
#define NET_NETIF_FIRST NET_FIRST
#define NET_NETIF_LAST ( NET_NETIF_FIRST + NET_NETIF_COUNT )
 
#define NET_NETWORKING_FIRST ( NET_NETIF_LAST + 0 )
#define NET_NETWORKING_LAST ( NET_NETWORKING_FIRST + NET_NETWORKING_COUNT )
 
#define NET_LL_FIRST ( NET_NETWORKING_LAST + 0 )
#define NET_LL_LAST ( NET_LL_FIRST + NET_LL_COUNT )
#define NET_ETHERNET_FIRST ( NET_LL_LAST + 0 )
#define NET_ETHERNET_LAST ( NET_ETHERNET_FIRST + NET_ETHERNET_COUNT )
 
#define NET_IL_FIRST ( NET_ETHERNET_LAST + 0 )
#define NET_IL_LAST ( NET_IL_FIRST + NET_IL_COUNT )
#define NET_IP_FIRST ( NET_IL_LAST + 0 )
#define NET_IP_LAST ( NET_IP_FIRST + NET_IP_COUNT )
 
#define NET_NETWORKING_FIRST NET_FIRST
#define NET_NETWORKING_LAST ( NET_NETWORKING_FIRST + 0 )
#define NET_IP_FIRST ( NET_NETWORKING_LAST + 0 )
#define NET_IP_LAST ( NET_IP_FIRST + 1 )
#define NET_ARP_FIRST ( NET_IP_LAST + 0 )
#define NET_ARP_LAST ( NET_ARP_FIRST + NET_ARP_COUNT )
#define NET_ARP_LAST ( NET_ARP_FIRST + 0 )
#define NET_RARP_FIRST ( NET_ARP_LAST + 0 )
#define NET_RARP_LAST ( NET_RARP_FIRST + NET_RARP_COUNT )
#define NET_RARP_LAST ( NET_RARP_FIRST + 0 )
#define NET_ICMP_FIRST ( NET_RARP_LAST + 0 )
#define NET_ICMP_LAST ( NET_ICMP_FIRST + NET_ICMP_COUNT )
#define NET_ICMP_LAST ( NET_ICMP_FIRST + 0 )
#define NET_UDP_FIRST ( NET_ICMP_LAST + 0 )
#define NET_UDP_LAST ( NET_UDP_FIRST + NET_UDP_COUNT )
#define NET_UDP_LAST ( NET_UDP_FIRST + 0 )
#define NET_TCP_FIRST ( NET_UDP_LAST + 0 )
#define NET_TCP_LAST ( NET_TCP_FIRST + NET_TCP_COUNT )
 
#define NET_TCP_LAST ( NET_TCP_FIRST + 0 )
#define NET_SOCKET_FIRST ( NET_TCP_LAST + 0 )
#define NET_SOCKET_LAST ( NET_SOCKET_FIRST + NET_SOCKET_COUNT )
#define NET_SOCKET_LAST ( NET_SOCKET_FIRST + 0 )
#define NET_ETHERNET_FIRST ( NET_SOCKET_LAST + 0 )
#define NET_ETHERNET_LAST ( NET_ETHERNET_FIRST + 0 )
#define NET_LAST NET_ETHERNET_LAST
 
#define NET_LAST NET_SOCKET_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_NETWORKING_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_NETWORKING_FIRST, NET_NETWORKING_LAST )
#define IS_NET_LL_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_LL_FIRST, NET_LL_LAST )
#define IS_NET_ETHERNET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_ETHERNET_FIRST, NET_SOCKET_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 {
NET_NETIF_PROBE = NET_NETIF_FIRST,
NET_NETIF_PROBE_AUTO,
NET_NETIF_REGISTER,
NET_NETIF_SEND,
NET_NETIF_START,
NET_NETIF_STATS,
NET_NETIF_STOP,
NET_NETWORKING_DEVICE = NET_NETWORKING_FIRST,
NET_NETWORKING_GET_CONFIGURATION,
NET_NETWORKING_GET_DEVICE_CONFIGURATION,
NET_NETWORKING_STARTUP,
NET_LL_DEVICE = NET_LL_FIRST,
NET_LL_DEVICE_STATUS_CHANGED,
NET_LL_MTU_CHANGED,
NET_LL_RECEIVED,
NET_LL_REGISTER,
NET_IL_DEVICE = NET_IL_FIRST,
NET_IL_DEVICE_STATUS_CHANGED,
NET_IP_CONFIGURATION_DHCP = NET_IP_FIRST,
NET_IP_CONFIGURATION_STATIC,
NET_IP_ECHO,
NET_IP_TCP_REGISTER
NET_IP_ECHO = NET_IP_FIRST
} net_message;
 
/** @}
/branches/network/uspace/srv/net/modules.h
33,9 → 33,15
/** @file
*/
 
#include <errno.h>
#include <ipc/ipc.h>
#include <ipc/services.h>
 
#define ERROR_NAME error_check_return_value
#define ERROR_DECLARE int ERROR_NAME
#define ERROR_OCCURED( value ) (( ERROR_NAME = ( value )) != EOK )
#define ERROR_PROPAGATE( value ) if( ERROR_OCCURED( value )) return ERROR_NAME
 
#define REGISTER_ME( me, phonehash ) ipc_connect_to_me( PHONE_NS, ( me ), 0, 0, ( phonehash ))
 
int connect_to_service( services_t need );
/branches/network/uspace/Makefile
46,7 → 46,7
srv/fs/tmpfs \
srv/vfs \
srv/devmap \
srv/net \
srv/net/networking \
app/tetris \
app/tester \
app/klog \
69,6 → 69,17
CFLAGS += -DCONFIG_MIPS_FPU
endif
 
ifeq ($(NETWORKING), modular)
DIRS += srv/net/ip \
srv/net/tcp
# srv/net/arp \
# srv/net/rarp \
# srv/net/icmp \
# srv/net/udp \
# srv/net/socket \
# srv/net/drivers/ne2k_isa
endif
 
BUILDS := $(addsuffix .build,$(DIRS))
CLEANS := $(addsuffix .clean,$(DIRS))
 
/branches/network/boot/arch/ia32/Makefile.inc
50,10 → 50,8
$(USPACEDIR)/app/tester/tester \
$(USPACEDIR)/app/klog/klog \
$(USPACEDIR)/app/bdsh/bdsh \
$(USPACEDIR)/srv/net/networking/networking \
$(USPACEDIR)/srv/net/networking_startup/networking_startup \
$(USPACEDIR)/srv/net/netif/lo
# $(USPACEDIR)/srv/net/netif/dp8390_isa
$(USPACEDIR)/srv/net/networking/networking
# $(USPACEDIR)/srv/net/drivers/ne2k_isa
 
ifeq ($(NETWORKING), modular)
RD_TASKS += $(USPACEDIR)/srv/net/ip/ip \
/branches/network/Makefile
118,7 → 118,7
ifneq ($(MACHINE),)
$(MAKE) -C kernel ARCH=$(KARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) MACHINE=$(MACHINE)
else
$(MAKE) -C kernel ARCH=$(KARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) NETWORKING=$(NETWORKING)
$(MAKE) -C kernel ARCH=$(KARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG)
endif
$(MAKE) -C uspace ARCH=$(UARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) NETWORKING=$(NETWORKING)
ifneq ($(IMAGE),)