Subversion Repositories HelenOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 4718 → Rev 4719

/branches/network/uspace/srv/net/tl/tcp/Makefile
36,21 → 36,21
 
OUTPUT = $(NAME)
SOURCES = \
$(NAME).c \
$(NAME)_module.c \
$(NAME).c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c \
$(STRUCTURES)dynamic_fifo.c \
$(STRUCTURES)measured_strings.c \
$(NET_BASE)il/ip/ip_client.c \
$(NET_BASE)il/ip/ip_remote.c \
$(NET_BASE)il/icmp/icmp_client.c \
$(NET_BASE)il/icmp/icmp_common.c \
$(NET_BASE)il/icmp/icmp_remote.c \
$(NET_BASE)net/net_remote.c \
$(NET_BASE)socket/socket_core.c
$(NET_BASE)socket/socket_core.c \
$(NET_BASE)tl/icmp/icmp_client.c \
$(NET_BASE)tl/icmp/icmp_common.c \
$(NET_BASE)tl/icmp/icmp_remote.c \
$(STRUCTURES)dynamic_fifo.c \
$(STRUCTURES)measured_strings.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/tl/udp/Makefile
36,21 → 36,21
 
OUTPUT = $(NAME)
SOURCES = \
$(NAME).c \
$(NAME)_module.c \
$(NAME).c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)il/ip/ip_client.c \
$(NET_BASE)il/ip/ip_remote.c \
$(NET_BASE)net/net_remote.c \
$(NET_BASE)socket/socket_core.c \
$(NET_BASE)tl/icmp/icmp_client.c \
$(NET_BASE)tl/icmp/icmp_common.c \
$(NET_BASE)tl/icmp/icmp_remote.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c \
$(STRUCTURES)dynamic_fifo.c \
$(STRUCTURES)measured_strings.c \
$(NET_BASE)il/ip/ip_client.c \
$(NET_BASE)il/ip/ip_remote.c \
$(NET_BASE)il/icmp/icmp_client.c \
$(NET_BASE)il/icmp/icmp_common.c \
$(NET_BASE)il/icmp/icmp_remote.c \
$(NET_BASE)net/net_remote.c \
$(NET_BASE)socket/socket_core.c
$(STRUCTURES)measured_strings.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/tl/icmp/icmp_common.c
0,0 → 1,59
/*
* Copyright (c) 2009 Lukas Mejdrech
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup icmp
* @{
*/
 
/** @file
* ICMP common interface implementation.
* @see icmp_common.h
*/
 
#include <async.h>
#include <ipc/services.h>
 
#include "../../err.h"
#include "../../modules.h"
 
#include "../../include/icmp_common.h"
 
#include "icmp_messages.h"
 
int icmp_connect_module( services_t service ){
int phone;
 
phone = connect_to_service( SERVICE_ICMP );
if( phone >= 0 ){
async_req_0_0( phone, NET_ICMP_INIT );
}
return phone;
}
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp_api.c
0,0 → 1,68
/*
* Copyright (c) 2009 Lukas Mejdrech
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup icmp
* @{
*/
 
/** @file
* ICMP application interface implementation.
* @see icmp_api.h
*/
 
#include <async.h>
 
#include <ipc/ipc.h>
#include <ipc/services.h>
 
#include <sys/types.h>
 
#include "../../modules.h"
 
#include "../../include/icmp_api.h"
#include "../../include/inet.h"
#include "../../include/ip_codes.h"
#include "../../include/socket_codes.h"
 
#include "icmp_messages.h"
 
int icmp_echo_msg( int icmp_phone, size_t size, suseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen ){
aid_t message_id;
ipcarg_t result;
 
message_id = async_send_5( icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, ( ipcarg_t ) dont_fragment, NULL );
// send the address
ipc_data_write_start( icmp_phone, addr, addrlen );
// timeout version may cause inconsistency - there is also an inner timer
// return async_wait_timeout( message_id, & result, timeout );
async_wait_for( message_id, & result );
return ( int ) result;
}
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp_module.h
0,0 → 1,66
/*
* 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 icmp
* @{
*/
 
/** @file
* ICMP module functions.
* The functions are used as ICMP module entry points.
*/
 
#ifndef __NET_ICMP_MODULE_H__
#define __NET_ICMP_MODULE_H__
 
#include <async.h>
#include <ipc/ipc.h>
 
/** Initializes the ICMP module.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
*/
int icmp_initialize( async_client_conn_t client_connection );
 
/** Processes the ICMP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @see icmp_interface.h
* @see IS_NET_ICMP_MESSAGE()
*/
int icmp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
 
#endif
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp_remote.c
0,0 → 1,76
/*
* Copyright (c) 2009 Lukas Mejdrech
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup icmp
* @{
*/
 
/** @file
* ICMP interface implementation for standalone remote modules.
* @see icmp_interface.h
*/
 
#include <async.h>
#include <errno.h>
 
#include <ipc/ipc.h>
#include <ipc/services.h>
 
#include <sys/types.h>
 
#include "../../messages.h"
#include "../../modules.h"
 
#include "../../include/icmp_interface.h"
 
#include "../../structures/packet/packet_client.h"
 
#include "icmp_messages.h"
 
int icmp_destination_unreachable_msg( int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet ){
async_msg_3( icmp_phone, NET_ICMP_DEST_UNREACH, ( ipcarg_t ) code, ( ipcarg_t ) packet_get_id( packet ), ( ipcarg_t ) mtu );
return EOK;
}
 
int icmp_source_quench_msg( int icmp_phone, packet_t packet ){
async_msg_2( icmp_phone, NET_ICMP_SOURCE_QUENCH, 0, ( ipcarg_t ) packet_get_id( packet ));
return EOK;
}
 
int icmp_time_exceeded_msg( int icmp_phone, icmp_code_t code, packet_t packet ){
async_msg_2( icmp_phone, NET_ICMP_TIME_EXCEEDED, ( ipcarg_t ) code, ( ipcarg_t ) packet_get_id( packet ));
return EOK;
}
 
