/branches/network/uspace/app/init/init.c |
---|
107,6 → 107,7 |
// FIXME: spawn("/sbin/pci"); |
spawn("/sbin/fb"); |
spawn("/sbin/kbd"); |
spawn("/sbin/networking"); |
spawn("/sbin/console"); |
console_wait(); |
/branches/network/uspace/doc/doxygroups.h |
---|
20,19 → 20,24 |
* @defgroup fbs Framebuffer Service |
* @ingroup srvcs |
*/ |
/** |
* @defgroup console Console Service |
* @ingroup srvcs |
*/ |
/** |
* @defgroup net Networking Service |
* @ingroup srvcs |
*/ |
/** |
* @cond amd64 |
* @defgroup pci PCI Service |
* @ingroup srvcs |
* @endcond |
*/ |
/** |
* @cond ia32 |
* @defgroup pci PCI Service |
39,18 → 44,19 |
* @ingroup srvcs |
* @endcond |
*/ |
/** |
* @defgroup emul Emulation Libraries |
* @ingroup uspace |
*/ |
/** |
* @defgroup sfl Softloat |
* @ingroup emul |
*/ |
/** |
* @defgroup softint Softint |
* @ingroup emul |
*/ |
/branches/network/uspace/lib/libc/include/ipc/services.h |
---|
43,7 → 43,16 |
SERVICE_VIDEO, |
SERVICE_CONSOLE, |
SERVICE_VFS, |
SERVICE_DEVMAP |
SERVICE_DEVMAP, |
SERVICE_NETWORKING, |
SERVICE_IP, |
SERVICE_ARP, |
SERVICE_RARP, |
SERVICE_ICMP, |
SERVICE_UDP, |
SERVICE_TCP, |
SERVICE_SOCKET, |
SERVICE_ETHERNET |
} services_t; |
/* Memory area to be received from NS */ |
/branches/network/uspace/srv/net/tcp/tcp.c |
---|
0,0 → 1,78 |
/* |
* 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 <async.h> |
#include <errno.h> |
#include <stdio.h> |
#include <ipc/ipc.h> |
#include <ipc/services.h> |
//#include <sys/mman.h> |
#include "../messages.h" |
#include "../modules.h" |
#include "tcp.h" |
struct { |
int ip_phone; |
} tcp_globals; |
/** Initializes the module. |
*/ |
int tcp_initialize( void ){ |
ipcarg_t arg1, arg2; |
ERROR_DECLARE; |
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; |
} |
int tcp_call( ipc_callid_t callid ){ |
return EOK; |
} |
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_PHONE_HUNGUP: |
return EOK; |
} |
return ENOTSUP; |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/tcp/tcp.h |
---|
0,0 → 1,58 |
/* |
* 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_TCP_INTERNALS_H__ |
#define __NET_TCP_INTERNALS_H__ |
#ifdef NETWORKING_modular |
#define ip_message( ... ) ipc_call_sync_3_3( tcp_globals.ip_phone, __VA_ARGS__ ) |
#else |
#ifdef NETWORKING_module |
#include "../ip/ip.h" |
#endif |
#endif |
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 ); |
#endif |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/tcp/tcp_module.c |
---|
0,0 → 1,96 |
/* |
* 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 <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" |
extern struct { |
int ip_phone; |
} tcp_globals; |
static void client_connection( ipc_callid_t iid, ipc_call_t * icall ); |
int main( int argc, char * argv[] ); |
/** 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; |
/* 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 ); |
} |
} |
/** 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 ] = NULL; |
need_phone[ 0 ] = & tcp_globals.ip_phone; |
need_phone[ 1 ] = NULL; |
return start_service( SERVICE_TCP, need, need_phone, client_connection, tcp_initialize ); |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/tcp/Makefile |
---|
0,0 → 1,78 |
# |
# Copyright (c) 2005 Martin Decky |
# 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. |
# |
NAME = tcp |
## Setup toolchain |
# |
LIBC_PREFIX = ../../../lib/libc |
SOFTINT_PREFIX = ../../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
LIBS = $(LIBC_PREFIX)/libc.a |
## Sources |
# |
OUTPUT = $(NAME) |
SOURCES = \ |
$(NAME)_module.c \ |
$(NAME).c \ |
../modules.c |
OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |
.PHONY: all clean depend disasm |
all: $(OUTPUT) $(OUTPUT).disasm |
-include Makefile.depend |
clean: |
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend |
depend: |
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend |
$(OUTPUT): $(OBJECTS) $(LIBS) |
$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map |
disasm: $(OUTPUT).disasm |
$(OUTPUT).disasm: $(OUTPUT) |
$(OBJDUMP) -d $< >$@ |
%.o: %.S |
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
%.o: %.s |
$(AS) $(AFLAGS) $< -o $@ |
%.o: %.c |
$(CC) $(DEFS) $(CFLAGS) -D NETWORKING_$(NETWORKING) -c $< -o $@ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/networking/networking.c |
---|
0,0 → 1,223 |
/* |
* 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 <async.h> |
#include <errno.h> |
#include <stdio.h> |
#include <task.h> |
#include <ipc/ipc.h> |
#include <ipc/services.h> |
//#include <sys/mman.h> |
#include "../modules.h" |
#include "../messages.h" |
#ifdef NETWORKING_module |
#include "../ip/ip.h" |
#include "../tcp/tcp.h" |
#endif |
#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_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 ) |
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 ); |
int networking_call( ipc_callid_t callid ){ |
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 ){ |
switch( method ){ |
case IPC_M_PHONE_HUNGUP: |
return EOK; |
} |
return ENOTSUP; |
} |
int spawn(const char *fname) |
{ |
const char *argv[2]; |
int res; |
printf("Spawning %s\n", fname); |
argv[0] = fname; |
argv[1] = NULL; |
res = task_spawn(fname, argv); |
if( res != 0 ){ |
/* Success */ |
sleep(1); |
}else return EINVAL; |
return EOK; |
} |
/** Initializes the module. |
*/ |
int networking_initialize( void ){ |
ERROR_DECLARE; |
#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; |
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; |
/* Accept the connection */ |
ipc_answer_0( iid, EOK ); |
while( true ){ |
callid = async_get_call( & call ); |
arg1 = 0; |
arg2 = 0; |
arg3 = 0; |
#ifdef NETWORKING_module |
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 ); |
} |
/* }else if( IS_NET_ARP_MESSAGE( call )){ |
res = arp_call( callid ); |
if( res == EOK ){ |
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 )){ |
res = rarp_call( callid ); |
if( res == EOK ){ |
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 )){ |
res = icmp_call( callid ); |
if( res == EOK ){ |
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 )){ |
res = udp_call( callid ); |
if( res == EOK ){ |
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 )){ |
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 ); |
} |
/* }else if( IS_NET_SOCKET_MESSAGE( call )){ |
res = socket_call( callid ); |
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_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 ); |
} |
*/ }else{ |
#endif |
res = networking_call( callid ); |
if( res == EOK ){ |
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, EOK, arg1, arg2 ); |
} |
} |
/** Starts the module. |
* Parameters are ignored. |
*/ |
int main( int argc, char * argv[] ){ |
printf("networking : HelenOS Networking subsystem\n"); |
return start_service( SERVICE_NETWORKING, NULL, NULL, client_connection, networking_initialize ); |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/networking/Makefile |
---|
0,0 → 1,80 |
# |
# Copyright (c) 2005 Martin Decky |
# 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. |
# |
## Setup toolchain |
# |
LIBC_PREFIX = ../../../lib/libc |
SOFTINT_PREFIX = ../../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
LIBS = $(LIBC_PREFIX)/libc.a |
## Sources |
# |
OUTPUT = networking |
SOURCES = \ |
networking.c \ |
../modules.c |
ifeq ($(NETWORKING), module) |
SOURCES += ../ip/ip.c \ |
../tcp/tcp.c |
endif |
OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |
.PHONY: all clean depend disasm |
all: $(OUTPUT) $(OUTPUT).disasm |
-include Makefile.depend |
clean: |
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend |
depend: |
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend |
$(OUTPUT): $(OBJECTS) $(LIBS) |
$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map |
disasm: $(OUTPUT).disasm |
$(OUTPUT).disasm: $(OUTPUT) |
$(OBJDUMP) -d $< >$@ |
%.o: %.S |
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
%.o: %.s |
$(AS) $(AFLAGS) $< -o $@ |
%.o: %.c |
$(CC) $(DEFS) $(CFLAGS) -D NETWORKING_$(NETWORKING) -c $< -o $@ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/ip/ip.c |
---|
0,0 → 1,76 |
/* |
* 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 <async.h> |
#include <errno.h> |
#include <stdio.h> |
#include <ipc/ipc.h> |
#include <ipc/services.h> |
//#include <sys/mman.h> |
#include "../messages.h" |
#include "../modules.h" |
#include "ip.h" |
struct { |
ipc_callid_t tcp_accepted; |
} ip_globals; |
/** Initializes the module. |
*/ |
int ip_initialize( void ){ |
return EOK; |
} |
int ip_call( ipc_callid_t callid ){ |
ip_globals.tcp_accepted = callid; |
return EOK; |
} |
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_PHONE_HUNGUP: |
return EOK; |
case NET_IP_ECHO: |
if( result1 ) * result1 = arg1; |
if( result2 ) * result2 = arg2; |
if( result3 ) * result3 = arg3; |
return EOK; |
} |
return ENOTSUP; |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/ip/Makefile |
---|
0,0 → 1,78 |
# |
# Copyright (c) 2005 Martin Decky |
# 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. |
# |
NAME = ip |
## Setup toolchain |
# |
LIBC_PREFIX = ../../../lib/libc |
SOFTINT_PREFIX = ../../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
LIBS = $(LIBC_PREFIX)/libc.a |
## Sources |
# |
OUTPUT = $(NAME) |
SOURCES = \ |
$(NAME)_module.c \ |
$(NAME).c \ |
../modules.c |
OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |
.PHONY: all clean depend disasm |
all: $(OUTPUT) $(OUTPUT).disasm |
-include Makefile.depend |
clean: |
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend |
depend: |
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend |
$(OUTPUT): $(OBJECTS) $(LIBS) |
$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map |
disasm: $(OUTPUT).disasm |
$(OUTPUT).disasm: $(OUTPUT) |
$(OBJDUMP) -d $< >$@ |
%.o: %.S |
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
%.o: %.s |
$(AS) $(AFLAGS) $< -o $@ |
%.o: %.c |
$(CC) $(DEFS) $(CFLAGS) -D NETWORKING_$(NETWORKING) -c $< -o $@ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/ip/ip.h |
---|
0,0 → 1,49 |
/* |
* 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_IP_INTERNALS_H__ |
#define __NET_IP_INTERNALS_H__ |
#include <ipc/ipc.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 ); |
#endif |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/ip/ip_module.c |
---|
0,0 → 1,84 |
/* |
* 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 <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" |
static void client_connection( ipc_callid_t iid, ipc_call_t * icall ); |
int main( int argc, char * argv[] ); |
/** 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; |
/* Accept the connection */ |
ipc_answer_0( iid, EOK ); |
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 ); |
} |
} |
/** Starts the module. |
* Parameters are ignored. |
*/ |
int main( int argc, char * argv[] ){ |
printf("ip : HelenOS IP network protocol\n"); |
return start_service( SERVICE_IP, NULL, NULL, client_connection, ip_initialize ); |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/modules.c |
---|
0,0 → 1,90 |
/* |
* 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 <async.h> |
#include <errno.h> |
#include <ipc/ipc.h> |
#include <ipc/services.h> |
#include <stdio.h> |
#include "modules.h" |
#define MODULE_WAIT_TIME 10000 |
int connect_to_service( services_t need ){ |
int phone; |
phone = ipc_connect_me_to( PHONE_NS, need, 0, 0 ); |
if( phone < 0 ){ |
do{ |
usleep( MODULE_WAIT_TIME ); |
phone = ipc_connect_me_to( PHONE_NS, need, 0, 0 ); |
}while( phone < 0 ); |
} |
return phone; |
} |
int start_service( services_t me, services_t need[], int * need_phone[], void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall ), int ( * initialize_me )( void )){ |
ipcarg_t phonehash; |
ERROR_DECLARE; |
if(( ! me ) || ( ! client_connection )) return EINVAL; |
async_set_client_connection( client_connection ); |
if( need ){ |
if( ! need_phone ) return EINVAL; |
while( * need ){ |
if( ! * need_phone ) return EINVAL; |
/* Connect to the needed service */ |
** need_phone = connect_to_service( * need ); |
++ need; |
++ need_phone; |
} |
} |
/* Initialize service by its callback */ |
if( initialize_me ) ERROR_PROPAGATE( initialize_me()); |
/* Register service at NS */ |
ERROR_PROPAGATE( REGISTER_ME( me, & phonehash )); |
async_manager(); |
return EOK; |
} |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/messages.h |
---|
0,0 → 1,62 |
/* |
* 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 |
*/ |
#define NET_FIRST 2000 |
#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 + 0 ) |
#define NET_RARP_FIRST ( NET_ARP_LAST + 0 ) |
#define NET_RARP_LAST ( NET_RARP_FIRST + 0 ) |
#define NET_ICMP_FIRST ( NET_RARP_LAST + 0 ) |
#define NET_ICMP_LAST ( NET_ICMP_FIRST + 0 ) |
#define NET_UDP_FIRST ( NET_ICMP_LAST + 0 ) |
#define NET_UDP_LAST ( NET_UDP_FIRST + 0 ) |
#define NET_TCP_FIRST ( NET_UDP_LAST + 0 ) |
#define NET_TCP_LAST ( NET_TCP_FIRST + 0 ) |
#define NET_SOCKET_FIRST ( NET_TCP_LAST + 0 ) |
#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 |
typedef enum { |
NET_IP_ECHO = NET_IP_FIRST |
} net_message; |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/srv/net/modules.h |
---|
0,0 → 1,51 |
/* |
* 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 <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 ); |
int start_service( services_t me, services_t need[], int * need_phone[], void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall ), int ( * initialize_me )( void )); |
/** @} |
*/ |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/branches/network/uspace/Makefile |
---|
46,6 → 46,7 |
srv/fs/tmpfs \ |
srv/vfs \ |
srv/devmap \ |
srv/net/networking \ |
app/tetris \ |
app/tester \ |
app/klog \ |
68,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)) |
93,4 → 105,4 |
-$(MAKE) -C $(basename $@) clean ARCH=$(ARCH) |
$(BUILDS): |
$(MAKE) -C $(basename $@) all ARCH=$(ARCH) COMPILER=$(COMPILER) |
$(MAKE) -C $(basename $@) all ARCH=$(ARCH) COMPILER=$(COMPILER) NETWORKING=$(NETWORKING) |
/branches/network/HelenOS.config |
---|
78,3 → 78,8 |
# Debug build |
! CONFIG_DEBUG (y/n) |
# Networking architecture |
@ "modular" Modular |
@ "module" One module |
! [PLATFORM=ia32] NETWORKING (choice) |
/branches/network/boot/arch/ia32/Makefile.inc |
---|
49,8 → 49,21 |
$(USPACEDIR)/app/tetris/tetris \ |
$(USPACEDIR)/app/tester/tester \ |
$(USPACEDIR)/app/klog/klog \ |
$(USPACEDIR)/app/bdsh/bdsh |
$(USPACEDIR)/app/bdsh/bdsh \ |
$(USPACEDIR)/srv/net/networking/networking |
# $(USPACEDIR)/srv/net/drivers/ne2k_isa |
ifeq ($(NETWORKING), modular) |
RD_TASKS += $(USPACEDIR)/srv/net/ip/ip \ |
$(USPACEDIR)/srv/net/tcp/tcp |
# $(USPACEDIR)/srv/net/arp \ |
# $(USPACEDIR)/srv/net/rarp \ |
# $(USPACEDIR)/srv/net/icmp \ |
# $(USPACEDIR)/srv/net/udp \ |
# $(USPACEDIR)/srv/net/socket \ |
# $(USPACEDIR)/srv/net/ethernet |
endif |
build: $(BASE)/image.iso |
$(BASE)/image.iso: arch/$(ARCH)/grub/stage2_eltorito arch/$(ARCH)/grub/menu.lst $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_TASKS) |
/branches/network/Makefile |
---|
120,11 → 120,11 |
else |
$(MAKE) -C kernel ARCH=$(KARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) |
endif |
$(MAKE) -C uspace ARCH=$(UARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) |
$(MAKE) -C uspace ARCH=$(UARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) NETWORKING=$(NETWORKING) |
ifneq ($(IMAGE),) |
$(MAKE) -C boot ARCH=$(BARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) IMAGE=$(IMAGE) |
$(MAKE) -C boot ARCH=$(BARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) NETWORKING=$(NETWORKING) IMAGE=$(IMAGE) |
else |
$(MAKE) -C boot ARCH=$(BARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) |
$(MAKE) -C boot ARCH=$(BARCH) COMPILER=$(COMPILER) CONFIG_DEBUG=$(CONFIG_DEBUG) NETWORKING=$(NETWORKING) |
endif |
config: |