Subversion Repositories HelenOS

Rev

Rev 3666 | Rev 3846 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 2008 Lukas Mejdrech
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. /** @addtogroup net
  30.  * @{
  31.  */
  32.  
  33. /** @file
  34.  */
  35.  
  36. #define NET_NETIF_COUNT     7
  37. #define NET_NETWORKING_COUNT    4
  38. #define NET_LL_COUNT        5
  39. #define NET_ETHERNET_COUNT  0
  40. #define NET_IL_COUNT        2
  41. #define NET_IP_COUNT        4
  42. #define NET_ARP_COUNT       0
  43. #define NET_RARP_COUNT      0
  44. #define NET_ICMP_COUNT      0
  45. #define NET_UDP_COUNT       0
  46. #define NET_TCP_COUNT       0
  47. #define NET_SOCKET_COUNT    0
  48.  
  49. #define NET_FIRST       2000
  50.  
  51. #define NET_NETIF_FIRST     NET_FIRST
  52. #define NET_NETIF_LAST      ( NET_NETIF_FIRST + NET_NETIF_COUNT )
  53.  
  54. #define NET_NETWORKING_FIRST    ( NET_NETIF_LAST + 0 )
  55. #define NET_NETWORKING_LAST ( NET_NETWORKING_FIRST + NET_NETWORKING_COUNT )
  56.  
  57. #define NET_LL_FIRST        ( NET_NETWORKING_LAST + 0 )
  58. #define NET_LL_LAST     ( NET_LL_FIRST + NET_LL_COUNT )
  59. #define NET_ETHERNET_FIRST  ( NET_LL_LAST + 0 )
  60. #define NET_ETHERNET_LAST   ( NET_ETHERNET_FIRST + NET_ETHERNET_COUNT )
  61.  
  62. #define NET_IL_FIRST        ( NET_ETHERNET_LAST + 0 )
  63. #define NET_IL_LAST     ( NET_IL_FIRST + NET_IL_COUNT )
  64. #define NET_IP_FIRST        ( NET_IL_LAST + 0 )
  65. #define NET_IP_LAST     ( NET_IP_FIRST + NET_IP_COUNT )
  66.  
  67. #define NET_ARP_FIRST       ( NET_IP_LAST + 0 )
  68. #define NET_ARP_LAST        ( NET_ARP_FIRST + NET_ARP_COUNT )
  69. #define NET_RARP_FIRST      ( NET_ARP_LAST + 0 )
  70. #define NET_RARP_LAST       ( NET_RARP_FIRST + NET_RARP_COUNT )
  71. #define NET_ICMP_FIRST      ( NET_RARP_LAST + 0 )
  72. #define NET_ICMP_LAST       ( NET_ICMP_FIRST + NET_ICMP_COUNT )
  73. #define NET_UDP_FIRST       ( NET_ICMP_LAST + 0 )
  74. #define NET_UDP_LAST        ( NET_UDP_FIRST + NET_UDP_COUNT )
  75. #define NET_TCP_FIRST       ( NET_UDP_LAST + 0 )
  76. #define NET_TCP_LAST        ( NET_TCP_FIRST + NET_TCP_COUNT )
  77.  
  78. #define NET_SOCKET_FIRST    ( NET_TCP_LAST + 0 )
  79. #define NET_SOCKET_LAST     ( NET_SOCKET_FIRST + NET_SOCKET_COUNT )
  80.  
  81. #define NET_LAST        NET_SOCKET_LAST
  82.  
  83. #define NET_COUNT       ( NET_LAST - NET_FIRST )
  84.  
  85. #define IS_IN_INTERVAL( item, first_inclusive, last_exclusive ) ((( item ) >= ( first_inclusive )) && (( item ) < ( last_exclusive )))
  86.  
  87. #define IS_NET_MESSAGE( call )          IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_FIRST, NET_LAST )
  88. #define IS_NET_NETWORKING_MESSAGE( call )   IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_NETWORKING_FIRST, NET_NETWORKING_LAST )
  89. #define IS_NET_LL_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_LL_FIRST, NET_LL_LAST )
  90. #define IS_NET_ETHERNET_MESSAGE( call )     IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_ETHERNET_FIRST, NET_SOCKET_LAST )
  91. #define IS_NET_IL_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_IL_FIRST, NET_IL_LAST )
  92. #define IS_NET_IP_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_IP_FIRST, NET_IP_LAST )
  93. #define IS_NET_ARP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_ARP_FIRST, NET_ARP_LAST )
  94. #define IS_NET_RARP_MESSAGE( call )     IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_RARP_FIRST, NET_RARP_LAST )
  95. #define IS_NET_UDP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_UDP_FIRST, NET_UDP_LAST )
  96. #define IS_NET_TCP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_TCP_FIRST, NET_TCP_LAST )
  97. #define IS_NET_SOCKET_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_SOCKET_FIRST, NET_SOCKET_LAST )
  98.  
  99. typedef enum {
  100.     NET_NETIF_PROBE = NET_NETIF_FIRST,
  101.     NET_NETIF_PROBE_AUTO,
  102.     NET_NETIF_REGISTER,
  103.     NET_NETIF_SEND,
  104.     NET_NETIF_START,
  105.     NET_NETIF_STATS,
  106.     NET_NETIF_STOP,
  107.     NET_NETWORKING_DEVICE = NET_NETWORKING_FIRST,
  108.     NET_NETWORKING_GET_CONFIGURATION,
  109.     NET_NETWORKING_GET_DEVICE_CONFIGURATION,
  110.     NET_NETWORKING_STARTUP,
  111.     NET_LL_DEVICE = NET_LL_FIRST,
  112.     NET_LL_DEVICE_STATE_CHANGED,
  113.     NET_LL_MTU_CHANGED,
  114.     NET_LL_RECEIVED,
  115.     NET_LL_REGISTER,
  116.     NET_IL_DEVICE = NET_IL_FIRST,
  117.     NET_IL_DEVICE_STATE_CHANGED,
  118.     NET_IP_CONFIGURATION_DHCP = NET_IP_FIRST,
  119.     NET_IP_CONFIGURATION_STATIC,
  120.     NET_IP_ECHO,
  121.     NET_IP_TCP_REGISTER
  122. } net_message;
  123.  
  124. /** @}
  125.  */
  126.