int icmp_parameter_problem_msg( int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet ){
async_msg_3( icmp_phone, NET_ICMP_PARAMETERPROB, ( ipcarg_t ) code, ( ipcarg_t ) packet_get_id( packet ), ( ipcarg_t ) pointer );
return EOK;
}
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp_messages.h
0,0 → 1,130
/*
* Copyright (c) 2009 Lukas Mejdrech
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup icmp
* @{
*/
 
/** @file
* ICMP module messages.
* @see icmp_interface.h
*/
 
#ifndef __NET_ICMP_MESSAGES__
#define __NET_ICMP_MESSAGES__
 
#include <ipc/ipc.h>
 
#include <sys/types.h>
 
#include "../../include/icmp_codes.h"
 
#include "../../messages.h"
 
/** ICMP module messages.
*/
typedef enum{
/** Sends echo request.
* @see icmp_echo()
*/
NET_ICMP_ECHO = NET_ICMP_FIRST,
/** Sends destination unreachable error message.
* @see icmp_destination_unreachable_msg()
*/
NET_ICMP_DEST_UNREACH,
/** Sends source quench error message.
* @see icmp_source_quench_msg()
*/
NET_ICMP_SOURCE_QUENCH,
/** Sends redirect error message.
* @see icmp_redirect_msg()
*/
NET_ICMP_REDIRECT,
/** Sends time exceeded error message.
* @see icmp_time_exceeded_msg()
*/
NET_ICMP_TIME_EXCEEDED,
/** Sends parameter problem error message.
* @see icmp_parameter_problem_msg()
*/
NET_ICMP_PARAMETERPROB,
/** Initializes new connection.
*/
NET_ICMP_INIT
} icmp_messages;
 
/** @name ICMP specific message parameters definitions
*/
/*@{*/
 
/** Returns the ICMP code message parameter.
* @param call The message call structure. Input parameter.
*/
#define ICMP_GET_CODE( call ) ( icmp_param_t ) IPC_GET_ARG1( call )
 
/** Returns the ICMP link MTU message parameter.
* @param call The message call structure. Input parameter.
*/
#define ICMP_GET_MTU( call ) ( icmp_param_t ) IPC_GET_ARG3( call )
 
/** Returns the pointer message parameter.
* @param call The message call structure. Input parameter.
*/
#define ICMP_GET_POINTER( call ) ( icmp_param_t ) IPC_GET_ARG3( call )
 
/** Returns the size message parameter.
* @param call The message call structure. Input parameter.
*/
#define ICMP_GET_SIZE( call ) ( size_t ) IPC_GET_ARG1( call )
 
/** Returns the timeout message parameter.
* @param call The message call structure. Input parameter.
*/
#define ICMP_GET_TIMEOUT( call ) ((( suseconds_t ) IPC_GET_ARG2( call )) * 1000 )
 
/** Returns the time to live message parameter.
* @param call The message call structure. Input parameter.
*/
#define ICMP_GET_TTL( call ) ( ip_ttl_t ) IPC_GET_ARG3( call )
 
/** Returns the type of service message parameter.
* @param call The message call structure. Input parameter.
*/
#define ICMP_GET_TOS( call ) ( ip_tos_t ) IPC_GET_ARG4( call )
 
/** Returns the dont fragment message parameter.
* @param call The message call structure. Input parameter.
*/
#define ICMP_GET_DONT_FRAGMENT( call ) ( int ) IPC_GET_ARG5( call )
 
/*@}*/
 
#endif
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp_header.h
0,0 → 1,126
/*
* Copyright (c) 2009 Lukas Mejdrech
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup icmp
* @{
*/
 
/** @file
* ICMP header definition.
* Names according to the linux src/include/linux/icmp.h header file.
*/
 
#ifndef __NET_ICMP_HEADER_H__
#define __NET_ICMP_HEADER_H__
 
#include <sys/types.h>
 
#include "../../include/in.h"
#include "../../include/icmp_codes.h"
 
/** Type definition of the echo specific data.
* @see icmp_echo
*/
typedef struct icmp_echo icmp_echo_t;
 
/** Type definition of the echo specific data pointer.
* @see icmp_echo
*/
typedef icmp_echo_t * icmp_echo_ref;
 
/** Echo specific data.
*/
struct icmp_echo{
/** Message idintifier.
*/
icmp_param_t id;
/** Message sequence number.
*/
icmp_param_t sequence;
} __attribute__ ((packed));
 
/** Type definition of the internet control message header.
* @see icmp_header
*/
typedef struct icmp_header icmp_header_t;
 
/** Type definition of the internet control message header pointer.
* @see icmp_header
*/
typedef icmp_header_t * icmp_header_ref;
 
/** Internet control message header.
*/
struct icmp_header{
/** Specifies the type of the message.
*/
uint8_t type;
/** Contains the error code for the datagram reported by this ICMP message.
* The interpretation is dependent on the message type.
*/
uint8_t code;
/** Contains the checksum for the ICMP message starting with the ICMP Type field.
* If the checksum does not match the contents, the datagram is discarded.
*/
uint16_t checksum;
/** Message specific data.
*/
union{
/** Echo specific data.
*/
icmp_echo_t echo;
/** Proposed gateway value.
*/
in_addr_t gateway;
/** Fragmentation needed specific data.
*/
struct{
/** Unused field.
*/
icmp_param_t _unused;
/** Proposed MTU.
*/
icmp_param_t mtu;
} frag;
/** Parameter problem specific data.
*/
struct{
/** Problem pointer.
*/
icmp_param_t pointer;
/** Unused field.
*/
icmp_param_t _unused;
} param;
} un;
} __attribute__ ((packed));
 
#endif
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp_client.c
0,0 → 1,67
/*
* Copyright (c) 2009 Lukas Mejdrech
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup icmp
* @{
*/
 
/** @file
* ICMP client interface implementation.
* @see icmp_client.h
*/
 
#include <errno.h>
 
#include <sys/types.h>
 
#include "../../include/icmp_codes.h"
#include "../../include/icmp_client.h"
 
#include "../../structures/packet/packet.h"
#include "../../structures/packet/packet_client.h"
 
#include "icmp_header.h"
 
int icmp_client_process_packet( packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu ){
icmp_header_ref header;
 
header = ( icmp_header_ref ) packet_get_data( packet );
if( ! header ) return ENOMEM;
if( type ) * type = header->type;
if( code ) * code = header->code;
if( pointer ) * pointer = header->un.param.pointer;
if( mtu ) * mtu = header->un.frag.mtu;
return sizeof( icmp_header_t );
}
 
