TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip6Option.h
Go to the documentation of this file.
1
10#ifndef __EFI_IP6_OPTION_H__
11#define __EFI_IP6_OPTION_H__
12
13#define IP6_FRAGMENT_OFFSET_MASK (~0x3)
14
15//
16// For more information see RFC 8200, Section 4.3, 4.4, and 4.6
17//
18// This example format is from section 4.6
19// This does not apply to fragment headers
20//
21// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22// | Next Header | Hdr Ext Len | |
23// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
24// | |
25// . .
26// . Header-Specific Data .
27// . .
28// | |
29// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30//
31// Next Header 8-bit selector. Identifies the type of
32// header immediately following the extension
33// header. Uses the same values as the IPv4
34// Protocol field [IANA-PN].
35//
36// Hdr Ext Len 8-bit unsigned integer. Length of the
37// Destination Options header in 8-octet units,
38// not including the first 8 octets.
39
40//
41// These defines apply to the following:
42// 1. Hop by Hop
43// 2. Routing
44// 3. Destination
45//
46typedef struct _IP6_EXT_HDR {
54 UINT8 HdrExtLen;
59
61 sizeof (IP6_EXT_HDR) == 2,
62 "The combined size of Next Header and Len is two 8 bit fields"
63 );
64
65//
66// IPv6 extension headers contain an 8-bit length field which describes the size of
67// the header. However, the length field only includes the size of the extension
68// header options, not the size of the first 8 bytes of the header. Therefore, in
69// order to calculate the full size of the extension header, we add 1 (to account
70// for the first 8 bytes omitted by the length field reporting) and then multiply
71// by 8 (since the size is represented in 8-byte units).
72//
73// a is the length field of the extension header (UINT8)
74// The result may be up to 2046 octets (UINT16)
75//
76#define IP6_HDR_EXT_LEN(a) (((UINT16)((UINT8)(a)) + 1) * 8)
77
78// This is the maxmimum length permissible by a extension header
79// Length is UINT8 of 8 octets not including the first 8 octets
80#define IP6_MAX_EXT_DATA_LENGTH (IP6_HDR_EXT_LEN (MAX_UINT8) - sizeof(IP6_EXT_HDR))
82 IP6_MAX_EXT_DATA_LENGTH == 2046,
83 "Maximum data length is ((MAX_UINT8 + 1) * 8) - 2"
84 );
85
86typedef struct _IP6_FRAGMENT_HEADER {
87 UINT8 NextHeader;
88 UINT8 Reserved;
89 UINT16 FragmentOffset;
90 UINT32 Identification;
92
93typedef struct _IP6_ROUTING_HEADER {
94 UINT8 NextHeader;
95 UINT8 HeaderLen;
96 UINT8 RoutingType;
97 UINT8 SegmentsLeft;
99
100typedef enum {
101 Ip6OptionPad1 = 0,
102 Ip6OptionPadN = 1,
103 Ip6OptionRouterAlert = 5,
104 Ip6OptionSkip = 0,
105 Ip6OptionDiscard = 0x40,
106 Ip6OptionParameterProblem = 0x80,
107 Ip6OptionMask = 0xc0,
108
109 Ip6OptionEtherSource = 1,
110 Ip6OptionEtherTarget = 2,
111 Ip6OptionPrefixInfo = 3,
112 Ip6OptionRedirected = 4,
113 Ip6OptionMtu = 5
114} IP6_OPTION_TYPE;
115
144BOOLEAN
146 IN IP6_SERVICE *IpSb OPTIONAL,
147 IN NET_BUF *Packet OPTIONAL,
148 IN UINT8 *NextHeader,
149 IN UINT8 *ExtHdrs,
150 IN UINT32 ExtHdrsLen,
151 IN BOOLEAN Rcvd,
152 OUT UINT32 *FormerHeader OPTIONAL,
153 OUT UINT8 **LastHeader,
154 OUT UINT32 *RealExtsLen OPTIONAL,
155 OUT UINT32 *UnFragmentLen OPTIONAL,
156 OUT BOOLEAN *Fragmented OPTIONAL
157 );
158
175 OUT UINT8 *Buffer,
176 IN OUT UINTN *BufferLen,
177 IN UINT8 NextHeader
178 );
179
201 IN IP6_SERVICE *IpSb,
202 IN UINT8 NextHeader,
203 IN UINT8 LastHeader,
204 IN UINT8 *ExtHdrs,
205 IN UINT32 ExtHdrsLen,
206 IN UINT16 FragmentOffset,
207 OUT UINT8 **UpdatedExtHdrs
208 );
209
229 IN UINT8 NextHeader,
230 IN UINT8 *ExtHdrs,
231 IN UINT8 *LastHeader,
232 IN UINT16 FragmentOffset,
233 IN UINT32 UnFragmentHdrLen,
234 IN OUT UINT8 *Buf,
235 IN OUT UINT32 *BufLen
236 );
237
250BOOLEAN
252 IN UINT8 *Option,
253 IN UINT16 OptionLen
254 );
255
256#endif
UINT64 UINTN
EFI_STATUS Ip6FillHopByHop(OUT UINT8 *Buffer, IN OUT UINTN *BufferLen, IN UINT8 NextHeader)
Definition: Ip6Option.c:663
BOOLEAN Ip6IsExtsValid(IN IP6_SERVICE *IpSb OPTIONAL, IN NET_BUF *Packet OPTIONAL, IN UINT8 *NextHeader, IN UINT8 *ExtHdrs, IN UINT32 ExtHdrsLen, IN BOOLEAN Rcvd, OUT UINT32 *FormerHeader OPTIONAL, OUT UINT8 **LastHeader, OUT UINT32 *RealExtsLen OPTIONAL, OUT UINT32 *UnFragmentLen OPTIONAL, OUT BOOLEAN *Fragmented OPTIONAL)
Definition: Ip6Option.c:318
BOOLEAN Ip6IsNDOptionValid(IN UINT8 *Option, IN UINT16 OptionLen)
Definition: Ip6Option.c:150
EFI_STATUS Ip6FillFragmentHeader(IN IP6_SERVICE *IpSb, IN UINT8 NextHeader, IN UINT8 LastHeader, IN UINT8 *ExtHdrs, IN UINT32 ExtHdrsLen, IN UINT16 FragmentOffset, OUT UINT8 **UpdatedExtHdrs)
Definition: Ip6Option.c:711
EFI_STATUS Ip6CopyExts(IN UINT8 NextHeader, IN UINT8 *ExtHdrs, IN UINT8 *LastHeader, IN UINT16 FragmentOffset, IN UINT32 UnFragmentHdrLen, IN OUT UINT8 *Buf, IN OUT UINT32 *BufLen)
#define STATIC_ASSERT
Definition: Base.h:808
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINT8 NextHeader
Definition: Ip6Option.h:50
UINT8 HdrExtLen
Definition: Ip6Option.h:54