This library is only intended to be used by UEFI network stack modules.\r
It provides the combined IpIo layer on the EFI IP4 Protocol and EFI IP6 protocol.\r
\r
-Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials are licensed and made available under \r
the terms and conditions of the BSD License that accompanies this distribution. \r
The full text of the license may be found at\r
UINT8 PrefixLength;\r
} IP_IO_IP_MASK;\r
\r
+typedef union {\r
+ EFI_IP4_PROTOCOL *Ip4;\r
+ EFI_IP6_PROTOCOL *Ip6;\r
+} IP_IO_IP_PROTOCOL;\r
+\r
///\r
/// The IP session for an IP receive packet.\r
///\r
@param[in] Status Result of the IP packet being sent.\r
@param[in] Context The data provided by user for the received packet when\r
the callback is registered in IP_IO_OPEN_DATA::SndContext.\r
- @param[in] Sender A pointer to EFI_IP4_PROTOCOL or EFI_IP6_PROTOCOL.\r
+ @param[in] Sender A Union type to specify a pointer of EFI_IP4_PROTOCOL \r
+ or EFI_IP6_PROTOCOL.\r
@param[in] NotifyData The Context data specified when calling IpIoSend()\r
\r
**/\r
typedef\r
VOID\r
(EFIAPI *PKT_SENT_NOTIFY) (\r
- IN EFI_STATUS Status,\r
- IN VOID *Context,\r
- IN VOID *Sender,\r
- IN VOID *NotifyData\r
+ IN EFI_STATUS Status,\r
+ IN VOID *Context,\r
+ IN IP_IO_IP_PROTOCOL Sender,\r
+ IN VOID *NotifyData\r
);\r
\r
///\r
//\r
// The IP instance consumed by this IP_IO\r
//\r
- VOID *Ip;\r
+ IP_IO_IP_PROTOCOL Ip;\r
BOOLEAN IsConfigured;\r
\r
///\r
PKT_RCVD_NOTIFY PktRcvdNotify; ///< See IP_IO_OPEN_DATA::PktRcvdNotify.\r
PKT_SENT_NOTIFY PktSentNotify; ///< See IP_IO_OPEN_DATA::PktSentNotify.\r
UINT8 IpVersion;\r
+ IP4_ADDR StationIp;\r
+ IP4_ADDR SubnetMask;\r
} IP_IO;\r
\r
///\r
IP_IO *IpIo;\r
VOID *Context;\r
VOID *NotifyData;\r
- VOID *Ip;\r
+ IP_IO_IP_PROTOCOL Ip;\r
NET_BUF *Pkt;\r
IP_IO_IP_COMPLETION_TOKEN SndToken;\r
} IP_IO_SEND_ENTRY;\r
IP_IO_IP_MASK PreMask;\r
LIST_ENTRY Entry;\r
EFI_HANDLE ChildHandle;\r
- VOID *Ip;\r
+ IP_IO_IP_PROTOCOL Ip;\r
IP_IO_IP_COMPLETION_TOKEN DummyRcvToken;\r
INTN RefCnt;\r
UINT8 IpVersion;\r
\r
/**\r
Create a new IP_IO instance.\r
+\r
+ If IpVersion is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
\r
This function uses IP4/IP6 service binding protocol in Controller to create\r
an IP4/IP6 child (aka IP4/IP6 instance).\r
\r
/**\r
Stop an IP_IO instance.\r
+\r
+ If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
\r
This function is paired with IpIoOpen(). The IP_IO will be unconfigured, and all\r
pending send/receive tokens will be canceled.\r
\r
@param[in, out] IpIo The pointer to the IP_IO instance that needs to stop.\r
\r
- @retval EFI_SUCCESS The IP_IO instance stopped successfully.\r
- @retval Others Anrror condition occurred.\r
+ @retval EFI_SUCCESS The IP_IO instance stopped successfully.\r
+ @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
+ @retval Others Anrror condition occurred.\r
\r
**/\r
EFI_STATUS\r
\r
/**\r
Open an IP_IO instance for use.\r
- \r
+\r
+ If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
+\r
This function is called after IpIoCreate(). It is used for configuring the IP\r
instance and register the callbacks and their context data for sending and\r
receiving IP packets.\r
@param[in] OpenData The configuration data and callbacks for\r
the IP_IO instance.\r
\r
- @retval EFI_SUCCESS The IP_IO instance opened with OpenData\r
- successfully.\r
- @retval EFI_ACCESS_DENIED The IP_IO instance is configured; avoid \r
- reopening it.\r
- @retval Others An error condition occurred.\r
+ @retval EFI_SUCCESS The IP_IO instance opened with OpenData\r
+ successfully.\r
+ @retval EFI_ACCESS_DENIED The IP_IO instance is configured, avoid to \r
+ reopen it.\r
+ @retval EFI_UNSUPPORTED IPv4 RawData mode is no supported.\r
+ @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
+ @retval Others Error condition occurred.\r
\r
**/\r
EFI_STATUS\r
/**\r
Send out an IP packet.\r
\r
- This function is called after IpIoOpen(). The data to be sent are wrapped in\r
- Pkt. The IP instance wrapped in IpIo is used for sending by default, but can be\r
- overriden by Sender. Other sending configurations, such as source address and gateway\r
- address, are specified in OverrideData.\r
+ This function is called after IpIoOpen(). The data to be sent is wrapped in\r
+ Pkt. The IP instance wrapped in IpIo is used for sending by default but can be\r
+ overriden by Sender. Other sending configs, like source address and gateway\r
+ address etc., are specified in OverrideData.\r
\r
- @param[in, out] IpIo The pointer to an IP_IO instance used for sending IP\r
+ @param[in, out] IpIo Pointer to an IP_IO instance used for sending IP\r
packet.\r
- @param[in, out] Pkt The pointer to the IP packet to be sent.\r
- @param[in] Sender Optional. The IP protocol instance used for sending.\r
- @param[in] Context The optional context data.\r
- @param[in] NotifyData The optional notify data.\r
+ @param[in, out] Pkt Pointer to the IP packet to be sent.\r
+ @param[in] Sender The IP protocol instance used for sending.\r
+ @param[in] Context Optional context data.\r
+ @param[in] NotifyData Optional notify data.\r
@param[in] Dest The destination IP address to send this packet to.\r
+ This parameter is optional when using IPv6.\r
@param[in] OverrideData The data to override some configuration of the IP\r
instance used for sending.\r
\r
- @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_SUCCESS The operation is completed successfully.\r
+ @retval EFI_INVALID_PARAMETER The input parameter is not correct.\r
@retval EFI_NOT_STARTED The IpIo is not configured.\r
- @retval EFI_OUT_OF_RESOURCES Failed due to resource limitations.\r
+ @retval EFI_OUT_OF_RESOURCES Failed due to resource limit.\r
+ @retval Others Error condition occurred.\r
\r
**/\r
EFI_STATUS\r
IN IP_IO_IP_INFO *Sender OPTIONAL,\r
IN VOID *Context OPTIONAL,\r
IN VOID *NotifyData OPTIONAL,\r
- IN EFI_IP_ADDRESS *Dest,\r
+ IN EFI_IP_ADDRESS *Dest OPTIONAL,\r
IN IP_IO_OVERRIDE *OverrideData OPTIONAL\r
);\r
\r
/**\r
Cancel the IP transmit token that wraps this Packet.\r
\r
+ If IpIo is NULL, then ASSERT().\r
+ If Packet is NULL, then ASSERT().\r
+\r
@param[in] IpIo The pointer to the IP_IO instance.\r
@param[in] Packet The pointer to the packet of NET_BUF to cancel.\r
\r
\r
/**\r
Add a new IP instance for sending data.\r
+\r
+ If IpIo is NULL, then ASSERT().\r
+ If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
\r
The function is used to add the IP_IO to the IP_IO sending list. The caller\r
can later use IpIoFindSender() to get the IP_IO and call IpIoSend() to send\r
Configure the IP instance of this IpInfo and start the receiving if IpConfigData\r
is not NULL.\r
\r
+ If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
+\r
@param[in, out] IpInfo The pointer to the IP_IO_IP_INFO instance.\r
@param[in, out] IpConfigData The IP4 or IP6 configure data used to configure \r
the IP instance. If NULL, the IP instance is reset.\r
/**\r
Destroy an IP instance maintained in IpIo->IpList for\r
sending purpose.\r
+\r
+ If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT(). \r
\r
This function pairs with IpIoAddIp(). The IpInfo is previously created by\r
IpIoAddIp(). The IP_IO_IP_INFO::RefCnt is decremented and the IP instance\r
@param[in] Src The local IP address.\r
\r
@return The pointer to the IP protocol can be used for sending purpose and its local\r
- address is the same with Src.\r
+ address is the same with Src. NULL if failed.\r
\r
**/\r
IP_IO_IP_INFO *\r
@param[out] IsHard If TRUE, indicates that it is a hard error.\r
@param[out] Notify If TRUE, SockError needs to be notified.\r
\r
+ @retval EFI_UNSUPPORTED Unrecognizable ICMP error code\r
@return The ICMP Error Status, such as EFI_NETWORK_UNREACHABLE.\r
\r
**/\r
@retval EFI_INVALID_PARAMETER The Neighbor Address is invalid.\r
@retval EFI_NOT_FOUND The neighbor cache entry is not in the \r
neighbor table. \r
+ @retval EFI_UNSUPPORTED IP version is IPv4, which doesn't support neighbor cache refresh.\r
@retval EFI_OUT_OF_RESOURCES Failed due to resource limitations.\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
IpIoRefreshNeighbor (\r
IN IP_IO *IpIo,\r
IN EFI_IP_ADDRESS *Neighbor,\r