int icmp_client_header_length( packet_t packet ){
return sizeof( icmp_header_t );
}
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp.c
0,0 → 1,581
/*
* 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 icmp
* @{
*/
 
/** @file
* ICMP module implementation.
* @see icmp.h
*/
 
#include <async.h>
#include <atomic.h>
#include <fibril.h>
#include <fibril_sync.h>
 
#include <ipc/ipc.h>
#include <ipc/services.h>
 
#include <sys/types.h>
 
#include "../../err.h"
#include "../../messages.h"
#include "../../modules.h"
 
#include "../../structures/packet/packet_client.h"
 
#include "../../include/byteorder.h"
#include "../../include/crc.h"
#include "../../include/icmp_api.h"
#include "../../include/icmp_client.h"
#include "../../include/icmp_codes.h"
#include "../../include/icmp_common.h"
#include "../../include/icmp_interface.h"
#include "../../include/il_interface.h"
#include "../../include/inet.h"
#include "../../include/ip_client.h"
#include "../../include/ip_interface.h"
#include "../../include/ip_protocols.h"
#include "../../include/socket_codes.h"
#include "../../include/socket_errno.h"
 
#include "../../tl/tl_messages.h"
 
#include "icmp.h"
#include "icmp_header.h"
#include "icmp_messages.h"
#include "icmp_module.h"
 
#define ICMP_KEEP_LENGTH 8
 
#define ICMP_CHECKSUM( header, length ) htons( ip_checksum(( uint8_t * ) ( header ), ( length )))
 
#define ICMP_ECHO_TEXT "Hello from HelenOS."
 
#define ICMP_GET_LOCK_KEY( id, sequence ) ((( id ) << 16 ) | ( sequence & 0xFFFF ))
 
/** Processes the received ICMP packet.
* Is used as an entry point from the underlying IP module.
* Releases the packet on error.
* @param device_id The device identifier. Ignored parameter.
* @param packet The received packet. Input/output parameter.
* @param receiver The target service. Ignored parameter.
* @param error The packet error reporting service. Prefixes the received packet. Input parameter.
* @returns EOK on success.
* @returns Other error codes as defined for the icmp_process_packet() function.
*/
int icmp_received_msg( device_id_t device_id, packet_t packet, services_t receiver, services_t error );
 
/** Processes the received ICMP packet.
* Notifies the destination socket application.
* @param packet The received packet. Input/output parameter.
* @param error The packet error reporting service. Prefixes the received packet. Input parameter.
* @returns EOK on success.
* @returns EINVAL if the packet is not valid.
* @returns EINVAL if the stored packet address is not the an_addr_t.
* @returns EINVAL if the packet does not contain any data.
* @returns NO_DATA if the packet content is shorter than the user datagram header.
* @returns ENOMEM if there is not enough memory left.
* @returns EADDRNOTAVAIL if the destination socket does not exist.
* @returns Other error codes as defined for the ip_client_process_packet() function.
*/
int icmp_process_packet( packet_t packet, services_t error );
 
/** Processes the client messages.
* Remenbers the assigned identifier and sequence numbers.
* Runs until the client module disconnects.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @returns EOK on success.
* @see icmp_interface.h
*/
int icmp_process_client_messages( ipc_callid_t callid, ipc_call_t call );
 
/** Releases the packet and returns the result.
* @param packet The packet queue to be released. Input parameter.
* @param result The result to be returned. Input parameter.
* @return The result parameter.
*/
int icmp_release_and_return( packet_t packet, int result );
 
int icmp_echo( icmp_param_t id, icmp_param_t sequence, size_t size, suseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen );
icmp_header_ref icmp_prepare_packet( packet_t packet );
int icmp_send_packet( icmp_type_t type, icmp_code_t code, packet_t packet, icmp_header_ref header, services_t error );
int process_echo_reply( packet_t packet, icmp_header_ref header, icmp_type_t type, icmp_code_t code );
 
/** ICMP global data.
*/
icmp_globals_t icmp_globals;
 
INT_MAP_IMPLEMENT( time_locks, atomic_t );
 
GENERIC_FIELD_IMPLEMENT( echo_data, icmp_echo_t );
 
int icmp_echo_msg( int icmp_phone, size_t size, suseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen ){
icmp_echo_ref echo_data;
int res;
 
fibril_rwlock_write_lock( & icmp_globals.lock );
// use the phone as the echo data index
echo_data = echo_data_get_index( & icmp_globals.echo_data, icmp_phone );
if( ! echo_data ){
res = ENOENT;
}else{
res = icmp_echo( echo_data->id, echo_data->sequence, size, timeout, ttl, tos, dont_fragment, addr, addrlen );
++ echo_data->sequence;
}
fibril_rwlock_write_unlock( & icmp_globals.lock );
return res;
}
 
