Subversion Repositories HelenOS

Rev

Rev 3685 | Rev 3901 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3466 mejdrech 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
 
3846 mejdrech 36
#ifndef __NET_MESSAGES_H__
37
#define __NET_MESSAGES_H__
38
 
39
#define NET_NETIF_COUNT     6
40
#define NET_NET_COUNT       9
41
#define NET_NIL_COUNT       8
42
#define NET_ETH_COUNT       0
43
#define NET_IL_COUNT        3
44
#define NET_IP_COUNT        2
45
#define NET_ARP_COUNT       4
3666 mejdrech 46
#define NET_RARP_COUNT      0
47
#define NET_ICMP_COUNT      0
48
#define NET_UDP_COUNT       0
49
#define NET_TCP_COUNT       0
50
#define NET_SOCKET_COUNT    0
51
 
3466 mejdrech 52
#define NET_FIRST       2000
3666 mejdrech 53
 
54
#define NET_NETIF_FIRST     NET_FIRST
55
#define NET_NETIF_LAST      ( NET_NETIF_FIRST + NET_NETIF_COUNT )
56
 
3846 mejdrech 57
#define NET_NET_FIRST       ( NET_NETIF_LAST + 0 )
58
#define NET_NET_LAST        ( NET_NET_FIRST + NET_NET_COUNT )
3666 mejdrech 59
 
3846 mejdrech 60
#define NET_NIL_FIRST       ( NET_NET_LAST + 0 )
61
#define NET_NIL_LAST        ( NET_NIL_FIRST + NET_NIL_COUNT )
62
#define NET_ETH_FIRST       ( NET_NIL_LAST + 0 )
63
#define NET_ETH_LAST        ( NET_ETH_FIRST + NET_ETH_COUNT )
3666 mejdrech 64
 
3846 mejdrech 65
#define NET_IL_FIRST        ( NET_ETH_LAST + 0 )
3666 mejdrech 66
#define NET_IL_LAST     ( NET_IL_FIRST + NET_IL_COUNT )
67
#define NET_IP_FIRST        ( NET_IL_LAST + 0 )
68
#define NET_IP_LAST     ( NET_IP_FIRST + NET_IP_COUNT )
69
 
3466 mejdrech 70
#define NET_ARP_FIRST       ( NET_IP_LAST + 0 )
3666 mejdrech 71
#define NET_ARP_LAST        ( NET_ARP_FIRST + NET_ARP_COUNT )
3466 mejdrech 72
#define NET_RARP_FIRST      ( NET_ARP_LAST + 0 )
3666 mejdrech 73
#define NET_RARP_LAST       ( NET_RARP_FIRST + NET_RARP_COUNT )
3466 mejdrech 74
#define NET_ICMP_FIRST      ( NET_RARP_LAST + 0 )
3666 mejdrech 75
#define NET_ICMP_LAST       ( NET_ICMP_FIRST + NET_ICMP_COUNT )
3466 mejdrech 76
#define NET_UDP_FIRST       ( NET_ICMP_LAST + 0 )
3666 mejdrech 77
#define NET_UDP_LAST        ( NET_UDP_FIRST + NET_UDP_COUNT )
3466 mejdrech 78
#define NET_TCP_FIRST       ( NET_UDP_LAST + 0 )
3666 mejdrech 79
#define NET_TCP_LAST        ( NET_TCP_FIRST + NET_TCP_COUNT )
80
 
3466 mejdrech 81
#define NET_SOCKET_FIRST    ( NET_TCP_LAST + 0 )
3666 mejdrech 82
#define NET_SOCKET_LAST     ( NET_SOCKET_FIRST + NET_SOCKET_COUNT )
3466 mejdrech 83
 
3666 mejdrech 84
#define NET_LAST        NET_SOCKET_LAST
85
 
86
#define NET_COUNT       ( NET_LAST - NET_FIRST )
87
 
88
#define IS_IN_INTERVAL( item, first_inclusive, last_exclusive ) ((( item ) >= ( first_inclusive )) && (( item ) < ( last_exclusive )))
89
 
