TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip4Output.c File Reference
#include "Ip4Impl.h"

Go to the source code of this file.

Functions

EFI_STATUS Ip4PrependHead (IN OUT NET_BUF *Packet, IN IP4_HEAD *Head, IN UINT8 *Option, IN UINT32 OptLen)
 
IP4_INTERFACEIp4SelectInterface (IN IP4_SERVICE *IpSb, IN IP4_ADDR Dst, IN IP4_ADDR Src)
 
VOID Ip4SysPacketSent (IP4_PROTOCOL *Ip4Instance, NET_BUF *Packet, EFI_STATUS IoStatus, UINT32 LinkFlag, VOID *Context)
 
EFI_STATUS Ip4Output (IN IP4_SERVICE *IpSb, IN IP4_PROTOCOL *IpInstance OPTIONAL, IN NET_BUF *Packet, IN IP4_HEAD *Head, IN UINT8 *Option, IN UINT32 OptLen, IN IP4_ADDR GateWay, IN IP4_FRAME_CALLBACK Callback, IN VOID *Context)
 
BOOLEAN Ip4CancelPacketFragments (IN IP4_LINK_TX_TOKEN *Frame, IN VOID *Context)
 
VOID Ip4CancelPacket (IN IP4_INTERFACE *IpIf, IN NET_BUF *Packet, IN EFI_STATUS IoStatus)
 

Variables

UINT16 mIp4Id
 

Detailed Description

Transmit the IP4 packet.

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

Definition in file Ip4Output.c.

Function Documentation

◆ Ip4CancelPacket()

VOID Ip4CancelPacket ( IN IP4_INTERFACE IpIf,
IN NET_BUF Packet,
IN EFI_STATUS  IoStatus 
)

Cancel the Packet and all its fragments.

Parameters
IpIfThe interface from which the Packet is sent
PacketThe Packet to cancel
IoStatusThe status returns to the sender.

Definition at line 467 of file Ip4Output.c.

◆ Ip4CancelPacketFragments()

BOOLEAN Ip4CancelPacketFragments ( IN IP4_LINK_TX_TOKEN Frame,
IN VOID *  Context 
)

The filter function to find a packet and all its fragments. The packet's fragments have their Context set to the packet.

Parameters
[in]FrameThe frames hold by the low level interface
[in]ContextContext to the function, which is the packet.
Return values
TRUEThis is the packet to cancel or its fragments.
FALSEThis is unrelated packet.

Definition at line 446 of file Ip4Output.c.

◆ Ip4Output()

EFI_STATUS Ip4Output ( IN IP4_SERVICE IpSb,
IN IP4_PROTOCOL *IpInstance  OPTIONAL,
IN NET_BUF Packet,
IN IP4_HEAD Head,
IN UINT8 *  Option,
IN UINT32  OptLen,
IN IP4_ADDR  GateWay,
IN IP4_FRAME_CALLBACK  Callback,
IN VOID *  Context 
)

Transmit an IP4 packet. The packet comes either from the IP4 child's consumer (IpInstance != NULL) or the IP4 driver itself (IpInstance == NULL). It will route the packet, fragment it, then transmit all the fragments through some interface.

Parameters
[in]IpSbThe IP4 service instance to transmit the packet
[in]IpInstanceThe IP4 child that issues the transmission. It is NULL if the packet is from the system.
[in]PacketThe user data to send, excluding the IP header.
[in]HeadThe caller supplied header. The caller should set the following header fields: Tos, TotalLen, Id, tl, Fragment, Protocol, Src and Dst. All the fields are in host byte order. This function will fill in the Ver, HeadLen, Fragment, and checksum. The Fragment only need to include the DF flag. Ip4Output will compute the MF and offset for you.
[in]OptionThe original option to append to the IP headers
[in]OptLenThe length of the option
[in]GateWayThe next hop address to transmit packet to. 255.255.255.255 means broadcast.
[in]CallbackThe callback function to issue when transmission completed.
[in]ContextThe opaque context for the callback
Return values
EFI_NO_MAPPINGThere is no interface to the destination.
EFI_NOT_FOUNDThere is no route to the destination
EFI_SUCCESSThe packet is successfully transmitted.
EFI_BAD_BUFFER_SIZEThe length of the IPv4 header + option length + total data length is greater than MTU (or greater than the maximum packet size if Token.Packet.TxData. OverrideData.DoNotFragment is TRUE.)
OthersFailed to transmit the packet.

Definition at line 205 of file Ip4Output.c.

◆ Ip4PrependHead()

EFI_STATUS Ip4PrependHead ( IN OUT NET_BUF Packet,
IN IP4_HEAD Head,
IN UINT8 *  Option,
IN UINT32  OptLen 
)

Prepend an IP4 head to the Packet. It will copy the options and build the IP4 header fields. Used for IP4 fragmentation.

Parameters
PacketThe packet to prepend IP4 header to
HeadThe caller supplied header. The caller should set the following header fields: Tos, TotalLen, Id, Fragment, Ttl, Protocol, Src and Dst. All the fields are in host byte order. This function will fill in the Ver, HeadLen, and checksum.
OptionThe original IP4 option to copy from
OptLenThe length of the IP4 option
Return values
EFI_BAD_BUFFER_SIZEThere is no enough room in the head space of Packet.
EFI_SUCCESSThe IP4 header is successfully added to the packet.

Definition at line 32 of file Ip4Output.c.

◆ Ip4SelectInterface()

IP4_INTERFACE * Ip4SelectInterface ( IN IP4_SERVICE IpSb,
IN IP4_ADDR  Dst,
IN IP4_ADDR  Src 
)

Select an interface to send the packet generated in the IP4 driver itself, that is, not by the requests of IP4 child's consumer. Such packets include the ICMP echo replies, and other ICMP error packets.

Parameters
[in]IpSbThe IP4 service that wants to send the packets.
[in]DstThe destination of the packet
[in]SrcThe source of the packet
Returns
NULL if no proper interface is found, otherwise the interface that can be used to send the system packet from.

Definition at line 97 of file Ip4Output.c.

◆ Ip4SysPacketSent()

VOID Ip4SysPacketSent ( IP4_PROTOCOL Ip4Instance,
NET_BUF Packet,
EFI_STATUS  IoStatus,
UINT32  LinkFlag,
VOID *  Context 
)

The default callback function for system generated packet. It will free the packet.

Parameters
Ip4InstanceThe IP4 child that issued the transmission. It most like is NULL.
PacketThe packet that transmitted.
IoStatusThe result of the transmission, succeeded or failed.
LinkFlagNot used when transmission. check IP4_FRAME_CALLBACK for reference.
ContextThe context provided by us

Definition at line 158 of file Ip4Output.c.

Variable Documentation

◆ mIp4Id

UINT16 mIp4Id

Definition at line 11 of file Ip4Output.c.