int icmp_echo( icmp_param_t id, icmp_param_t sequence, size_t size, suseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen ){
ERROR_DECLARE;
 
icmp_header_ref header;
packet_t packet;
size_t offset;
uint8_t * data;
atomic_t * lock;
int result;
int index;
int lock_key;
struct sockaddr_in * address_in;
struct timeval time_before;
struct timeval time_after;
 
// TODO do not ask all the time
ERROR_PROPAGATE( ip_packet_size_req( icmp_globals.ip_phone, -1, & icmp_globals.addr_len, & icmp_globals.prefix, & icmp_globals.content, & icmp_globals.suffix ));
packet = packet_get_4( icmp_globals.net_phone, size, icmp_globals.addr_len, sizeof( icmp_header_t ) + icmp_globals.prefix, icmp_globals.suffix );
if( ! packet ) return ENOMEM;
// set the destination address
if( addrlen < sizeof( struct sockaddr )){
return icmp_release_and_return( packet, EINVAL );
}
switch( addr->sa_family ){
case AF_INET:
if( addrlen != sizeof( struct sockaddr_in )){
return icmp_release_and_return( packet, EINVAL );
}
address_in = ( struct sockaddr_in * ) addr;
if( ERROR_OCCURRED( packet_set_addr( packet, NULL, ( uint8_t * ) & address_in->sin_addr.s_addr, sizeof( address_in->sin_addr.s_addr )))){
return icmp_release_and_return( packet, ERROR_CODE );
}
break;
default:
return icmp_release_and_return( packet, EAFNOSUPPORT );
}
// allocate space in the packet
data = ( uint8_t * ) packet_suffix( packet, size );
if( ! data ){
return icmp_release_and_return( packet, ENOMEM );
}
offset = 0;
while( size > offset + sizeof( ICMP_ECHO_TEXT )){
memcpy( data + offset, ICMP_ECHO_TEXT, sizeof( ICMP_ECHO_TEXT ));
offset += sizeof( ICMP_ECHO_TEXT );
}
memcpy( data + offset, ICMP_ECHO_TEXT, size - offset );
header = icmp_prepare_packet( packet );
if( ! header ){
return icmp_release_and_return( packet, ENOMEM );
}
header->un.echo.id = id;
header->un.echo.sequence = sequence;
lock_key = ICMP_GET_LOCK_KEY( header->un.echo.id, header->un.echo.sequence );
// create a locked fuxed
lock = malloc( sizeof( * lock ));
if( ! lock ){
return icmp_release_and_return( packet, ENOMEM );
}
atomic_set( lock, 0 );
index = time_locks_add( & icmp_globals.time_locks, lock_key, lock );
if( index < 0 ){
free( lock );
return icmp_release_and_return( packet, index );
}
if( ERROR_OCCURRED( icmp_send_packet( ICMP_ECHO, 0, packet, header, 0 ))){
free( lock );
return icmp_release_and_return( packet, ERROR_CODE );
}
// unlock the global to allow unlocking and other fibrils to work
// try to lock again - may be unlocked by the reply
ERROR_PROPAGATE( gettimeofday( & time_before, NULL ));
do{
result = atomic_get( lock );
if( result ){
break;
}else{
fibril_rwlock_write_unlock( & icmp_globals.lock );
// TODO does not yield?
//printf( "y %d\n", fibril_yield());
fibril_yield();
fibril_rwlock_write_lock( & icmp_globals.lock );
ERROR_PROPAGATE( gettimeofday( & time_after, NULL ));
}
}while( tv_sub( & time_after, & time_before ) <= timeout );
if( ! result ){
result = ELIMIT;
}
// destroy the lock
time_locks_exclude_index( & icmp_globals.time_locks, index );
return result;
}
 
int icmp_destination_unreachable_msg( int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet ){
icmp_header_ref header;
 
header = icmp_prepare_packet( packet );
if( ! header ) return ENOMEM;
if( mtu ){
header->un.frag.mtu = mtu;
}
return icmp_send_packet( ICMP_DEST_UNREACH, code, packet, header, SERVICE_ICMP );
}
 
int icmp_source_quench_msg( int icmp_phone, packet_t packet ){
icmp_header_ref header;
 
header = icmp_prepare_packet( packet );
if( ! header ) return ENOMEM;
return icmp_send_packet( ICMP_SOURCE_QUENCH, 0, packet, header, SERVICE_ICMP );
}
 
int icmp_time_exceeded_msg( int icmp_phone, icmp_code_t code, packet_t packet ){
icmp_header_ref header;
 
header = icmp_prepare_packet( packet );
if( ! header ) return ENOMEM;
return icmp_send_packet( ICMP_TIME_EXCEEDED, code, packet, header, SERVICE_ICMP );
}
 
int icmp_parameter_problem_msg( int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet ){
icmp_header_ref header;
 
header = icmp_prepare_packet( packet );
if( ! header ) return ENOMEM;
header->un.param.pointer = pointer;
return icmp_send_packet( ICMP_PARAMETERPROB, code, packet, header, SERVICE_ICMP );
}
 
icmp_header_ref icmp_prepare_packet( packet_t packet ){
icmp_header_ref header;
int header_length;
size_t total_length;
 
total_length = packet_get_data_length( packet );
if( total_length <= 0 ) return NULL;
header_length = ip_client_header_length( packet );
if( header_length <= 0 ) return NULL;
// truncate if longer than 64 bits (without the IP header)
if( total_length - header_length > ICMP_KEEP_LENGTH ){
if( packet_trim( packet, 0, total_length - header_length - ICMP_KEEP_LENGTH ) != EOK ) return NULL;
}
header = PACKET_PREFIX( packet, icmp_header_t );
if( ! header ){
pq_release( icmp_globals.net_phone, packet_get_id( packet ));
return NULL;
}
bzero( header, sizeof( * header ));
return header;
}
 
int icmp_send_packet( icmp_type_t type, icmp_code_t code, packet_t packet, icmp_header_ref header, services_t error ){
ERROR_DECLARE;
 
header->type = type;
header->code = code;
header->checksum = 0;
header->checksum = ICMP_CHECKSUM( header, packet_get_data_length( packet ));
if( ERROR_OCCURRED( ip_client_prepare_packet( packet, IPPROTO_ICMP, 0, 0, 0, 0 ))){
pq_release( icmp_globals.net_phone, packet_get_id( packet ));
return ERROR_CODE;
}
return ip_send_msg( icmp_globals.ip_phone, -1, packet, SERVICE_ICMP, error );
}
 
int icmp_connect_module( services_t service ){
icmp_echo_ref echo_data;
int index;
 
echo_data = ( icmp_echo_ref ) malloc( sizeof( * echo_data ));
if( ! echo_data ) return ENOMEM;
// assign a new identifier
fibril_rwlock_write_lock( & icmp_globals.lock );
++ icmp_globals.last_used_id;
echo_data->id = icmp_globals.last_used_id;
echo_data->sequence = 0;
// remember the assigned echo data
index = echo_data_add( & icmp_globals.echo_data, echo_data );
if( index < 0 ){
free( echo_data );
}
fibril_rwlock_write_unlock( & icmp_globals.lock );
// return the echo data index as the ICMP phone
return index;
}
 
