/*
* 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 net
* @{
*/
/** @file
*/
#ifndef __NET_MESSAGES_H__
#define __NET_MESSAGES_H__
#define NET_NETIF_COUNT 6
#define NET_NET_COUNT 9
#define NET_NIL_COUNT 8
#define NET_ETH_COUNT 0
#define NET_IL_COUNT 3
#define NET_IP_COUNT 2
#define NET_ARP_COUNT 4
#define NET_RARP_COUNT 0
#define NET_ICMP_COUNT 0
#define NET_UDP_COUNT 0
#define NET_TCP_COUNT 0
#define NET_PACKET_COUNT 5
#define NET_SOCKET_COUNT 0
#define NET_FIRST 2000
#define NET_NETIF_FIRST NET_FIRST
#define NET_NETIF_LAST ( NET_NETIF_FIRST + NET_NETIF_COUNT )
#define NET_NET_FIRST ( NET_NETIF_LAST + 0 )
#define NET_NET_LAST ( NET_NET_FIRST + NET_NET_COUNT )
#define NET_NIL_FIRST ( NET_NET_LAST + 0 )
#define NET_NIL_LAST ( NET_NIL_FIRST + NET_NIL_COUNT )
#define NET_ETH_FIRST ( NET_NIL_LAST + 0 )
#define NET_ETH_LAST ( NET_ETH_FIRST + NET_ETH_COUNT )
#define NET_IL_FIRST ( NET_ETH_LAST + 0 )
#define NET_IL_LAST ( NET_IL_FIRST + NET_IL_COUNT )
#define NET_IP_FIRST ( NET_IL_LAST + 0 )
#define NET_IP_LAST ( NET_IP_FIRST + NET_IP_COUNT )
#define NET_ARP_FIRST ( NET_IP_LAST + 0 )
#define NET_ARP_LAST ( NET_ARP_FIRST + NET_ARP_COUNT )
#define NET_RARP_FIRST ( NET_ARP_LAST + 0 )
#define NET_RARP_LAST ( NET_RARP_FIRST + NET_RARP_COUNT )
#define NET_ICMP_FIRST ( NET_RARP_LAST + 0 )
#define NET_ICMP_LAST ( NET_ICMP_FIRST + NET_ICMP_COUNT )
#define NET_UDP_FIRST ( NET_ICMP_LAST + 0 )
#define NET_UDP_LAST ( NET_UDP_FIRST + NET_UDP_COUNT )
#define NET_TCP_FIRST ( NET_UDP_LAST + 0 )
#define NET_TCP_LAST ( NET_TCP_FIRST + NET_TCP_COUNT )
#define NET_SOCKET_FIRST ( NET_TCP_LAST + 0 )
#define NET_SOCKET_LAST ( NET_SOCKET_FIRST + NET_SOCKET_COUNT )
#define NET_PACKET_FIRST ( NET_SOCKET_LAST + 0 )
#define NET_PACKET_LAST ( NET_PACKET_FIRST + NET_PACKET_COUNT )
#define NET_LAST NET_PACKET_LAST
#define NET_COUNT ( NET_LAST - NET_FIRST )
#define IS_IN_INTERVAL( item, first_inclusive, last_exclusive ) ((( item ) >= ( first_inclusive )) && (( item ) < ( last_exclusive )))
#define IS_NET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_FIRST, NET_LAST )
#define IS_NET_NET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NET_FIRST, NET_NET_LAST )
#define IS_NET_NIL_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NIL_FIRST, NET_NIL_LAST )
#define IS_NET_ETH_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ETH_FIRST, NET_ETH_LAST )
#define IS_NET_IL_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IL_FIRST, NET_IL_LAST )
#define IS_NET_IP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IP_FIRST, NET_IP_LAST )
#define IS_NET_ARP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ARP_FIRST, NET_ARP_LAST )
#define IS_NET_RARP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_RARP_FIRST, NET_RARP_LAST )
#define IS_NET_UDP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_UDP_FIRST, NET_UDP_LAST )
#define IS_NET_TCP_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_TCP_FIRST, NET_TCP_LAST )
#define IS_NET_SOCKET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_SOCKET_FIRST, NET_SOCKET_LAST )
#define IS_NET_PACKET_MESSAGE( call ) IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_PACKET_FIRST, NET_PACKET_LAST )
typedef enum {
/* ( device_id, irq, io ) */
NET_NETIF_PROBE = NET_NETIF_FIRST,
/* () not supported, should ask networking for a name and register device */
NET_NETIF_PROBE_AUTO,
/* ( device_id, packet_id ) */
NET_NETIF_SEND,
/* ( device_id ) */
NET_NETIF_START,
/* ( device_id ), ipc_data_read( stats ) */
NET_NETIF_STATS,
/* ( device_id ) */
NET_NETIF_STOP,
/* () not supported, registers new device */
NET_NET_DEVICE = NET_NET_FIRST,
/* ( NULL, count ), measured_strings_send( names ), measured_strings_return( values ) */
NET_NET_GET_CONF,
/* ( device_id, count ), measured_strings_send( names ), measured_strings_return( values ) */
NET_NET_GET_DEVICE_CONF,
/* () not supported, measured_strings_send( names ), measured_strings_send( values ) */
NET_NET_SET_CONF,
/* ( device_id, count ) not supported, measured_strings_send( names ), measured_strings_send( values ) */
NET_NET_SET_DEVICE_CONF,
/* () */
NET_NET_STARTUP,
/* ( device_id ) */
NET_NET_START,
/* ( device_id ) */
NET_NET_STOP,
/* ( device_id ) ipc_data_read( stats ) */
NET_NET_STATS,
/* ( device_id, driver_service ) */
NET_NIL_DEVICE = NET_NIL_FIRST,
/* ( device_id, state ) */
NET_NIL_DEVICE_STATE,
/* ( device_id, mtu ) */
NET_NIL_MTU,
/* ( device_id ), packet_send */
NET_NIL_RECEIVED,
/* ( device_id ), packet_send */
NET_NIL_SEND,
/* ( device_id ) -> prefix, content, suffix */
NET_NIL_PACKET_SPACE,
/* ( device_id ), measured_strings_return( hardware address ) */
NET_NIL_ADDR,
/* ( device_id ), measured_strings_return( broadcast address ) */
NET_NIL_BROADCAST_ADDR,
/* ( service ), protocol */
// NET_NIL_PROTOCOL,
/* ( device_id, nil_service ) */
NET_IL_DEVICE = NET_IL_FIRST,
/* ( device_id, state ) */
NET_IL_DEVICE_STATE,
/* ( device_id ), packet_send */
NET_IL_RECEIVED,
/* ( device_id ), measured_strings_send( address ) */
// NET_IL_MY_ADDR,
NET_IP_ECHO = NET_IP_FIRST,
/* ( packet_id ) */
NET_IP_SEND,
/* ( device_id, nil_service, proto ), measured_strings_send( proto_addr ) */
NET_ARP_DEVICE = NET_ARP_FIRST,
/* ( device_id, protocol ), measured_strings_send( target ), measured_strings_return( translation ) */
NET_ARP_TRANSLATE,
/* ( device_id ) */
NET_ARP_CLEAR_DEVICE,
/* () */
NET_ARP_CLEAN_CACHE,
NET_PACKET_CREATE_1 = NET_PACKET_FIRST,
NET_PACKET_CREATE_5,
NET_PACKET_GET,
NET_PACKET_GET_SIZE,
NET_PACKET_RELEASE
} net_messages;
#endif
/** @}
*/