X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FIp4Dxe%2FIp4Impl.h;h=615e5ae2a8bcda4a2e02d51157bfccd37c060a14;hp=94b4534de2cddc8ad7274a1ee08b1d6a1a2996a2;hb=d8d26fb207e02aa5ef57e2bcb213f9dda16166cc;hpb=c4a62a12c2890297cfcb9828b51b058fb347c01a diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h index 94b4534de2..615e5ae2a8 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h @@ -1,6 +1,7 @@ /** @file - -Copyright (c) 2005 - 2007, Intel Corporation + Ip4 internal functions and type defintions. + +Copyright (c) 2005 - 2007, Intel Corporation.
All rights reserved. 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 @@ -9,24 +10,15 @@ 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. -Module Name: - - Ip4Impl.h - -Abstract: - - Ip4 internal functions and type defintions. - - **/ #ifndef __EFI_IP4_IMPL_H__ #define __EFI_IP4_IMPL_H__ -#include +#include -#include -#include +#include +#include #include #include @@ -39,6 +31,7 @@ Abstract: #include #include #include +#include #include "Ip4Common.h" #include "Ip4Driver.h" @@ -50,9 +43,11 @@ Abstract: #include "Ip4Input.h" #include "Ip4Output.h" -enum { - IP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'P'), - IP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'S'), + + +typedef enum { + IP4_PROTOCOL_SIGNATURE = SIGNATURE_32 ('I', 'P', '4', 'P'), + IP4_SERVICE_SIGNATURE = SIGNATURE_32 ('I', 'P', '4', 'S'), // // The state of IP4 protocol. It starts from UNCONFIGED. if it is @@ -74,17 +69,17 @@ enum { IP4_SERVICE_STARTED, IP4_SERVICE_CONFIGED, IP4_SERVICE_DESTORY -}; - -// -// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token. -// The user's data is kept in the Packet. When fragment is -// needed, each fragment of the Packet has a reference to the -// Packet, no data is actually copied. The Packet will be -// released when all the fragments of it have been recycled by -// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and -// user's event signalled. -// +} IP4_IMPL_ENUM_TYPES; + +/// +/// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token. +/// The user's data is kept in the Packet. When fragment is +/// needed, each fragment of the Packet has a reference to the +/// Packet, no data is actually copied. The Packet will be +/// released when all the fragments of it have been recycled by +/// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and +/// user's event signalled. +/// typedef struct { IP4_PROTOCOL *IpInstance; EFI_IP4_COMPLETION_TOKEN *Token; @@ -93,22 +88,23 @@ typedef struct { INTN Life; } IP4_TXTOKEN_WRAP; -// -// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the -// upper layers. The received packet is kept in the Packet. -// The Packet itself may be constructured from some fragments. -// All the fragments of the Packet is organized by a -// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by -// the upper layer, the assemble entry and its associated -// fragments will be freed at last. -// +/// +/// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the +/// upper layers. The received packet is kept in the Packet. +/// The Packet itself may be constructured from some fragments. +/// All the fragments of the Packet is organized by a +/// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by +/// the upper layer, the assemble entry and its associated +/// fragments will be freed at last. +/// typedef struct { - NET_LIST_ENTRY Link; + LIST_ENTRY Link; IP4_PROTOCOL *IpInstance; NET_BUF *Packet; EFI_IP4_RECEIVE_DATA RxData; } IP4_RXDATA_WRAP; + struct _IP4_PROTOCOL { UINT32 Signature; @@ -117,15 +113,15 @@ struct _IP4_PROTOCOL { INTN State; IP4_SERVICE *Service; - NET_LIST_ENTRY Link; // Link to all the IP protocol from the service + LIST_ENTRY Link; // Link to all the IP protocol from the service // // User's transmit/receive tokens, and received/deliverd packets // NET_MAP RxTokens; NET_MAP TxTokens; // map between (User's Token, IP4_TXTOKE_WRAP) - NET_LIST_ENTRY Received; // Received but not delivered packet - NET_LIST_ENTRY Delivered; // Delivered and to be recycled packets + LIST_ENTRY Received; // Received but not delivered packet + LIST_ENTRY Delivered; // Delivered and to be recycled packets EFI_LOCK RecycleLock; // @@ -134,7 +130,7 @@ struct _IP4_PROTOCOL { // is used to communicate the current route info to the upper layer. // IP4_INTERFACE *Interface; - NET_LIST_ENTRY AddrLink; // Ip instances with the same IP address. + LIST_ENTRY AddrLink; // Ip instances with the same IP address. IP4_ROUTE_TABLE *RouteTable; EFI_IP4_ROUTE_TABLE *EfiRouteTable; @@ -161,9 +157,9 @@ struct _IP4_SERVICE { // interface and route table and caches. // UINTN NumChildren; - NET_LIST_ENTRY Children; + LIST_ENTRY Children; - NET_LIST_ENTRY Interfaces; + LIST_ENTRY Interfaces; IP4_INTERFACE *DefaultInterface; IP4_ROUTE_TABLE *DefaultRouteTable; @@ -213,36 +209,108 @@ struct _IP4_SERVICE { extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete; +/** + Config the MNP parameter used by IP. The IP driver use one MNP + child to transmit/receive frames. By default, it configures MNP + to receive unicast/multicast/broadcast. And it will enable/disable + the promiscous receive according to whether there is IP child + enable that or not. If Force is FALSE, it will iterate through + all the IP children to check whether the promiscuous receive + setting has been changed. If it hasn't been changed, it won't + reconfigure the MNP. If Force is TRUE, the MNP is configured no + matter whether that is changed or not. + + @param[in] IpSb The IP4 service instance that is to be changed. + @param[in] Force Force the configuration or not. + + @retval EFI_SUCCESS The MNP is successfully configured/reconfigured. + @retval Others Configuration failed. + +**/ EFI_STATUS Ip4ServiceConfigMnp ( IN IP4_SERVICE *IpSb, IN BOOLEAN Force ); +/** + Intiialize the IP4_PROTOCOL structure to the unconfigured states. + + @param IpSb The IP4 service instance. + @param IpInstance The IP4 child instance. + +**/ VOID Ip4InitProtocol ( - IN IP4_SERVICE *IpSb, - IN IP4_PROTOCOL *IpInstance + IN IP4_SERVICE *IpSb, + IN OUT IP4_PROTOCOL *IpInstance ); +/** + Clean up the IP4 child, release all the resources used by it. + + @param[in] IpInstance The IP4 child to clean up. + + @retval EFI_SUCCESS The IP4 child is cleaned up + @retval EFI_DEVICE_ERROR Some resources failed to be released + +**/ EFI_STATUS Ip4CleanProtocol ( IN IP4_PROTOCOL *IpInstance ); +/** + Cancel the user's receive/transmit request. + + @param[in] IpInstance The IP4 child + @param[in] Token The token to cancel. If NULL, all token will be + cancelled. + + @retval EFI_SUCCESS The token is cancelled + @retval EFI_NOT_FOUND The token isn't found on either the + transmit/receive queue + @retval EFI_DEVICE_ERROR Not all token is cancelled when Token is NULL. + +**/ EFI_STATUS Ip4Cancel ( IN IP4_PROTOCOL *IpInstance, - IN EFI_IP4_COMPLETION_TOKEN *Token + IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL ); +/** + Change the IP4 child's multicast setting. The caller + should make sure that the parameters is valid. + + @param[in] IpInstance The IP4 child to change the setting. + @param[in] JoinFlag TRUE to join the group, otherwise leave it + @param[in] GroupAddress The target group address + + @retval EFI_ALREADY_STARTED Want to join the group, but already a member of it + @retval EFI_OUT_OF_RESOURCES Failed to allocate some resources. + @retval EFI_DEVICE_ERROR Failed to set the group configuraton + @retval EFI_SUCCESS Successfully updated the group setting. + @retval EFI_NOT_FOUND Try to leave the group which it isn't a member. + +**/ EFI_STATUS Ip4Groups ( IN IP4_PROTOCOL *IpInstance, IN BOOLEAN JoinFlag, - IN EFI_IPv4_ADDRESS *GroupAddress + IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL ); +/** + The heart beat timer of IP4 service instance. It times out + all of its IP4 children's received-but-not-delivered and + transmitted-but-not-recycle packets, and provides time input + for its IGMP protocol. + + @param[in] Event The IP4 service instance's heart beat timer. + @param[in] Context The IP4 service instance. + +**/ VOID EFIAPI Ip4TimerTicking ( @@ -250,6 +318,20 @@ Ip4TimerTicking ( IN VOID *Context ); +/** + Decrease the life of the transmitted packets. If it is + decreased to zero, cancel the packet. This function is + called by Ip4PacketTimerTicking which time out both the + received-but-not-delivered and transmitted-but-not-recycle + packets. + + @param[in] Map The IP4 child's transmit map. + @param[in] Item Current transmitted packet + @param[in] Context Not used. + + @retval EFI_SUCCESS Always returns EFI_SUCCESS + +**/ EFI_STATUS Ip4SentPacketTicking ( IN NET_MAP *Map,