int icmp_initialize( async_client_conn_t client_connection ){
ERROR_DECLARE;
 
fibril_rwlock_initialize( & icmp_globals.lock );
fibril_rwlock_write_lock( & icmp_globals.lock );
time_locks_initialize( & icmp_globals.time_locks );
echo_data_initialize( & icmp_globals.echo_data );
icmp_globals.ip_phone = ip_bind_service( SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP, client_connection, icmp_received_msg );
if( icmp_globals.ip_phone < 0 ){
return icmp_globals.ip_phone;
}
ERROR_PROPAGATE( ip_packet_size_req( icmp_globals.ip_phone, -1, & icmp_globals.addr_len, & icmp_globals.prefix, & icmp_globals.content, & icmp_globals.suffix ));
icmp_globals.prefix += sizeof( icmp_header_t );
icmp_globals.content -= sizeof( icmp_header_t );
fibril_rwlock_write_unlock( & icmp_globals.lock );
return EOK;
}
 
int icmp_received_msg( device_id_t device_id, packet_t packet, services_t receiver, services_t error ){
ERROR_DECLARE;
 
if( ERROR_OCCURRED( icmp_process_packet( packet, error ))){
pq_release( icmp_globals.net_phone, packet_get_id( packet ));
return ERROR_CODE;
}
 
return EOK;
}
 
int icmp_process_packet( packet_t packet, services_t error ){
ERROR_DECLARE;
 
size_t length;
uint8_t * src;
int addrlen;
int result;
void * data;
icmp_header_ref header;
icmp_type_t type;
icmp_code_t code;
 
if( error ){
switch( error ){
case SERVICE_ICMP:
// process error
// TODO remove debug dump
// length = icmp_client_header_length( packet );
result = icmp_client_process_packet( packet, & type, & code, NULL, NULL );
if( result < 0 ) return result;
length = ( size_t ) result;
printf( "ICMP error %d (%d) in packet %d\n", type, code, packet_get_id( packet ) );
ERROR_PROPAGATE( packet_trim( packet, length, 0 ));
break;
default:
return ENOTSUP;
}
}
// get rid of the ip header
result = ip_client_process_packet( packet, NULL, NULL, NULL, NULL, NULL );
if( result < 0 ) return result;
packet_trim( packet, ( size_t ) result, 0 );
 
length = packet_get_data_length( packet );
if( length <= 0 ) return EINVAL;
if( length < sizeof( icmp_header_t )) return EINVAL;
data = packet_get_data( packet );
if( ! data ) return EINVAL;
// get icmp header
header = ( icmp_header_ref ) data;
// checksum
if(( header->checksum ) && ( ICMP_CHECKSUM( header, length ))){
return EINVAL;
}
switch( header->type ){
case ICMP_ECHOREPLY:
return process_echo_reply( packet, header, ICMP_ECHO, 0 );
case ICMP_ECHO:
if( error ){
return process_echo_reply( packet, header, type, code );
}else{
addrlen = packet_get_addr( packet, & src, NULL );
if(( addrlen > 0 )
// set both addresses to the source one (avoids the source address deletion before setting the destination one)
&& ( packet_set_addr( packet, src, src, ( size_t ) addrlen ) == EOK )){
// send the reply
return icmp_send_packet( ICMP_ECHOREPLY, 0, packet, header, 0 );
}else{
return icmp_release_and_return( packet, EINVAL );
}
}
case ICMP_DEST_UNREACH:
case ICMP_SOURCE_QUENCH:
case ICMP_REDIRECT:
case ICMP_ALTERNATE_ADDR:
case ICMP_ROUTER_ADV:
case ICMP_ROUTER_SOL:
case ICMP_TIME_EXCEEDED:
case ICMP_PARAMETERPROB:
case ICMP_CONVERSION_ERROR:
case ICMP_REDIRECT_MOBILE:
case ICMP_SKIP:
case ICMP_PHOTURIS:
fibril_rwlock_read_lock( & icmp_globals.lock );
ip_received_error_msg( icmp_globals.ip_phone, -1, packet, SERVICE_IP, SERVICE_ICMP );
fibril_rwlock_read_unlock( & icmp_globals.lock );
return EOK;
default:
return icmp_release_and_return( packet, ENOTSUP );
}
}
 
int process_echo_reply( packet_t packet, icmp_header_ref header, icmp_type_t type, icmp_code_t code ){
int lock_key;
atomic_t * lock;
 
lock_key = ICMP_GET_LOCK_KEY( header->un.echo.id, header->un.echo.sequence );
fibril_rwlock_write_lock( & icmp_globals.lock );
lock = time_locks_find( & icmp_globals.time_locks, lock_key );
if( lock ){
// unlock the lock for the waiting fibril
atomic_set( lock, type );
}
pq_release( icmp_globals.net_phone, packet_get_id( packet ));
fibril_rwlock_write_unlock( & icmp_globals.lock );
return EOK;
}
 
int icmp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
ERROR_DECLARE;
 
packet_t packet;
 
* answer_count = 0;
switch( IPC_GET_METHOD( * call )){
case NET_TL_RECEIVED:
if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
ERROR_CODE = icmp_received_msg( IPC_GET_DEVICE( call ), packet, SERVICE_ICMP, IPC_GET_ERROR( call ));
}
return ERROR_CODE;
case NET_ICMP_INIT:
return icmp_process_client_messages( callid, * call );
}
return ENOTSUP;
}
 
