]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
Update to support to produce Component Name and & Component Name 2 protocol based...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Impl.h
index 58bf045372ac09c8709cf7f948c42159178f2c61..35ada7feff294179b11ca5c2e93eadb5a9ee4761 100644 (file)
@@ -1,28 +1,28 @@
-/** @file
-
-Copyright (c) 2005 - 2006, 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
-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__
-
+/** @file\r
+\r
+Copyright (c) 2005 - 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+Module Name:\r
+\r
+  Ip4Impl.h\r
+\r
+Abstract:\r
+\r
+  Ip4 internal functions and type defintions.\r
+\r
+\r
+**/\r
+\r
+#ifndef __EFI_IP4_IMPL_H__\r
+#define __EFI_IP4_IMPL_H__\r
+\r
 #include <PiDxe.h>\r
 \r
 #include <Protocol/IP4.h>\r
@@ -35,224 +35,224 @@ Abstract:
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/BaseLib.h>\r
-#include <Library/UefiLib.h>
-#include <Library/NetLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include "Ip4Common.h"
-#include "Ip4Driver.h"
-#include "Ip4If.h"
-#include "Ip4Icmp.h"
-#include "Ip4Option.h"
-#include "Ip4Igmp.h"
-#include "Ip4Route.h"
-#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'),
-
-  //
-  // The state of IP4 protocol. It starts from UNCONFIGED. if it is
-  // successfully configured, it goes to CONFIGED. if configure NULL
-  // is called, it becomes UNCONFIGED again. If (partly) destoried, it
-  // becomes DESTORY.
-  //
-  IP4_STATE_UNCONFIGED   = 0,
-  IP4_STATE_CONFIGED,
-  IP4_STATE_DESTORY,
-
-  //
-  // The state of IP4 service. It starts from UNSTARTED. It transits
-  // to STARTED if autoconfigure is started. If default address is
-  // configured, it becomes CONFIGED. and if partly destoried, it goes
-  // to DESTORY.
-  //
-  IP4_SERVICE_UNSTARTED  = 0,
-  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.
-//
-typedef struct {
-  IP4_PROTOCOL              *IpInstance;
-  EFI_IP4_COMPLETION_TOKEN  *Token;
-  NET_BUF                   *Packet;
-  BOOLEAN                   Sent;
-  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.
-//
-typedef struct {
-  NET_LIST_ENTRY            Link;
-  IP4_PROTOCOL              *IpInstance;
-  NET_BUF                   *Packet;
-  EFI_IP4_RECEIVE_DATA      RxData;
-} IP4_RXDATA_WRAP;
-
-struct _IP4_PROTOCOL {
-  UINT32                    Signature;
-
-  EFI_IP4_PROTOCOL          Ip4Proto;
-  EFI_HANDLE                Handle;
-  INTN                      State;
-
-  IP4_SERVICE               *Service;
-  NET_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
-  EFI_LOCK                  RecycleLock;
-
-  //
-  // Instance's address and route tables. There are two route tables.
-  // RouteTable is used by the IP4 driver to route packet. EfiRouteTable
-  // 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.
-  IP4_ROUTE_TABLE           *RouteTable;
-
-  EFI_IP4_ROUTE_TABLE       *EfiRouteTable;
-  UINT32                    EfiRouteCount;
-
-  //
-  // IGMP data for this instance
-  //
-  IP4_ADDR                  *Groups;  // stored in network byte order
-  UINT32                    GroupCount;
-
-  EFI_IP4_CONFIG_DATA       ConfigData;
-
-};
-
-struct _IP4_SERVICE {
-  UINT32                          Signature;
-  EFI_SERVICE_BINDING_PROTOCOL    ServiceBinding;
-  INTN                            State;
-  BOOLEAN                         InDestory;
-
-  //
-  // List of all the IP instances and interfaces, and default
-  // interface and route table and caches.
-  //
-  UINTN                           NumChildren;
-  NET_LIST_ENTRY                  Children;
-
-  NET_LIST_ENTRY                  Interfaces;
-
-  IP4_INTERFACE                   *DefaultInterface;
-  IP4_ROUTE_TABLE                 *DefaultRouteTable;
-
-  //
-  // Ip reassemble utilities, and IGMP data
-  //
-  IP4_ASSEMBLE_TABLE              Assemble;
-  IGMP_SERVICE_DATA               IgmpCtrl;
-
-  //
-  // Low level protocol used by this service instance
-  //
-  EFI_HANDLE                      Image;
-  EFI_HANDLE                      Controller;
-
-  EFI_HANDLE                      MnpChildHandle;
-  EFI_MANAGED_NETWORK_PROTOCOL    *Mnp;
-
-  EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
-  EFI_SIMPLE_NETWORK_MODE         SnpMode;
-
-  EFI_EVENT                       Timer;
-
-  //
-  // Auto configure staff
-  //
-  EFI_IP4_CONFIG_PROTOCOL         *Ip4Config;
-  EFI_EVENT                       DoneEvent;
-  EFI_EVENT                       ReconfigEvent;
-
-  //
-  // The string representation of the current mac address of the
-  // NIC this IP4_SERVICE works on.
-  //
-  CHAR16                          *MacString;
-};
-
-#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \
-          CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
-
-#define IP4_SERVICE_FROM_PROTOCOL(Sb)   \
-          CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
-
-#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
-
-extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
-
-EFI_STATUS
-Ip4ServiceConfigMnp (
-  IN IP4_SERVICE            *IpSb,
-  IN BOOLEAN                Force
-  );
-
-VOID
-Ip4InitProtocol (
-  IN IP4_SERVICE            *IpSb,
-  IN IP4_PROTOCOL           *IpInstance
-  );
-
-EFI_STATUS
-Ip4CleanProtocol (
-  IN  IP4_PROTOCOL          *IpInstance
-  );
-
-EFI_STATUS
-Ip4Cancel (
-  IN IP4_PROTOCOL             *IpInstance,
-  IN EFI_IP4_COMPLETION_TOKEN *Token
-  );
-
-EFI_STATUS
-Ip4Groups (
-  IN IP4_PROTOCOL           *IpInstance,
-  IN BOOLEAN                JoinFlag,
-  IN EFI_IPv4_ADDRESS       *GroupAddress
-  );
-
-VOID
-EFIAPI
-Ip4TimerTicking (
-  IN EFI_EVENT              Event,
-  IN VOID                   *Context
-  );
-
-EFI_STATUS
-Ip4SentPacketTicking (
-  IN NET_MAP                *Map,
-  IN NET_MAP_ITEM           *Item,
-  IN VOID                   *Context
-  );
-#endif
+#include <Library/UefiLib.h>\r
+#include <Library/NetLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.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
+\r
+enum {\r
+  IP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'P'),\r
+  IP4_SERVICE_SIGNATURE  = EFI_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. If (partly) destoried, it\r
+  // becomes DESTORY.\r
+  //\r
+  IP4_STATE_UNCONFIGED   = 0,\r
+  IP4_STATE_CONFIGED,\r
+  IP4_STATE_DESTORY,\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 destoried, it goes\r
+  // to DESTORY.\r
+  //\r
+  IP4_SERVICE_UNSTARTED  = 0,\r
+  IP4_SERVICE_STARTED,\r
+  IP4_SERVICE_CONFIGED,\r
+  IP4_SERVICE_DESTORY\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
+  NET_BUF                   *Packet;\r
+  BOOLEAN                   Sent;\r
+  INTN                      Life;\r
+} IP4_TXTOKEN_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
+  NET_LIST_ENTRY            Link;\r
+  IP4_PROTOCOL              *IpInstance;\r
+  NET_BUF                   *Packet;\r
+  EFI_IP4_RECEIVE_DATA      RxData;\r
+} IP4_RXDATA_WRAP;\r
+\r
+struct _IP4_PROTOCOL {\r
+  UINT32                    Signature;\r
+\r
+  EFI_IP4_PROTOCOL          Ip4Proto;\r
+  EFI_HANDLE                Handle;\r
+  INTN                      State;\r
+\r
+  IP4_SERVICE               *Service;\r
+  NET_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
+  NET_LIST_ENTRY            Received;   // Received but not delivered packet\r
+  NET_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
+  NET_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
+  BOOLEAN                         InDestory;\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
+  NET_LIST_ENTRY                  Children;\r
+\r
+  NET_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
+\r
+  //\r
+  // Auto configure staff\r
+  //\r
+  EFI_IP4_CONFIG_PROTOCOL         *Ip4Config;\r
+  EFI_EVENT                       DoneEvent;\r
+  EFI_EVENT                       ReconfigEvent;\r
+\r
+  //\r
+  // The string representation of the current mac address of the\r
+  // NIC this IP4_SERVICE works on.\r
+  //\r
+  CHAR16                          *MacString;\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_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)\r
+\r
+extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;\r
+\r
+EFI_STATUS\r
+Ip4ServiceConfigMnp (\r
+  IN IP4_SERVICE            *IpSb,\r
+  IN BOOLEAN                Force\r
+  );\r
+\r
+VOID\r
+Ip4InitProtocol (\r
+  IN IP4_SERVICE            *IpSb,\r
+  IN IP4_PROTOCOL           *IpInstance\r
+  );\r
+\r
+EFI_STATUS\r
+Ip4CleanProtocol (\r
+  IN  IP4_PROTOCOL          *IpInstance\r
+  );\r
+\r
+EFI_STATUS\r
+Ip4Cancel (\r
+  IN IP4_PROTOCOL             *IpInstance,\r
+  IN EFI_IP4_COMPLETION_TOKEN *Token\r
+  );\r
+\r
+EFI_STATUS\r
+Ip4Groups (\r
+  IN IP4_PROTOCOL           *IpInstance,\r
+  IN BOOLEAN                JoinFlag,\r
+  IN EFI_IPv4_ADDRESS       *GroupAddress\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+Ip4TimerTicking (\r
+  IN EFI_EVENT              Event,\r
+  IN VOID                   *Context\r
+  );\r
+\r
+EFI_STATUS\r
+Ip4SentPacketTicking (\r
+  IN NET_MAP                *Map,\r
+  IN NET_MAP_ITEM           *Item,\r
+  IN VOID                   *Context\r
+  );\r
+#endif\r