90
#define IS_NET_MESSAGE( call )          IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_FIRST, NET_LAST )
3846 mejdrech 91
#define IS_NET_NET_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_NET_FIRST, NET_NET_LAST )
92
#define IS_NET_NIL_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_NIL_FIRST, NET_NIL_LAST )
93
#define IS_NET_ETH_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_ETH_FIRST, NET_ETH_LAST )
3666 mejdrech 94
#define IS_NET_IL_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_IL_FIRST, NET_IL_LAST )
95
#define IS_NET_IP_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_IP_FIRST, NET_IP_LAST )
96
#define IS_NET_ARP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_ARP_FIRST, NET_ARP_LAST )
97
#define IS_NET_RARP_MESSAGE( call )     IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_RARP_FIRST, NET_RARP_LAST )
98
#define IS_NET_UDP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_UDP_FIRST, NET_UDP_LAST )
99
#define IS_NET_TCP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_TCP_FIRST, NET_TCP_LAST )
100
#define IS_NET_SOCKET_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( call ), NET_SOCKET_FIRST, NET_SOCKET_LAST )
101
 
3466 mejdrech 102
typedef enum {
3846 mejdrech 103
    /* ( device_id, irq, io ) */
3666 mejdrech 104
    NET_NETIF_PROBE = NET_NETIF_FIRST,
3846 mejdrech 105
    /* () not supported, should ask networking for a name and register device */
3666 mejdrech 106
    NET_NETIF_PROBE_AUTO,
3846 mejdrech 107
    /* ( device_id ), packet_send */
3666 mejdrech 108
    NET_NETIF_SEND,
3846 mejdrech 109
    /* ( device_id ) */
3666 mejdrech 110
    NET_NETIF_START,
3846 mejdrech 111
    /* ( device_id ), ipc_data_read( stats ) */
3666 mejdrech 112
    NET_NETIF_STATS,
3846 mejdrech 113
    /* ( device_id ) */
3666 mejdrech 114
    NET_NETIF_STOP,
3846 mejdrech 115
    /* () not supported, registers new device */
116
    NET_NET_DEVICE = NET_NET_FIRST,
117
    /* (), measured_strings_send( names ), measured_strings_return( values ) */
118
    NET_NET_GET_CONF,
119
    /* ( device_id ), measured_strings_send( names ), measured_strings_return( values ) */
120
    NET_NET_GET_DEVICE_CONF,
121
    /* () not supported, measured_strings_send( names ), measured_strings_send( values ) */
122
    NET_NET_SET_CONF,
123
    /* ( device_id ) not supported, measured_strings_send( names ), measured_strings_send( values ) */
124
    NET_NET_SET_DEVICE_CONF,
125
    /* () */
126
    NET_NET_STARTUP,
127
    /* ( device_id ) */
128
    NET_NET_START,
129
    /* ( device_id ) */
130
    NET_NET_STOP,
131
    /* ( device_id ) ipc_data_read( stats ) */
132
    NET_NET_STATS,
133
    /* ( device_id, driver_service ) */
134
    NET_NIL_DEVICE = NET_NIL_FIRST,
135
    /* ( device_id, state ) */
136
    NET_NIL_DEVICE_STATE,
137
    /* ( device_id, mtu ) */
138
    NET_NIL_MTU,
139
    /* ( device_id ), packet_send */
140
    NET_NIL_RECEIVED,
141
    /* ( device_id ), packet_send */
142
    NET_NIL_SEND,
143
    /* ( device_id ) -> prefix, content, sufix */
144
    NET_NIL_PACKET_SPACE,
145
    /* ( device_id ), measured_strings_return( hardware address ) */
146
    NET_NIL_ADDR,
147
    /* ( device_id ), measured_strings_return( broadcast address ) */
148
    NET_NIL_BROADCAST_ADDR,
149
    /* ( service ), protocol */
150
//  NET_NIL_PROTOCOL,
151
    /* ( device_id, nil_service ) */
3666 mejdrech 152
    NET_IL_DEVICE = NET_IL_FIRST,
3846 mejdrech 153
    /* ( device_id, state ) */
154
    NET_IL_DEVICE_STATE,
155
    /* ( device_id ), packet_send */
156
    NET_IL_RECEIVED,
157
    /* ( device_id ), measured_strings_send( address ) */
158
//  NET_IL_MY_ADDR,
159
    NET_IP_ECHO = NET_IP_FIRST,
160
    NET_IP_SEND,
161
    /* ( device_id, nil_service, proto ), measured_strings_send( proto_addr ) */
162
    NET_ARP_DEVICE = NET_ARP_FIRST,
163
    /* ( device_id, protocol ), measured_strings_send( target ), measured_strings_return( translation ) */
164
    NET_ARP_TRANSLATE,
165
    /* ( device_id ) */
166
    NET_ARP_CLEAR_DEVICE,
167
    /* () */
168
    NET_ARP_CLEAN_CACHE
3466 mejdrech 169
} net_message;
170
 
3846 mejdrech 171
#endif
172
 
3466 mejdrech 173
/** @}
174
 */