Rev 3901 | Rev 3991 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3846 | mejdrech | 1 | /* |
3912 | mejdrech | 2 | * Copyright (c) 2009 Lukas Mejdrech |
3846 | 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 arp |
||
30 | * @{ |
||
31 | */ |
||
32 | |||
33 | /** @file |
||
3912 | mejdrech | 34 | * ARP module. |
3846 | mejdrech | 35 | */ |
36 | |||
37 | #ifndef __NET_ARP_H__ |
||
38 | #define __NET_ARP_H__ |
||
39 | |||
40 | #include <ipc/ipc.h> |
||
41 | |||
3886 | mejdrech | 42 | #include "../../netif/device.h" |
3846 | mejdrech | 43 | |
3886 | mejdrech | 44 | #include "../../structures/generic_char_map.h" |
45 | #include "../../structures/int_map.h" |
||
46 | #include "../../structures/measured_strings.h" |
||
3846 | mejdrech | 47 | |
3912 | mejdrech | 48 | |
49 | /** Type definition of the ARP global data. |
||
50 | * @see arp_globals |
||
51 | */ |
||
3846 | mejdrech | 52 | typedef struct arp_globals arp_globals_t; |
3912 | mejdrech | 53 | |
54 | /** Type definition of the ARP device specific data. |
||
55 | * @see arp_device |
||
56 | */ |
||
3846 | mejdrech | 57 | typedef struct arp_device arp_device_t; |
3912 | mejdrech | 58 | |
59 | /** Type definition of the ARP device specific data pointer. |
||
60 | * @see arp_device |
||
61 | */ |
||
3846 | mejdrech | 62 | typedef arp_device_t * arp_device_ref; |
3912 | mejdrech | 63 | |
64 | /** Type definition of the ARP protocol specific data. |
||
65 | * @see arp_proto |
||
66 | */ |
||
3846 | mejdrech | 67 | typedef struct arp_proto arp_proto_t; |
3912 | mejdrech | 68 | |
69 | /** Type definition of the ARP protocol specific data pointer. |
||
70 | * @see arp_proto |
||
71 | */ |
||
3846 | mejdrech | 72 | typedef arp_proto_t * arp_proto_ref; |
73 | |||
3912 | mejdrech | 74 | /** ARP address cache. |
75 | * Maps devices to the ARP device specific data. |
||
76 | * @see device.h |
||
77 | */ |
||
3846 | mejdrech | 78 | DEVICE_MAP_DECLARE( arp_cache, arp_device_t ) |
79 | |||
3912 | mejdrech | 80 | /** ARP protocol map. |
81 | * Maps protocol identifiers to the ARP protocol specific data. |
||
82 | * @see int_map.h |
||
83 | */ |
||
3846 | mejdrech | 84 | INT_MAP_DECLARE( arp_protos, arp_proto_t ) |
85 | |||
3912 | mejdrech | 86 | /** ARP address map. |
87 | * Translates addresses. |
||
88 | * @see generic_char_map.h |
||
89 | */ |
||
3846 | mejdrech | 90 | GENERIC_CHAR_MAP_DECLARE( arp_addr, measured_string_t ) |
91 | |||
3912 | mejdrech | 92 | /** ARP device specific data. |
93 | */ |
||
3846 | mejdrech | 94 | struct arp_device{ |
3912 | mejdrech | 95 | /** Device identifier. |
96 | */ |
||
3846 | mejdrech | 97 | device_id_t device_id; |
3912 | mejdrech | 98 | /** Hardware type. |
99 | */ |
||
3846 | mejdrech | 100 | ipcarg_t hardware; |
3912 | mejdrech | 101 | /** Reserved packet prefix length. |
102 | */ |
||
3846 | mejdrech | 103 | ipcarg_t prefix; |
3912 | mejdrech | 104 | /** Maximal packet content length. |
105 | */ |
||
3846 | mejdrech | 106 | ipcarg_t content; |
3912 | mejdrech | 107 | /** Reserved packet suffix length. |
108 | */ |
||
109 | ipcarg_t suffix; |
||
110 | /** Packet address length. |
||
111 | * The hardware address length is used. |
||
112 | */ |
||
3901 | mejdrech | 113 | ipcarg_t addr_len; |
3912 | mejdrech | 114 | /** Actual device hardware address. |
115 | */ |
||
3846 | mejdrech | 116 | measured_string_ref addr; |
3912 | mejdrech | 117 | /** Actual device hardware address data. |
118 | */ |
||
3846 | mejdrech | 119 | char * addr_data; |
3912 | mejdrech | 120 | /** Broadcast device hardware address. |
121 | */ |
||
3846 | mejdrech | 122 | measured_string_ref broadcast_addr; |
3912 | mejdrech | 123 | /** Broadcast device hardware address data. |
124 | */ |
||
3846 | mejdrech | 125 | char * broadcast_data; |
3912 | mejdrech | 126 | /** Device driver service. |
127 | */ |
||
3846 | mejdrech | 128 | services_t service; |
3912 | mejdrech | 129 | /** Driver phone. |
130 | */ |
||
3846 | mejdrech | 131 | int phone; |
3912 | mejdrech | 132 | /** Protocol map. |
133 | * Address map for each protocol. |
||
134 | */ |
||
3846 | mejdrech | 135 | arp_protos_t protos; |
136 | }; |
||
137 | |||
3912 | mejdrech | 138 | /** ARP protocol specific data. |
139 | */ |
||
3846 | mejdrech | 140 | struct arp_proto{ |
3912 | mejdrech | 141 | /** Protocol service. |
142 | */ |
||
3846 | mejdrech | 143 | services_t service; |
144 | // int phone; |
||
3912 | mejdrech | 145 | /** Actual device protocol address. |
146 | */ |
||
3846 | mejdrech | 147 | measured_string_ref addr; |
3912 | mejdrech | 148 | /** Actual device protocol address data. |
149 | */ |
||
3846 | mejdrech | 150 | char * addr_data; |
3912 | mejdrech | 151 | /** Address map. |
152 | */ |
||
3846 | mejdrech | 153 | arp_addr_t addresses; |
154 | }; |
||
155 | |||
3912 | mejdrech | 156 | /** ARP global data. |
157 | */ |
||
3846 | mejdrech | 158 | struct arp_globals{ |
3912 | mejdrech | 159 | /** Networking module phone. |
160 | */ |
||
3846 | mejdrech | 161 | int networking_phone; |
3912 | mejdrech | 162 | /** ARP address cache. |
163 | */ |
||
3846 | mejdrech | 164 | arp_cache_t cache; |
165 | }; |
||
166 | |||
167 | #endif |
||
168 | |||
169 | /** @} |
||
170 | */ |