]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
NetworkPkg: Move Network library and drivers from MdeModulePkg to NetworkPkg
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Impl.h
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
deleted file mode 100644 (file)
index a322a85..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-/** @file\r
-  Ip4 internal functions and type defintions.\r
-\r
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
-(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
-\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef __EFI_IP4_IMPL_H__\r
-#define __EFI_IP4_IMPL_H__\r
-\r
-#include <Uefi.h>\r
-\r
-#include <Protocol/IpSec.h>\r
-#include <Protocol/Ip4.h>\r
-#include <Protocol/Ip4Config2.h>\r
-#include <Protocol/Arp.h>\r
-#include <Protocol/ManagedNetwork.h>\r
-#include <Protocol/Dhcp4.h>\r
-#include <Protocol/HiiConfigRouting.h>\r
-#include <Protocol/HiiConfigAccess.h>\r
-\r
-#include <IndustryStandard/Dhcp.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/NetLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DpcLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/UefiHiiServicesLib.h>\r
-\r
-#include "Ip4Common.h"\r
-#include "Ip4Driver.h"\r
-#include "Ip4If.h"\r
-#include "Ip4Icmp.h"\r
-#include "Ip4Option.h"\r
-#include "Ip4Igmp.h"\r
-#include "Ip4Route.h"\r
-#include "Ip4Input.h"\r
-#include "Ip4Output.h"\r
-#include "Ip4Config2Impl.h"\r
-#include "Ip4Config2Nv.h"\r
-#include "Ip4NvData.h"\r
-\r
-#define IP4_PROTOCOL_SIGNATURE  SIGNATURE_32 ('I', 'P', '4', 'P')\r
-#define IP4_SERVICE_SIGNATURE   SIGNATURE_32 ('I', 'P', '4', 'S')\r
-\r
-//\r
-// The state of IP4 protocol. It starts from UNCONFIGED. if it is\r
-// successfully configured, it goes to CONFIGED. if configure NULL\r
-// is called, it becomes UNCONFIGED again.\r
-//\r
-#define IP4_STATE_UNCONFIGED    0\r
-#define IP4_STATE_CONFIGED      1\r
-\r
-//\r
-// The state of IP4 service. It starts from UNSTARTED. It transits\r
-// to STARTED if autoconfigure is started. If default address is\r
-// configured, it becomes CONFIGED. and if partly destroyed, it goes\r
-// to DESTROY.\r
-//\r
-#define IP4_SERVICE_UNSTARTED   0\r
-#define IP4_SERVICE_STARTED     1\r
-#define IP4_SERVICE_CONFIGED    2\r
-#define IP4_SERVICE_DESTROY     3\r
-\r
-\r
-///\r
-/// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.\r
-/// The user's data is kept in the Packet. When fragment is\r
-/// needed, each fragment of the Packet has a reference to the\r
-/// Packet, no data is actually copied. The Packet will be\r
-/// released when all the fragments of it have been recycled by\r
-/// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and\r
-/// user's event signalled.\r
-///\r
-typedef struct {\r
-  IP4_PROTOCOL              *IpInstance;\r
-  EFI_IP4_COMPLETION_TOKEN  *Token;\r
-  EFI_EVENT                 IpSecRecycleSignal;\r
-  NET_BUF                   *Packet;\r
-  BOOLEAN                   Sent;\r
-  INTN                      Life;\r
-} IP4_TXTOKEN_WRAP;\r
-\r
-///\r
-/// IP4_IPSEC_WRAP wraps the packet received from MNP layer. The packet\r
-/// will be released after it has been processed by the receiver. Upon then,\r
-/// the IP4_IPSEC_WRAP will be released, and the IpSecRecycleSignal will be signaled\r
-/// to notice IPsec to free the resources.\r
-///\r
-typedef struct {\r
-  EFI_EVENT                 IpSecRecycleSignal;\r
-  NET_BUF                   *Packet;\r
-} IP4_IPSEC_WRAP;\r
-\r
-///\r
-/// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the\r
-/// upper layers. The received packet is kept in the Packet.\r
-/// The Packet itself may be constructured from some fragments.\r
-/// All the fragments of the Packet is organized by a\r
-/// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by\r
-/// the upper layer, the assemble entry and its associated\r
-/// fragments will be freed at last.\r
-///\r
-typedef struct {\r
-  LIST_ENTRY                Link;\r
-  IP4_PROTOCOL              *IpInstance;\r
-  NET_BUF                   *Packet;\r
-  EFI_IP4_RECEIVE_DATA      RxData;\r
-} IP4_RXDATA_WRAP;\r
-\r
-\r
-struct _IP4_PROTOCOL {\r
-  UINT32                    Signature;\r
-\r
-  EFI_IP4_PROTOCOL          Ip4Proto;\r
-  EFI_HANDLE                Handle;\r
-  INTN                      State;\r
-\r
-  BOOLEAN                   InDestroy;\r
-\r
-  IP4_SERVICE               *Service;\r
-  LIST_ENTRY                Link;       // Link to all the IP protocol from the service\r
-\r
-  //\r
-  // User's transmit/receive tokens, and received/deliverd packets\r
-  //\r
-  NET_MAP                   RxTokens;\r
-  NET_MAP                   TxTokens;   // map between (User's Token, IP4_TXTOKE_WRAP)\r
-  LIST_ENTRY                Received;   // Received but not delivered packet\r
-  LIST_ENTRY                Delivered;  // Delivered and to be recycled packets\r
-  EFI_LOCK                  RecycleLock;\r
-\r
-  //\r
-  // Instance's address and route tables. There are two route tables.\r
-  // RouteTable is used by the IP4 driver to route packet. EfiRouteTable\r
-  // is used to communicate the current route info to the upper layer.\r
-  //\r
-  IP4_INTERFACE             *Interface;\r
-  LIST_ENTRY                AddrLink;   // Ip instances with the same IP address.\r
-  IP4_ROUTE_TABLE           *RouteTable;\r
-\r
-  EFI_IP4_ROUTE_TABLE       *EfiRouteTable;\r
-  UINT32                    EfiRouteCount;\r
-\r
-  //\r
-  // IGMP data for this instance\r
-  //\r
-  IP4_ADDR                  *Groups;    // stored in network byte order\r
-  UINT32                    GroupCount;\r
-\r
-  EFI_IP4_CONFIG_DATA       ConfigData;\r
-\r
-};\r
-\r
-struct _IP4_SERVICE {\r
-  UINT32                          Signature;\r
-  EFI_SERVICE_BINDING_PROTOCOL    ServiceBinding;\r
-  INTN                            State;\r
-\r
-  //\r
-  // List of all the IP instances and interfaces, and default\r
-  // interface and route table and caches.\r
-  //\r
-  UINTN                           NumChildren;\r
-  LIST_ENTRY                      Children;\r
-\r
-  LIST_ENTRY                      Interfaces;\r
-\r
-  IP4_INTERFACE                   *DefaultInterface;\r
-  IP4_ROUTE_TABLE                 *DefaultRouteTable;\r
-\r
-  //\r
-  // Ip reassemble utilities, and IGMP data\r
-  //\r
-  IP4_ASSEMBLE_TABLE              Assemble;\r
-  IGMP_SERVICE_DATA               IgmpCtrl;\r
-\r
-  //\r
-  // Low level protocol used by this service instance\r
-  //\r
-  EFI_HANDLE                      Image;\r
-  EFI_HANDLE                      Controller;\r
-\r
-  EFI_HANDLE                      MnpChildHandle;\r
-  EFI_MANAGED_NETWORK_PROTOCOL    *Mnp;\r
-\r
-  EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;\r
-  EFI_SIMPLE_NETWORK_MODE         SnpMode;\r
-\r
-  EFI_EVENT                       Timer;\r
-  EFI_EVENT                       ReconfigCheckTimer;\r
-  EFI_EVENT                       ReconfigEvent;\r
-\r
-  BOOLEAN                         Reconfig;\r
-\r
-  //\r
-  // Underlying media present status.\r
-  //\r
-  BOOLEAN                         MediaPresent;\r
-\r
-  //\r
-  // IPv4 Configuration II Protocol instance\r
-  //\r
-  IP4_CONFIG2_INSTANCE            Ip4Config2Instance;\r
-\r
-  CHAR16                          *MacString;\r
-\r
-  UINT32                          MaxPacketSize;\r
-  UINT32                          OldMaxPacketSize; ///< The MTU before IPsec enable.\r
-};\r
-\r
-#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \\r
-          CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)\r
-\r
-#define IP4_SERVICE_FROM_PROTOCOL(Sb)   \\r
-          CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)\r
-\r
-#define IP4_SERVICE_FROM_CONFIG2_INSTANCE(This) \\r
-  CR (This, IP4_SERVICE, Ip4Config2Instance, IP4_SERVICE_SIGNATURE)\r
-\r
-\r
-#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)\r
-\r
-extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;\r
-\r
-/**\r
-  Config the MNP parameter used by IP. The IP driver use one MNP\r
-  child to transmit/receive frames. By default, it configures MNP\r
-  to receive unicast/multicast/broadcast. And it will enable/disable\r
-  the promiscous receive according to whether there is IP child\r
-  enable that or not. If Force is FALSE, it will iterate through\r
-  all the IP children to check whether the promiscuous receive\r
-  setting has been changed. If it hasn't been changed, it won't\r
-  reconfigure the MNP. If Force is TRUE, the MNP is configured no\r
-  matter whether that is changed or not.\r
-\r
-  @param[in]  IpSb               The IP4 service instance that is to be changed.\r
-  @param[in]  Force              Force the configuration or not.\r
-\r
-  @retval EFI_SUCCESS            The MNP is successfully configured/reconfigured.\r
-  @retval Others                 Configuration failed.\r
-\r
-**/\r
-EFI_STATUS\r
-Ip4ServiceConfigMnp (\r
-  IN IP4_SERVICE            *IpSb,\r
-  IN BOOLEAN                Force\r
-  );\r
-\r
-/**\r
-  Intiialize the IP4_PROTOCOL structure to the unconfigured states.\r
-\r
-  @param  IpSb                   The IP4 service instance.\r
-  @param  IpInstance             The IP4 child instance.\r
-\r
-**/\r
-VOID\r
-Ip4InitProtocol (\r
-  IN     IP4_SERVICE            *IpSb,\r
-  IN OUT IP4_PROTOCOL           *IpInstance\r
-  );\r
-\r
-/**\r
-  Clean up the IP4 child, release all the resources used by it.\r
-\r
-  @param[in]  IpInstance         The IP4 child to clean up.\r
-\r
-  @retval EFI_SUCCESS            The IP4 child is cleaned up.\r
-  @retval EFI_DEVICE_ERROR       Some resources failed to be released.\r
-\r
-**/\r
-EFI_STATUS\r
-Ip4CleanProtocol (\r
-  IN  IP4_PROTOCOL          *IpInstance\r
-  );\r
-\r
-/**\r
-  Cancel the user's receive/transmit request.\r
-\r
-  @param[in]  IpInstance         The IP4 child.\r
-  @param[in]  Token              The token to cancel. If NULL, all token will be\r
-                                 cancelled.\r
-\r
-  @retval EFI_SUCCESS            The token is cancelled.\r
-  @retval EFI_NOT_FOUND          The token isn't found on either the\r
-                                 transmit/receive queue.\r
-  @retval EFI_DEVICE_ERROR       Not all token is cancelled when Token is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-Ip4Cancel (\r
-  IN IP4_PROTOCOL             *IpInstance,\r
-  IN EFI_IP4_COMPLETION_TOKEN *Token          OPTIONAL\r
-  );\r
-\r
-/**\r
-  Change the IP4 child's multicast setting. The caller\r
-  should make sure that the parameters is valid.\r
-\r
-  @param[in]  IpInstance             The IP4 child to change the setting.\r
-  @param[in]  JoinFlag               TRUE to join the group, otherwise leave it\r
-  @param[in]  GroupAddress           The target group address\r
-\r
-  @retval EFI_ALREADY_STARTED    Want to join the group, but already a member of it\r
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate some resources.\r
-  @retval EFI_DEVICE_ERROR       Failed to set the group configuraton\r
-  @retval EFI_SUCCESS            Successfully updated the group setting.\r
-  @retval EFI_NOT_FOUND          Try to leave the group which it isn't a member.\r
-\r
-**/\r
-EFI_STATUS\r
-Ip4Groups (\r
-  IN IP4_PROTOCOL           *IpInstance,\r
-  IN BOOLEAN                JoinFlag,\r
-  IN EFI_IPv4_ADDRESS       *GroupAddress       OPTIONAL\r
-  );\r
-\r
-/**\r
-  This heart beat timer of IP4 service instance times out all of its IP4 children's\r
-  received-but-not-delivered and transmitted-but-not-recycle packets, and provides\r
-  time input for its IGMP protocol.\r
-\r
-  @param[in]  Event                  The IP4 service instance's heart beat timer.\r
-  @param[in]  Context                The IP4 service instance.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-Ip4TimerTicking (\r
-  IN EFI_EVENT              Event,\r
-  IN VOID                   *Context\r
-  );\r
-\r
-/**\r
-  This dedicated timer is used to poll underlying network media status. In case\r
-  of cable swap or wireless network switch, a new round auto configuration will\r
-  be initiated. The timer will signal the IP4 to run DHCP configuration again.\r
-  IP4 driver will free old IP address related resource, such as route table and\r
-  Interface, then initiate a DHCP process to acquire new IP, eventually create\r
-  route table for new IP address.\r
-\r
-  @param[in]  Event                  The IP4 service instance's heart beat timer.\r
-  @param[in]  Context                The IP4 service instance.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-Ip4TimerReconfigChecking (\r
-  IN EFI_EVENT              Event,\r
-  IN VOID                   *Context\r
-  );\r
-\r
-/**\r
-  Decrease the life of the transmitted packets. If it is\r
-  decreased to zero, cancel the packet. This function is\r
-  called by Ip4PacketTimerTicking which time out both the\r
-  received-but-not-delivered and transmitted-but-not-recycle\r
-  packets.\r
-\r
-  @param[in]  Map                    The IP4 child's transmit map.\r
-  @param[in]  Item                   Current transmitted packet.\r
-  @param[in]  Context                Not used.\r
-\r
-  @retval EFI_SUCCESS            Always returns EFI_SUCCESS.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Ip4SentPacketTicking (\r
-  IN NET_MAP                *Map,\r
-  IN NET_MAP_ITEM           *Item,\r
-  IN VOID                   *Context\r
-  );\r
-\r
-/**\r
-  The callback function for the net buffer which wraps the user's\r
-  transmit token. Although it seems this function is pretty simple,\r
-  there are some subtle things.\r
-  When user requests the IP to transmit a packet by passing it a\r
-  token, the token is wrapped in an IP4_TXTOKEN_WRAP and the data\r
-  is wrapped in an net buffer. the net buffer's Free function is\r
-  set to Ip4FreeTxToken. The Token and token wrap are added to the\r
-  IP child's TxToken map. Then the buffer is passed to Ip4Output for\r
-  transmission. If something error happened before that, the buffer\r
-  is freed, which in turn will free the token wrap. The wrap may\r
-  have been added to the TxToken map or not, and the user's event\r
-  shouldn't be fired because we are still in the EfiIp4Transmit. If\r
-  the buffer has been sent by Ip4Output, it should be removed from\r
-  the TxToken map and user's event signaled. The token wrap and buffer\r
-  are bound together. Check the comments in Ip4Output for information\r
-  about IP fragmentation.\r
-\r
-  @param[in]  Context                The token's wrap.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-Ip4FreeTxToken (\r
-  IN VOID                   *Context\r
-  );\r
-\r
-extern EFI_IPSEC2_PROTOCOL   *mIpSec;\r
-extern BOOLEAN               mIpSec2Installed;\r
-\r
-#endif\r