Functions | |
IP6_ASSEMBLE_ENTRY * | Ip6CreateAssembleEntry (IN EFI_IPv6_ADDRESS *Dst, IN EFI_IPv6_ADDRESS *Src, IN UINT32 Id) |
VOID | Ip6FreeAssembleEntry (IN IP6_ASSEMBLE_ENTRY *Assemble) |
VOID EFIAPI | Ip6OnFreeFragments (IN VOID *Arg) |
VOID | Ip6TrimPacket (IN OUT NET_BUF *Packet, IN INTN Start, IN INTN End) |
NET_BUF * | Ip6Reassemble (IN OUT IP6_ASSEMBLE_TABLE *Table, IN NET_BUF *Packet) |
VOID EFIAPI | Ip6IpSecFree (IN VOID *Arg) |
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) |
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) |
VOID | Ip6AcceptFrame (IN NET_BUF *Packet, IN EFI_STATUS IoStatus, IN UINT32 Flag, IN VOID *Context) |
VOID | Ip6CreateAssembleTable (IN OUT IP6_ASSEMBLE_TABLE *Table) |
VOID | Ip6CleanAssembleTable (IN OUT IP6_ASSEMBLE_TABLE *Table) |
VOID EFIAPI | Ip6OnRecyclePacket (IN EFI_EVENT Event, IN VOID *Context) |
IP6_RXDATA_WRAP * | Ip6WrapRxData (IN IP6_PROTOCOL *IpInstance, IN NET_BUF *Packet) |
BOOLEAN | Ip6InstanceFrameAcceptable (IN IP6_PROTOCOL *IpInstance, IN EFI_IP6_HEADER *Head, IN NET_BUF *Packet) |
EFI_STATUS | Ip6InstanceEnquePacket (IN IP6_PROTOCOL *IpInstance, IN EFI_IP6_HEADER *Head, IN NET_BUF *Packet) |
EFI_STATUS | Ip6InstanceDeliverPacket (IN IP6_PROTOCOL *IpInstance) |
INTN | Ip6InterfaceEnquePacket (IN IP6_SERVICE *IpSb, IN EFI_IP6_HEADER *Head, IN NET_BUF *Packet, IN IP6_INTERFACE *IpIf) |
VOID | Ip6InterfaceDeliverPacket (IN IP6_SERVICE *IpSb, IN IP6_INTERFACE *IpIf) |
EFI_STATUS | Ip6Demultiplex (IN IP6_SERVICE *IpSb, IN EFI_IP6_HEADER *Head, IN NET_BUF *Packet) |
EFI_STATUS EFIAPI | Ip6SentPacketTicking (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context) |
VOID | Ip6PacketTimerTicking (IN IP6_SERVICE *IpSb) |
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
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. |
References IP6_GET_CLIP_INFO, IP6_SERVICE_DESTROY, IP6_SERVICE_SIGNATURE, Ip6AcceptFrame(), Ip6Demultiplex(), Ip6IcmpHandle(), Ip6IpSecProcessPacket(), Ip6PreProcessPacket(), Ip6ReceiveFrame(), and _IP6_SERVICE::State.
Referenced by Ip6AcceptFrame(), and Ip6DriverBindingStart().
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. |
References IP6_ASSEMLE_HASH_SIZE, and Ip6FreeAssembleEntry().
Referenced by Ip6CleanService().
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. |
References IP6_ASSEMBLE_ENTRY::CurLen, IP6_ASSEMBLE_ENTRY::Dst, IP6_ASSEMBLE_ENTRY::Fragments, IP6_ASSEMBLE_ENTRY::Head, IP6_ASSEMBLE_ENTRY::Id, IP6_ASSEMBLE_ENTRY::Info, IP6_FRAGMENT_LIFE, IP6_ASSEMBLE_ENTRY::Life, IP6_ASSEMBLE_ENTRY::Packet, IP6_ASSEMBLE_ENTRY::Src, and IP6_ASSEMBLE_ENTRY::TotalLen.
Referenced by Ip6Reassemble().
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. |
References IP6_ASSEMLE_HASH_SIZE.
Referenced by Ip6CreateService().
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. |
References _IP6_INTERFACE::Configured, Ip6InterfaceDeliverPacket(), and Ip6InterfaceEnquePacket().
Referenced by Ip6AcceptFrame(), Ip6ProcessIcmpError(), and Ip6ProcessIcmpInformation().
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. |
Referenced by Ip6CleanAssembleTable(), Ip6OnFreeFragments(), Ip6PacketTimerTicking(), and Ip6Reassemble().
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. |
References IP6_GET_CLIP_INFO, Ip6WrapRxData(), IP6_RXDATA_WRAP::Link, and IP6_RXDATA_WRAP::RxData.
Referenced by EfiIp6Receive(), and Ip6InterfaceDeliverPacket().
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. |
References IP6_GET_CLIP_INFO, IP6_STATE_CONFIGED, IP6_US_TO_SEC, Ip6InstanceFrameAcceptable(), and IP6_CLIP_INFO::Life.
Referenced by Ip6InterfaceEnquePacket().
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. |
References IP6_CLIP_INFO::CastType, ICMP_V6_ERROR_MAX, IP6_GET_CLIP_INFO, Ip6IsExtsValid(), and Ip6Multicast.
Referenced by Ip6InstanceEnquePacket().
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. |
References Ip6InstanceDeliverPacket().
Referenced by Ip6Demultiplex().
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. |
References IP6_CLIP_INFO::CastType, IP6_GET_CLIP_INFO, IP6_PROTOCOL_SIGNATURE, Ip6InstanceEnquePacket(), and Ip6Promiscuous.
Referenced by Ip6Demultiplex().
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. |
References IP6_IPSEC_WRAP::IpSecRecycleSignal, and IP6_IPSEC_WRAP::Packet.
Referenced by Ip6IpSecProcessPacket().
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 suffcient 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. |
References IP6_GET_CLIP_INFO, IP6_MAX_HEADLEN, IP6_MAX_IPSEC_HEADLEN, Ip6FreeTxToken(), Ip6IpSecFree(), Ip6NtohHead(), IP6_IPSEC_WRAP::IpSecRecycleSignal, IP6_TXTOKEN_WRAP::IpSecRecycleSignal, mIpSec, mIpSec2Installed, IP6_IPSEC_WRAP::Packet, and IP6_TXTOKEN_WRAP::Packet.
Referenced by Ip6AcceptFrame(), and Ip6Output().
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. |
References Ip6FreeAssembleEntry().
Referenced by Ip6Reassemble().
VOID EFIAPI Ip6OnRecyclePacket | ( | IN EFI_EVENT | Event, | |
IN VOID * | Context | |||
) |
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. |
References IP6_RXDATA_WRAP::IpInstance, IP6_RXDATA_WRAP::Link, IP6_RXDATA_WRAP::Packet, _IP6_PROTOCOL::RecycleLock, and IP6_RXDATA_WRAP::RxData.
Referenced by Ip6WrapRxData().
VOID Ip6PacketTimerTicking | ( | IN IP6_SERVICE * | IpSb | ) |
Timeout the fragments, and the enqueued, and transmitted packets.
[in] | IpSb | The IP6 service instance to timeout. |
References IP6_ASSEMBLE_ENTRY::Head, IP6_ASSEMLE_HASH_SIZE, IP6_GET_CLIP_INFO, Ip6FreeAssembleEntry(), Ip6SendIcmpError(), Ip6SentPacketTicking(), IP6_CLIP_INFO::Life, IP6_ASSEMBLE_ENTRY::Life, IP6_ASSEMBLE_ENTRY::Packet, _IP6_PROTOCOL::Received, and _IP6_PROTOCOL::TxTokens.
Referenced by Ip6TimerTicking().
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 recieved 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. |
References IP6_CLIP_INFO::CastType, IP6_CLIP_INFO::End, IP6_CLIP_INFO::FormerNextHeader, _IP6_FRAGMENT_HEADER::FragmentOffset, IP6_CLIP_INFO::HeadLen, IP6_CLIP_INFO::Id, _IP6_FRAGMENT_HEADER::Identification, IP6_GET_CLIP_INFO, IP6_MIN_HEADLEN, Ip6FindMldEntry(), Ip6IsExtsValid(), Ip6IsOneOfSetAddress(), Ip6Multicast, Ip6NtohHead(), Ip6Promiscuous, Ip6Reassemble(), Ip6Unicast, IP6_CLIP_INFO::LastFrag, IP6_CLIP_INFO::Length, IP6_CLIP_INFO::LinkFlag, _IP6_FRAGMENT_HEADER::NextHeader, IP6_CLIP_INFO::NextHeader, IP6_CLIP_INFO::Start, and IP6_CLIP_INFO::Status.
Referenced by Ip6AcceptFrame().
NET_BUF* Ip6Reassemble | ( | IN OUT IP6_ASSEMBLE_TABLE * | Table, | |
IN NET_BUF * | Packet | |||
) |
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. |
References IP6_ASSEMBLE_ENTRY::CurLen, IP6_ASSEMBLE_ENTRY::Dst, IP6_CLIP_INFO::End, IP6_CLIP_INFO::FormerNextHeader, IP6_ASSEMBLE_ENTRY::Fragments, IP6_ASSEMBLE_ENTRY::Head, IP6_CLIP_INFO::HeadLen, IP6_ASSEMBLE_ENTRY::Id, IP6_CLIP_INFO::Id, IP6_ASSEMBLE_ENTRY::Info, IP6_ASSEMBLE_HASH, IP6_GET_CLIP_INFO, Ip6CreateAssembleEntry(), Ip6FreeAssembleEntry(), Ip6NtohHead(), Ip6OnFreeFragments(), Ip6TrimPacket(), IP6_CLIP_INFO::LastFrag, IP6_CLIP_INFO::Length, IP6_ASSEMBLE_ENTRY::Link, IP6_CLIP_INFO::NextHeader, IP6_ASSEMBLE_ENTRY::Packet, IP6_ASSEMBLE_ENTRY::Src, IP6_CLIP_INFO::Start, and IP6_ASSEMBLE_ENTRY::TotalLen.
Referenced by Ip6PreProcessPacket().
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. |
References _IP6_PROTOCOL::Interface, Ip6CancelPacket(), IP6_TXTOKEN_WRAP::IpInstance, IP6_TXTOKEN_WRAP::Life, and IP6_TXTOKEN_WRAP::Packet.
Referenced by Ip6PacketTimerTicking().
VOID Ip6TrimPacket | ( | IN OUT NET_BUF * | Packet, | |
IN INTN | Start, | |||
IN INTN | End | |||
) |
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. |
References IP6_CLIP_INFO::End, IP6_GET_CLIP_INFO, IP6_CLIP_INFO::Length, and IP6_CLIP_INFO::Start.
Referenced by Ip6Reassemble().
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. |
References IP6_RXDATA_WRAP_SIZE, Ip6NtohHead(), Ip6OnRecyclePacket(), IP6_RXDATA_WRAP::IpInstance, IP6_RXDATA_WRAP::Link, IP6_RXDATA_WRAP::Packet, and IP6_RXDATA_WRAP::RxData.
Referenced by Ip6InstanceDeliverPacket().