net.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009 Lukas Mejdrech
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00037 #ifndef LIBC_NET_MESSAGES_H_
00038 #define LIBC_NET_MESSAGES_H_
00039 
00040 #include <ipc/services.h>
00041 #include <net/device.h>
00042 #include <net/packet.h>
00043 
00051 #define IS_IN_INTERVAL(item, first_inclusive, last_exclusive) \
00052         (((item) >= (first_inclusive)) && ((item) < (last_exclusive)))
00053 
00056 
00057 #define NET_ARP_COUNT     5   
00058 #define NET_ETH_COUNT     0   
00059 #define NET_ICMP_COUNT    6   
00060 #define NET_IL_COUNT      6   
00061 #define NET_IP_COUNT      4   
00062 #define NET_NET_COUNT     3   
00063 #define NET_NETIF_COUNT   6   
00064 #define NET_NIL_COUNT     7   
00065 #define NET_PACKET_COUNT  5   
00066 #define NET_SOCKET_COUNT  14  
00067 #define NET_TCP_COUNT     0   
00068 #define NET_TL_COUNT      1   
00069 #define NET_UDP_COUNT     0   
00072 
00073 
00076 
00077 
00079 #define NET_FIRST  2000
00080 
00082 #define NET_NETIF_FIRST  NET_FIRST
00083 
00085 #define NET_NETIF_LAST  (NET_NETIF_FIRST + NET_NETIF_COUNT)
00086 
00088 #define NET_NET_FIRST  (NET_NETIF_LAST + 0)
00089 
00091 #define NET_NET_LAST  (NET_NET_FIRST + NET_NET_COUNT)
00092 
00094 #define NET_NIL_FIRST  (NET_NET_LAST + 0)
00095 
00097 #define NET_NIL_LAST  (NET_NIL_FIRST + NET_NIL_COUNT)
00098 
00100 #define NET_ETH_FIRST  (NET_NIL_LAST + 0)
00101 
00103 #define NET_ETH_LAST  (NET_ETH_FIRST + NET_ETH_COUNT)
00104 
00106 #define NET_IL_FIRST  (NET_ETH_LAST + 0)
00107 
00109 #define NET_IL_LAST  (NET_IL_FIRST + NET_IL_COUNT)
00110 
00112 #define NET_IP_FIRST  (NET_IL_LAST + 0)
00113 
00115 #define NET_IP_LAST  (NET_IP_FIRST + NET_IP_COUNT)
00116 
00118 #define NET_ARP_FIRST  (NET_IP_LAST + 0)
00119 
00121 #define NET_ARP_LAST  (NET_ARP_FIRST + NET_ARP_COUNT)
00122 
00124 #define NET_ICMP_FIRST  (NET_ARP_LAST + 0)
00125 
00127 #define NET_ICMP_LAST  (NET_ICMP_FIRST + NET_ICMP_COUNT)
00128 
00130 #define NET_TL_FIRST  (NET_ICMP_LAST + 0)
00131 
00133 #define NET_TL_LAST  (NET_TL_FIRST + NET_TL_COUNT)
00134 
00136 #define NET_UDP_FIRST  (NET_TL_LAST + 0)
00137 
00139 #define NET_UDP_LAST  (NET_UDP_FIRST + NET_UDP_COUNT)
00140 
00142 #define NET_TCP_FIRST  (NET_UDP_LAST + 0)
00143 
00145 #define NET_TCP_LAST  (NET_TCP_FIRST + NET_TCP_COUNT)
00146 
00148 #define NET_SOCKET_FIRST  (NET_TCP_LAST + 0)
00149 
00151 #define NET_SOCKET_LAST  (NET_SOCKET_FIRST + NET_SOCKET_COUNT)
00152 
00154 #define NET_PACKET_FIRST  (NET_SOCKET_LAST + 0)
00155 
00157 #define NET_PACKET_LAST  (NET_PACKET_FIRST + NET_PACKET_COUNT)
00158 
00160 #define NET_LAST  NET_PACKET_LAST
00161 
00163 #define NET_COUNT  (NET_LAST - NET_FIRST)
00164 
00170 #define IS_NET_MESSAGE(call) \
00171         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_FIRST, NET_LAST)
00172 
00178 #define IS_NET_ARP_MESSAGE(call) \
00179         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ARP_FIRST, NET_ARP_LAST)
00180 
00186 #define IS_NET_ETH_MESSAGE(call) \
00187         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ETH_FIRST, NET_ETH_LAST)
00188 
00194 #define IS_NET_ICMP_MESSAGE(call) \
00195         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ICMP_FIRST, NET_ICMP_LAST)
00196 
00202 #define IS_NET_IL_MESSAGE(call) \
00203         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IL_FIRST, NET_IL_LAST)
00204 
00210 #define IS_NET_IP_MESSAGE(call) \
00211         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IP_FIRST, NET_IP_LAST)
00212 
00218 #define IS_NET_NET_MESSAGE(call) \
00219         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NET_FIRST, NET_NET_LAST)
00220 
00226 #define IS_NET_NIL_MESSAGE(call) \
00227         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NIL_FIRST, NET_NIL_LAST)
00228 
00234 #define IS_NET_PACKET_MESSAGE(call) \
00235         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_PACKET_FIRST, NET_PACKET_LAST)
00236 
00242 #define IS_NET_SOCKET_MESSAGE(call) \
00243         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
00244 
00250 #define IS_NET_TCP_MESSAGE(call) \
00251         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TCP_FIRST, NET_TCP_LAST)
00252 
00258 #define IS_NET_TL_MESSAGE(call) \
00259         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TL_FIRST, NET_TL_LAST)
00260 
00266 #define IS_NET_UDP_MESSAGE(call) \
00267         IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_UDP_FIRST, NET_UDP_LAST)
00268 
00273 
00279 #define IPC_GET_DEVICE(call)  ((device_id_t) IPC_GET_ARG1(call))
00280 
00286 #define IPC_GET_PACKET(call)  ((packet_id_t) IPC_GET_ARG2(call))
00287 
00293 #define IPC_GET_COUNT(call)  ((size_t) IPC_GET_ARG2(call))
00294 
00300 #define IPC_GET_STATE(call)  ((device_state_t) IPC_GET_ARG2(call))
00301 
00307 #define IPC_GET_MTU(call)  ((size_t) IPC_GET_ARG2(call))
00308 
00314 #define IPC_GET_SERVICE(call)  ((services_t) IPC_GET_ARG3(call))
00315 
00321 #define IPC_GET_TARGET(call)  ((services_t) IPC_GET_ARG3(call))
00322 
00328 #define IPC_GET_SENDER(call)  ((services_t) IPC_GET_ARG3(call))
00329 
00335 #define IPC_GET_ERROR(call)  ((services_t) IPC_GET_ARG4(call))
00336 
00342 #define IPC_GET_PHONE(call)  ((int) IPC_GET_ARG5(call))
00343 
00350 #define IPC_SET_DEVICE(answer, value)  IPC_SET_ARG1(answer, (sysarg_t) (value))
00351 
00358 #define IPC_SET_ADDR(answer, value)  IPC_SET_ARG1(answer, (sysarg_t) (value))
00359 
00366 #define IPC_SET_PREFIX(answer, value)  IPC_SET_ARG2(answer, (sysarg_t) (value))
00367 
00374 #define IPC_SET_CONTENT(answer, value)  IPC_SET_ARG3(answer, (sysarg_t) (value))
00375 
00382 #define IPC_SET_SUFFIX(answer, value)  IPC_SET_ARG4(answer, (sysarg_t) (value))
00383 
00386 #endif
00387 

Generated on Thu Jun 2 07:45:47 2011 for HelenOS/USB by  doxygen 1.4.7