]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Include/Protocol/Udp4.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Protocol / Udp4.h
diff --git a/OldMdePkg/Include/Protocol/Udp4.h b/OldMdePkg/Include/Protocol/Udp4.h
new file mode 100644 (file)
index 0000000..7ac3c80
--- /dev/null
@@ -0,0 +1,363 @@
+/** @file\r
+  Copyright (c) 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:  Udp4.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_UDP4_PROTOCOL_H__\r
+#define __EFI_UDP4_PROTOCOL_H__\r
+\r
+//\r
+//GUID definitions\r
+//\r
+#define EFI_UDP4_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } \\r
+  }\r
+\r
+#define EFI_UDP4_PROTOCOL_GUID \\r
+  { \\r
+    0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } \\r
+  }\r
+\r
+typedef struct _EFI_UDP4_PROTOCOL EFI_UDP4_PROTOCOL; \r
+  \r
+typedef struct {\r
+  EFI_HANDLE              InstanceHandle;\r
+  EFI_IPv4_ADDRESS        LocalAddress;\r
+  UINT16                  LocalPort;\r
+  EFI_IPv4_ADDRESS        RemoteAddress;\r
+  UINT16                  RemotePort;\r
+} EFI_UDP4_SERVICE_POINT; \r
+\r
+typedef struct {\r
+  EFI_HANDLE              DriverHandle;\r
+  UINT32                  ServiceCount;\r
+  EFI_UDP4_SERVICE_POINT  Services[1];\r
+} EFI_UDP4_VARIABLE_DATA;\r
+\r
+//\r
+//ICMP error definitions\r
+//\r
+#define EFI_NETWORK_UNREACHABLE      EFIERR(100)\r
+#define EFI_HOST_UNREACHABLE         EFIERR(101) \r
+#define EFI_PROTOCOL_UNREACHABLE     EFIERR(102)\r
+#define EFI_PORT_UNREACHABLE         EFIERR(103)\r
+\r
+\r
+typedef struct {\r
+  UINT32             FragmentLength;\r
+  VOID               *FragmentBuffer;\r
+} EFI_UDP4_FRAGMENT_DATA;\r
+\r
+typedef struct {\r
+  EFI_IPv4_ADDRESS   SourceAddress;\r
+  UINT16             SourcePort;\r
+  EFI_IPv4_ADDRESS   DestinationAddress;\r
+  UINT16             DestinationPort;\r
+} EFI_UDP4_SESSION_DATA;\r
+typedef struct {\r
+  //\r
+  // Receiving Filters\r
+  //\r
+  BOOLEAN            AcceptBroadcast;\r
+  BOOLEAN            AcceptPromiscuous;\r
+  BOOLEAN            AcceptAnyPort;\r
+  BOOLEAN            AllowDuplicatePort;\r
+  //\r
+  // I/O parameters\r
+  //\r
+  UINT8              TypeOfService;\r
+  UINT8              TimeToLive;\r
+  BOOLEAN            DoNotFragment;\r
+  UINT32             ReceiveTimeout;\r
+  UINT32             TransmitTimeout;\r
+  //\r
+  // Access Point\r
+  //\r
+  BOOLEAN            UseDefaultAddress;\r
+  EFI_IPv4_ADDRESS   StationAddress;\r
+  EFI_IPv4_ADDRESS   SubnetMask;\r
+  UINT16             StationPort;\r
+  EFI_IPv4_ADDRESS   RemoteAddress;\r
+  UINT16             RemotePort;\r
+} EFI_UDP4_CONFIG_DATA;\r
+\r
+typedef struct {\r
+  EFI_UDP4_SESSION_DATA     *UdpSessionData;       //OPTIONAL\r
+  EFI_IPv4_ADDRESS          *GatewayAddress;       //OPTIONAL\r
+  UINT32                    DataLength;\r
+  UINT32                    FragmentCount; \r
+  EFI_UDP4_FRAGMENT_DATA    FragmentTable[1];\r
+} EFI_UDP4_TRANSMIT_DATA;\r
+\r
+typedef struct {\r
+  EFI_TIME                  TimeStamp;\r
+  EFI_EVENT                 RecycleSignal;\r
+  EFI_UDP4_SESSION_DATA     UdpSession;\r
+  UINT32                    DataLength;\r
+  UINT32                    FragmentCount;\r
+  EFI_UDP4_FRAGMENT_DATA    FragmentTable[1];\r
+} EFI_UDP4_RECEIVE_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_EVENT                 Event;\r
+  EFI_STATUS                Status;\r
+  union {\r
+    EFI_UDP4_RECEIVE_DATA   *RxData;\r
+    EFI_UDP4_TRANSMIT_DATA  *TxData;\r
+  } Packet;\r
+} EFI_UDP4_COMPLETION_TOKEN;\r
+\r
+/**\r
+  Reads the current operational settings.\r
+\r
+  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Udp4ConfigData Pointer to the buffer to receive the current configuration data.\r
+  @param  Ip4ModeData    Pointer to the EFI IPv4 Protocol mode data structure.\r
+  @param  MnpConfigData  Pointer to the managed network configuration data structure.\r
+  @param  SnpModeData    Pointer to the simple network mode data structure.\r
+\r
+  @retval EFI_SUCCESS           The mode data was read.\r
+  @retval EFI_NOT_STARTED       When Udp4ConfigData is queried, no configuration data is\r
+                                available because this instance has not been started.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_GET_MODE_DATA) (\r
+  IN  EFI_UDP4_PROTOCOL                *This,\r
+  OUT EFI_UDP4_CONFIG_DATA             *Udp4ConfigData OPTIONAL,\r
+  OUT EFI_IP4_MODE_DATA                *Ip4ModeData    OPTIONAL,\r
+  OUT EFI_MANAGED_NETWORK_CONFIG_DATA  *MnpConfigData  OPTIONAL,\r
+  OUT EFI_SIMPLE_NETWORK_MODE          *SnpModeData    OPTIONAL\r
+  )\r
+;  \r
+  \r
+\r
+/**\r
+  Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4\r
+  Protocol.\r
+\r
+  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Udp4ConfigData Pointer to the buffer to receive the current configuration data.\r
+\r
+  @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
+  @retval EFI_ALREADY_STARTED   The EFI UDPv4 Protocol instance is already started/configured\r
+                                and must be stopped/reset before it can be reconfigured.\r
+  @retval EFI_ACCESS_DENIED     UdpConfigData. AllowDuplicatePort is FALSE\r
+                                and UdpConfigData.StationPort is already used by\r
+                                other instance.\r
+  @retval EFI_OUT_OF_RESOURCES  The EFI UDPv4 Protocol driver cannot allocate memory for this\r
+                                EFI UDPv4 Protocol instance.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred and this instance\r
+                                 was not opened. \r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_CONFIGURE) (\r
+  IN EFI_UDP4_PROTOCOL      *This,\r
+  IN EFI_UDP4_CONFIG_DATA   *UdpConfigData OPTIONAL\r
+  )\r
+;  \r
+\r
+/**\r
+  Joins and leaves multicast groups.\r
+\r
+  @param  This             Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  JoinFlag         Set to TRUE to join a multicast group. Set to FALSE to leave one\r
+                           or all multicast groups.\r
+  @param  MulticastAddress Pointer to multicast group address to join or leave.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_NOT_STARTED       The EFI UDPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate resources to join the group.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - JoinFlag is TRUE and MulticastAddress is NULL.\r
+                                - JoinFlag is TRUE and *MulticastAddress is not\r
+                                  a valid multicast address.\r
+  @retval EFI_ALREADY_STARTED   The group address is already in the group table (when\r
+                                JoinFlag is TRUE).\r
+  @retval EFI_NOT_FOUND         The group address is not in the group table (when JoinFlag is\r
+                                FALSE).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_GROUPS) (\r
+  IN EFI_UDP4_PROTOCOL      *This,\r
+  IN BOOLEAN                JoinFlag,\r
+  IN EFI_IPv4_ADDRESS       *MulticastAddress    OPTIONAL\r
+  )\r
+;   \r
+\r
+/**\r
+  Adds and deletes routing table entries.\r
+\r
+  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  DeleteRoute    Set to TRUE to delete this route from the routing table.\r
+                         Set to FALSE to add this route to the routing table.\r
+  @param  SubnetAddress  The destination network address that needs to be routed.\r
+  @param  SubnetMask     The subnet mask of SubnetAddress.\r
+  @param  GatewayAddress The gateway IP address for this route.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_NOT_STARTED       The EFI UDPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                - RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not add the entry to the routing table.\r
+  @retval EFI_NOT_FOUND         This route is not in the routing table.\r
+  @retval EFI_ACCESS_DENIED     The route is already defined in the routing table.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_ROUTES) (\r
+  IN EFI_UDP4_PROTOCOL      *This,\r
+  IN BOOLEAN                DeleteRoute,\r
+  IN EFI_IPv4_ADDRESS       *SubnetAddress,\r
+  IN EFI_IPv4_ADDRESS       *SubnetMask,\r
+  IN EFI_IPv4_ADDRESS       *GatewayAddress\r
+  )\r
+;     \r
+\r
+/**\r
+  Polls for incoming data packets and processes outgoing data packets.\r
+\r
+  @param  This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           Incoming or outgoing data was processed.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval EFI_TIMEOUT           Data was dropped out of the transmit and/or receive queue.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_POLL) (\r
+  IN EFI_UDP4_PROTOCOL      *This\r
+  )\r
+;   \r
+\r
+/**\r
+  Places an asynchronous receive request into the receiving queue.\r
+\r
+  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token Pointer to a token that is associated with the receive data\r
+                descriptor.\r
+\r
+  @retval EFI_SUCCESS           The receive completion token was cached.\r
+  @retval EFI_NOT_STARTED       This EFI UDPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP, RARP, etc.)\r
+                                is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+  @retval EFI_OUT_OF_RESOURCES  The receive completion token could not be queued due to a lack of system\r
+                                resources (usually memory).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval EFI_ACCESS_DENIED     A receive completion token with the same Token.Event was already in\r
+                                the receive queue.\r
+  @retval EFI_NOT_READY         The receive request could not be queued because the receive queue is full.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_RECEIVE) (\r
+  IN EFI_UDP4_PROTOCOL          *This,\r
+  IN EFI_UDP4_COMPLETION_TOKEN  *Token\r
+  )\r
+;   \r
+\r
+/**\r
+  Queues outgoing data packets into the transmit queue.\r
+\r
+  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token Pointer to the completion token that will be placed into the\r
+                transmit queue.\r
+\r
+  @retval EFI_SUCCESS           The data has been queued for transmission.\r
+  @retval EFI_NOT_STARTED       This EFI UDPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_ACCESS_DENIED     The transmit completion token with the same\r
+                                Token.Event was already in the transmit queue.\r
+  @retval EFI_NOT_READY         The completion token could not be queued because the\r
+                                transmit queue is full.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not queue the transmit data.\r
+  @retval EFI_NOT_FOUND         There is no route to the destination network or address.\r
+  @retval EFI_BAD_BUFFER_SIZE   The data length is greater than the maximum UDP packet\r
+                                size. Or the length of the IP header + UDP header + data\r
+                                length is greater than MTU if DoNotFragment is TRUE.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_TRANSMIT) (\r
+  IN EFI_UDP4_PROTOCOL           *This,\r
+  IN EFI_UDP4_COMPLETION_TOKEN   *Token\r
+  )\r
+;     \r
+\r
+/**\r
+  Aborts an asynchronous transmit or receive request.\r
+\r
+  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token Pointer to a token that has been issued by\r
+                EFI_UDP4_PROTOCOL.Transmit() or\r
+                EFI_UDP4_PROTOCOL.Receive().If NULL, all pending\r
+                tokens are aborted.\r
+\r
+  @retval  EFI_SUCCESS           The asynchronous I/O request was aborted and Token.Event\r
+                                 was signaled. When Token is NULL, all pending requests are\r
+                                 aborted and their events are signaled.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL.\r
+  @retval  EFI_NOT_STARTED       This instance has not been started.\r
+  @retval  EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,\r
+                                 RARP, etc.) is not finished yet.\r
+  @retval  EFI_NOT_FOUND         When Token is not NULL, the asynchronous I/O request was\r
+                                 not found in the transmit or receive queue. It has either completed\r
+                                 or was not issued by Transmit() and Receive().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_CANCEL)(\r
+  IN EFI_UDP4_PROTOCOL          *This,\r
+  IN EFI_UDP4_COMPLETION_TOKEN  *Token  OPTIONAL\r
+  )\r
+;       \r
+\r
+struct _EFI_UDP4_PROTOCOL {\r
+  EFI_UDP4_GET_MODE_DATA        GetModeData;\r
+  EFI_UDP4_CONFIGURE            Configure;\r
+  EFI_UDP4_GROUPS               Groups;\r
+  EFI_UDP4_ROUTES               Routes;\r
+  EFI_UDP4_TRANSMIT             Transmit;\r
+  EFI_UDP4_RECEIVE              Receive;\r
+  EFI_UDP4_CANCEL               Cancel;\r
+  EFI_UDP4_POLL                 Poll;\r
+};\r
+\r
+extern EFI_GUID gEfiUdp4ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiUdp4ProtocolGuid;\r
+\r
+#endif\r