int icmp_process_client_messages( ipc_callid_t callid, ipc_call_t call ){
ERROR_DECLARE;
 
bool keep_on_going = true;
fibril_rwlock_t lock;
ipc_call_t answer;
int answer_count;
packet_t packet;
size_t addrlen;
struct sockaddr * addr;
icmp_param_t id;
icmp_param_t sequence = 0;
ipc_callid_t data_callid;
 
/*
* Accept the connection
* - Answer the first NET_ICMP_INIT call.
*/
ipc_answer_0( callid, EOK );
 
fibril_rwlock_initialize( & lock );
 
// assign a new identifier
fibril_rwlock_write_lock( & icmp_globals.lock );
++ icmp_globals.last_used_id;
id = icmp_globals.last_used_id;
fibril_rwlock_write_unlock( & icmp_globals.lock );
 
while( keep_on_going ){
refresh_answer( & answer, & answer_count );
 
callid = async_get_call( & call );
 
switch( IPC_GET_METHOD( call )){
case IPC_M_PHONE_HUNGUP:
keep_on_going = false;
ERROR_CODE = EOK;
break;
case NET_ICMP_ECHO:
fibril_rwlock_write_lock( & lock );
if( ! ipc_data_write_receive( & data_callid, & addrlen )){
ERROR_CODE = EINVAL;
}else{
addr = malloc( addrlen );
if( ! addr ){
ERROR_CODE = ENOMEM;
}else{
if( ! ERROR_OCCURRED( ipc_data_write_finalize( data_callid, addr, addrlen ))){
fibril_rwlock_write_lock( & icmp_globals.lock );
ERROR_CODE = icmp_echo( id, sequence, ICMP_GET_SIZE( call ), ICMP_GET_TIMEOUT( call ), ICMP_GET_TTL( call ), ICMP_GET_TOS( call ), ICMP_GET_DONT_FRAGMENT( call ), addr, addrlen );
fibril_rwlock_write_unlock( & icmp_globals.lock );
free( addr );
++ sequence;
}
}
}
fibril_rwlock_write_unlock( & lock );
break;
case NET_ICMP_DEST_UNREACH:
if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( & call )))){
ERROR_CODE = icmp_destination_unreachable_msg( 0, ICMP_GET_CODE( call ), ICMP_GET_MTU( call ), packet );
}
break;
case NET_ICMP_SOURCE_QUENCH:
if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( & call )))){
ERROR_CODE = icmp_source_quench_msg( 0, packet );
}
case NET_ICMP_TIME_EXCEEDED:
if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( & call )))){
ERROR_CODE = icmp_time_exceeded_msg( 0, ICMP_GET_CODE( call ), packet );
}
break;
case NET_ICMP_PARAMETERPROB:
if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( & call )))){
ERROR_CODE = icmp_parameter_problem_msg( 0, ICMP_GET_CODE( call ), ICMP_GET_POINTER( call ), packet );
}
default:
ERROR_CODE = ENOTSUP;
}
 
answer_call( callid, ERROR_CODE, & answer, answer_count );
}
 
return EOK;
}
 
int icmp_release_and_return( packet_t packet, int result ){
pq_release( icmp_globals.net_phone, packet_get_id( packet ));
return result;
}
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/Makefile
0,0 → 1,53
#
# Copyright (c) 2009 Lukas Mejdrech
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
NAME = icmp
 
NET_BASE = ../../
STRUCTURES = $(NET_BASE)structures/
 
## Sources
#
 
OUTPUT = $(NAME)
SOURCES = \
$(NAME).c \
$(NAME)_module.c \
$(NAME)_client.c \
$(NET_BASE)crc.c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)il/ip/ip_client.c \
$(NET_BASE)il/ip/ip_remote.c \
$(NET_BASE)net/net_remote.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c \
$(STRUCTURES)measured_strings.c
 
include $(NET_BASE)Makefile.module
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp.h
0,0 → 1,108
/*
* 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 icmp
* @{
*/
 
/** @file
* ICMP module.
*/
 
#ifndef __NET_ICMP_H__
#define __NET_ICMP_H__
 
#include <atomic.h>
#include <fibril_sync.h>
 
#include "../../include/icmp_codes.h"
 
#include "../../structures/int_map.h"
#include "../../structures/generic_field.h"
 
#include "icmp_header.h"
 
/** Type definition of the ICMP global data.
* @see icmp_globals
*/
typedef struct icmp_globals icmp_globals_t;
 
/** Timeout locks map.
* Maps message identifiers to timeout implementing atomic variables.
* Sending fibril waits for its associated atomic variable to be set nonzero.
* Receiving fibril sets the associated atomic variable with the return value.
*/
INT_MAP_DECLARE( time_locks, atomic_t );
 
/** Echo specific data field.
* Used for bundle modules.
* The bundle module gets an index to the assigned echo specific data while connecting.
* The index is used in the future semi-remote calls instead of the ICMP phone.
*/
GENERIC_FIELD_DECLARE( echo_data, icmp_echo_t );
 
/** ICMP global data.
*/
struct icmp_globals{
/** IP module phone.
*/
int ip_phone;
/** Reserved packet prefix length.
*/
size_t prefix;
/** Maximal packet content length.
*/
size_t content;
/** Reserved packet suffix length.
*/
size_t suffix;
/** Packet address length.
*/
size_t addr_len;
/** Networking module phone.
*/
int net_phone;
/** The last used identifier number.
*/
icmp_param_t last_used_id;
/** The budled modules assigned echo specific data.
*/
echo_data_t echo_data;
/** Echo timeout locks.
*/
time_locks_t time_locks;
/** Safety lock.
*/
fibril_rwlock_t lock;
};
 
#endif
 
/** @}
*/
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp/icmp_module.c
0,0 → 1,120
/*
* 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 icmp
* @{
*/
 
/** @file
* ICMP standalone module implementation.
* Contains skeleton module functions mapping.
* The functions are used by the module skeleton as module specific entry points.
* @see module.c
*/
 
#include <async.h>
#include <stdio.h>
 
#include <ipc/ipc.h>
#include <ipc/services.h>
 
#include "../../err.h"
#include "../../modules.h"
 
#include "../../structures/packet/packet.h"
 
#include "../../include/net_interface.h"
 
#include "icmp.h"
#include "icmp_module.h"
 
/** ICMP module name.
*/
#define NAME "ICMP protocol"
 
/** Prints the module name.
* @see NAME
*/
void module_print_name( void );
 
/** Starts the ICMP module.
* Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @returns EOK on successful module termination.
* @returns Other error codes as defined for the arp_initialize() function.
* @returns Other error codes as defined for the REGISTER_ME() macro function.
*/
int module_start( async_client_conn_t client_connection );
 
/** Processes the ICMP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @returns EOK on success.
* @returns Other error codes as defined for the icmp_message() function.
*/
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
 
/** ICMP module global data.
*/
extern icmp_globals_t icmp_globals;
 
void module_print_name( void ){
printf( "%s", NAME );
}
 
