]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
Fixing function headers.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Impl.h
index 94b4534de2cddc8ad7274a1ee08b1d6a1a2996a2..c72e27ad55f4676e27d3de34897fd93289f1c8b2 100644 (file)
@@ -25,8 +25,8 @@ Abstract:
 \r
 #include <PiDxe.h>\r
 \r
-#include <Protocol/IP4.h>\r
-#include <Protocol/IP4Config.h>\r
+#include <Protocol/Ip4.h>\r
+#include <Protocol/Ip4Config.h>\r
 #include <Protocol/Arp.h>\r
 #include <Protocol/ManagedNetwork.h>\r
 \r
@@ -50,9 +50,11 @@ Abstract:
 #include "Ip4Input.h"\r
 #include "Ip4Output.h"\r
 \r
-enum {\r
-  IP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'P'),\r
-  IP4_SERVICE_SIGNATURE  = EFI_SIGNATURE_32 ('I', 'P', '4', 'S'),\r
+\r
+\r
+typedef enum {\r
+  IP4_PROTOCOL_SIGNATURE = SIGNATURE_32 ('I', 'P', '4', 'P'),\r
+  IP4_SERVICE_SIGNATURE  = SIGNATURE_32 ('I', 'P', '4', 'S'),\r
 \r
   //\r
   // The state of IP4 protocol. It starts from UNCONFIGED. if it is\r
@@ -74,17 +76,17 @@ enum {
   IP4_SERVICE_STARTED,\r
   IP4_SERVICE_CONFIGED,\r
   IP4_SERVICE_DESTORY\r
-};\r
-\r
-//\r
-// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.\r
-// The user's data is kept in the Packet. When fragment is\r
-// needed, each fragment of the Packet has a reference to the\r
-// Packet, no data is actually copied. The Packet will be\r
-// released when all the fragments of it have been recycled by\r
-// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and\r
-// user's event signalled.\r
-//\r
+} IP4_IMPL_ENUM_TYPES;\r
+\r
+///\r
+/// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.\r
+/// The user's data is kept in the Packet. When fragment is\r
+/// needed, each fragment of the Packet has a reference to the\r
+/// Packet, no data is actually copied. The Packet will be\r
+/// released when all the fragments of it have been recycled by\r
+/// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and\r
+/// user's event signalled.\r
+///\r
 typedef struct {\r
   IP4_PROTOCOL              *IpInstance;\r
   EFI_IP4_COMPLETION_TOKEN  *Token;\r
@@ -93,22 +95,23 @@ typedef struct {
   INTN                      Life;\r
 } IP4_TXTOKEN_WRAP;\r
 \r
-//\r
-// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the\r
-// upper layers. The received packet is kept in the Packet.\r
-// The Packet itself may be constructured from some fragments.\r
-// All the fragments of the Packet is organized by a\r
-// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by\r
-// the upper layer, the assemble entry and its associated\r
-// fragments will be freed at last.\r
-//\r
+///\r
+/// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the\r
+/// upper layers. The received packet is kept in the Packet.\r
+/// The Packet itself may be constructured from some fragments.\r
+/// All the fragments of the Packet is organized by a\r
+/// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by\r
+/// the upper layer, the assemble entry and its associated\r
+/// fragments will be freed at last.\r
+///\r
 typedef struct {\r
-  NET_LIST_ENTRY            Link;\r
+  LIST_ENTRY                Link;\r
   IP4_PROTOCOL              *IpInstance;\r
   NET_BUF                   *Packet;\r
   EFI_IP4_RECEIVE_DATA      RxData;\r
 } IP4_RXDATA_WRAP;\r
 \r
+\r
 struct _IP4_PROTOCOL {\r
   UINT32                    Signature;\r
 \r
@@ -117,15 +120,15 @@ struct _IP4_PROTOCOL {
   INTN                      State;\r
 \r
   IP4_SERVICE               *Service;\r
-  NET_LIST_ENTRY            Link; // Link to all the IP protocol from the service\r
+  LIST_ENTRY                Link; // Link to all the IP protocol from the service\r
 \r
   //\r
   // User's transmit/receive tokens, and received/deliverd packets\r
   //\r
   NET_MAP                   RxTokens;\r
   NET_MAP                   TxTokens;   // map between (User's Token, IP4_TXTOKE_WRAP)\r
-  NET_LIST_ENTRY            Received;   // Received but not delivered packet\r
-  NET_LIST_ENTRY            Delivered;  // Delivered and to be recycled packets\r
+  LIST_ENTRY                Received;   // Received but not delivered packet\r
+  LIST_ENTRY                Delivered;  // Delivered and to be recycled packets\r
   EFI_LOCK                  RecycleLock;\r
 \r
   //\r
@@ -134,7 +137,7 @@ struct _IP4_PROTOCOL {
   // is used to communicate the current route info to the upper layer.\r
   //\r
   IP4_INTERFACE             *Interface;\r
-  NET_LIST_ENTRY            AddrLink;   // Ip instances with the same IP address.\r
+  LIST_ENTRY                AddrLink;   // Ip instances with the same IP address.\r
   IP4_ROUTE_TABLE           *RouteTable;\r
 \r
   EFI_IP4_ROUTE_TABLE       *EfiRouteTable;\r
@@ -161,9 +164,9 @@ struct _IP4_SERVICE {
   // interface and route table and caches.\r
   //\r
   UINTN                           NumChildren;\r
-  NET_LIST_ENTRY                  Children;\r
+  LIST_ENTRY                      Children;\r
 \r
-  NET_LIST_ENTRY                  Interfaces;\r
+  LIST_ENTRY                      Interfaces;\r
 \r
   IP4_INTERFACE                   *DefaultInterface;\r
   IP4_ROUTE_TABLE                 *DefaultRouteTable;\r
@@ -213,36 +216,112 @@ struct _IP4_SERVICE {
 \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
@@ -250,6 +329,20 @@ Ip4TimerTicking (
   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