]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c
add assertion to pass K8 check.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Dispatcher.c
index 9f170677f947886d526996fce3d8bf2607fc70d5..49b313615d2ac78216f4e5a443b2609fd7567304 100644 (file)
@@ -1,21 +1,15 @@
 /** @file\r
+  Tcp request dispatcher implementation.\r
 \r
-Copyright (c) 2005 - 2006, Intel Corporation\r
+Copyright (c) 2005 - 2006, Intel Corporation<BR>\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
+http://opensource.org/licenses/bsd-license.php<BR>\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:\r
-\r
-  Tcp4Dispatcher.c\r
-\r
-Abstract:\r
-\r
-\r
 **/\r
 \r
 #include "Tcp4Main.h"\r
@@ -23,42 +17,33 @@ Abstract:
 #define TCP_COMP_VAL(Min, Max, Default, Val) \\r
   ((((Val) <= (Max)) && ((Val) >= (Min))) ? (Val) : (Default))\r
 \r
+/**\r
+  Add or remove a route entry in the IP route table associated with this TCP instance.\r
+\r
+  @param  Tcb                   Pointer to the TCP_CB of this TCP instance.\r
+  @param  RouteInfo             Pointer to the route info to be processed.\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,\r
+                                BOOTP, RARP, etc.) is not finished yet.\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
+                                (when RouteInfo->DeleteRoute is TRUE).\r
+  @retval EFI_ACCESS_DENIED     The route is already defined in the routing table\r
+                                (when RouteInfo->DeleteRoute is FALSE).\r
+**/\r
 EFI_STATUS\r
 Tcp4Route (\r
   IN TCP_CB           *Tcb,\r
   IN TCP4_ROUTE_INFO  *RouteInfo\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Add or remove a route entry in the IP route table associated\r
-  with this TCP instance.\r
-\r
-Arguments:\r
-\r
-  Tcb       - Pointer to the TCP_CB of this TCP instance.\r
-  RouteInfo - Pointer to the route info to be processed.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - The operation completed successfully.\r
-  EFI_NOT_STARTED      - The driver instance has not been started.\r
-  EFI_NO_MAPPING       - When using the default address, configuration(DHCP,\r
-                         BOOTP, RARP, etc.) is not finished yet.\r
-  EFI_OUT_OF_RESOURCES - Could not add the entry to the routing table.\r
-  EFI_NOT_FOUND        - This route is not in the routing table\r
-                         (when RouteInfo->DeleteRoute is TRUE).\r
-  EFI_ACCESS_DENIED    - The route is already defined in the routing table\r
-                         (when RouteInfo->DeleteRoute is FALSE).\r
-\r
---*/\r
 {\r
   EFI_IP4_PROTOCOL  *Ip;\r
 \r
   Ip = Tcb->IpInfo->Ip;\r
 \r
-  ASSERT (Ip);\r
+  ASSERT (Ip != NULL);\r
 \r
   return Ip->Routes (\r
               Ip,\r
@@ -67,7 +52,7 @@ Returns:
               RouteInfo->SubnetMask,\r
               RouteInfo->GatewayAddress\r
               );\r
-\r
+              \r
 }\r
 \r
 \r
@@ -85,8 +70,8 @@ Returns:
 **/\r
 EFI_STATUS\r
 Tcp4GetMode (\r
-  IN TCP_CB         *Tcb,\r
-  IN TCP4_MODE_DATA *Mode\r
+  IN     TCP_CB         *Tcb,\r
+  IN OUT TCP4_MODE_DATA *Mode\r
   )\r
 {\r
   SOCKET                *Sock;\r
@@ -111,8 +96,8 @@ Tcp4GetMode (
     AccessPoint                     = &(ConfigData->AccessPoint);\r
     Option                          = ConfigData->ControlOption;\r
 \r
-    ConfigData->TypeOfService       = Tcb->TOS;\r
-    ConfigData->TimeToLive          = Tcb->TTL;\r
+    ConfigData->TypeOfService       = Tcb->Tos;\r
+    ConfigData->TimeToLive          = Tcb->Ttl;\r
 \r
     AccessPoint->UseDefaultAddress  = Tcb->UseDefaultAddr;\r
 \r
@@ -147,7 +132,7 @@ Tcp4GetMode (
   }\r
 \r
   Ip = Tcb->IpInfo->Ip;\r
-  ASSERT (Ip);\r
+  ASSERT (Ip != NULL);\r
 \r
   return Ip->GetModeData (Ip, Mode->Ip4ModeData, Mode->MnpConfigData, Mode->SnpModeData);\r
 }\r
@@ -224,9 +209,7 @@ Tcp4Bind (
 \r
   @param  Tcb                    Pointer to the TCP_CB to be flushed.\r
 \r
-  None\r
-\r
- **/\r
+**/\r
 VOID\r
 Tcp4FlushPcb (\r
   IN TCP_CB *Tcb\r
@@ -260,6 +243,15 @@ Tcp4FlushPcb (
   NetbufFreeList (&Tcb->RcvQue);\r
 }\r
 \r
+/**\r
+  Attach a Pcb to the socket.\r
+\r
+  @param  Sk                     Pointer to the socket of this TCP instance.\r
+  \r
+  @retval EFI_SUCCESS            The operation is completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES   Failed due to resource limit.\r
+\r
+**/\r
 EFI_STATUS\r
 Tcp4AttachPcb (\r
   IN SOCKET  *Sk\r
@@ -302,6 +294,12 @@ Tcp4AttachPcb (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Detach the Pcb of the socket.\r
+\r
+  @param  Sk                     Pointer to the socket of this TCP instance.\r
+  \r
+**/\r
 VOID\r
 Tcp4DetachPcb (\r
   IN SOCKET  *Sk\r
@@ -326,7 +324,7 @@ Tcp4DetachPcb (
 \r
 \r
 /**\r
-  Configure the Tcb using CfgData.\r
+  Configure the Pcb using CfgData.\r
 \r
   @param  Sk                     Pointer to the socket of this TCP instance.\r
   @param  CfgData                Pointer to the TCP configuration data.\r
@@ -349,7 +347,7 @@ Tcp4ConfigurePcb (
   TCP4_PROTO_DATA     *TcpProto;\r
   TCP_CB              *Tcb;\r
 \r
-  ASSERT (CfgData && Sk && Sk->SockHandle);\r
+  ASSERT ((CfgData != NULL) && (Sk != NULL) && (Sk->SockHandle != NULL));\r
 \r
   TcpProto = (TCP4_PROTO_DATA *) Sk->ProtoReserved;\r
   Tcb      = TcpProto->TcpPcb;\r
@@ -426,8 +424,8 @@ Tcp4ConfigurePcb (
   //\r
   // initialize Tcb in the light of CfgData\r
   //\r
-  Tcb->TTL            = CfgData->TimeToLive;\r
-  Tcb->TOS            = CfgData->TypeOfService;\r
+  Tcb->Ttl            = CfgData->TimeToLive;\r
+  Tcb->Tos            = CfgData->TypeOfService;\r
 \r
   Tcb->UseDefaultAddr = CfgData->AccessPoint.UseDefaultAddress;\r
 \r
@@ -617,13 +615,13 @@ Tcp4Dispatcher (
     // notify TCP using this message to give it a chance to send out\r
     // window update information\r
     //\r
-    ASSERT (Tcb);\r
+    ASSERT (Tcb != NULL);\r
     TcpOnAppConsume (Tcb);\r
     break;\r
 \r
   case SOCK_SND:\r
 \r
-    ASSERT (Tcb);\r
+    ASSERT (Tcb != NULL);\r
     TcpOnAppSend (Tcb);\r
     break;\r
 \r
@@ -686,7 +684,7 @@ Tcp4Dispatcher (
 \r
   case SOCK_MODE:\r
 \r
-    ASSERT (Data && Tcb);\r
+    ASSERT ((Data != NULL) && (Tcb != NULL));\r
 \r
     return Tcp4GetMode (Tcb, (TCP4_MODE_DATA *) Data);\r
 \r
@@ -694,7 +692,7 @@ Tcp4Dispatcher (
 \r
   case SOCK_ROUTE:\r
 \r
-    ASSERT (Data && Tcb);\r
+    ASSERT ((Data != NULL) && (Tcb != NULL));\r
 \r
     return Tcp4Route (Tcb, (TCP4_ROUTE_INFO *) Data);\r
 \r