TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip6Option.h File Reference

Go to the source code of this file.

Data Structures

struct  _IP6_EXT_HDR
 
struct  _IP6_FRAGMENT_HEADER
 
struct  _IP6_ROUTING_HEADER
 

Macros

#define IP6_FRAGMENT_OFFSET_MASK   (~0x3)
 
#define IP6_HDR_EXT_LEN(a)   (((UINT16)((UINT8)(a)) + 1) * 8)
 
#define IP6_MAX_EXT_DATA_LENGTH   (IP6_HDR_EXT_LEN (MAX_UINT8) - sizeof(IP6_EXT_HDR))
 

Typedefs

typedef struct _IP6_EXT_HDR IP6_EXT_HDR
 
typedef struct _IP6_FRAGMENT_HEADER IP6_FRAGMENT_HEADER
 
typedef struct _IP6_ROUTING_HEADER IP6_ROUTING_HEADER
 

Enumerations

enum  IP6_OPTION_TYPE {
  Ip6OptionPad1 = 0 , Ip6OptionPadN = 1 , Ip6OptionRouterAlert = 5 , Ip6OptionSkip = 0 ,
  Ip6OptionDiscard = 0x40 , Ip6OptionParameterProblem = 0x80 , Ip6OptionMask = 0xc0 , Ip6OptionEtherSource = 1 ,
  Ip6OptionEtherTarget = 2 , Ip6OptionPrefixInfo = 3 , Ip6OptionRedirected = 4 , Ip6OptionMtu = 5
}
 

Functions

 STATIC_ASSERT (sizeof(IP6_EXT_HDR)==2, "The combined size of Next Header and Len is two 8 bit fields")
 
 STATIC_ASSERT (IP6_MAX_EXT_DATA_LENGTH==2046, "Maximum data length is ((MAX_UINT8 + 1) * 8) - 2")
 
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)
 
EFI_STATUS Ip6FillHopByHop (OUT UINT8 *Buffer, IN OUT UINTN *BufferLen, IN UINT8 NextHeader)
 
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)
 
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)
 
BOOLEAN Ip6IsNDOptionValid (IN UINT8 *Option, IN UINT16 OptionLen)
 

Detailed Description

Definition of IP6 option process routines.

Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ip6Option.h.

Macro Definition Documentation

◆ IP6_FRAGMENT_OFFSET_MASK

#define IP6_FRAGMENT_OFFSET_MASK   (~0x3)

Definition at line 13 of file Ip6Option.h.

◆ IP6_HDR_EXT_LEN

#define IP6_HDR_EXT_LEN (   a)    (((UINT16)((UINT8)(a)) + 1) * 8)

Definition at line 76 of file Ip6Option.h.

◆ IP6_MAX_EXT_DATA_LENGTH

#define IP6_MAX_EXT_DATA_LENGTH   (IP6_HDR_EXT_LEN (MAX_UINT8) - sizeof(IP6_EXT_HDR))

Definition at line 80 of file Ip6Option.h.

Enumeration Type Documentation

◆ IP6_OPTION_TYPE

enum IP6_OPTION_TYPE

Definition at line 100 of file Ip6Option.h.

Function Documentation

◆ Ip6CopyExts()

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 
)

Copy the extension headers from the original to buffer. A Fragment header is appended to the end.

Parameters
[in]NextHeaderThe 8-bit selector indicates the type of the fragment header's next header.
[in]ExtHdrsThe length of the original extension header.
[in]LastHeaderThe pointer of next header of last extension header.
[in]FragmentOffsetThe fragment offset of the data following the header.
[in]UnFragmentHdrLenThe length of unfragmented length of extension headers.
[in,out]BufThe buffer to copy options to.
[in,out]BufLenThe length of the buffer.
Return values
EFI_SUCCESSThe options are copied over.
EFI_BUFFER_TOO_SMALLThe buffer caller provided is too small.

◆ Ip6FillFragmentHeader()

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 
)

Insert a Fragment Header to the Extension headers and output it in UpdatedExtHdrs.

Parameters
[in]IpSbThe IP6 service instance to transmit the packet.
[in]NextHeaderThe extension header type of first extension header.
[in]LastHeaderThe extension header type of last extension header.
[in]ExtHdrsThe length of the original extension header.
[in]ExtHdrsLenThe length of the extension headers.
[in]FragmentOffsetThe fragment offset of the data following the header.
[out]UpdatedExtHdrsThe updated ExtHdrs with Fragment header inserted. It's caller's responsibility to free this buffer.
Return values
EFI_OUT_OF_RESOURCESFailed to finish the operation due to lake of resource.
EFI_UNSUPPORTEDThe extension header specified in ExtHdrs is not supported currently.
EFI_SUCCESSThe operation performed successfully.

Definition at line 711 of file Ip6Option.c.

◆ Ip6FillHopByHop()

EFI_STATUS Ip6FillHopByHop ( OUT UINT8 *  Buffer,
IN OUT UINTN BufferLen,
IN UINT8  NextHeader 
)

Generate an IPv6 router alert option in network order and output it through Buffer.

Parameters
[out]BufferPoints to a buffer to record the generated option.
[in,out]BufferLenThe length of Buffer, in bytes.
[in]NextHeaderThe 8-bit selector indicates the type of header immediately following the Hop-by-Hop Options header.
Return values
EFI_BUFFER_TOO_SMALLThe Buffer is too small to contain the generated option. BufferLen is updated for the required size.
EFI_SUCCESSThe option is generated and filled in to Buffer.

Definition at line 663 of file Ip6Option.c.

◆ Ip6IsExtsValid()

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 
)

Validate the IP6 extension header format for both the packets we received and that we will transmit. It will compute the ICMPv6 error message fields if the option is mal-formatted.

Parameters
[in]IpSbThe IP6 service instance. This is an optional parameter.
[in]PacketThe data of the packet. Ignored if NULL.
[in]NextHeaderThe next header field in IPv6 basic header.
[in]ExtHdrsThe first byte of the option.
[in]ExtHdrsLenThe length of the whole option.
[in]RcvdThe option is from the packet we received if TRUE, otherwise, the option we want to transmit.
[out]FormerHeaderThe offset of NextHeader which points to Fragment Header when we received, of the ExtHdrs. Ignored if we transmit.
[out]LastHeaderThe pointer of NextHeader of the last extension header processed by IP6.
[out]RealExtsLenThe length of extension headers processed by IP6 layer. This is an optional parameter that may be NULL.
[out]UnFragmentLenThe length of unfragmented length of extension headers. This is an optional parameter that may be NULL.
[out]FragmentedIndicate whether the packet is fragmented. This is an optional parameter that may be NULL.
Return values
TRUEThe option is properly formatted.
FALSEThe option is malformatted.

Definition at line 318 of file Ip6Option.c.

◆ Ip6IsNDOptionValid()

BOOLEAN Ip6IsNDOptionValid ( IN UINT8 *  Option,
IN UINT16  OptionLen 
)

Validate the IP6 option format for both the packets we received and that we will transmit. It supports the defined options in Neighbor Discovery messages.

Parameters
[in]OptionThe first byte of the option.
[in]OptionLenThe length of the whole option.
Return values
TRUEThe option is properly formatted.
FALSEThe option is malformatted.

Definition at line 150 of file Ip6Option.c.