int module_start( async_client_conn_t client_connection ){
ERROR_DECLARE;
 
ipcarg_t phonehash;
 
async_set_client_connection( client_connection );
icmp_globals.net_phone = net_connect_module( SERVICE_NETWORKING );
if( icmp_globals.net_phone < 0 ){
return icmp_globals.net_phone;
}
ERROR_PROPAGATE( pm_init());
if( ERROR_OCCURRED( icmp_initialize( client_connection ))
|| ERROR_OCCURRED( REGISTER_ME( SERVICE_ICMP, & phonehash ))){
pm_destroy();
return ERROR_CODE;
}
 
async_manager();
 
pm_destroy();
return EOK;
}
 
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
return icmp_message( callid, call, answer, answer_count );
}
 
/** @}
*/
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/network/uspace/srv/net/tl/icmp
Property changes:
Added: svn:mergeinfo
/branches/network/uspace/srv/net/app/ping/Makefile
41,8 → 41,8
$(NAME).c \
$(NET_BASE)app/parse.c \
$(NET_BASE)inet.c \
$(NET_BASE)il/icmp/icmp_api.c \
$(NET_BASE)il/icmp/icmp_common.c \
$(NET_BASE)modules.c
$(NET_BASE)modules.c \
$(NET_BASE)tl/icmp/icmp_api.c \
$(NET_BASE)tl/icmp/icmp_common.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/nil/eth/Makefile
33,16 → 33,16
 
OUTPUT = $(NAME)
SOURCES = \
$(NAME).c \
$(NAME)_module.c \
$(NAME).c \
$(NET_BASE)crc.c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)crc.c \
$(NET_BASE)net/net_remote.c \
$(NET_BASE)netif/netif_remote.c \
$(STRUCTURES)measured_strings.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)/packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c \
$(NET_BASE)netif/netif_remote.c \
$(NET_BASE)net/net_remote.c
$(STRUCTURES)packet/packet_remote.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/nil/nildummy/Makefile
33,15 → 33,15
 
OUTPUT = $(NAME)
SOURCES = \
$(NAME).c \
$(NAME)_module.c \
$(NAME).c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)net/net_remote.c \
$(NET_BASE)netif/netif_remote.c \
$(STRUCTURES)measured_strings.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)/packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c \
$(NET_BASE)netif/netif_remote.c \
$(NET_BASE)net/net_remote.c
$(STRUCTURES)packet/packet_remote.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/net/net_standalone.c
70,9 → 70,6
modules_initialize( & net_globals.modules );
measured_strings_initialize( & net_globals.configuration );
 
// run self tests
// ERROR_PROPAGATE( self_test());
 
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service ));
84,7 → 81,6
if( ! spawn( "/srv/icmp" )) return EINVAL;
if( ! spawn( "/srv/udp" )) return EINVAL;
if( ! spawn( "/srv/tcp" )) return EINVAL;
// if( ! spawn( "/srv/rarp" )) return EINVAL;
return EOK;
}
 
/branches/network/uspace/srv/net/net/net_bundle.c
49,7 → 49,7
 
#include "../il/arp/arp_module.h"
#include "../il/ip/ip_module.h"
#include "../il/icmp/icmp_module.h"
#include "../tl/icmp/icmp_module.h"
#include "../tl/udp/udp_module.h"
#include "../tl/tcp/tcp_module.h"
 
82,9 → 82,7
return ip_message( callid, call, answer, answer_count );
}else if( IS_NET_ARP_MESSAGE( call )){
return arp_message( callid, call, answer, answer_count );
/* }else if( IS_NET_RARP_MESSAGE( call )){
return rarp_message( callid, call, answer, answer_count );
*/ }else if( IS_NET_ICMP_MESSAGE( call )){
}else if( IS_NET_ICMP_MESSAGE( call )){
return icmp_message( callid, call, answer, answer_count );
}else if( IS_NET_UDP_MESSAGE( call )){
return udp_message( callid, call, answer, answer_count );
109,9 → 107,6
modules_initialize( & net_globals.modules );
measured_strings_initialize( & net_globals.configuration );
 
// run self tests
// ERROR_PROPAGATE( self_test());
 
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service ));
ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service ));
122,8 → 117,6
ERROR_PROPAGATE( ip_initialize( client_connection ));
ERROR_PROPAGATE( REGISTER_ME( SERVICE_ARP, & phonehash ));
ERROR_PROPAGATE( arp_initialize( client_connection ));
// ERROR_PROPAGATE( REGISTER_ME( SERVICE_RARP, & phonehash ));
// ERROR_PROPAGATE( rarp_initialize( client_connection ));
ERROR_PROPAGATE( REGISTER_ME( SERVICE_ICMP, & phonehash ));
ERROR_PROPAGATE( icmp_initialize( client_connection ));
ERROR_PROPAGATE( REGISTER_ME( SERVICE_UDP, & phonehash ));
/branches/network/uspace/srv/net/net/net.c
48,7 → 48,6
#include "../err.h"
#include "../messages.h"
#include "../modules.h"
//#include "../self_test.h"
 
#include "../structures/char_map.h"
#include "../structures/generic_char_map.h"
/branches/network/uspace/srv/net/net/Makefile
41,28 → 41,27
$(NAME).c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)netif/netif_remote.c \
$(STRUCTURES)char_map.c \
$(STRUCTURES)measured_strings.c \
$(STRUCTURES)module_map.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_server.c \
$(NET_BASE)netif/netif_remote.c
# $(NET_BASE)self_test.c
$(STRUCTURES)packet/packet_server.c
 
ifeq ($(NETWORKING), module)
 
SOURCES += $(NAME)_bundle.c \
$(NET_BASE)crc.c \
$(NET_BASE)inet.c \
$(NET_BASE)il/arp/arp.c \
$(NET_BASE)il/ip/ip.c \
$(NET_BASE)il/ip/ip_client.c \
$(NET_BASE)il/icmp/icmp.c \
$(NET_BASE)il/icmp/icmp_client.c \
$(NET_BASE)inet.c \
$(NET_BASE)socket/socket_core.c \
$(NET_BASE)tl/icmp/icmp.c \
$(NET_BASE)tl/icmp/icmp_client.c \
$(NET_BASE)tl/tcp/tcp.c \
$(NET_BASE)tl/udp/udp.c \
$(NET_BASE)socket/socket_core.c \
$(STRUCTURES)dynamic_fifo.c
 
