All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ipv6_packet_defines.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #define IP_OFFSET 4
5 
6 #pragma pack(push,2)
7 
8 // T I p v 6 C n t r l
9 // -------------------
10 //
11 struct TIpv6Cntrl
12 {
13  union
14  {
15  struct TIpv6Hdr
16  {
17  uint32_t ui32Flow; // 20 bits of flow-ID
18  uint16_t ui16Len; // payload length (ipv6 length - header)
19  uint8_t ui8Next; // next header
20  uint8_t ui8Hop; // hop limit
21  } tUnion1;
22  uint8_t ui8VC; // 4 bits version, top 4 bits class
23  } tCtlUn;
24 };
25 
26 
27 // T I P v 6 H e a d e r
28 // ---------------------
29 // This is the main header and can be followed by 0 or more
30 // Extension headers
31 
33 { // 40 bytes
37 };
38 
39 
40 // T I P v 6 E x t e n s i o n H e a d e r
41 // ---------------------------------------
42 //
44 {
45  uint8_t ui8Next; // next header field
46  uint8_t ui8Len; // len field
47 };
48 
49 
50 // T I P v 6 H B H H e a d e r
51 // ---------------------------
52 //
54 {
55  uint8_t uiOptoinsType; // next header field
56  uint8_t ui8Len; // length of data in bytes
57 };
58 
59 
60 // T I P v 6 F r a g m e n t a i o n H e a d e r
61 // ----------------------------------------------
62 //
64 {
65  uint8_t ui8Next; // next header field
66  uint8_t ui8Reserverd; // len field
67  uint16_t ui16OffsetFlg; // offset, reserver and flag
68  uint32_t ui32Ident; // identification
69 };
70 
71 
72 // Extension header options
73 
75 {
76  EHO_FINISHED = 257, // own marker to finish processing
77  EHO_HOPOPTS = 0, // IP6 hop-by-hop options
78 // EHO_TCP = 6, // TCP
79 // EHO_UDP = 17, // UDP
80  EHO_IPV6ENCAP = 41, // IP6 encapsulation
81  EHO_ROUTING = 43, // IP6 routing header
82  EHO_FRAGMENT = 44, // IP6 fragmentation header
83  EHO_ESP = 50, // IP6 Encap Sec. Payload
84  EHO_AH = 51, // IP6 Auth Header
85  EHO_ICMPV6 = 58, // ICMP6
86  EHO_NONEXT = 59, // No Next header
87  EHO_DSTOPTS = 60, // IP6 destination option
88 };
89 
90 
91 // T I C M P 6 H e a d e r
92 // -----------------------
93 // Overlapping ICMP6 header
94 // Used to find the options type
95 // Only used for decoding
96 //
98 {
99  uint8_t ui8Type;
100  uint8_t ui8Code;
101  uint16_t ui16Checksum;
102 };
103 
104 
105 // T I C M P 6 N e i g b o r S o l
106 // -------------------------------
107 //
109 {
110  uint8_t ui8Type;
111  uint8_t ui8Code;
112  uint16_t ui16Checksum;
115 };
116 
117 // T I C M P 6 R o u t e r S o l
118 // -------------------------------
119 //
121 {
122  uint8_t ui8Type;
123  uint8_t ui8Code;
124  uint16_t ui16Checksum;
126 };
127 
128 
129 
130 // T I C M P 6 N e i g b o r A d v
131 // -------------------------------
132 //
134 {
135  uint8_t ui8Type;
136  uint8_t ui8Code;
137  uint16_t ui16Checksum;
140 };
141 
142 
143 // T I C M P 6 D e s t U n r
144 // -------------------------
145 //
147 {
148  uint8_t ui8Type;
149  uint8_t ui8Code;
150  uint16_t ui16Checksum;
152 };
153 
154 // T I C M P 6 R o u t e r A d v e r t i s e m e n t
155 // -------------------------------------------------
156 //
158 {
159  uint8_t ui8Type;
160  uint8_t ui8Code; // not used
161  uint16_t ui16Checksum; // icmp header checksum
162  uint8_t HopLimit; // current recommended hop limit
163  uint8_t Flags; // auto configuration flags : 8 bits M,O,H,P1,P0,R2,R1,R0
164  uint16_t RouterLifetime; // how long to be used as default router, if 0 don't use
165  uint32_t ReachableTime; // reachable timeout
166  uint32_t RetransTime; // timer for retransmitting neighbor solicitation messages
167 };
168 
169 
170 
171 
172 // T I C M 6 P E c h o
173 // -------------------
175 {
176  uint16_t Identifier;
177  uint16_t SeqNr;
178 };
179 
180 
181 
182 // I C M P 6 O p t i o n s
183 // -------------------------------
184 // Header for all available options
185 // Used to find the options type when decoding
186 // Will be overlapping with the real options
187 //
189 {
190  uint8_t Type;
191  uint8_t Length;
192 };
193 
194 
195 // T I C M P 6 O p t L i n k L a y e r
196 // -----------------------------------
197 // Type 1 = source link layer
198 // Type 2 = target link layer
199 //
201 {
202  uint8_t Type;
203  uint8_t Length;
205 };
206 
207 
208 // I C M P 6 O p t P r e f i x
209 // ---------------------------
210 // Type = 3
211 //
213 {
214  uint8_t Type;
215  uint8_t Length;
216  uint8_t PrefixLength; // nr of bits used for prefix
217  uint8_t Flags; // bits : L,A,x,x x,x,x,x : L = use for on-link determination
218  // A = user for Auto address configuration
219  uint32_t ValidLifetime; // time in seconds that this prefix can be used for on-link determination
220  // 1 is forever
221  uint32_t PreferedLifetime; // liftime for the autogenerated address, 1 is forever
222  uint32_t Reserved; // all zero
223  TIPAddr Prefix; // the prefix to be used
224 };
225 
226 
227 // I C M P 6 O p t M t u
228 // ---------------------
229 // Type = 5
230 //
232 {
233  uint8_t Type;
234  uint8_t Length;
235  uint16_t Reserved;
236  uint32_t MTU; // recommended mtu size
237 };
238 
239 
240 // I C M P 6 O p t R o u t e I n f o
241 // ---------------------------------
242 // Used to generate preferred gateway info
243 // Avoid redirect messages
244 // Type = 24
245 // TODO Implement this Router Advertisement option
246 //
248 {
249  uint8_t Type;
250  uint8_t Length; // 1, 2 or 3
251  uint8_t PrefixLength; // leading bits 0-128 (prefix field is 0,8 or 16 bytes)
252  uint8_t Prf; // mask with 0x18 -> 0x08 : High, 0x00 : Medium, 0x18: Low, 0x10 : RESERVED treat as 0x00 (High)
253  uint16_t RouteLifetime;
254  uint64_t Pref1; // optional, depending on prefix length
255  uint64_t Pref2; // optional, depending on prefix length
256 };
257 
258 
259 
261 {
276 };
277 
278 
280 {
286  IMCMP_OPT_ROUTE_INFO = 24, // TODO : Implement opt route info
287 };
288 
289 
290 #pragma pack(pop)
291 
292 
struct TIpv6Cntrl::@8::TIpv6Hdr tUnion1
union TIpv6Cntrl::@8 tCtlUn
TIpv6Cntrl tCntrl
Struct contains an IPV4 or an IPV6 address.
Definition: packet-defines.h:7
MAC address.
Definition: sir_ethernet.h:27
EHeaderOptions