///\r
#define IP4_US_TO_SEC(Us) (((Us) + 999999) / 1000000)\r
\r
+/**\r
+ Return the cast type (Unicast/Boradcast) specific to an\r
+ interface. All the addresses are host byte ordered.\r
+\r
+ @param IpAddr The IP address to classify in host byte order\r
+ @param IpIf The interface that IpAddr received from\r
+\r
+ @return The cast type of this IP address specific to the interface.\r
+ @retval IP4_LOCAL_HOST The IpAddr equals to the interface's address\r
+ @retval IP4_SUBNET_BROADCAST The IpAddr is a directed subnet boradcast to the\r
+ interface\r
+ @retval IP4_NET_BROADCAST The IpAddr is a network broadcast to the interface\r
+ @retval 0 Otherwise.\r
+\r
+**/\r
INTN\r
Ip4GetNetCast (\r
- IN IP4_ADDR IpAddr,\r
- IN IP4_INTERFACE *IpIf\r
+ IN IP4_ADDR IpAddr,\r
+ IN IP4_INTERFACE *IpIf\r
);\r
\r
+/**\r
+ Find the cast type of the packet related to the local host.\r
+ This isn't the same as link layer cast type. For example, DHCP\r
+ server may send local broadcast to the local unicast MAC.\r
+\r
+ @param IpSb The IP4 service binding instance that received the\r
+ packet\r
+ @param Dst The destination address in the packet (host byte\r
+ order)\r
+ @param Src The source address in the packet (host byte order)\r
+\r
+ @return The cast type for the Dst, it will return on the first non-promiscuous\r
+ cast type to a configured interface. If the packet doesn't match any of\r
+ the interface, multicast address and local broadcast address are checked.\r
+\r
+**/\r
INTN\r
Ip4GetHostCast (\r
- IN IP4_SERVICE *IpSb,\r
- IN IP4_ADDR Dst,\r
- IN IP4_ADDR Src\r
+ IN IP4_SERVICE *IpSb,\r
+ IN IP4_ADDR Dst,\r
+ IN IP4_ADDR Src\r
);\r
\r
+/**\r
+ Find an interface whose configured IP address is Ip.\r
+\r
+ @param IpSb The IP4 service binding instance\r
+ @param Ip The Ip address (host byte order) to find\r
+\r
+ @return The IP4_INTERFACE point if found, otherwise NULL\r
+\r
+**/\r
IP4_INTERFACE *\r
Ip4FindInterface (\r
- IN IP4_SERVICE *IpService,\r
- IN IP4_ADDR Addr\r
+ IN IP4_SERVICE *IpSb,\r
+ IN IP4_ADDR Ip\r
);\r
\r
+/**\r
+ Find an interface that Ip is on that connected network.\r
+\r
+ @param IpSb The IP4 service binding instance\r
+ @param Ip The Ip address (host byte order) to find\r
+\r
+ @return The IP4_INTERFACE point if found, otherwise NULL\r
+\r
+**/\r
IP4_INTERFACE *\r
Ip4FindNet (\r
- IN IP4_SERVICE *IpService,\r
- IN IP4_ADDR Addr\r
+ IN IP4_SERVICE *IpSb,\r
+ IN IP4_ADDR Ip\r
);\r
\r
+/**\r
+ Find an interface of the service with the same Ip/Netmask pair.\r
+\r
+ @param IpSb Ip4 service binding instance\r
+ @param Ip The Ip adress to find (host byte order)\r
+ @param Netmask The network to find (host byte order)\r
+\r
+ @return The IP4_INTERFACE point if found, otherwise NULL\r
+\r
+**/\r
IP4_INTERFACE *\r
Ip4FindStationAddress (\r
- IN IP4_SERVICE *IpSb,\r
- IN IP4_ADDR Ip,\r
- IN IP4_ADDR Netmask\r
+ IN IP4_SERVICE *IpSb,\r
+ IN IP4_ADDR Ip,\r
+ IN IP4_ADDR Netmask\r
);\r
\r
+/**\r
+ Get the MAC address for a multicast IP address. Call\r
+ Mnp's McastIpToMac to find the MAC address in stead of\r
+ hard code the NIC to be Ethernet.\r
+\r
+ @param Mnp The Mnp instance to get the MAC address.\r
+ @param Multicast The multicast IP address to translate.\r
+ @param Mac The buffer to hold the translated address.\r
+\r
+ @retval EFI_SUCCESS if the multicast IP is successfully translated to a\r
+ multicast MAC address.\r
+ @retval other Otherwise some error.\r
+\r
+**/\r
EFI_STATUS\r
Ip4GetMulticastMac (\r
IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,\r
OUT EFI_MAC_ADDRESS *Mac\r
);\r
\r
+/**\r
+ Convert the multibyte field in IP header's byter order.\r
+ In spite of its name, it can also be used to convert from\r
+ host to network byte order.\r
+\r
+ @param Head The IP head to convert\r
+\r
+ @return Point to the converted IP head\r
+\r
+**/\r
IP4_HEAD *\r
Ip4NtohHead (\r
- IN IP4_HEAD *Head\r
+ IN IP4_HEAD *Head\r
);\r
\r
+/**\r
+ Set the Ip4 variable data.\r
+ \r
+ Save the list of all of the IPv4 addresses and subnet masks that are currently\r
+ being used to volatile variable storage.\r
+\r
+ @param IpSb Ip4 service binding instance\r
+\r
+ @retval EFI_SUCCESS Successfully set variable.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.\r
+ @retval other Set variable failed.\r
+\r
+**/\r
EFI_STATUS\r
Ip4SetVariableData (\r
- IN IP4_SERVICE *IpSb\r
+ IN IP4_SERVICE *IpSb\r
);\r
\r
+/**\r
+ Clear the variable and free the resource.\r
+\r
+ @param IpSb Ip4 service binding instance\r
+\r
+ @return None.\r
+\r
+**/\r
VOID\r
Ip4ClearVariableData (\r
- IN IP4_SERVICE *IpSb\r
+ IN IP4_SERVICE *IpSb\r
);\r
\r
#endif\r
return Status;\r
}\r
\r
+/**\r
+ Clean up a IP4 service binding instance. It will release all\r
+ the resource allocated by the instance. The instance may be\r
+ partly initialized, or partly destroyed. If a resource is\r
+ destroyed, it is marked as that in case the destory failed and\r
+ being called again later.\r
+\r
+ @param IpSb The IP4 serviceing binding instance to clean up\r
+\r
+ @retval EFI_SUCCESS The resource used by the instance are cleaned up\r
+ @retval other Failed to clean up some of the resources.\r
+\r
+**/\r
EFI_STATUS\r
Ip4CleanService (\r
IN IP4_SERVICE *IpSb\r
//\r
// Function prototype for the driver's entry point\r
//\r
+/**\r
+ This is the declaration of an EFI image entry point. This entry point is\r
+ the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
+ both device drivers and bus drivers.\r
+ \r
+ The entry point for IP4 driver which install the driver\r
+ binding and component name protocol on its image.\r
+\r
+ @param ImageHandle The firmware allocated handle for the UEFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
Ip4DriverEntryPoint (\r
//\r
// Function prototypes for the Drivr Binding Protocol\r
//\r
+/**\r
+ Test to see if this driver supports ControllerHandle. This service\r
+ is called by the EFI boot service ConnectController(). In\r
+ order to make drivers as small as possible, there are a few calling\r
+ restrictions for this service. ConnectController() must\r
+ follow these calling restrictions. If any other agent wishes to call\r
+ Supported() it must also follow these calling restrictions.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to test\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver supports this device\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
Ip4DriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
);\r
\r
+/**\r
+ Start this driver on ControllerHandle. This service is called by the\r
+ EFI boot service ConnectController(). In order to make\r
+ drivers as small as possible, there are a few calling restrictions for\r
+ this service. ConnectController() must follow these\r
+ calling restrictions. If any other agent wishes to call Start() it\r
+ must also follow these calling restrictions.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to bind driver to\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver is added to ControllerHandle\r
+ @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
Ip4DriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
);\r
\r
+/**\r
+ Stop this driver on ControllerHandle. This service is called by the\r
+ EFI boot service DisconnectController(). In order to\r
+ make drivers as small as possible, there are a few calling\r
+ restrictions for this service. DisconnectController()\r
+ must follow these calling restrictions. If any other agent wishes\r
+ to call Stop() it must also follow these calling restrictions.\r
+ \r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to stop driver on\r
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
+ children is zero stop the entire bus driver.\r
+ @param ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+ @retval EFI_SUCCESS This driver is removed ControllerHandle\r
+ @retval other This driver was not removed from this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
Ip4DriverBindingStop (\r
//\r
// Function ptototypes for the ServiceBinding Prococol\r
//\r
+/**\r
+ Creates a child handle with a set of I/O services.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
+ then a new handle is created. If it is not NULL, then the\r
+ I/O services are added to the existing child handle.\r
+\r
+ @retval EFI_SUCCES The child handle was created with the I/O services\r
+ @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create\r
+ the child\r
+ @retval other The child handle was not created\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
Ip4ServiceBindingCreateChild (\r
IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE *ChildHandle\r
+ IN OUT EFI_HANDLE *ChildHandle\r
);\r
\r
+/**\r
+ Destroys a child handle with a set of I/O services.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ChildHandle Handle of the child to destroy\r
+\r
+ @retval EFI_SUCCES The I/O services were removed from the child handle\r
+ @retval EFI_UNSUPPORTED The child handle does not support the I/O services\r
+ that are being removed.\r
+ @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.\r
+ @retval EFI_ACCESS_DENIED The child handle could not be destroyed because its\r
+ I/O services are being used.\r
+ @retval other The child handle was not destroyed\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
Ip4ServiceBindingDestroyChild (\r
extern IP4_ICMP_CLASS mIcmpClass[];\r
extern EFI_IP4_ICMP_TYPE mIp4SupportedIcmp[];\r
\r
+/**\r
+ Handle the ICMP packet. First validate the message format,\r
+ then according to the message types, process it as query or\r
+ error packet.\r
+\r
+ @param IpSb The IP service that receivd the packet\r
+ @param Head The IP head of the ICMP query packet\r
+ @param Packet The content of the ICMP query with IP head\r
+ removed.\r
+\r
+ @retval EFI_INVALID_PARAMETER The packet is malformated.\r
+ @retval EFI_SUCCESS The ICMP message is successfully processed.\r
+ @retval Others Failed to handle ICMP packet.\r
+\r
+**/\r
EFI_STATUS\r
Ip4IcmpHandle (\r
- IN IP4_SERVICE *IpSb,\r
- IN IP4_HEAD *Header,\r
- IN NET_BUF *Packet\r
+ IN IP4_SERVICE *IpSb,\r
+ IN IP4_HEAD *Head,\r
+ IN NET_BUF *Packet\r
);\r
#endif\r
//\r
EFI_MAC_ADDRESS mZeroMacAddress;\r
\r
+/**\r
+ Callback funtion when frame transmission is finished. It will\r
+ call the frame owner's callback function to tell it the result.\r
+\r
+ @param Context Context which is point to the token.\r
+\r
+ @return None.\r
+\r
+**/\r
VOID\r
EFIAPI\r
Ip4OnFrameSentDpc (\r
- IN VOID *Context\r
+ IN VOID *Context\r
);\r
\r
+/**\r
+ Request Ip4OnFrameSentDpc as a DPC at TPL_CALLBACK.\r
+\r
+ @param Event The transmit token's event.\r
+ @param Context Context which is point to the token.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
EFIAPI\r
Ip4OnFrameSent (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
);\r
\r
+/**\r
+ Callback function when ARP request are finished. It will cancelled\r
+ all the queued frame if the ARP requests failed. Or transmit them\r
+ if the request succeed.\r
+\r
+ @param Context The context of the callback, a point to the ARP\r
+ queue\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
EFIAPI\r
Ip4OnArpResolvedDpc (\r
IN VOID *Context\r
);\r
\r
+/**\r
+ Request Ip4OnArpResolvedDpc as a DPC at TPL_CALLBACK.\r
+\r
+ @param Event The Arp request event.\r
+ @param Context The context of the callback, a point to the ARP\r
+ queue.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
EFIAPI\r
Ip4OnArpResolved (\r
IN VOID *Context\r
);\r
\r
+/**\r
+ Received a frame from MNP, wrap it in net buffer then deliver\r
+ it to IP's input function. The ownship of the packet also\r
+ transferred to IP. When Ip is finished with this packet, it\r
+ will call NetbufFree to release the packet, NetbufFree will\r
+ again call the Ip4RecycleFrame to signal MNP's event and free\r
+ the token used.\r
+\r
+ @param Context Context for the callback.\r
+\r
+ @return None.\r
+\r
+**/\r
VOID\r
EFIAPI\r
Ip4OnFrameReceivedDpc (\r
- IN VOID *Context\r
+ IN VOID *Context\r
);\r
\r
+/**\r
+\r
+ Request Ip4OnFrameReceivedDpc as a DPC at TPL_CALLBACK.\r
+\r
+ @param Event The receive event delivered to MNP for receive.\r
+ @param Context Context for the callback.\r
+ \r
+ @return None.\r
+\r
+**/\r
VOID\r
EFIAPI\r
Ip4OnFrameReceived (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
);\r
\r
+/**\r
+ Remove all the frames on the ARP queue that pass the FrameToCancel,\r
+ that is, either FrameToCancel is NULL or it returns true for the frame.\r
+\r
+ @param ArpQue ARP frame to remove the frames from.\r
+ @param IoStatus The status returned to the cancelled frames'\r
+ callback function.\r
+ @param FrameToCancel Function to select which frame to cancel.\r
+ @param Context Opaque parameter to the FrameToCancel.\r
+\r
+ @return NONE\r
+\r
+**/\r
VOID\r
Ip4CancelFrameArp (\r
IN IP4_ARP_QUE *ArpQue,\r
Token->CallBack (Token->IpInstance, Packet, EFI_SUCCESS, Flag, Token->Context);\r
}\r
\r
+/**\r
+\r
+ Request Ip4OnFrameReceivedDpc as a DPC at TPL_CALLBACK.\r
+\r
+ @param Event The receive event delivered to MNP for receive.\r
+ @param Context Context for the callback.\r
+ \r
+ @return None.\r
+\r
+**/\r
VOID\r
EFIAPI\r
Ip4OnFrameReceived (\r
IN EFI_EVENT Event,\r
IN VOID *Context\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Request Ip4OnFrameReceivedDpc as a DPC at TPL_CALLBACK\r
-\r
-Arguments:\r
-\r
- Event - The receive event delivered to MNP for receive.\r
- Context - Context for the callback.\r
-\r
-Returns:\r
-\r
- None.\r
-\r
---*/\r
{\r
//\r
// Request Ip4OnFrameReceivedDpc as a DPC at TPL_CALLBACK\r
BOOLEAN PromiscRecv;\r
};\r
\r
+/**\r
+ Create an IP4_INTERFACE. Delay the creation of ARP instance until\r
+ the interface is configured.\r
+\r
+ @param Mnp The shared MNP child of this IP4 service binding\r
+ instance\r
+ @param Controller The controller this IP4 service binding instance\r
+ is installed. Most like the UNDI handle.\r
+ @param ImageHandle This driver's image handle\r
+\r
+ @return Point to the created IP4_INTERFACE, otherwise NULL.\r
+\r
+**/\r
IP4_INTERFACE *\r
Ip4CreateInterface (\r
IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,\r
IN EFI_HANDLE ImageHandle\r
);\r
\r
+/**\r
+ Set the interface's address, create and configure\r
+ the ARP child if necessary.\r
+\r
+ @param Interface The interface to set the address\r
+ @param IpAddr The interface's IP address\r
+ @param SubnetMask The interface's netmask\r
+\r
+ @retval EFI_SUCCESS The interface is configured with Ip/netmask pair,\r
+ and a ARP is created for it.\r
+ @retval Others Failed to set the interface's address.\r
+\r
+**/\r
EFI_STATUS\r
Ip4SetAddress (\r
- IN IP4_INTERFACE *Interface,\r
- IN IP4_ADDR IpAddr,\r
- IN IP4_ADDR SubnetMask\r
+ IN OUT IP4_INTERFACE *Interface,\r
+ IN IP4_ADDR IpAddr,\r
+ IN IP4_ADDR SubnetMask\r
);\r
\r
+/**\r
+ Free the interface used by IpInstance. All the IP instance with\r
+ the same Ip/Netmask pair share the same interface. It is reference\r
+ counted. All the frames haven't been sent will be cancelled.\r
+ Because the IpInstance is optional, the caller must remove\r
+ IpInstance from the interface's instance list itself.\r
+\r
+ @param Interface The interface used by the IpInstance\r
+ @param IpInstance The Ip instance that free the interface. NULL if\r
+ the Ip driver is releasing the default interface.\r
+\r
+ @retval EFI_SUCCESS The interface use IpInstance is freed.\r
+\r
+**/\r
EFI_STATUS\r
Ip4FreeInterface (\r
IN IP4_INTERFACE *Interface,\r
- IN IP4_PROTOCOL *IpInstance OPTIONAL\r
+ IN IP4_PROTOCOL *IpInstance OPTIONAL\r
);\r
\r
+/**\r
+ Send a frame from the interface. If the next hop is broadcast or\r
+ multicast address, it is transmitted immediately. If the next hop\r
+ is a unicast, it will consult ARP to resolve the NextHop's MAC.\r
+ If some error happened, the CallBack won't be called. So, the caller\r
+ must test the return value, and take action when there is an error.\r
+\r
+ @param Interface The interface to send the frame from\r
+ @param IpInstance The IP child that request the transmission. NULL\r
+ if it is the IP4 driver itself.\r
+ @param Packet The packet to transmit.\r
+ @param NextHop The immediate destination to transmit the packet\r
+ to.\r
+ @param CallBack Function to call back when transmit finished.\r
+ @param Context Opaque parameter to the call back.\r
+\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to send the frame\r
+ @retval EFI_NO_MAPPING Can't resolve the MAC for the nexthop\r
+ @retval EFI_SUCCESS The packet is successfully transmitted.\r
+ @retval other Other error occurs.\r
+\r
+**/\r
EFI_STATUS\r
Ip4SendFrame (\r
IN IP4_INTERFACE *Interface,\r
IN VOID *Context\r
);\r
\r
+/**\r
+ Remove all the frames on the interface that pass the FrameToCancel,\r
+ either queued on ARP queues or that have already been delivered to\r
+ MNP and not yet recycled.\r
+\r
+ @param Interface Interface to remove the frames from\r
+ @param IoStatus The transmit status returned to the frames'\r
+ callback\r
+ @param FrameToCancel Function to select the frame to cancel, NULL to\r
+ select all\r
+ @param Context Opaque parameters passed to FrameToCancel\r
+\r
+ @return NONE\r
+\r
+**/\r
VOID\r
Ip4CancelFrames (\r
IN IP4_INTERFACE *Interface,\r
IN VOID *Context\r
);\r
\r
+/**\r
+ If there is a pending receive request, cancel it. Don't call\r
+ the receive request's callback because this function can be only\r
+ called if the instance or driver is tearing itself down. It\r
+ doesn't make sense to call it back. But it is necessary to call\r
+ the transmit token's callback to give it a chance to free the\r
+ packet and update the upper layer's transmit request status, say\r
+ that from the UDP.\r
+\r
+ @param Interface The interface used by the IpInstance\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4CancelReceive (\r
IN IP4_INTERFACE *Interface\r
);\r
\r
+/**\r
+ Request to receive the packet from the interface.\r
+\r
+ @param Interface The interface to receive the frames from\r
+ @param IpInstance The instance that requests the receive. NULL for\r
+ the driver itself.\r
+ @param CallBack Function to call when receive finished.\r
+ @param Context Opaque parameter to the callback\r
+\r
+ @retval EFI_ALREADY_STARTED There is already a pending receive request.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to receive\r
+ @retval EFI_SUCCESS The recieve request has been started.\r
+ @retval other Other error occurs.\r
+\r
+**/\r
EFI_STATUS\r
Ip4ReceiveFrame (\r
IN IP4_INTERFACE *Interface,\r
IGMP_UNSOLICIATED_REPORT = 10\r
} IGMP_ENUM_TYPES;\r
\r
+/**\r
+ Init the IGMP control data of the IP4 service instance, configure\r
+ MNP to receive ALL SYSTEM multicast.\r
+\r
+ @param IpSb The IP4 service whose IGMP is to be initialized.\r
+\r
+ @retval EFI_SUCCESS IGMP of the IpSb is successfully initialized.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to initialize IGMP.\r
+ @retval Others Failed to initialize the IGMP of IpSb.\r
+\r
+**/\r
EFI_STATUS\r
Ip4InitIgmp (\r
- IN IP4_SERVICE *IpService\r
+ IN OUT IP4_SERVICE *IpSb\r
);\r
\r
+/**\r
+ Join the multicast group on behalf of this IP4 child\r
+\r
+ @param IpInstance The IP4 child that wants to join the group\r
+ @param Address The group to join\r
+\r
+ @retval EFI_SUCCESS Successfully join the multicast group\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resources\r
+ @retval Others Failed to join the multicast group.\r
+\r
+**/\r
EFI_STATUS\r
Ip4JoinGroup (\r
- IN IP4_PROTOCOL *IpInstance,\r
- IN IP4_ADDR Address\r
+ IN IP4_PROTOCOL *IpInstance,\r
+ IN IP4_ADDR Address\r
);\r
\r
+/**\r
+ Leave the IP4 multicast group on behalf of IpInstance.\r
+\r
+ @param IpInstance The IP4 child that wants to leave the group\r
+ address\r
+ @param Address The group address to leave\r
+\r
+ @retval EFI_NOT_FOUND The IP4 service instance isn't in the group\r
+ @retval EFI_SUCCESS Successfully leave the multicast group.\r
+ @retval Others Failed to leave the multicast group.\r
+\r
+**/\r
EFI_STATUS\r
Ip4LeaveGroup (\r
- IN IP4_PROTOCOL *IpInstance,\r
- IN IP4_ADDR Address\r
+ IN IP4_PROTOCOL *IpInstance,\r
+ IN IP4_ADDR Address\r
);\r
\r
+/**\r
+ Handle the received IGMP message for the IP4 service instance.\r
+\r
+ @param IpSb The IP4 service instance that received the message\r
+ @param Head The IP4 header of the received message\r
+ @param Packet The IGMP message, without IP4 header\r
+\r
+ @retval EFI_INVALID_PARAMETER The IGMP message is malformated.\r
+ @retval EFI_SUCCESS The IGMP message is successfully processed.\r
+\r
+**/\r
EFI_STATUS\r
Ip4IgmpHandle (\r
- IN IP4_SERVICE *IpService,\r
- IN IP4_HEAD *Head,\r
- IN NET_BUF *Packet\r
+ IN IP4_SERVICE *IpSb,\r
+ IN IP4_HEAD *Head,\r
+ IN NET_BUF *Packet\r
);\r
\r
+/**\r
+ The periodical timer function for IGMP. It does the following\r
+ things:\r
+ 1. Decrease the Igmpv1QuerySeen to make it possible to refresh\r
+ the IGMP server type.\r
+ 2. Decrease the report timer for each IGMP group in "delaying\r
+ member" state.\r
+\r
+ @param IpSb The IP4 service instance that is ticking\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4IgmpTicking (\r
- IN IP4_SERVICE *IpService\r
+ IN IP4_SERVICE *IpSb\r
);\r
\r
+/**\r
+ Add a group address to the array of group addresses.\r
+ The caller should make sure that no duplicated address\r
+ existed in the array. Although the function doesn't\r
+ assume the byte order of the both Source and Addr, the\r
+ network byte order is used by the caller.\r
+\r
+ @param Source The array of group addresses to add to\r
+ @param Count The number of group addresses in the Source\r
+ @param Addr The IP4 multicast address to add\r
+\r
+ @return NULL if failed to allocate memory for the new groups,\r
+ otherwise the new combined group addresses.\r
+\r
+**/\r
IP4_ADDR *\r
Ip4CombineGroups (\r
- IN IP4_ADDR *SourceGroups,\r
- IN UINT32 Count,\r
- IN IP4_ADDR Addr\r
+ IN IP4_ADDR *Source,\r
+ IN UINT32 Count,\r
+ IN IP4_ADDR Addr\r
);\r
\r
+/**\r
+ Remove a group address from the array of group addresses.\r
+ Although the function doesn't assume the byte order of the\r
+ both Groups and Addr, the network byte order is used by\r
+ the caller.\r
+\r
+ @param Groups The array of group addresses to remove from\r
+ @param Count The number of group addresses in the Groups\r
+ @param Addr The IP4 multicast address to remove\r
+\r
+ @return The nubmer of group addresses in the Groups after remove.\r
+ It is Count if the Addr isn't in the Groups.\r
+\r
+**/\r
INTN\r
Ip4RemoveGroupAddr (\r
- IN IP4_ADDR *Group,\r
- IN UINT32 GroupCnt,\r
- IN IP4_ADDR Addr\r
+ IN OUT IP4_ADDR *Groups,\r
+ IN UINT32 Count,\r
+ IN IP4_ADDR Addr\r
);\r
\r
+/**\r
+ Find the IGMP_GROUP structure which contains the status of multicast\r
+ group Address in this IGMP control block\r
+\r
+ @param IgmpCtrl The IGMP control block to search from\r
+ @param Address The multicast address to search\r
+\r
+ @return NULL if the multicast address isn't in the IGMP control block. Otherwise\r
+ the point to the IGMP_GROUP which contains the status of multicast group\r
+ for Address.\r
+\r
+**/\r
IGMP_GROUP *\r
Ip4FindGroup (\r
- IN IGMP_SERVICE_DATA *IgmpCtrl,\r
- IN IP4_ADDR Address\r
+ IN IGMP_SERVICE_DATA *IgmpCtrl,\r
+ IN IP4_ADDR Address\r
);\r
#endif\r
gBS->FreePool (Data);\r
}\r
\r
-/*++\r
+/**\r
+\r
Request Ip4AutoConfigCallBackDpc as a DPC at TPL_CALLBACK.\r
\r
@param Event The event that is signalled.\r
\r
@return None.\r
\r
-++*/\r
+**/\r
VOID\r
EFIAPI\r
Ip4AutoConfigCallBack (\r
\r
extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;\r
\r
+/**\r
+ Config the MNP parameter used by IP. The IP driver use one MNP\r
+ child to transmit/receive frames. By default, it configures MNP\r
+ to receive unicast/multicast/broadcast. And it will enable/disable\r
+ the promiscous receive according to whether there is IP child\r
+ enable that or not. If Force is FALSE, it will iterate through\r
+ all the IP children to check whether the promiscuous receive\r
+ setting has been changed. If it hasn't been changed, it won't\r
+ reconfigure the MNP. If Force is TRUE, the MNP is configured no\r
+ matter whether that is changed or not.\r
+\r
+ @param IpSb The IP4 service instance that is to be changed.\r
+ @param Force Force the configuration or not.\r
+\r
+ @retval EFI_SUCCESS The MNP is successfully configured/reconfigured.\r
+ @retval Others Configuration failed.\r
+\r
+**/\r
EFI_STATUS\r
Ip4ServiceConfigMnp (\r
IN IP4_SERVICE *IpSb,\r
IN BOOLEAN Force\r
);\r
\r
+/**\r
+ Intiialize the IP4_PROTOCOL structure to the unconfigured states.\r
+\r
+ @param IpSb The IP4 service instance.\r
+ @param IpInstance The IP4 child instance.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4InitProtocol (\r
- IN IP4_SERVICE *IpSb,\r
- IN IP4_PROTOCOL *IpInstance\r
+ IN IP4_SERVICE *IpSb,\r
+ IN OUT IP4_PROTOCOL *IpInstance\r
);\r
\r
+/**\r
+ Clean up the IP4 child, release all the resources used by it.\r
+\r
+ @param IpInstance The IP4 child to clean up.\r
+\r
+ @retval EFI_SUCCESS The IP4 child is cleaned up\r
+ @retval EFI_DEVICE_ERROR Some resources failed to be released\r
+\r
+**/\r
EFI_STATUS\r
Ip4CleanProtocol (\r
IN IP4_PROTOCOL *IpInstance\r
);\r
\r
+/**\r
+ Cancel the user's receive/transmit request.\r
+\r
+ @param IpInstance The IP4 child\r
+ @param Token The token to cancel. If NULL, all token will be\r
+ cancelled.\r
+\r
+ @retval EFI_SUCCESS The token is cancelled\r
+ @retval EFI_NOT_FOUND The token isn't found on either the\r
+ transmit/receive queue\r
+ @retval EFI_DEVICE_ERROR Not all token is cancelled when Token is NULL.\r
+\r
+**/\r
EFI_STATUS\r
Ip4Cancel (\r
IN IP4_PROTOCOL *IpInstance,\r
- IN EFI_IP4_COMPLETION_TOKEN *Token\r
+ IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL\r
);\r
\r
+/**\r
+ Change the IP4 child's multicast setting. The caller\r
+ should make sure that the parameters is valid.\r
+\r
+ @param IpInstance The IP4 child to change the setting.\r
+ @param JoinFlag TRUE to join the group, otherwise leave it\r
+ @param GroupAddress The target group address\r
+\r
+ @retval EFI_ALREADY_STARTED Want to join the group, but already a member of it\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.\r
+ @retval EFI_DEVICE_ERROR Failed to set the group configuraton\r
+ @retval EFI_SUCCESS Successfully updated the group setting.\r
+ @retval EFI_NOT_FOUND Try to leave the group which it isn't a member.\r
+\r
+**/\r
EFI_STATUS\r
Ip4Groups (\r
IN IP4_PROTOCOL *IpInstance,\r
IN BOOLEAN JoinFlag,\r
- IN EFI_IPv4_ADDRESS *GroupAddress\r
+ IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL\r
);\r
\r
+/**\r
+ The heart beat timer of IP4 service instance. It times out\r
+ all of its IP4 children's received-but-not-delivered and\r
+ transmitted-but-not-recycle packets, and provides time input\r
+ for its IGMP protocol.\r
+\r
+ @param Event The IP4 service instance's heart beat timer.\r
+ @param Context The IP4 service instance.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
EFIAPI\r
Ip4TimerTicking (\r
IN VOID *Context\r
);\r
\r
+/**\r
+ Decrease the life of the transmitted packets. If it is\r
+ decreased to zero, cancel the packet. This function is\r
+ called by Ip4PacketTimerTicking which time out both the\r
+ received-but-not-delivered and transmitted-but-not-recycle\r
+ packets.\r
+\r
+ @param Map The IP4 child's transmit map.\r
+ @param Item Current transmitted packet\r
+ @param Context Not used.\r
+\r
+ @retval EFI_SUCCESS Always returns EFI_SUCCESS\r
+\r
+**/\r
EFI_STATUS\r
Ip4SentPacketTicking (\r
IN NET_MAP *Map,\r
#define IP4_RXDATA_WRAP_SIZE(NumFrag) \\r
(sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))\r
\r
+/**\r
+ Initialize an already allocated assemble table. This is generally\r
+ the assemble table embedded in the IP4 service instance.\r
+\r
+ @param Table The assemble table to initialize.\r
+\r
+ @return NONE\r
+\r
+**/\r
VOID\r
Ip4InitAssembleTable (\r
- IN IP4_ASSEMBLE_TABLE *Table\r
+ IN OUT IP4_ASSEMBLE_TABLE *Table\r
);\r
\r
+/**\r
+ Clean up the assemble table: remove all the fragments\r
+ and assemble entries.\r
+\r
+ @param Table The assemble table to clean up\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4CleanAssembleTable (\r
IN IP4_ASSEMBLE_TABLE *Table\r
);\r
\r
+/**\r
+ The IP4 input routine. It is called by the IP4_INTERFACE when a\r
+ IP4 fragment is received from MNP.\r
+\r
+ @param Ip4Instance The IP4 child that request the receive, most like\r
+ it is NULL.\r
+ @param Packet The IP4 packet received.\r
+ @param IoStatus The return status of receive request.\r
+ @param Flag The link layer flag for the packet received, such\r
+ as multicast.\r
+ @param Context The IP4 service instance that own the MNP.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4AccpetFrame (\r
IN IP4_PROTOCOL *Ip4Instance,\r
IN VOID *Context\r
);\r
\r
+/**\r
+ Demultiple the packet. the packet delivery is processed in two\r
+ passes. The first pass will enque a shared copy of the packet\r
+ to each IP4 child that accepts the packet. The second pass will\r
+ deliver a non-shared copy of the packet to each IP4 child that\r
+ has pending receive requests. Data is copied if more than one\r
+ child wants to consume the packet because each IP child needs\r
+ its own copy of the packet to make changes.\r
+\r
+ @param IpSb The IP4 service instance that received the packet\r
+ @param Head The header of the received packet\r
+ @param Packet The data of the received packet\r
+\r
+ @retval EFI_NOT_FOUND No IP child accepts the packet\r
+ @retval EFI_SUCCESS The packet is enqueued or delivered to some IP\r
+ children.\r
+\r
+**/\r
EFI_STATUS\r
Ip4Demultiplex (\r
- IN IP4_SERVICE *SbInstance,\r
+ IN IP4_SERVICE *IpSb,\r
IN IP4_HEAD *Head,\r
IN NET_BUF *Packet\r
);\r
\r
+/**\r
+ Enqueue a received packet to all the IP children that share\r
+ the same interface.\r
+\r
+ @param IpSb The IP4 service instance that receive the packet\r
+ @param Head The header of the received packet\r
+ @param Packet The data of the received packet\r
+ @param IpIf The interface to enqueue the packet to\r
+\r
+ @return The number of the IP4 children that accepts the packet\r
+\r
+**/\r
INTN\r
Ip4InterfaceEnquePacket (\r
- IN IP4_SERVICE *SbInstance,\r
+ IN IP4_SERVICE *IpSb,\r
IN IP4_HEAD *Head,\r
IN NET_BUF *Packet,\r
- IN IP4_INTERFACE *Interface\r
+ IN IP4_INTERFACE *IpIf\r
);\r
\r
+/**\r
+ Deliver the received packets to upper layer if there are both received\r
+ requests and enqueued packets. If the enqueued packet is shared, it will\r
+ duplicate it to a non-shared packet, release the shared packet, then\r
+ deliver the non-shared packet up.\r
+\r
+ @param IpInstance The IP child to deliver the packet up.\r
+\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to deliver the\r
+ packets.\r
+ @retval EFI_SUCCESS All the enqueued packets that can be delivered\r
+ are delivered up.\r
+\r
+**/\r
EFI_STATUS\r
Ip4InstanceDeliverPacket (\r
- IN IP4_PROTOCOL *Ip4Instance\r
+ IN IP4_PROTOCOL *IpInstance\r
);\r
\r
+/**\r
+ Timeout the fragment and enqueued packets.\r
+\r
+ @param IpSb The IP4 service instance to timeout\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4PacketTimerTicking (\r
IN IP4_SERVICE *IpSb\r
IP4_OPTION_COPY_MASK = 0x80\r
} IP4_OPTION_ENUM_TYPES;\r
\r
+/**\r
+ Validate the IP4 option format for both the packets we received\r
+ and will transmit. It will compute the ICMP error message fields\r
+ if the option is mal-formated. But this information isn't used.\r
+\r
+ @param Option The first byte of the option\r
+ @param OptionLen The length of the whole option\r
+ @param Rcvd The option is from the packet we received if TRUE,\r
+ otherwise the option we wants to transmit.\r
+\r
+ @retval TRUE The option is properly formatted\r
+ @retval FALSE The option is mal-formated\r
+\r
+**/\r
BOOLEAN\r
Ip4OptionIsValid (\r
IN UINT8 *Option,\r
- IN UINT32 OptLen,\r
+ IN UINT32 OptionLen,\r
IN BOOLEAN Rcvd\r
);\r
\r
+/**\r
+ Copy the option from the original option to buffer. It\r
+ handles the details such as:\r
+ 1. whether copy the single IP4 option to the first/non-first\r
+ fragments.\r
+ 2. Pad the options copied over to aligned to 4 bytes.\r
+\r
+ @param Option The original option to copy from\r
+ @param OptionLen The length of the original option\r
+ @param FirstFragment Whether it is the first fragment\r
+ @param Buf The buffer to copy options to. NULL \r
+ @param BufLen The length of the buffer\r
+\r
+ @retval EFI_SUCCESS The options are copied over\r
+ @retval EFI_BUFFER_TOO_SMALL Buf is NULL or BufLen provided is too small.\r
+\r
+**/\r
EFI_STATUS\r
Ip4CopyOption (\r
- IN UINT8 *Option,\r
- IN UINT32 OptLen,\r
- IN BOOLEAN Fragment,\r
- IN UINT8 *Buf, OPTIONAL\r
+ IN UINT8 *Option,\r
+ IN UINT32 OptionLen,\r
+ IN BOOLEAN FirstFragment,\r
+ IN OUT UINT8 *Buf, OPTIONAL\r
IN OUT UINT32 *BufLen\r
);\r
#endif\r
#ifndef __EFI_IP4_OUTPUT_H__\r
#define __EFI_IP4_OUTPUT_H__\r
\r
+/**\r
+ The default callback function for system generated packet.\r
+ It will free the packet.\r
+\r
+ @param Ip4Instance The IP4 child that issued the transmission. It most\r
+ like is NULL.\r
+ @param Packet The packet that transmitted.\r
+ @param IoStatus The result of the transmission, succeeded or failed.\r
+ @param LinkFlag Not used when transmission. check IP4_FRAME_CALLBACK\r
+ for reference.\r
+ @param Context The context provided by us\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4SysPacketSent (\r
IP4_PROTOCOL *Ip4Instance,\r
NET_BUF *Packet,\r
EFI_STATUS IoStatus,\r
- UINT32 Flag,\r
+ UINT32 LinkFlag,\r
VOID *Context\r
);\r
\r
+/**\r
+ Transmit an IP4 packet. The packet comes either from the IP4\r
+ child's consumer (IpInstance != NULL) or the IP4 driver itself\r
+ (IpInstance == NULL). It will route the packet, fragment it,\r
+ then transmit all the fragments through some interface.\r
+\r
+ @param IpSb The IP4 service instance to transmit the packet\r
+ @param IpInstance The IP4 child that issues the transmission. It is\r
+ NULL if the packet is from the system.\r
+ @param Packet The user data to send, excluding the IP header.\r
+ @param Head The caller supplied header. The caller should set\r
+ the following header fields: Tos, TotalLen, Id, tl,\r
+ Fragment, Protocol, Src and Dst. All the fields are\r
+ in host byte order. This function will fill in the\r
+ Ver, HeadLen, Fragment, and checksum. The Fragment\r
+ only need to include the DF flag. Ip4Output will\r
+ compute the MF and offset for you.\r
+ @param Option The original option to append to the IP headers\r
+ @param OptLen The length of the option\r
+ @param GateWay The next hop address to transmit packet to.\r
+ 255.255.255.255 means broadcast.\r
+ @param Callback The callback function to issue when transmission\r
+ completed.\r
+ @param Context The opaque context for the callback\r
+\r
+ @retval EFI_NO_MAPPING There is no interface to the destination.\r
+ @retval EFI_NOT_FOUND There is no route to the destination\r
+ @retval EFI_SUCCESS The packet is successfully transmitted.\r
+ @retval Others Failed to transmit the packet.\r
+\r
+**/\r
EFI_STATUS\r
Ip4Output (\r
IN IP4_SERVICE *IpSb,\r
- IN IP4_PROTOCOL *IpInstance, OPTIONAL\r
- IN NET_BUF *Data,\r
+ IN IP4_PROTOCOL *IpInstance, OPTIONAL\r
+ IN NET_BUF *Packet,\r
IN IP4_HEAD *Head,\r
IN UINT8 *Option,\r
IN UINT32 OptLen,\r
IN VOID *Context\r
);\r
\r
+/**\r
+ Cancel the Packet and all its fragments.\r
+\r
+ @param IpIf The interface from which the Packet is sent\r
+ @param Packet The Packet to cancel\r
+ @param IoStatus The status returns to the sender.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4CancelPacket (\r
- IN IP4_INTERFACE *IpIf,\r
- IN NET_BUF *Packet,\r
- IN EFI_STATUS IoStatus\r
+ IN IP4_INTERFACE *IpIf,\r
+ IN NET_BUF *Packet,\r
+ IN EFI_STATUS IoStatus\r
);\r
\r
extern UINT16 mIp4Id;\r
IP4_ROUTE_CACHE Cache;\r
};\r
\r
-IP4_ROUTE_TABLE*\r
+/**\r
+ Create an empty route table, includes its internal route cache\r
+\r
+ @return NULL if failed to allocate memory for the route table, otherwise\r
+ the point to newly created route table.\r
+\r
+**/\r
+IP4_ROUTE_TABLE *\r
Ip4CreateRouteTable (\r
VOID\r
);\r
\r
+/**\r
+ Free the route table and its associated route cache. Route\r
+ table is reference counted.\r
+\r
+ @param RtTable The route table to free.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4FreeRouteTable (\r
- IN IP4_ROUTE_TABLE *RouteTable\r
+ IN IP4_ROUTE_TABLE *RtTable\r
);\r
\r
+/**\r
+ Add a route entry to the route table. All the IP4_ADDRs are in\r
+ host byte order.\r
+\r
+ @param RtTable Route table to add route to\r
+ @param Dest The destination of the network\r
+ @param Netmask The netmask of the destination\r
+ @param Gateway The next hop address\r
+\r
+ @retval EFI_ACCESS_DENIED The same route already exists\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the entry\r
+ @retval EFI_SUCCESS The route is added successfully.\r
+\r
+**/\r
EFI_STATUS\r
Ip4AddRoute (\r
- IN IP4_ROUTE_TABLE *RtTable,\r
- IN IP4_ADDR Dest,\r
- IN IP4_ADDR Netmask,\r
- IN IP4_ADDR Gateway\r
+ IN OUT IP4_ROUTE_TABLE *RtTable,\r
+ IN IP4_ADDR Dest,\r
+ IN IP4_ADDR Netmask,\r
+ IN IP4_ADDR Gateway\r
);\r
\r
+/**\r
+ Remove a route entry and all the route caches spawn from it.\r
+\r
+ @param RtTable The route table to remove the route from\r
+ @param Dest The destination network\r
+ @param Netmask The netmask of the Dest\r
+ @param Gateway The next hop address\r
+\r
+ @retval EFI_SUCCESS The route entry is successfully removed\r
+ @retval EFI_NOT_FOUND There is no route entry in the table with that\r
+ properity.\r
+\r
+**/\r
EFI_STATUS\r
Ip4DelRoute (\r
- IN IP4_ROUTE_TABLE *RtTable,\r
- IN IP4_ADDR Dest,\r
- IN IP4_ADDR Netmask,\r
- IN IP4_ADDR Gateway\r
+ IN OUT IP4_ROUTE_TABLE *RtTable,\r
+ IN IP4_ADDR Dest,\r
+ IN IP4_ADDR Netmask,\r
+ IN IP4_ADDR Gateway\r
);\r
\r
+/**\r
+ Find a route cache with the dst and src. This is used by ICMP\r
+ redirect messasge process. All kinds of redirect is treated as\r
+ host redirect according to RFC1122. So, only route cache entries\r
+ are modified according to the ICMP redirect message.\r
+\r
+ @param RtTable The route table to search the cache for\r
+ @param Dest The destination address\r
+ @param Src The source address\r
+\r
+ @return NULL if no route entry to the (Dest, Src). Otherwise the point\r
+ to the correct route cache entry.\r
+\r
+**/\r
IP4_ROUTE_CACHE_ENTRY *\r
Ip4FindRouteCache (\r
IN IP4_ROUTE_TABLE *RtTable,\r
IN IP4_ADDR Src\r
);\r
\r
+/**\r
+ Free the route cache entry. It is reference counted.\r
+\r
+ @param RtCacheEntry The route cache entry to free.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
Ip4FreeRouteCacheEntry (\r
IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry\r
);\r
\r
+/**\r
+ Search the route table to route the packet. Return/create a route\r
+ cache if there is a route to the destination.\r
+\r
+ @param RtTable The route table to search from\r
+ @param Dest The destination address to search for\r
+ @param Src The source address to search for\r
+\r
+ @return NULL if failed to route packet, otherwise a route cache\r
+ entry that can be used to route packet.\r
+\r
+**/\r
IP4_ROUTE_CACHE_ENTRY *\r
Ip4Route (\r
IN IP4_ROUTE_TABLE *RtTable,\r
IN IP4_ADDR Src\r
);\r
\r
+/**\r
+ Build a EFI_IP4_ROUTE_TABLE to be returned to the caller of\r
+ GetModeData. The EFI_IP4_ROUTE_TABLE is clumsy to use in the\r
+ internal operation of the IP4 driver.\r
+\r
+ @param IpInstance The IP4 child that requests the route table.\r
+\r
+ @retval EFI_SUCCESS The route table is successfully build\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory for the rotue table.\r
+\r
+**/\r
EFI_STATUS\r
Ip4BuildEfiRouteTable (\r
IN IP4_PROTOCOL *IpInstance\r