]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h
Update to support to produce Component Name and & Component Name 2 protocol based...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4If.h
index 9db1d8ac79892b9e3421240e500e02f23bee07c5..22db034a0a509484dba7aedd5aff3065d865cb98 100644 (file)
-/** @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:
-
-  Ip4If.h
-
-Abstract:
-
-  Definition for IP4 pesudo interface structure.
-
-
-**/
-
-#ifndef __EFI_IP4_IF_H__
-#define __EFI_IP4_IF_H__
-
-enum {
-  IP4_FRAME_RX_SIGNATURE  = EFI_SIGNATURE_32 ('I', 'P', 'F', 'R'),
-  IP4_FRAME_TX_SIGNATURE  = EFI_SIGNATURE_32 ('I', 'P', 'F', 'T'),
-  IP4_FRAME_ARP_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'A'),
-  IP4_INTERFACE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'I', 'F')
-};
-
-//
-// This prototype is used by both receive and transmission.
-// When receiving Netbuf is allocated by IP4_INTERFACE, and
-// released by IP4. Flag shows whether the frame is received
-// as link broadcast/multicast...
-//
-// When transmitting, the Netbuf is from IP4, and provided
-// to the callback as a reference. Flag isn't used.
-//
-// IpInstance can be NULL which means that it is the IP4 driver
-// itself sending the packets. IP4 driver may send packets that
-// don't belong to any instance, such as ICMP errors, ICMP echo
-// responses, or IGMP packets. IpInstance is used as a tag in
-// this module.
-//
-typedef
-VOID
-(*IP4_FRAME_CALLBACK) (
-  IP4_PROTOCOL              *IpInstance,       OPTIONAL
-  NET_BUF                   *Packet,
-  EFI_STATUS                IoStatus,
-  UINT32                    LinkFlag,
-  VOID                      *Context
-  );
-
-//
-// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
-// Upon completion, the Callback will be called. Only one
-// receive request is send to MNP. IpInstance is always NULL.
-// Reference MNP's spec for information.
-//
-typedef struct {
-  UINT32                                Signature;
-  IP4_INTERFACE                         *Interface;
-
-  IP4_PROTOCOL                          *IpInstance;
-  IP4_FRAME_CALLBACK                    CallBack;
-  VOID                                  *Context;
-
-  EFI_MANAGED_NETWORK_COMPLETION_TOKEN  MnpToken;
-} IP4_LINK_RX_TOKEN;
-
-//
-// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
-// Upon completion, the Callback will be called.
-//
-typedef struct {
-  UINT32                                Signature;
-  NET_LIST_ENTRY                        Link;
-
-  IP4_INTERFACE                         *Interface;
-
-  IP4_PROTOCOL                          *IpInstance;
-  IP4_FRAME_CALLBACK                    CallBack;
-  NET_BUF                               *Packet;
-  VOID                                  *Context;
-
-  EFI_MAC_ADDRESS                       DstMac;
-  EFI_MAC_ADDRESS                       SrcMac;
-
-  EFI_MANAGED_NETWORK_COMPLETION_TOKEN  MnpToken;
-  EFI_MANAGED_NETWORK_TRANSMIT_DATA     MnpTxData;
-} IP4_LINK_TX_TOKEN;
-
-//
-// Only one ARP request is requested for all the frames in
-// a time. It is started for the first frames to the Ip. Any
-// subsequent transmission frame will be linked to Frames, and
-// be sent all at once the ARP requests succeed.
-//
-typedef struct {
-  UINT32                  Signature;
-  NET_LIST_ENTRY          Link;
-
-  NET_LIST_ENTRY          Frames;
-  IP4_INTERFACE           *Interface;
-
-  //
-  // ARP requesting staffs
-  //
-  EFI_EVENT               OnResolved;
-  IP4_ADDR                Ip;
-  EFI_MAC_ADDRESS         Mac;
-} IP4_ARP_QUE;
-
-//
-// Callback to select which frame to cancel. Caller can cancel a
-// single frame, or all the frame from an IP instance.
-//
-typedef
-BOOLEAN
-(*IP4_FRAME_TO_CANCEL) (
-  IP4_LINK_TX_TOKEN       *Frame,
-  VOID                    *Context
-  );
-
-//
-// Each IP4 instance has its own station address. All the instances
-// with the same station address share a single interface structure.
-// Each interface has its own ARP child, and shares one MNP child.
-// Notice the special cases that DHCP can configure the interface
-// with 0.0.0.0/0.0.0.0.
-//
-struct _IP4_INTERFACE {
-  UINT32                        Signature;
-  NET_LIST_ENTRY                Link;
-  INTN                          RefCnt;
-
-  //
-  // IP address and subnet mask of the interface. It also contains
-  // the subnet/net broadcast address for quick access. The fileds
-  // are invalid if (Configured == FALSE)
-  //
-  IP4_ADDR                      Ip;
-  IP4_ADDR                      SubnetMask;
-  IP4_ADDR                      SubnetBrdcast;
-  IP4_ADDR                      NetBrdcast;
-  BOOLEAN                       Configured;
-
-  //
-  // Handle used to create/destory ARP child. All the IP children
-  // share one MNP which is owned by IP service binding.
-  //
-  EFI_HANDLE                    Controller;
-  EFI_HANDLE                    Image;
-
-  EFI_MANAGED_NETWORK_PROTOCOL  *Mnp;
-  EFI_ARP_PROTOCOL              *Arp;
-  EFI_HANDLE                    ArpHandle;
-
-  //
-  // Queues to keep the frames sent and waiting ARP request.
-  //
-  NET_LIST_ENTRY                ArpQues;
-  NET_LIST_ENTRY                SentFrames;
-  IP4_LINK_RX_TOKEN             *RecvRequest;
-
-  //
-  // The interface's MAC and broadcast MAC address.
-  //
-  EFI_MAC_ADDRESS               Mac;
-  EFI_MAC_ADDRESS               BroadcastMac;
-  UINT32                        HwaddrLen;
-
-  //
-  // All the IP instances that have the same IP/SubnetMask are linked
-  // together through IpInstances. If any of the instance enables
-  // promiscuous receive, PromiscRecv is true.
-  //
-  NET_LIST_ENTRY                IpInstances;
-  BOOLEAN                       PromiscRecv;
-};
-
-IP4_INTERFACE *
-Ip4CreateInterface (
-  IN  EFI_MANAGED_NETWORK_PROTOCOL  *Mnp,
-  IN  EFI_HANDLE                    Controller,
-  IN  EFI_HANDLE                    ImageHandle
-  );
-
-EFI_STATUS
-Ip4SetAddress (
-  IN  IP4_INTERFACE         *Interface,
-  IN  IP4_ADDR              IpAddr,
-  IN  IP4_ADDR              SubnetMask
-  );
-
-EFI_STATUS
-Ip4FreeInterface (
-  IN  IP4_INTERFACE         *Interface,
-  IN  IP4_PROTOCOL          *IpInstance       OPTIONAL
-  );
-
-EFI_STATUS
-Ip4SendFrame (
-  IN  IP4_INTERFACE         *Interface,
-  IN  IP4_PROTOCOL          *IpInstance,      OPTIONAL
-  IN  NET_BUF               *Packet,
-  IN  IP4_ADDR              NextHop,
-  IN  IP4_FRAME_CALLBACK    CallBack,
-  IN  VOID                  *Context
-  );
-
-VOID
-Ip4CancelFrames (
-  IN IP4_INTERFACE          *Interface,
-  IN EFI_STATUS             IoStatus,
-  IN IP4_FRAME_TO_CANCEL    FrameToCancel,   OPTIONAL
-  IN VOID                   *Context
-  );
-
-VOID
-Ip4CancelReceive (
-  IN IP4_INTERFACE          *Interface
-  );
-
-EFI_STATUS
-Ip4ReceiveFrame (
-  IN  IP4_INTERFACE         *Interface,
-  IN  IP4_PROTOCOL          *IpInstance,      OPTIONAL
-  IN  IP4_FRAME_CALLBACK    CallBack,
-  IN  VOID                  *Context
-  );
-
-#endif
+/** @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
+\r
+Module Name:\r
+\r
+  Ip4If.h\r
+\r
+Abstract:\r
+\r
+  Definition for IP4 pesudo interface structure.\r
+\r
+\r
+**/\r
+\r
+#ifndef __EFI_IP4_IF_H__\r
+#define __EFI_IP4_IF_H__\r
+\r
+enum {\r
+  IP4_FRAME_RX_SIGNATURE  = EFI_SIGNATURE_32 ('I', 'P', 'F', 'R'),\r
+  IP4_FRAME_TX_SIGNATURE  = EFI_SIGNATURE_32 ('I', 'P', 'F', 'T'),\r
+  IP4_FRAME_ARP_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'A'),\r
+  IP4_INTERFACE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'I', 'F')\r
+};\r
+\r
+//\r
+// This prototype is used by both receive and transmission.\r
+// When receiving Netbuf is allocated by IP4_INTERFACE, and\r
+// released by IP4. Flag shows whether the frame is received\r
+// as link broadcast/multicast...\r
+//\r
+// When transmitting, the Netbuf is from IP4, and provided\r
+// to the callback as a reference. Flag isn't used.\r
+//\r
+// IpInstance can be NULL which means that it is the IP4 driver\r
+// itself sending the packets. IP4 driver may send packets that\r
+// don't belong to any instance, such as ICMP errors, ICMP echo\r
+// responses, or IGMP packets. IpInstance is used as a tag in\r
+// this module.\r
+//\r
+typedef\r
+VOID\r
+(*IP4_FRAME_CALLBACK) (\r
+  IP4_PROTOCOL              *IpInstance,       OPTIONAL\r
+  NET_BUF                   *Packet,\r
+  EFI_STATUS                IoStatus,\r
+  UINT32                    LinkFlag,\r
+  VOID                      *Context\r
+  );\r
+\r
+//\r
+// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.\r
+// Upon completion, the Callback will be called. Only one\r
+// receive request is send to MNP. IpInstance is always NULL.\r
+// Reference MNP's spec for information.\r
+//\r
+typedef struct {\r
+  UINT32                                Signature;\r
+  IP4_INTERFACE                         *Interface;\r
+\r
+  IP4_PROTOCOL                          *IpInstance;\r
+  IP4_FRAME_CALLBACK                    CallBack;\r
+  VOID                                  *Context;\r
+\r
+  EFI_MANAGED_NETWORK_COMPLETION_TOKEN  MnpToken;\r
+} IP4_LINK_RX_TOKEN;\r
+\r
+//\r
+// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.\r
+// Upon completion, the Callback will be called.\r
+//\r
+typedef struct {\r
+  UINT32                                Signature;\r
+  NET_LIST_ENTRY                        Link;\r
+\r
+  IP4_INTERFACE                         *Interface;\r
+\r
+  IP4_PROTOCOL                          *IpInstance;\r
+  IP4_FRAME_CALLBACK                    CallBack;\r
+  NET_BUF                               *Packet;\r
+  VOID                                  *Context;\r
+\r
+  EFI_MAC_ADDRESS                       DstMac;\r
+  EFI_MAC_ADDRESS                       SrcMac;\r
+\r
+  EFI_MANAGED_NETWORK_COMPLETION_TOKEN  MnpToken;\r
+  EFI_MANAGED_NETWORK_TRANSMIT_DATA     MnpTxData;\r
+} IP4_LINK_TX_TOKEN;\r
+\r
+//\r
+// Only one ARP request is requested for all the frames in\r
+// a time. It is started for the first frames to the Ip. Any\r
+// subsequent transmission frame will be linked to Frames, and\r
+// be sent all at once the ARP requests succeed.\r
+//\r
+typedef struct {\r
+  UINT32                  Signature;\r
+  NET_LIST_ENTRY          Link;\r
+\r
+  NET_LIST_ENTRY          Frames;\r
+  IP4_INTERFACE           *Interface;\r
+\r
+  //\r
+  // ARP requesting staffs\r
+  //\r
+  EFI_EVENT               OnResolved;\r
+  IP4_ADDR                Ip;\r
+  EFI_MAC_ADDRESS         Mac;\r
+} IP4_ARP_QUE;\r
+\r
+//\r
+// Callback to select which frame to cancel. Caller can cancel a\r
+// single frame, or all the frame from an IP instance.\r
+//\r
+typedef\r
+BOOLEAN\r
+(*IP4_FRAME_TO_CANCEL) (\r
+  IP4_LINK_TX_TOKEN       *Frame,\r
+  VOID                    *Context\r
+  );\r
+\r
+//\r
+// Each IP4 instance has its own station address. All the instances\r
+// with the same station address share a single interface structure.\r
+// Each interface has its own ARP child, and shares one MNP child.\r
+// Notice the special cases that DHCP can configure the interface\r
+// with 0.0.0.0/0.0.0.0.\r
+//\r
+struct _IP4_INTERFACE {\r
+  UINT32                        Signature;\r
+  NET_LIST_ENTRY                Link;\r
+  INTN                          RefCnt;\r
+\r
+  //\r
+  // IP address and subnet mask of the interface. It also contains\r
+  // the subnet/net broadcast address for quick access. The fileds\r
+  // are invalid if (Configured == FALSE)\r
+  //\r
+  IP4_ADDR                      Ip;\r
+  IP4_ADDR                      SubnetMask;\r
+  IP4_ADDR                      SubnetBrdcast;\r
+  IP4_ADDR                      NetBrdcast;\r
+  BOOLEAN                       Configured;\r
+\r
+  //\r
+  // Handle used to create/destory ARP child. All the IP children\r
+  // share one MNP which is owned by IP service binding.\r
+  //\r
+  EFI_HANDLE                    Controller;\r
+  EFI_HANDLE                    Image;\r
+\r
+  EFI_MANAGED_NETWORK_PROTOCOL  *Mnp;\r
+  EFI_ARP_PROTOCOL              *Arp;\r
+  EFI_HANDLE                    ArpHandle;\r
+\r
+  //\r
+  // Queues to keep the frames sent and waiting ARP request.\r
+  //\r
+  NET_LIST_ENTRY                ArpQues;\r
+  NET_LIST_ENTRY                SentFrames;\r
+  IP4_LINK_RX_TOKEN             *RecvRequest;\r
+\r
+  //\r
+  // The interface's MAC and broadcast MAC address.\r
+  //\r
+  EFI_MAC_ADDRESS               Mac;\r
+  EFI_MAC_ADDRESS               BroadcastMac;\r
+  UINT32                        HwaddrLen;\r
+\r
+  //\r
+  // All the IP instances that have the same IP/SubnetMask are linked\r
+  // together through IpInstances. If any of the instance enables\r
+  // promiscuous receive, PromiscRecv is true.\r
+  //\r
+  NET_LIST_ENTRY                IpInstances;\r
+  BOOLEAN                       PromiscRecv;\r
+};\r
+\r
+IP4_INTERFACE *\r
+Ip4CreateInterface (\r
+  IN  EFI_MANAGED_NETWORK_PROTOCOL  *Mnp,\r
+  IN  EFI_HANDLE                    Controller,\r
+  IN  EFI_HANDLE                    ImageHandle\r
+  );\r
+\r
+EFI_STATUS\r
+Ip4SetAddress (\r
+  IN  IP4_INTERFACE         *Interface,\r
+  IN  IP4_ADDR              IpAddr,\r
+  IN  IP4_ADDR              SubnetMask\r
+  );\r
+\r
+EFI_STATUS\r
+Ip4FreeInterface (\r
+  IN  IP4_INTERFACE         *Interface,\r
+  IN  IP4_PROTOCOL          *IpInstance       OPTIONAL\r
+  );\r
+\r
+EFI_STATUS\r
+Ip4SendFrame (\r
+  IN  IP4_INTERFACE         *Interface,\r
+  IN  IP4_PROTOCOL          *IpInstance,      OPTIONAL\r
+  IN  NET_BUF               *Packet,\r
+  IN  IP4_ADDR              NextHop,\r
+  IN  IP4_FRAME_CALLBACK    CallBack,\r
+  IN  VOID                  *Context\r
+  );\r
+\r
+VOID\r
+Ip4CancelFrames (\r
+  IN IP4_INTERFACE          *Interface,\r
+  IN EFI_STATUS             IoStatus,\r
+  IN IP4_FRAME_TO_CANCEL    FrameToCancel,   OPTIONAL\r
+  IN VOID                   *Context\r
+  );\r
+\r
+VOID\r
+Ip4CancelReceive (\r
+  IN IP4_INTERFACE          *Interface\r
+  );\r
+\r
+EFI_STATUS\r
+Ip4ReceiveFrame (\r
+  IN  IP4_INTERFACE         *Interface,\r
+  IN  IP4_PROTOCOL          *IpInstance,      OPTIONAL\r
+  IN  IP4_FRAME_CALLBACK    CallBack,\r
+  IN  VOID                  *Context\r
+  );\r
+\r
+#endif\r