TianoCore EDK2 master
|
#include "Ip6Impl.h"
Go to the source code of this file.
IP6 internal functions to process the incoming packets.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Ip6Input.c.
VOID Ip6AcceptFrame | ( | IN NET_BUF * | Packet, |
IN EFI_STATUS | IoStatus, | ||
IN UINT32 | Flag, | ||
IN VOID * | Context | ||
) |
The IP6 input routine. It is called by the IP6_INTERFACE when an IP6 fragment is received from MNP.
[in] | Packet | The IP6 packet received. |
[in] | IoStatus | The return status of receive request. |
[in] | Flag | The link layer flag for the packet received, such as multicast. |
[in] | Context | The IP6 service instance that owns the MNP. |
Definition at line 976 of file Ip6Input.c.
VOID Ip6CleanAssembleTable | ( | IN OUT IP6_ASSEMBLE_TABLE * | Table | ) |
Clean up the assemble table by removing all of the fragments and assemble entries.
[in,out] | Table | The assemble table to clean up. |
Definition at line 1136 of file Ip6Input.c.
IP6_ASSEMBLE_ENTRY * Ip6CreateAssembleEntry | ( | IN EFI_IPv6_ADDRESS * | Dst, |
IN EFI_IPv6_ADDRESS * | Src, | ||
IN UINT32 | Id | ||
) |
Create an empty assemble entry for the packet identified by (Dst, Src, Id). The default life for the packet is 60 seconds.
[in] | Dst | The destination address. |
[in] | Src | The source address. |
[in] | Id | The ID field in the IP header. |
Definition at line 26 of file Ip6Input.c.
VOID Ip6CreateAssembleTable | ( | IN OUT IP6_ASSEMBLE_TABLE * | Table | ) |
Initialize an already allocated assemble table. This is generally the assemble table embedded in the IP6 service instance.
[in,out] | Table | The assemble table to initialize. |
Definition at line 1117 of file Ip6Input.c.
EFI_STATUS Ip6Demultiplex | ( | IN IP6_SERVICE * | IpSb, |
IN EFI_IP6_HEADER * | Head, | ||
IN NET_BUF * | Packet | ||
) |
De-multiplex the packet. the packet delivery is processed in two passes. The first pass will enqueue a shared copy of the packet to each IP6 child that accepts the packet. The second pass will deliver a non-shared copy of the packet to each IP6 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.
[in] | IpSb | The IP6 service instance that received the packet. |
[in] | Head | The header of the received packet. |
[in] | Packet | The data of the received packet. |
EFI_NOT_FOUND | No IP child accepts the packet. |
EFI_SUCCESS | The packet is enqueued or delivered to some IP children. |
Definition at line 1651 of file Ip6Input.c.
VOID Ip6FreeAssembleEntry | ( | IN IP6_ASSEMBLE_ENTRY * | Assemble | ) |
Release all the fragments of a packet, then free the assemble entry.
[in] | Assemble | The assemble entry to free. |
Definition at line 62 of file Ip6Input.c.
EFI_STATUS Ip6InstanceDeliverPacket | ( | IN IP6_PROTOCOL * | IpInstance | ) |
Deliver the received packets to the 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.
[in] | IpInstance | The IP child to deliver the packet up. |
EFI_OUT_OF_RESOURCES | Failed to allocate resources to deliver the packets. |
EFI_SUCCESS | All the enqueued packets that can be delivered are delivered up. |
Definition at line 1466 of file Ip6Input.c.
EFI_STATUS Ip6InstanceEnquePacket | ( | IN IP6_PROTOCOL * | IpInstance, |
IN EFI_IP6_HEADER * | Head, | ||
IN NET_BUF * | Packet | ||
) |
Enqueue a shared copy of the packet to the IP6 child if the packet is acceptable to it. Here the data of the packet is shared, but the net buffer isn't.
IpInstance | The IP6 child to enqueue the packet to. |
Head | The IP header of the received packet. |
Packet | The data of the received packet. |
EFI_NOT_STARTED | The IP child hasn't been configured. |
EFI_INVALID_PARAMETER | The child doesn't want to receive the packet. |
EFI_OUT_OF_RESOURCES | Failed to allocate some resources |
EFI_SUCCESS | A shared copy the packet is enqueued to the child. |
Definition at line 1411 of file Ip6Input.c.
BOOLEAN Ip6InstanceFrameAcceptable | ( | IN IP6_PROTOCOL * | IpInstance, |
IN EFI_IP6_HEADER * | Head, | ||
IN NET_BUF * | Packet | ||
) |
Check whether this IP child accepts the packet.
[in] | IpInstance | The IP child to check. |
[in] | Head | The IP header of the packet. |
[in] | Packet | The data of the packet. |
TRUE | The child wants to receive the packet. |
FALSE | The child does not want to receive the packet. |
Definition at line 1266 of file Ip6Input.c.
VOID Ip6InterfaceDeliverPacket | ( | IN IP6_SERVICE * | IpSb, |
IN IP6_INTERFACE * | IpIf | ||
) |
Deliver the packet for each IP6 child on the interface.
[in] | IpSb | The IP6 service instance that received the packet. |
[in] | IpIf | The IP6 interface to deliver the packet. |
Definition at line 1618 of file Ip6Input.c.
INTN Ip6InterfaceEnquePacket | ( | IN IP6_SERVICE * | IpSb, |
IN EFI_IP6_HEADER * | Head, | ||
IN NET_BUF * | Packet, | ||
IN IP6_INTERFACE * | IpIf | ||
) |
Enqueue a received packet to all the IP children that share the same interface.
[in] | IpSb | The IP6 service instance that receive the packet. |
[in] | Head | The header of the received packet. |
[in] | Packet | The data of the received packet. |
[in] | IpIf | The interface to enqueue the packet to. |
Definition at line 1559 of file Ip6Input.c.
VOID EFIAPI Ip6IpSecFree | ( | IN VOID * | Arg | ) |
The callback function for the net buffer that wraps the packet processed by IPsec. It releases the wrap packet and also signals IPsec to free the resources.
[in] | Arg | The wrap context. |
Definition at line 453 of file Ip6Input.c.
EFI_STATUS Ip6IpSecProcessPacket | ( | IN IP6_SERVICE * | IpSb, |
IN OUT EFI_IP6_HEADER ** | Head, | ||
IN OUT UINT8 * | LastHead, | ||
IN OUT NET_BUF ** | Netbuf, | ||
IN OUT UINT8 ** | ExtHdrs, | ||
IN OUT UINT32 * | ExtHdrsLen, | ||
IN EFI_IPSEC_TRAFFIC_DIR | Direction, | ||
IN VOID * | Context | ||
) |
The work function to locate the IPsec protocol to process the inbound or outbound IP packets. The process routine handles the packet with the following actions: bypass the packet, discard the packet, or protect the packet.
[in] | IpSb | The IP6 service instance. |
[in,out] | Head | The caller-supplied IP6 header. |
[in,out] | LastHead | The next header field of last IP header. |
[in,out] | Netbuf | The IP6 packet to be processed by IPsec. |
[in,out] | ExtHdrs | The caller-supplied options. |
[in,out] | ExtHdrsLen | The length of the option. |
[in] | Direction | The directionality in an SPD entry, EfiIPsecInBound, or EfiIPsecOutBound. |
[in] | Context | The token's wrap. |
EFI_SUCCESS | The IPsec protocol is not available or disabled. |
EFI_SUCCESS | The packet was bypassed, and all buffers remain the same. |
EFI_SUCCESS | The packet was protected. |
EFI_ACCESS_DENIED | The packet was discarded. |
EFI_OUT_OF_RESOURCES | There are not sufficient resources to complete the operation. |
EFI_BUFFER_TOO_SMALL | The number of non-empty blocks is bigger than the number of input data blocks when building a fragment table. |
Definition at line 497 of file Ip6Input.c.
VOID EFIAPI Ip6OnFreeFragments | ( | IN VOID * | Arg | ) |
Release all the fragments of the packet. This is the callback for the assembled packet's OnFree. It will free the assemble entry, which in turn frees all the fragments of the packet.
[in] | Arg | The assemble entry to free. |
Definition at line 94 of file Ip6Input.c.
The signal handle of IP6's recycle event. It is called back when the upper layer releases the packet.
[in] | Event | The IP6's recycle event. |
[in] | Context | The context of the handle, which is a IP6_RXDATA_WRAP. |
Definition at line 1165 of file Ip6Input.c.
VOID Ip6PacketTimerTicking | ( | IN IP6_SERVICE * | IpSb | ) |
Timeout the fragments, and the enqueued, and transmitted packets.
[in] | IpSb | The IP6 service instance to timeout. |
Definition at line 1739 of file Ip6Input.c.
EFI_STATUS Ip6PreProcessPacket | ( | IN IP6_SERVICE * | IpSb, |
IN OUT NET_BUF ** | Packet, | ||
IN UINT32 | Flag, | ||
OUT UINT8 ** | Payload, | ||
OUT UINT8 ** | LastHead, | ||
OUT UINT32 * | ExtHdrsLen, | ||
OUT UINT32 * | UnFragmentLen, | ||
OUT BOOLEAN * | Fragmented, | ||
OUT EFI_IP6_HEADER ** | Head | ||
) |
Pre-process the IPv6 packet. First validates the IPv6 packet, and then reassembles packet if it is necessary.
[in] | IpSb | The IP6 service instance. |
[in,out] | Packet | The received IP6 packet to be processed. |
[in] | Flag | The link layer flag for the packet received, such as multicast. |
[out] | Payload | The pointer to the payload of the received packet. it starts from the first byte of the extension header. |
[out] | LastHead | The pointer of NextHeader of the last extension header processed by IP6. |
[out] | ExtHdrsLen | The length of the whole option. |
[out] | UnFragmentLen | The length of unfragmented length of extension headers. |
[out] | Fragmented | Indicate whether the packet is fragmented. |
[out] | Head | The pointer to the EFI_IP6_Header. |
EFI_SUCCESS | The received packet is well format. |
EFI_INVALID_PARAMETER | The received packet is malformed. |
Definition at line 732 of file Ip6Input.c.
Reassemble the IP fragments. If all the fragments of the packet have been received, it will wrap the packet in a net buffer then return it to caller. If the packet can't be assembled, NULL is returned.
[in,out] | Table | The assemble table used. A new assemble entry will be created if the Packet is from a new chain of fragments. |
[in] | Packet | The fragment to assemble. It might be freed if the fragment can't be re-assembled. |
Definition at line 158 of file Ip6Input.c.
EFI_STATUS EFIAPI Ip6SentPacketTicking | ( | IN NET_MAP * | Map, |
IN NET_MAP_ITEM * | Item, | ||
IN VOID * | Context | ||
) |
Decrease the life of the transmitted packets. If it is decreased to zero, cancel the packet. This function is called by Ip6packetTimerTicking that provides timeout for both the received-but-not-delivered and transmitted-but-not-recycle packets.
[in] | Map | The IP6 child's transmit map. |
[in] | Item | Current transmitted packet. |
[in] | Context | Not used. |
EFI_SUCCESS | Always returns EFI_SUCCESS. |
Definition at line 1714 of file Ip6Input.c.
Trim the packet to fit in [Start, End), and update per the packet information.
[in,out] | Packet | Packet to trim. |
[in] | Start | The sequence of the first byte to fit in. |
[in] | End | One beyond the sequence of last byte to fit in. |
Definition at line 111 of file Ip6Input.c.
IP6_RXDATA_WRAP * Ip6WrapRxData | ( | IN IP6_PROTOCOL * | IpInstance, |
IN NET_BUF * | Packet | ||
) |
Wrap the received packet to a IP6_RXDATA_WRAP, which will be delivered to the upper layer. Each IP6 child that accepts the packet will get a not-shared copy of the packet which is wrapped in the IP6_RXDATA_WRAP. The IP6_RXDATA_WRAP->RxData is passed to the upper layer. The upper layer will signal the recycle event in it when it is done with the packet.
[in] | IpInstance | The IP6 child to receive the packet. |
[in] | Packet | The packet to deliver up. |
Definition at line 1200 of file Ip6Input.c.