--- /dev/null
+/** @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: IP4.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_IP4_PROTOCOL_H__\r
+#define __EFI_IP4_PROTOCOL_H__\r
+\r
+#define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \\r
+ { \\r
+ 0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \\r
+ }\r
+\r
+#define EFI_IP4_PROTOCOL_GUID \\r
+ { \\r
+ 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \\r
+ }\r
+\r
+typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL;\r
+ \r
+typedef struct {\r
+ EFI_HANDLE InstanceHandle;\r
+ EFI_IPv4_ADDRESS Ip4Address;\r
+ EFI_IPv4_ADDRESS SubnetMask;\r
+} EFI_IP4_ADDRESS_PAIR; \r
+\r
+typedef struct {\r
+ EFI_HANDLE DriverHandle;\r
+ UINT32 AddressCount;\r
+ EFI_IP4_ADDRESS_PAIR AddressPairs[1];\r
+} EFI_IP4_VARIABLE_DATA;\r
+\r
+typedef struct {\r
+ UINT8 DefaultProtocol;\r
+ BOOLEAN AcceptAnyProtocol;\r
+ BOOLEAN AcceptIcmpErrors;\r
+ BOOLEAN AcceptBroadcast;\r
+ BOOLEAN AcceptPromiscuous;\r
+ BOOLEAN UseDefaultAddress;\r
+ EFI_IPv4_ADDRESS StationAddress;\r
+ EFI_IPv4_ADDRESS SubnetMask;\r
+ UINT8 TypeOfService;\r
+ UINT8 TimeToLive;\r
+ BOOLEAN DoNotFragment;\r
+ BOOLEAN RawData;\r
+ UINT32 ReceiveTimeout;\r
+ UINT32 TransmitTimeout;\r
+} EFI_IP4_CONFIG_DATA;\r
+\r
+\r
+typedef struct {\r
+ EFI_IPv4_ADDRESS SubnetAddress;\r
+ EFI_IPv4_ADDRESS SubnetMask;\r
+ EFI_IPv4_ADDRESS GatewayAddress;\r
+} EFI_IP4_ROUTE_TABLE;\r
+\r
+typedef struct {\r
+ UINT8 Type;\r
+ UINT8 Code;\r
+} EFI_IP4_ICMP_TYPE;\r
+\r
+typedef struct {\r
+ BOOLEAN IsStarted;\r
+ EFI_IP4_CONFIG_DATA ConfigData;\r
+ BOOLEAN IsConfigured;\r
+ UINT32 GroupCount;\r
+ EFI_IPv4_ADDRESS *GroupTable;\r
+ UINT32 RouteCount;\r
+ EFI_IP4_ROUTE_TABLE *RouteTable;\r
+ UINT32 IcmpTypeCount;\r
+ EFI_IP4_ICMP_TYPE *IcmpTypeList;\r
+} EFI_IP4_MODE_DATA;\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+ UINT8 HeaderLength:4;\r
+ UINT8 Version:4;\r
+ UINT8 TypeOfService;\r
+ UINT16 TotalLength;\r
+ UINT16 Identification;\r
+ UINT16 Fragmentation;\r
+ UINT8 TimeToLive;\r
+ UINT8 Protocol;\r
+ UINT16 Checksum;\r
+ EFI_IPv4_ADDRESS SourceAddress;\r
+ EFI_IPv4_ADDRESS DestinationAddress;\r
+} EFI_IP4_HEADER;\r
+#pragma pack()\r
+\r
+\r
+typedef struct {\r
+ UINT32 FragmentLength;\r
+ VOID *FragmentBuffer;\r
+} EFI_IP4_FRAGMENT_DATA;\r
+\r
+\r
+typedef struct {\r
+ EFI_TIME TimeStamp;\r
+ EFI_EVENT RecycleSignal;\r
+ UINT32 HeaderLength;\r
+ EFI_IP4_HEADER *Header;\r
+ UINT32 OptionsLength;\r
+ VOID *Options;\r
+ UINT32 DataLength;\r
+ UINT32 FragmentCount;\r
+ EFI_IP4_FRAGMENT_DATA FragmentTable[1];\r
+} EFI_IP4_RECEIVE_DATA;\r
+\r
+\r
+typedef struct {\r
+ EFI_IPv4_ADDRESS SourceAddress;\r
+ EFI_IPv4_ADDRESS GatewayAddress;\r
+ UINT8 Protocol;\r
+ UINT8 TypeOfService;\r
+ UINT8 TimeToLive;\r
+ BOOLEAN DoNotFragment;\r
+} EFI_IP4_OVERRIDE_DATA;\r
+\r
+typedef struct {\r
+ EFI_IPv4_ADDRESS DestinationAddress;\r
+ EFI_IP4_OVERRIDE_DATA *OverrideData; //OPTIONAL\r
+ UINT32 OptionsLength; //OPTIONAL\r
+ VOID *OptionsBuffer; //OPTIONAL\r
+ UINT32 TotalDataLength;\r
+ UINT32 FragmentCount;\r
+ EFI_IP4_FRAGMENT_DATA FragmentTable[1];\r
+} EFI_IP4_TRANSMIT_DATA;\r
+\r
+typedef struct {\r
+ EFI_EVENT Event;\r
+ EFI_STATUS Status;\r
+ union {\r
+ EFI_IP4_RECEIVE_DATA *RxData;\r
+ EFI_IP4_TRANSMIT_DATA *TxData;\r
+ } Packet;\r
+} EFI_IP4_COMPLETION_TOKEN;\r
+\r
+/**\r
+ Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.\r
+\r
+ @param This Pointer to the EFI_IP4_PROTOCOL instance.\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 SnpData Pointer to the simple network mode data structure.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_GET_MODE_DATA) (\r
+ IN EFI_IP4_PROTOCOL *This,\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
+ Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.\r
+\r
+ @param This Pointer to the EFI_IP4_PROTOCOL instance.\r
+ @param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.\r
+\r
+ @retval EFI_SUCCESS The driver instance was successfully opened.\r
+ @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,\r
+ RARP, etc.) is not finished yet.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:\r
+ A configuration protocol (DHCP, BOOTP, RARP, etc.) could\r
+ not be located when clients choose to use the default IPv4\r
+ address. This EFI IPv4 Protocol implementation does not\r
+ support this requested filter or timeout setting.\r
+ @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.\r
+ @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the\r
+ IPv4 address or subnet mask can be changed. The interface must\r
+ also be stopped when switching to/from raw packet mode.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4\r
+ Protocol driver instance is not opened.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_CONFIGURE) (\r
+ IN EFI_IP4_PROTOCOL *This,\r
+ IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL\r
+ )\r
+; \r
+\r
+/**\r
+ Joins and leaves multicast groups.\r
+\r
+ @param This Pointer to the EFI_IP4_PROTOCOL instance.\r
+ @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.\r
+ @param GroupAddress Pointer to the IPv4 multicast address.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:\r
+ - This is NULL.\r
+ - JoinFlag is TRUE and GroupAddress is NULL.\r
+ - GroupAddress is not NULL and *GroupAddress is\r
+ not a multicast IPv4 address.\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_OUT_OF_RESOURCES System resources could not be allocated.\r
+ @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.\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 FALSE).\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_GROUPS) (\r
+ IN EFI_IP4_PROTOCOL *This,\r
+ IN BOOLEAN JoinFlag,\r
+ IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL\r
+ )\r
+; \r
+\r
+/**\r
+ Adds and deletes routing table entries.\r
+\r
+ @param This Pointer to the EFI_IP4_PROTOCOL instance.\r
+ @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to\r
+ FALSE to add this route to the routing table. SubnetAddress\r
+ and SubnetMask are used as the key to each route entry.\r
+ @param SubnetAddress The address of the subnet that needs to be routed.\r
+ @param SubnetMask The subnet mask of SubnetAddress.\r
+ @param GatewayAddress The unicast gateway IPv4 address for this route.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_NOT_STARTED The driver 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_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ - This is NULL.\r
+ - SubnetAddress is NULL.\r
+ - SubnetMask is NULL.\r
+ - GatewayAddress is NULL.\r
+ - *SubnetAddress is not a valid subnet address.\r
+ - *SubnetMask is not a valid subnet mask.\r
+ - *GatewayAddress is not a valid unicast IPv4 address.\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 (when DeleteRoute is TRUE).\r
+ @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when\r
+ DeleteRoute is FALSE).\r
+ \r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_ROUTES) (\r
+ IN EFI_IP4_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
+ Places outgoing data packets into the transmit queue.\r
+\r
+ @param This Pointer to the EFI_IP4_PROTOCOL instance.\r
+ @param Token Pointer to the transmit token.\r
+\r
+ @retval EFI_SUCCESS The data has been queued for transmission.\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_INVALID_PARAMETER One or more pameters are invalid.\r
+ @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event\r
+ was already in the transmit queue.\r
+ @retval EFI_NOT_READY The completion token could not be queued because the transmit\r
+ queue is full. \r
+ @retval EFI_NOT_FOUND Not route is found to destination address.\r
+ @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.\r
+ @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too\r
+ short to transmit.\r
+ @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is\r
+ greater than MTU (or greater than the maximum packet size if\r
+ Token.Packet.TxData.OverrideData.\r
+ DoNotFragment is TRUE.)\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_TRANSMIT) (\r
+ IN EFI_IP4_PROTOCOL *This,\r
+ IN EFI_IP4_COMPLETION_TOKEN *Token\r
+ )\r
+; \r
+\r
+/**\r
+ Places a receiving request into the receiving queue.\r
+\r
+ @param This Pointer to the EFI_IP4_PROTOCOL instance.\r
+ @param Token Pointer to a token that is associated with the receive data descriptor.\r
+\r
+ @retval EFI_SUCCESS The receive completion token was cached.\r
+ @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.\r
+ @retval EFI_NO_MAPPING When using the 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
+ - This is NULL.\r
+ - Token is NULL.\r
+ - Token.Event is NULL.\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
+ The EFI IPv4 Protocol instance has been reset to startup defaults.\r
+ EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already\r
+ in the receive queue.\r
+ @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
+ @retval EFI_ICMP_ERROR An ICMP error packet was received.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_RECEIVE) (\r
+ IN EFI_IP4_PROTOCOL *This,\r
+ IN EFI_IP4_COMPLETION_TOKEN *Token\r
+ )\r
+; \r
+\r
+/**\r
+ Abort an asynchronous transmit or receive request.\r
+\r
+ @param This Pointer to the EFI_IP4_PROTOCOL instance.\r
+ @param Token Pointer to a token that has been issued by\r
+ EFI_IP4_PROTOCOL.Transmit() or\r
+ EFI_IP4_PROTOCOL.Receive(). If NULL, all pending\r
+ tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is\r
+ defined in EFI_IP4_PROTOCOL.Transmit().\r
+\r
+ @retval EFI_SUCCESS The asynchronous I/O request was aborted and\r
+ Token.->Event was signaled. When Token is NULL, all\r
+ pending requests were aborted and their events were 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_IP4_CANCEL) (\r
+ IN EFI_IP4_PROTOCOL *This,\r
+ IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL\r
+ )\r
+; \r
+ \r
+/**\r
+ Polls for incoming data packets and processes outgoing data packets.\r
+\r
+ @param This Pointer to the EFI_IP4_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
+ @retval EFI_NOT_STARTED This EFI IPv4 Protocol 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_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+ @retval EFI_NOT_READY No incoming or outgoing data is processed.\r
+ @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r
+ Consider increasing the polling rate.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_POLL) (\r
+ IN EFI_IP4_PROTOCOL *This\r
+ )\r
+; \r
+\r
+struct _EFI_IP4_PROTOCOL {\r
+ EFI_IP4_GET_MODE_DATA GetModeData;\r
+ EFI_IP4_CONFIGURE Configure;\r
+ EFI_IP4_GROUPS Groups;\r
+ EFI_IP4_ROUTES Routes;\r
+ EFI_IP4_TRANSMIT Transmit;\r
+ EFI_IP4_RECEIVE Receive;\r
+ EFI_IP4_CANCEL Cancel;\r
+ EFI_IP4_POLL Poll;\r
+};\r
+\r
+extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiIp4ProtocolGuid;\r
+\r
+#endif\r