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

Go to the source code of this file.

Data Structures

struct  IP4_CLIP_INFO
 
struct  IP4_ASSEMBLE_ENTRY
 
struct  IP4_ASSEMBLE_TABLE
 

Macros

#define IP4_MIN_HEADLEN   20
 
#define IP4_MAX_HEADLEN   60
 
#define IP4_MAX_IPSEC_HEADLEN   54
 
#define IP4_ASSEMLE_HASH_SIZE   31
 
#define IP4_FRAGMENT_LIFE   120
 
#define IP4_MAX_PACKET_SIZE   65535
 
#define IP4_GET_CLIP_INFO(Packet)   ((IP4_CLIP_INFO *) ((Packet)->ProtoData))
 
#define IP4_ASSEMBLE_HASH(Dst, Src, Id, Proto)    (((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)
 
#define IP4_RXDATA_WRAP_SIZE(NumFrag)    (sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))
 

Functions

VOID Ip4InitAssembleTable (IN OUT IP4_ASSEMBLE_TABLE *Table)
 
VOID Ip4CleanAssembleTable (IN IP4_ASSEMBLE_TABLE *Table)
 
VOID Ip4AccpetFrame (IN IP4_PROTOCOL *Ip4Instance, IN NET_BUF *Packet, IN EFI_STATUS IoStatus, IN UINT32 Flag, IN VOID *Context)
 
EFI_STATUS Ip4Demultiplex (IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet, IN UINT8 *Option, IN UINT32 OptionLen)
 
INTN Ip4InterfaceEnquePacket (IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet, IN UINT8 *Option, IN UINT32 OptionLen, IN IP4_INTERFACE *IpIf)
 
EFI_STATUS Ip4InstanceDeliverPacket (IN IP4_PROTOCOL *IpInstance)
 
VOID Ip4PacketTimerTicking (IN IP4_SERVICE *IpSb)
 
EFI_STATUS Ip4IpSecProcessPacket (IN IP4_SERVICE *IpSb, IN OUT IP4_HEAD **Head, IN OUT NET_BUF **Netbuf, IN OUT UINT8 **Options, IN OUT UINT32 *OptionsLen, IN EFI_IPSEC_TRAFFIC_DIR Direction, IN VOID *Context)
 

Detailed Description

Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ip4Input.h.

Macro Definition Documentation

◆ IP4_ASSEMBLE_HASH