else
/branches/network/uspace/srv/net/net/start/Makefile
39,11 → 39,11
OUTPUT = $(NAME)
SOURCES = \
$(NAME).c \
$(NET_BASE)crc.c \
$(NET_BASE)modules.c \
$(NET_BASE)self_test.c \
$(STRUCTURES)char_map.c \
$(STRUCTURES)dynamic_fifo.c \
$(STRUCTURES)measured_strings.c \
$(NET_BASE)crc.c
$(STRUCTURES)measured_strings.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/socket/Makefile
37,8 → 37,8
LIB = lib$(NAME).a
SOURCES = \
$(NAME)_client.c \
$(NET_BASE)inet.c \
$(NET_BASE)modules.c \
$(NET_BASE)inet.c \
$(STRUCTURES)dynamic_fifo.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/il/rarp
Property changes:
Deleted: svn:mergeinfo
/branches/network/uspace/srv/net/il/icmp/icmp.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/Makefile
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp_module.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp_common.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp_api.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp_module.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp_remote.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp_messages.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp_header.h
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp/icmp_client.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/il/icmp
Property changes:
Deleted: svn:mergeinfo
/branches/network/uspace/srv/net/il/arp/Makefile
36,16 → 36,16
 
OUTPUT = $(NAME)
SOURCES = \
$(NAME).c \
$(NAME)_module.c \
$(NAME).c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)net/net_remote.c \
$(NET_BASE)nil/nil_remote.c \
$(STRUCTURES)char_map.c \
$(STRUCTURES)measured_strings.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)/packet/packet_client.c \
$(STRUCTURES)/packet/packet_remote.c \
$(NET_BASE)nil/nil_remote.c \
$(NET_BASE)net/net_remote.c
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/il/ip/Makefile
36,23 → 36,23
 
OUTPUT = $(NAME)
SOURCES = \
$(NAME)_module.c \
$(NAME).c \
$(NAME)_client.c \
$(NAME)_module.c \
$(NET_BASE)crc.c \
$(NET_BASE)inet.c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)crc.c \
$(NET_BASE)il/arp/arp_remote.c \
$(NET_BASE)nil/nil_remote.c \
$(NET_BASE)net/net_remote.c \
$(NET_BASE)tl/icmp/icmp_remote.c \
$(NET_BASE)tl/icmp/icmp_client.c \
$(STRUCTURES)char_map.c \
$(STRUCTURES)measured_strings.c \
$(STRUCTURES)module_map.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)/packet/packet_client.c \
$(NET_BASE)inet.c \
$(STRUCTURES)/packet/packet_remote.c \
$(NET_BASE)il/arp/arp_remote.c \
$(NET_BASE)il/icmp/icmp_remote.c \
$(NET_BASE)il/icmp/icmp_client.c \
$(NET_BASE)nil/nil_remote.c \
$(NET_BASE)net/net_remote.c
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c
 
include $(NET_BASE)Makefile.module
/branches/network/uspace/srv/net/netif/dp8390/Makefile
26,7 → 26,7
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
NAME = netif
NAME = dp8390
 
NET_BASE = ../../
STRUCTURES = $(NET_BASE)structures/
36,14 → 36,14
## Sources
#
 
OUTPUT = dp8390
OUTPUT = $(NAME)
SOURCES = \
$(OUTPUT).c \
$(OUTPUT)_module.c \
../$(NAME).c \
$(NAME).c \
$(NAME)_module.c \
ne2000.c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)netif/netif.c \
$(STRUCTURES)measured_strings.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)packet/packet_client.c \
51,15 → 51,15
 
ifeq ($(NETWORKING), module)
 
SOURCES += ../$(NAME)_nil_bundle.c \
SOURCES += $(NET_BASE)crc.c \
$(NET_BASE)nil/eth/eth.c \
$(NET_BASE)crc.c \
$(NET_BASE)net/net_remote.c
$(NET_BASE)net/net_remote.c \
$(NET_BASE)netif/netif_nil_bundle.c
 
else
 
SOURCES += ../$(NAME)_standalone.c \
$(NET_BASE)nil/nil_remote.c
SOURCES += $(NET_BASE)nil/nil_remote.c \
$(NET_BASE)netif/netif_standalone.c
 
endif
 
/branches/network/uspace/srv/net/netif/lo/Makefile
26,7 → 26,7
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
NAME = netif
NAME = lo
 
NET_BASE = ../../
STRUCTURES = $(NET_BASE)structures/
36,27 → 36,27
## Sources
#
 
OUTPUT = lo
OUTPUT = $(NAME)
SOURCES = \
$(OUTPUT).c \
../$(NAME).c \
$(NAME).c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
$(NET_BASE)net/net_remote.c \
$(NET_BASE)netif/netif.c \
$(STRUCTURES)measured_strings.c \
$(STRUCTURES)packet/packet.c \
$(STRUCTURES)packet/packet_client.c \
$(STRUCTURES)packet/packet_remote.c \
$(NET_BASE)net/net_remote.c
$(STRUCTURES)packet/packet_remote.c
 
ifeq ($(NETWORKING), module)
 
SOURCES += ../$(NAME)_nil_bundle.c \
$(NET_BASE)nil/nildummy/nildummy.c
SOURCES += $(NET_BASE)nil/nildummy/nildummy.c \
$(NET_BASE)netif/netif_nil_bundle.c
 
else
 
SOURCES += ../$(NAME)_standalone.c \
$(NET_BASE)nil/nil_remote.c
SOURCES += $(NET_BASE)nil/nil_remote.c \
$(NET_BASE)netif/netif_standalone.c
 
endif
 
/branches/network/uspace/srv/net/Makefile
42,7 → 42,7
DIRS_MODULAR = \
il/arp \
il/ip \
il/icmp \
tl/icmp \
tl/udp \
tl/tcp \
 
/branches/network/boot/arch/ia32/Makefile.inc
74,7 → 74,7
$(USPACEDIR)/srv/net/il/arp/arp \
$(USPACEDIR)/srv/net/tl/udp/udp \
$(USPACEDIR)/srv/net/tl/tcp/tcp \
$(USPACEDIR)/srv/net/il/icmp/icmp
$(USPACEDIR)/srv/net/tl/icmp/icmp
endif
 
build: $(BASE)/image.iso