4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Ip4 internal functions and type defintions.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncCopyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncThis program and the accompanying materials
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncare licensed and made available under the terms and conditions of the BSD License
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncwhich accompanies this distribution. The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define IP4_PROTOCOL_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'P')
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define IP4_SERVICE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'S')
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// The state of IP4 protocol. It starts from UNCONFIGED. if it is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// successfully configured, it goes to CONFIGED. if configure NULL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// is called, it becomes UNCONFIGED again. If (partly) destoried, it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// becomes DESTORY.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// The state of IP4 service. It starts from UNSTARTED. It transits
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// to STARTED if autoconfigure is started. If default address is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// configured, it becomes CONFIGED. and if partly destoried, it goes
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// to DESTORY.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// The user's data is kept in the Packet. When fragment is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// needed, each fragment of the Packet has a reference to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// Packet, no data is actually copied. The Packet will be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// released when all the fragments of it have been recycled by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// user's event signalled.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctypedef struct {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// IP4_IPSEC_WRAP wraps the packet received from MNP layer. The packet
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// will be released after it has been processed by the receiver. Upon then,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// the IP4_IPSEC_WRAP will be released, and the IpSecRecycleSignal will be signaled
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// to notice IPsec to free the resources.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctypedef struct {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// upper layers. The received packet is kept in the Packet.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// The Packet itself may be constructured from some fragments.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// All the fragments of the Packet is organized by a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// the upper layer, the assemble entry and its associated
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// fragments will be freed at last.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctypedef struct {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync LIST_ENTRY Link; // Link to all the IP protocol from the service
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // User's transmit/receive tokens, and received/deliverd packets
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync NET_MAP TxTokens; // map between (User's Token, IP4_TXTOKE_WRAP)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync LIST_ENTRY Received; // Received but not delivered packet
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync LIST_ENTRY Delivered; // Delivered and to be recycled packets
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Instance's address and route tables. There are two route tables.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // RouteTable is used by the IP4 driver to route packet. EfiRouteTable
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // is used to communicate the current route info to the upper layer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync LIST_ENTRY AddrLink; // Ip instances with the same IP address.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // IGMP data for this instance
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // List of all the IP instances and interfaces, and default
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // interface and route table and caches.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Ip reassemble utilities, and IGMP data
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Low level protocol used by this service instance
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Auto configure staff
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // The string representation of the current mac address of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // NIC this IP4_SERVICE works on.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync UINT32 OldMaxPacketSize; ///< The MTU before IPsec enable.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Config the MNP parameter used by IP. The IP driver use one MNP
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync child to transmit/receive frames. By default, it configures MNP
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to receive unicast/multicast/broadcast. And it will enable/disable
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the promiscous receive according to whether there is IP child
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync enable that or not. If Force is FALSE, it will iterate through
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync all the IP children to check whether the promiscuous receive
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync setting has been changed. If it hasn't been changed, it won't
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync reconfigure the MNP. If Force is TRUE, the MNP is configured no
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync matter whether that is changed or not.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] IpSb The IP4 service instance that is to be changed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Force Force the configuration or not.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS The MNP is successfully configured/reconfigured.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Others Configuration failed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Intiialize the IP4_PROTOCOL structure to the unconfigured states.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param IpSb The IP4 service instance.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param IpInstance The IP4 child instance.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Clean up the IP4 child, release all the resources used by it.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] IpInstance The IP4 child to clean up.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS The IP4 child is cleaned up
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_DEVICE_ERROR Some resources failed to be released
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Cancel the user's receive/transmit request.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] IpInstance The IP4 child
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Token The token to cancel. If NULL, all token will be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS The token is cancelled
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_NOT_FOUND The token isn't found on either the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_DEVICE_ERROR Not all token is cancelled when Token is NULL.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Change the IP4 child's multicast setting. The caller
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync should make sure that the parameters is valid.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] IpInstance The IP4 child to change the setting.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] JoinFlag TRUE to join the group, otherwise leave it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] GroupAddress The target group address
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_ALREADY_STARTED Want to join the group, but already a member of it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_DEVICE_ERROR Failed to set the group configuraton
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS Successfully updated the group setting.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_NOT_FOUND Try to leave the group which it isn't a member.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The heart beat timer of IP4 service instance. It times out
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync all of its IP4 children's received-but-not-delivered and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync transmitted-but-not-recycle packets, and provides time input
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync for its IGMP protocol.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Event The IP4 service instance's heart beat timer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Context The IP4 service instance.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Decrease the life of the transmitted packets. If it is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync decreased to zero, cancel the packet. This function is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync called by Ip4PacketTimerTicking which time out both the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync received-but-not-delivered and transmitted-but-not-recycle
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Map The IP4 child's transmit map.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Item Current transmitted packet
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Context Not used.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS Always returns EFI_SUCCESS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The callback function for the net buffer which wraps the user's
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync transmit token. Although it seems this function is pretty simple,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync there are some subtle things.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync When user requests the IP to transmit a packet by passing it a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync token, the token is wrapped in an IP4_TXTOKEN_WRAP and the data
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is wrapped in an net buffer. the net buffer's Free function is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync set to Ip4FreeTxToken. The Token and token wrap are added to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IP child's TxToken map. Then the buffer is passed to Ip4Output for
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync transmission. If something error happened before that, the buffer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is freed, which in turn will free the token wrap. The wrap may
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync have been added to the TxToken map or not, and the user's event
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shouldn't be fired because we are still in the EfiIp4Transmit. If
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the buffer has been sent by Ip4Output, it should be removed from
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the TxToken map and user's event signaled. The token wrap and buffer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync are bound together. Check the comments in Ip4Output for information
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync about IP fragmentation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Context The token's wrap