#define IP4_ASSEMBLE_HASH (   Dst,
  Src,
  Id,
  Proto 
)     (((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)

Definition at line 77 of file Ip4Input.h.

◆ IP4_ASSEMLE_HASH_SIZE

#define IP4_ASSEMLE_HASH_SIZE   31

Definition at line 18 of file Ip4Input.h.

◆ IP4_FRAGMENT_LIFE

#define IP4_FRAGMENT_LIFE   120

Definition at line 19 of file Ip4Input.h.

◆ IP4_GET_CLIP_INFO

#define IP4_GET_CLIP_INFO (   Packet)    ((IP4_CLIP_INFO *) ((Packet)->ProtoData))

Definition at line 75 of file Ip4Input.h.

◆ IP4_MAX_HEADLEN

#define IP4_MAX_HEADLEN   60

Definition at line 12 of file Ip4Input.h.

◆ IP4_MAX_IPSEC_HEADLEN

#define IP4_MAX_IPSEC_HEADLEN   54

8(ESP header) + 16(max IV) + 16(max padding) + 2(ESP tail) + 12(max ICV) = 54

Definition at line 16 of file Ip4Input.h.

◆ IP4_MAX_PACKET_SIZE

#define IP4_MAX_PACKET_SIZE   65535

Definition at line 20 of file Ip4Input.h.

◆ IP4_MIN_HEADLEN

#define IP4_MIN_HEADLEN   20

Definition at line 11 of file Ip4Input.h.

◆ IP4_RXDATA_WRAP_SIZE

#define IP4_RXDATA_WRAP_SIZE (   NumFrag)     (sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))

Definition at line 80 of file Ip4Input.h.

Function Documentation

◆ Ip4AccpetFrame()

VOID Ip4AccpetFrame ( IN IP4_PROTOCOL Ip4Instance,
IN NET_BUF Packet,
IN EFI_STATUS  IoStatus,
IN UINT32  Flag,
IN VOID *  Context 
)

The IP4 input routine. It is called by the IP4_INTERFACE when a IP4 fragment is received from MNP.

Parameters
[in]Ip4InstanceThe IP4 child that request the receive, most like it is NULL.
[in]PacketThe IP4 packet received.
[in]IoStatusThe return status of receive request.
[in]FlagThe link layer flag for the packet received, such as multicast.
[in]ContextThe IP4 service instance that own the MNP.

Definition at line 838 of file Ip4Input.c.

◆ Ip4CleanAssembleTable()

VOID Ip4CleanAssembleTable ( IN IP4_ASSEMBLE_TABLE Table)

Clean up the assemble table: remove all the fragments and assemble entries.

Parameters
[in]TableThe assemble table to clean up

Definition at line 111 of file Ip4Input.c.

◆ Ip4Demultiplex()

EFI_STATUS Ip4Demultiplex ( IN IP4_SERVICE IpSb,
IN IP4_HEAD Head,
IN NET_BUF Packet,
IN UINT8 *  Option,
IN UINT32  OptionLen 
)

Demultiple the packet. the packet delivery is processed in two passes. The first pass will enqueue a shared copy of the packet to each IP4 child that accepts the packet. The second pass will deliver a non-shared copy of the packet to each IP4 child that has pending receive requests. Data is copied if more than one child wants to consume the packet because each IP child needs its own copy of the packet to make changes.

Parameters
[in]IpSbThe IP4 service instance that received the packet.
[in]HeadThe header of the received packet.
[in]PacketThe data of the received packet.
[in]OptionPoint to the IP4 packet header options.
[in]OptionLenLength of the IP4 packet header options.
Return values
EFI_NOT_FOUNDNo IP child accepts the packet.
EFI_SUCCESSThe packet is enqueued or delivered to some IP children.

Definition at line 1495 of file Ip4Input.c.

◆ Ip4InitAssembleTable()

VOID Ip4InitAssembleTable ( IN OUT IP4_ASSEMBLE_TABLE Table)

Initialize an already allocated assemble table. This is generally the assemble table embedded in the IP4 service instance.

Parameters
[in,out]TableThe assemble table to initialize.

Definition at line 92 of file Ip4Input.c.

◆ Ip4InstanceDeliverPacket()

EFI_STATUS Ip4InstanceDeliverPacket ( IN IP4_PROTOCOL IpInstance)

Deliver the received packets to upper layer if there are both received requests and enqueued packets. If the enqueued packet is shared, it will duplicate it to a non-shared packet, release the shared packet, then deliver the non-shared packet up.

Parameters
[in]IpInstanceThe IP child to deliver the packet up.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate resources to deliver the packets.
EFI_SUCCESSAll the enqueued packets that can be delivered are delivered up.

Definition at line 1256 of file Ip4Input.c.

◆ Ip4InterfaceEnquePacket()

INTN Ip4InterfaceEnquePacket ( IN IP4_SERVICE IpSb,
IN IP4_HEAD Head,
IN NET_BUF Packet,
IN UINT8 *  Option,
IN UINT32  OptionLen,
IN IP4_INTERFACE IpIf 
)

Enqueue a received packet to all the IP children that share the same interface.

Parameters
[in]IpSbThe IP4 service instance that receive the packet.
[in]HeadThe header of the received packet.
[in]PacketThe data of the received packet.
[in]OptionPoint to the IP4 packet header options.
[in]OptionLenLength of the IP4 packet header options.
[in]IpIfThe interface to enqueue the packet to.
Returns
The number of the IP4 children that accepts the packet

Definition at line 1363 of file Ip4Input.c.

◆ Ip4IpSecProcessPacket()

EFI_STATUS Ip4IpSecProcessPacket ( IN IP4_SERVICE IpSb,
IN OUT IP4_HEAD **  Head,
IN OUT NET_BUF **  Netbuf,
IN OUT UINT8 **  Options,
IN OUT UINT32 *  OptionsLen,
IN EFI_IPSEC_TRAFFIC_DIR  Direction,
IN VOID *  Context 
)

The work function to locate IPsec protocol to process the inbound or outbound IP packets. The process routine handls the packet with following actions: bypass the packet, discard the packet, or protect the packet.

Parameters
[in]IpSbThe IP4 service instance.
[in,out]HeadThe caller supplied IP4 header.
[in,out]NetbufThe IP4 packet to be processed by IPsec.
[in,out]OptionsThe caller supplied options.
[in,out]OptionsLenThe length of the option.
[in]DirectionThe directionality in an SPD entry, EfiIPsecInBound or EfiIPsecOutBound.
[in]ContextThe token's wrap.
Return values
EFI_SUCCESSThe IPsec protocol is not available or disabled.
EFI_SUCCESSThe packet was bypassed and all buffers remain the same.
EFI_SUCCESSThe packet was protected.
EFI_ACCESS_DENIEDThe packet was discarded.
EFI_OUT_OF_RESOURCESThere is no sufficient resource to complete the operation.
EFI_BUFFER_TOO_SMALLThe number of non-empty block is bigger than the number of input data blocks when build a fragment table.

Definition at line 482 of file Ip4Input.c.

◆ Ip4PacketTimerTicking()

VOID Ip4PacketTimerTicking ( IN IP4_SERVICE IpSb)

Timeout the fragment and enqueued packets.

Parameters
[in]IpSbThe IP4 service instance to timeout

Definition at line 1557 of file Ip4Input.c.