]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add comments for functions and fix some coding style issue.
authorniry <niry@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 5 Dec 2008 23:47:55 +0000 (23:47 +0000)
committerniry <niry@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 5 Dec 2008 23:47:55 +0000 (23:47 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6885 6f19259b-4bc3-4df7-8a09-765794883524

12 files changed:
MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c
MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.h
MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.h
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Timer.c

index 602765b25237007f2589a141848b3a44cb57f93b..14342dfff02ed37bec70f1d4712b225e65131855 100644 (file)
@@ -20,18 +20,41 @@ Abstract:
 \r
 #include "SockImpl.h"\r
 \r
+/**\r
+  Get the length of the data that can be retrieved from the socket\r
+  receive buffer.\r
+\r
+  @param  SockBuffer            Pointer to the socket receive buffer.\r
+  @param  IsUrg                 Pointer to a BOOLEAN variable. If TRUE the data is\r
+                                OOB.\r
+  @param  BufLen                The maximum length of the data buffer to store the\r
+                                received data in socket layer.\r
+\r
+  @return The length of the data can be retreived.\r
+\r
+**/\r
 UINT32\r
 SockTcpDataToRcv (\r
   IN  SOCK_BUFFER   *SockBuffer,\r
   OUT BOOLEAN       *IsOOB,\r
   IN  UINT32        BufLen\r
   );\r
+  \r
+/**\r
+  Process the send token.\r
 \r
+  @param  Sock                  Pointer to the socket.\r
+\r
+**/\r
 VOID\r
 SockProcessSndToken (\r
   IN SOCKET *Sock\r
   );\r
 \r
+/**\r
+    \r
+\r
+**/\r
 VOID\r
 SockFreeFoo (\r
   IN EFI_EVENT Event\r
@@ -56,9 +79,9 @@ SockFreeFoo (
 **/\r
 UINT32\r
 SockTcpDataToRcv (\r
-  IN  SOCK_BUFFER    *SockBuffer,\r
-  OUT BOOLEAN        *IsUrg,\r
-  IN  UINT32         BufLen\r
+  IN     SOCK_BUFFER    *SockBuffer,\r
+     OUT BOOLEAN        *IsUrg,\r
+  IN     UINT32         BufLen\r
   )\r
 {\r
   NET_BUF       *RcvBufEntry;\r
@@ -66,10 +89,10 @@ SockTcpDataToRcv (
   TCP_RSV_DATA  *TcpRsvData;\r
   BOOLEAN       Urg;\r
 \r
-  ASSERT (SockBuffer && IsUrg && (BufLen > 0));\r
+  ASSERT ((SockBuffer != NULL) && (IsUrg != NULL) && (BufLen > 0));\r
 \r
   RcvBufEntry = SockBufFirst (SockBuffer);\r
-  ASSERT (RcvBufEntry);\r
+  ASSERT (RcvBufEntry != NULL);\r
 \r
   TcpRsvData  = (TCP_RSV_DATA *) RcvBufEntry->ProtoData;\r
 \r
@@ -133,8 +156,6 @@ SockTcpDataToRcv (
   @param  RcvdBytes             The maximum length of the data can be copied.\r
   @param  IsOOB                 If TURE the data is OOB, else the data is normal.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockSetTcpRxData (\r
@@ -197,7 +218,7 @@ SockProcessRcvToken (
   EFI_TCP4_RECEIVE_DATA  *RxData;\r
   BOOLEAN                IsUrg;\r
 \r
-  ASSERT (Sock);\r
+  ASSERT (Sock != NULL);\r
 \r
   ASSERT (SOCK_STREAM == Sock->Type);\r
 \r
@@ -305,9 +326,7 @@ SockProcessTcpSndData (
 \r
   @param  Sock                  Pointer to the socket.\r
   @param  PendingTokenList      Pointer to the token list to be flushed.\r
-\r
-  @return None.\r
-\r
+  \r
 **/\r
 VOID\r
 SockFlushPendingToken (\r
@@ -318,7 +337,7 @@ SockFlushPendingToken (
   SOCK_TOKEN            *SockToken;\r
   SOCK_COMPLETION_TOKEN *Token;\r
 \r
-  ASSERT (Sock && PendingTokenList);\r
+  ASSERT ((Sock != NULL) && (PendingTokenList != NULL));\r
 \r
   while (!IsListEmpty (PendingTokenList)) {\r
     SockToken = NET_LIST_HEAD (\r
@@ -337,14 +356,11 @@ SockFlushPendingToken (
 \r
 \r
 /**\r
-  Wake up the connection token while the connection is\r
-  successfully established, then try to process any\r
-  pending send token.\r
+  Wake up the connection token while the connection is successfully established, \r
+  then try to process any pending send token.\r
 \r
   @param  Sock                  Pointer to the socket.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockWakeConnToken (\r
@@ -365,13 +381,10 @@ SockWakeConnToken (
 \r
 \r
 /**\r
-  Wake up the listen token while the connection is\r
-  established successfully.\r
+  Wake up the listen token while the connection is established successfully.\r
 \r
   @param  Sock                  Pointer to the socket.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockWakeListenToken (\r
@@ -384,7 +397,7 @@ SockWakeListenToken (
 \r
   Parent = Sock->Parent;\r
 \r
-  ASSERT (Parent && SOCK_IS_LISTENING (Parent) && SOCK_IS_CONNECTED (Sock));\r
+  ASSERT ((Parent != NULL) && SOCK_IS_LISTENING (Parent) && SOCK_IS_CONNECTED (Sock));\r
 \r
   if (!IsListEmpty (&Parent->ListenTokenList)) {\r
     SockToken = NET_LIST_HEAD (\r
@@ -416,8 +429,6 @@ SockWakeListenToken (
 \r
   @param  Sock                  Pointer to the socket.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockWakeRcvToken (\r
@@ -429,7 +440,7 @@ SockWakeRcvToken (
   SOCK_TOKEN    *SockToken;\r
   SOCK_IO_TOKEN *RcvToken;\r
 \r
-  ASSERT (Sock->RcvBuffer.DataQueue);\r
+  ASSERT (Sock->RcvBuffer.DataQueue != NULL);\r
 \r
   RcvdBytes = (Sock->RcvBuffer.DataQueue)->BufSize;\r
 \r
@@ -462,8 +473,6 @@ SockWakeRcvToken (
 \r
   @param  Sock                  Pointer to the socket.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockProcessSndToken (\r
@@ -477,7 +486,7 @@ SockProcessSndToken (
   EFI_TCP4_TRANSMIT_DATA  *TxData;\r
   EFI_STATUS              Status;\r
 \r
-  ASSERT (Sock && (SOCK_STREAM == Sock->Type));\r
+  ASSERT ((Sock != NULL) && (SOCK_STREAM == Sock->Type));\r
 \r
   FreeSpace = SockGetFreeSpace (Sock, SOCK_SND_BUF);\r
 \r
@@ -552,9 +561,9 @@ SockCreate (
   SOCKET      *Parent;\r
   EFI_STATUS  Status;\r
 \r
-  ASSERT (SockInitData && SockInitData->ProtoHandler);\r
+  ASSERT ((SockInitData != NULL) && (SockInitData->ProtoHandler != NULL));\r
   ASSERT (SockInitData->Type == SOCK_STREAM);\r
-  ASSERT (SockInitData->ProtoData && (SockInitData->DataSize <= PROTO_RESERVED_LEN));\r
+  ASSERT ((SockInitData->ProtoData != NULL) && (SockInitData->DataSize <= PROTO_RESERVED_LEN));\r
 \r
   Parent = SockInitData->Parent;\r
 \r
@@ -706,8 +715,6 @@ OnError:
 \r
   @param  Sock                  Pointer to the socket.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockDestroy (\r
@@ -807,8 +814,6 @@ FreeSock:
 \r
   @param  Sock                  Pointer to the socket.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockConnFlush (\r
@@ -817,7 +822,7 @@ SockConnFlush (
 {\r
   SOCKET  *Child;\r
 \r
-  ASSERT (Sock);\r
+  ASSERT (Sock != NULL);\r
 \r
   //\r
   // Clear the flag in this socket\r
@@ -875,8 +880,6 @@ SockConnFlush (
   @param  Sock                  Pointer to the socket.\r
   @param  State                 The new state to be set.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockSetState (\r
@@ -893,8 +896,7 @@ SockSetState (
 \r
   @param  Sock                  Pointer to the socket to be cloned.\r
 \r
-  @retval *                     Pointer to the newly cloned socket. If NULL, error\r
-                                condition occurred.\r
+  @return Pointer to the newly cloned socket. If NULL, error condition occurred.\r
 \r
 **/\r
 SOCKET *\r
@@ -905,22 +907,22 @@ SockClone (
   SOCKET          *ClonedSock;\r
   SOCK_INIT_DATA  InitData;\r
 \r
-  InitData.BackLog        = Sock->BackLog;\r
-  InitData.Parent         = Sock;\r
-  InitData.State          = Sock->State;\r
-  InitData.ProtoHandler   = Sock->ProtoHandler;\r
-  InitData.Type           = Sock->Type;\r
-  InitData.RcvBufferSize  = Sock->RcvBuffer.HighWater;\r
-  InitData.SndBufferSize  = Sock->SndBuffer.HighWater;\r
-  InitData.DriverBinding  = Sock->DriverBinding;\r
-  InitData.Protocol       = &(Sock->NetProtocol);\r
+  InitData.BackLog         = Sock->BackLog;\r
+  InitData.Parent          = Sock;\r
+  InitData.State           = Sock->State;\r
+  InitData.ProtoHandler    = Sock->ProtoHandler;\r
+  InitData.Type            = Sock->Type;\r
+  InitData.RcvBufferSize   = Sock->RcvBuffer.HighWater;\r
+  InitData.SndBufferSize   = Sock->SndBuffer.HighWater;\r
+  InitData.DriverBinding   = Sock->DriverBinding;\r
+  InitData.Protocol        = &(Sock->NetProtocol);\r
   InitData.CreateCallback  = Sock->CreateCallback;\r
   InitData.DestroyCallback = Sock->DestroyCallback;\r
   InitData.Context         = Sock->Context;\r
   InitData.ProtoData       = Sock->ProtoReserved;\r
   InitData.DataSize        = sizeof (Sock->ProtoReserved);\r
 \r
-  ClonedSock              = SockCreate (&InitData);\r
+  ClonedSock               = SockCreate (&InitData);\r
 \r
   if (NULL == ClonedSock) {\r
     DEBUG ((EFI_D_ERROR, "SockClone: no resource to create a cloned sock\n"));\r
@@ -935,16 +937,12 @@ SockClone (
 \r
 \r
 /**\r
-  Called by the low layer protocol to indicate the socket\r
-  a connection is established. This function just changes\r
-  the socket's state to SO_CONNECTED and signals the token\r
-  used for connection establishment.\r
+  Called by the low layer protocol to indicate the socket a connection is \r
+  established. This function just changes the socket's state to SO_CONNECTED \r
+  and signals the token used for connection establishment.\r
 \r
   @param  Sock                  Pointer to the socket associated with the\r
                                 established connection.\r
-\r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockConnEstablished (\r
@@ -967,15 +965,12 @@ SockConnEstablished (
 \r
 \r
 /**\r
-  Called by the low layer protocol to indicate the connection\r
-  is closed. This function flushes the socket, sets the state\r
-  to SO_CLOSED and signals the close token.\r
+  Called by the low layer protocol to indicate the connection is closed; This \r
+  function flushes the socket, sets the state to SO_CLOSED and signals the close \r
+  token.\r
 \r
   @param  Sock                  Pointer to the socket associated with the closed\r
                                 connection.\r
-\r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockConnClosed (\r
@@ -998,16 +993,13 @@ SockConnClosed (
 \r
 \r
 /**\r
-  Called by low layer protocol to indicate that some\r
-  data is sent or processed. This function trims the\r
-  sent data in the socket send buffer, signals the\r
-  data token if proper\r
+  Called by low layer protocol to indicate that some data is sent or processed; \r
+  This function trims the sent data in the socket send buffer, signals the data \r
+  token if proper.\r
 \r
   @param  Sock                  Pointer to the socket.\r
   @param  Count                 The length of the data processed or sent, in bytes.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockDataSent (\r
@@ -1078,7 +1070,7 @@ SockGetDataToSend (
   IN UINT8       *Dest\r
   )\r
 {\r
-  ASSERT (Sock && SOCK_STREAM == Sock->Type);\r
+  ASSERT ((Sock != NULL) && SOCK_STREAM == Sock->Type);\r
 \r
   return NetbufQueCopy (\r
           Sock->SndBuffer.DataQueue,\r
@@ -1090,18 +1082,15 @@ SockGetDataToSend (
 \r
 \r
 /**\r
-  Called by the low layer protocol to deliver received data\r
-  to socket layer. This function will append the data to the\r
-  socket receive buffer, set ther urgent data length and then\r
-  check if any receive token can be signaled.\r
+  Called by the low layer protocol to deliver received data to socket layer; \r
+  This function will append the data to the socket receive buffer, set ther \r
+  urgent data length and then check if any receive token can be signaled.\r
 \r
   @param  Sock                  Pointer to the socket.\r
   @param  NetBuffer             Pointer to the buffer that contains the received\r
                                 data.\r
   @param  UrgLen                The length of the urgent data in the received data.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockDataRcvd (\r
@@ -1110,7 +1099,7 @@ SockDataRcvd (
   IN UINT32    UrgLen\r
   )\r
 {\r
-  ASSERT (Sock && Sock->RcvBuffer.DataQueue &&\r
+  ASSERT ((Sock != NULL) && (Sock->RcvBuffer.DataQueue != NULL) &&\r
     UrgLen <= NetBuffer->TotalSize);\r
 \r
   NET_GET_REF (NetBuffer);\r
@@ -1143,7 +1132,7 @@ SockGetFreeSpace (
   UINT32      BufferCC;\r
   SOCK_BUFFER *SockBuffer;\r
 \r
-  ASSERT (Sock && ((SOCK_SND_BUF == Which) || (SOCK_RCV_BUF == Which)));\r
+  ASSERT ((Sock != NULL) && ((SOCK_SND_BUF == Which) || (SOCK_RCV_BUF == Which)));\r
 \r
   if (SOCK_SND_BUF == Which) {\r
     SockBuffer = &(Sock->SndBuffer);\r
@@ -1169,8 +1158,6 @@ SockGetFreeSpace (
   @param  Sock                  Pointer to the socket.\r
   @param  Error                 The error code received.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockRcvdErr (\r
@@ -1202,15 +1189,13 @@ SockRcvdErr (
 \r
 /**\r
   Called by the low layer protocol to indicate that there\r
-  will be no more data from the communication peer. This\r
+  will be no more data from the communication peer; This\r
   function set the socket's state to SO_NO_MORE_DATA and\r
   signal all queued IO tokens with the error status\r
   EFI_CONNECTION_FIN.\r
 \r
   @param  Sock                  Pointer to the socket.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 SockNoMoreData (\r
@@ -1270,7 +1255,8 @@ SockBufFirst (
   @param  SockEntry             Pointer to the buffer block prior to the required\r
                                 one.\r
 \r
-  @return Pointer to the buffer block next to SockEntry. NULL if SockEntry is the tail or head entry.\r
+  @return Pointer to the buffer block next to SockEntry. NULL if SockEntry is \r
+          the tail or head entry.\r
 \r
 **/\r
 NET_BUF *\r
@@ -1285,8 +1271,7 @@ SockBufNext (
 \r
   if ((SockEntry->List.ForwardLink == NetbufList) ||\r
       (SockEntry->List.BackLink == &SockEntry->List) ||\r
-      (SockEntry->List.ForwardLink == &SockEntry->List)\r
-      ) {\r
+      (SockEntry->List.ForwardLink == &SockEntry->List)) {\r
 \r
     return NULL;\r
   }\r
index 4d5456d3cfa3161fd150440e268f2bea468da6f1..f06179578c4469aae47be6016c38d4cb6d69473e 100644 (file)
@@ -68,7 +68,7 @@ SockConnFlush (
   IN SOCKET *Sock\r
   );\r
 \r
-SOCKET  *\r
+SOCKET *\r
 SockCreate (\r
   IN SOCK_INIT_DATA *SockInitData\r
   );\r
index a25bd4e1b4bb20e216e5c20644ca4d33f00249b2..67aa919c338382595e38aff696c8ea6803735bc1 100644 (file)
@@ -28,8 +28,8 @@ Abstract:
   @param  List                 Pointer to the token list to be searched.\r
   @param  Event                The event to be checked.\r
 \r
-  @retval BOOLEAN              If TRUE, the specific Event exists in the List. If\r
-                               FALSE, the specific Event is not in the List.\r
+  @retval  TRUE                The specific Event exists in the List. \r
+  @retval  False               The specific Event is not in the List.\r
 \r
 **/\r
 BOOLEAN\r
@@ -77,8 +77,7 @@ SockTokenExisted (
   if (SockTokenExistedInList (&Sock->SndTokenList, Event) ||\r
       SockTokenExistedInList (&Sock->ProcessingSndTokenList, Event) ||\r
       SockTokenExistedInList (&Sock->RcvTokenList, Event) ||\r
-      SockTokenExistedInList (&Sock->ListenTokenList, Event)\r
-        ) {\r
+      SockTokenExistedInList (&Sock->ListenTokenList, Event)) {\r
 \r
     return TRUE;\r
   }\r
@@ -152,7 +151,7 @@ SockDestroyChild (
 {\r
   EFI_STATUS  Status;\r
 \r
-  ASSERT (Sock && Sock->ProtoHandler);\r
+  ASSERT ((Sock != NULL) && (Sock->ProtoHandler != NULL));\r
 \r
   if (Sock->IsDestroyed) {\r
     return EFI_SUCCESS;\r
@@ -258,8 +257,7 @@ SockCreateChild (
 \r
 \r
 /**\r
-  Configure the specific socket Sock using configuration data\r
-  ConfigData.\r
+  Configure the specific socket Sock using configuration data ConfigData.\r
 \r
   @param  Sock                 Pointer to the socket to be configured.\r
   @param  ConfigData           Pointer to the configuration data.\r
@@ -455,7 +453,7 @@ SockAccept (
 \r
       RemoveEntryList (ListEntry);\r
 \r
-      ASSERT (Socket->Parent);\r
+      ASSERT (Socket->Parent != NULL);\r
 \r
       Socket->Parent->ConnCnt--;\r
 \r
index 9f170677f947886d526996fce3d8bf2607fc70d5..009ae582a505927ba761c6a28cc73b278253f220 100644 (file)
@@ -23,42 +23,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 +58,7 @@ Returns:
               RouteInfo->SubnetMask,\r
               RouteInfo->GatewayAddress\r
               );\r
-\r
+              \r
 }\r
 \r
 \r
@@ -147,7 +138,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 +215,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 +249,15 @@ Tcp4FlushPcb (
   NetbufFreeList (&Tcb->RcvQue);\r
 }\r
 \r
+/**\r
+  Attach a Tcb 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 +300,12 @@ Tcp4AttachPcb (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Detach the Tcb 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
@@ -349,7 +353,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
@@ -617,13 +621,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 +690,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 +698,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
index cfdfbe68f29151ab28527b687262a8d6a68b6601..c51962ba9ebaf172f671403139f10a0d05131ee2 100644 (file)
@@ -21,7 +21,7 @@ Abstract:
 #include "Tcp4Main.h"\r
 \r
 \r
-UINT16                               mTcp4RandomPort;\r
+UINT16                                mTcp4RandomPort;\r
 extern EFI_COMPONENT_NAME_PROTOCOL    gTcp4ComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL   gTcp4ComponentName2;\r
 \r
@@ -78,8 +78,6 @@ EFI_SERVICE_BINDING_PROTOCOL mTcp4ServiceBinding = {
 /**\r
   Create and start the heartbeat timer for TCP driver.\r
 \r
-  None.\r
-\r
   @retval EFI_SUCCESS            The timer is successfully created and started.\r
   @retval other                  The timer is not created.\r
 \r
@@ -124,13 +122,11 @@ Tcp4CreateTimer (
 /**\r
   Stop and destroy the heartbeat timer for TCP driver.\r
   \r
-  None\r
-  \r
-  None\r
-\r
 **/\r
 VOID\r
-Tcp4DestroyTimer ()\r
+Tcp4DestroyTimer (\r
+  VOID\r
+  )\r
 {\r
   ASSERT (mTcp4Timer.RefCnt > 0);\r
 \r
@@ -146,8 +142,7 @@ Tcp4DestroyTimer ()
 }\r
 \r
 /**\r
-  The entry point for Tcp4 driver. \r
-  Used to install Tcp4 driver on the ImageHandle.\r
+  The entry point for Tcp4 driver, used to install Tcp4 driver on the ImageHandle.\r
 \r
   @param  ImageHandle   The firmware allocated handle for this\r
                         driver image.\r
@@ -184,7 +179,7 @@ Tcp4DriverEntryPoint (
   //\r
   Seed            = NetRandomInitSeed ();\r
   mTcpGlobalIss   = NET_RANDOM (Seed) % mTcpGlobalIss;\r
-  mTcp4RandomPort = (UINT16) ( TCP4_PORT_KNOWN +\r
+  mTcp4RandomPort = (UINT16) (TCP4_PORT_KNOWN +\r
                     (UINT16) (NET_RANDOM(Seed) % TCP4_PORT_KNOWN));\r
 \r
   return Status;\r
@@ -207,9 +202,9 @@ Tcp4DriverEntryPoint (
 EFI_STATUS\r
 EFIAPI\r
 Tcp4DriverBindingSupported (\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
   EFI_STATUS  Status;\r
@@ -262,9 +257,9 @@ Tcp4DriverBindingSupported (
 EFI_STATUS\r
 EFIAPI\r
 Tcp4DriverBindingStart (\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
   EFI_STATUS               Status;\r
@@ -464,6 +459,17 @@ Tcp4DriverBindingStop (
   return Status;\r
 }\r
 \r
+/**\r
+  Open Ip4 and device path protocols for a created socket, and insert it in \r
+  socket list.\r
+  \r
+  @param  This                Pointer to the socket just created\r
+  @param  Context             Context of the socket\r
+  \r
+  @retval EFI_SUCCESS         This protocol is installed successfully.\r
+  @retval other               Some error occured.\r
+  \r
+**/\r
 EFI_STATUS\r
 Tcp4CreateSocketCallback (\r
   IN SOCKET  *This,\r
@@ -519,6 +525,13 @@ Tcp4CreateSocketCallback (
   return Status;\r
 }\r
 \r
+/**\r
+  Close Ip4 and device path protocols for a socket, and remove it from socket list. \r
+    \r
+  @param  This                Pointer to the socket to be removed\r
+  @param  Context             Context of the socket\r
+  \r
+**/\r
 VOID\r
 Tcp4DestroySocketCallback (\r
   IN SOCKET  *This,\r
index 2636ce708c89c580be8b9b0489a680e5f5654bb6..82fd57c34da1453e487f6ce48b9a1e2759d5b14f 100644 (file)
@@ -100,17 +100,17 @@ Tcp4DriverEntryPoint (
 EFI_STATUS\r
 EFIAPI\r
 Tcp4DriverBindingSupported (\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
 EFI_STATUS\r
 EFIAPI\r
 Tcp4DriverBindingStart (\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
 EFI_STATUS\r
index 2e436249f23b14b71a01977feb624f8da43892ae..f525f240e40604dec0d625da3a270f4249c7a8e8 100644 (file)
@@ -24,13 +24,13 @@ Abstract:
 \r
 \r
 /**\r
-  Check whether the sequence number of the incoming segment\r
-  is acceptable.\r
+  Check whether the sequence number of the incoming segment is acceptable.\r
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
   @param  Seg      Pointer to the incoming segment.\r
 \r
-  @return 1 if the sequence number is acceptable, otherwise 0.\r
+  @retval 1       The sequence number is acceptable.\r
+  @retval 0       The sequence number is not acceptable.\r
 \r
 **/\r
 INTN\r
@@ -50,8 +50,6 @@ TcpSeqAcceptable (
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
   @param  Seg      Segment that triggers the fast recovery.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpFastRecover (\r
@@ -162,8 +160,6 @@ TcpFastRecover (
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
   @param  Seg      Segment that triggers the fast loss recovery.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpFastLossRecover (\r
@@ -203,13 +199,11 @@ TcpFastLossRecover (
 \r
 \r
 /**\r
-  Compute the RTT as specified in RFC2988\r
+  Compute the RTT as specified in RFC2988.\r
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
   @param  Measure  Currently measured RTT in heart beats.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpComputeRtt (\r
@@ -264,14 +258,13 @@ TcpComputeRtt (
 \r
 \r
 /**\r
-  Trim the data, SYN and FIN to fit into the window defined by\r
-  Left and Right.\r
+  Trim the data, SYN and FIN to fit into the window defined by Left and Right.\r
 \r
   @param  Nbuf     Buffer that contains received TCP segment without IP header.\r
   @param  Left     The sequence number of the window's left edge.\r
   @param  Right    The sequence number of the window's right edge.\r
 \r
-  @return 0, the data is successfully trimmed.\r
+  @return 0        The data is successfully trimmed.\r
 \r
 **/\r
 INTN\r
@@ -351,7 +344,7 @@ TcpTrimSegment (
     }\r
   }\r
 \r
-  ASSERT (TcpVerifySegment (Nbuf));\r
+  ASSERT (TcpVerifySegment (Nbuf) != 0);\r
   return 0;\r
 }\r
 \r
@@ -362,7 +355,7 @@ TcpTrimSegment (
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
   @param  Nbuf     Pointer to the NET_BUF containing the received tcp segment.\r
 \r
-  @return 0, the data is trimmed.\r
+  @return 0        The data is trimmed.\r
 \r
 **/\r
 INTN\r
@@ -397,7 +390,7 @@ TcpDeliverData (
   TCP_SEG         *Seg;\r
   UINT32          Urgent;\r
 \r
-  ASSERT (Tcb && Tcb->Sk);\r
+  ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL));\r
 \r
   //\r
   // make sure there is some data queued,\r
@@ -418,7 +411,7 @@ TcpDeliverData (
     Nbuf  = NET_LIST_USER_STRUCT (Entry, NET_BUF, List);\r
     Seg   = TCPSEG_NETBUF (Nbuf);\r
 \r
-    ASSERT (TcpVerifySegment (Nbuf));\r
+    ASSERT (TcpVerifySegment (Nbuf) != 0);\r
     ASSERT (Nbuf->Tcp == NULL);\r
 \r
     if (TCP_SEQ_GT (Seg->Seq, Seq)) {\r
@@ -547,8 +540,6 @@ TcpDeliverData (
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
   @param  Nbuf     Pointer to the buffer containing the data to be queued.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpQueueData (\r
@@ -562,7 +553,7 @@ TcpQueueData (
   LIST_ENTRY      *Cur;\r
   NET_BUF         *Node;\r
 \r
-  ASSERT (Tcb && Nbuf && (Nbuf->Tcp == NULL));\r
+  ASSERT ((Tcb != NULL) && (Nbuf != NULL) && (Nbuf->Tcp == NULL));\r
 \r
   NET_GET_REF (Nbuf);\r
 \r
@@ -655,8 +646,6 @@ TcpQueueData (
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
   @param  Ack      The acknowledge seuqence number of the received segment.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpAdjustSndQue (\r
@@ -989,10 +978,9 @@ TcpInput (
       // if it comes from a LISTEN TCB.\r
       //\r
     } else if ((Tcb->State == TCP_ESTABLISHED) ||\r
-             (Tcb->State == TCP_FIN_WAIT_1) ||\r
-             (Tcb->State == TCP_FIN_WAIT_2) ||\r
-             (Tcb->State == TCP_CLOSE_WAIT)\r
-            ) {\r
+               (Tcb->State == TCP_FIN_WAIT_1) ||\r
+               (Tcb->State == TCP_FIN_WAIT_2) ||\r
+               (Tcb->State == TCP_CLOSE_WAIT)) {\r
 \r
       SOCK_ERROR (Tcb->Sk, EFI_CONNECTION_RESET);\r
 \r
@@ -1162,7 +1150,7 @@ TcpInput (
     Tcb->SndUna = Seg->Ack;\r
 \r
     if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_SND_URG) &&\r
-        (TCP_SEQ_LT (Tcb->SndUp, Seg->Ack))) {\r
+        TCP_SEQ_LT (Tcb->SndUp, Seg->Ack)) {\r
 \r
       TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_URG);\r
     }\r
@@ -1390,7 +1378,7 @@ RESET_THEN_DROP:
   TcpSendReset (Tcb, Head, Len, Dst, Src);\r
 \r
 DROP_CONNECTION:\r
-  ASSERT (Tcb && Tcb->Sk);\r
+  ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL));\r
 \r
   NetbufFree (Nbuf);\r
   TcpClose (Tcb);\r
@@ -1411,7 +1399,7 @@ DISCARD:
 \r
   if ((Parent != NULL) && (Tcb != NULL)) {\r
 \r
-    ASSERT (Tcb->Sk);\r
+    ASSERT (Tcb->Sk != NULL);\r
     TcpClose (Tcb);\r
   }\r
 \r
@@ -1428,8 +1416,6 @@ DISCARD:
   @param  Src      Source address of the ICMP error message.\r
   @param  Dst      Destination address of the ICMP error message.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpIcmpInput (\r
index b01704efc65e51381b48b84a1180363c58bfebd1..d43a4a4faf0f8edb28b9ffc54e2214a79678e577 100644 (file)
@@ -89,12 +89,12 @@ Tcp4ChkDataBuf (
 EFI_STATUS\r
 EFIAPI\r
 Tcp4GetModeData (\r
-  IN  CONST EFI_TCP4_PROTOCOL                  *This,\r
-  OUT       EFI_TCP4_CONNECTION_STATE          *Tcp4State       OPTIONAL,\r
-  OUT       EFI_TCP4_CONFIG_DATA               *Tcp4ConfigData  OPTIONAL,\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
+  IN     CONST EFI_TCP4_PROTOCOL                  *This,\r
+     OUT       EFI_TCP4_CONNECTION_STATE          *Tcp4State       OPTIONAL,\r
+     OUT       EFI_TCP4_CONFIG_DATA               *Tcp4ConfigData  OPTIONAL,\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
   TCP4_MODE_DATA  TcpMode;\r
@@ -221,9 +221,9 @@ Tcp4Configure (
 /**\r
   Add or delete routing entries.\r
   \r
-  The Routes() function adds or deletes a route from the instance¡¯s routing table.\r
+  The Routes() function adds or deletes a route from the instance\92s routing table.\r
   The most specific route is selected by comparing the SubnetAddress with the \r
-  destination IP address¡¯s arithmetical AND to the SubnetMask.\r
+  destination IP address\92s arithmetical AND to the SubnetMask.\r
   The default route is added with both SubnetAddress and SubnetMask set to 0.0.0.0. \r
   The default route matches all destination IP addresses if there is no more specific route.\r
   Direct route is added with GatewayAddress set to 0.0.0.0. Packets are sent to \r
@@ -231,9 +231,9 @@ Tcp4Configure (
   cache or it is on the local subnet. If the instance is configured to use default \r
   address, a direct route to the local network will be added automatically.\r
   Each TCP instance has its own independent routing table. Instance that uses the \r
-  default IP address will have a copy of the EFI_IP4_CONFIG_PROTOCOL¡¯s routing table. \r
+  default IP address will have a copy of the EFI_IP4_CONFIG_PROTOCOL\92s routing table. \r
   The copy will be updated automatically whenever the IP driver reconfigures its \r
-  instance. As a result, the previous modification to the instance¡¯s local copy \r
+  instance. As a result, the previous modification to the instance\92s local copy \r
   will be lost. The priority of checking the route table is specific with IP \r
   implementation and every IP implementation must comply with RFC 1122.\r
 \r
@@ -348,7 +348,7 @@ Tcp4Connect (
   incoming connection on the passive TCP instance. If a remote peer successfully \r
   establishes a connection with this instance, a new TCP instance will be created \r
   and its handle will be returned in ListenToken->NewChildHandle. The newly created \r
-  instance is configured by inheriting the passive instance¡¯s configuration and is \r
+  instance is configured by inheriting the passive instance\92s configuration and is \r
   ready for use upon return. The instance is in the Tcp4StateEstablished state.\r
   The ListenToken->CompletionToken.Event will be signaled when a new connection \r
   is accepted, user aborts the listen or connection is reset. This function only \r
@@ -393,7 +393,7 @@ Tcp4Accept (
 \r
 \r
 /**\r
-  Queues outgoing data into the transmit queue\r
+  Queues outgoing data into the transmit queue.\r
 \r
   The Transmit() function queues a sending request to this TCPv4 instance along \r
   with the user data. The status of the token is updated and the event in the token \r
@@ -403,12 +403,12 @@ Tcp4Accept (
   @param  Token                    Pointer to the completion token to queue to the\r
                                    transmit queue\r
 \r
-  @retval EFI_SUCCESS              The data has been queued for transmission\r
+  @retval EFI_SUCCESS              The data has been queued for transmission.\r
   @retval EFI_NOT_STARTED          The EFI_TCP4_PROTOCOL instance hasn't been\r
                                    configured.\r
   @retval EFI_NO_MAPPING           When using a default address, configuration\r
                                    (DHCP, BOOTP, RARP, etc.) is not finished yet.\r
-  @retval EFI_INVALID_PARAMETER    One or more parameters are invalid\r
+  @retval EFI_INVALID_PARAMETER    One or more parameters are invalid.\r
   @retval EFI_ACCESS_DENIED        One or more of the following conditions is TRUE:\r
                                    * A transmit completion token with the same\r
                                      Token-> CompletionToken.Event was already in the\r
@@ -481,7 +481,7 @@ Tcp4Transmit (
   @param  Token                    Pointer to a token that is associated with the\r
                                    receive data descriptor.\r
 \r
-  @retval EFI_SUCCESS              The receive completion token was cached\r
+  @retval EFI_SUCCESS              The receive completion token was cached.\r
   @retval EFI_NOT_STARTED          The EFI_TCP4_PROTOCOL instance hasn't been\r
                                    configured.\r
   @retval EFI_NO_MAPPING           When using a default address, configuration\r
@@ -556,11 +556,11 @@ Tcp4Receive (
   asynchronous operation is signaled and any buffers used for TCP network traffic \r
   is flushed.\r
 \r
-  @param  This                     Pointer to the EFI_TCP4_PROTOCOL instance\r
+  @param  This                     Pointer to the EFI_TCP4_PROTOCOL instance.\r
   @param  CloseToken               Pointer to the close token to return when\r
                                    operation finishes.\r
 \r
-  @retval EFI_SUCCESS              The operation completed successfully\r
+  @retval EFI_SUCCESS              The operation completed successfully.\r
   @retval EFI_NOT_STARTED          The EFI_TCP4_PROTOCOL instance hasn't been\r
                                    configured.\r
   @retval EFI_ACCESS_DENIED        One or more of the following are TRUE: \r
@@ -568,9 +568,9 @@ Tcp4Receive (
                                      set to NULL and this function has not returned.\r
                                    * Previous Close() call on this instance has not\r
                                      finished.\r
-  @retval EFI_INVALID_PARAMETER    One ore more parameters are invalid\r
+  @retval EFI_INVALID_PARAMETER    One ore more parameters are invalid.\r
   @retval EFI_OUT_OF_RESOURCES     Could not allocate enough resource to finish the\r
-                                   operation\r
+                                   operation.\r
   @retval EFI_DEVICE_ERROR         Any unexpected and not belonged to above\r
                                    category error.\r
 \r
@@ -606,7 +606,8 @@ Tcp4Close (
   is not in one of the queues, which usually means that the asynchronous operation \r
   has completed, EFI_NOT_FOUND is returned. If Token is NULL all asynchronous token \r
   issued by Connect(), Accept(), Transmit() and Receive()will be aborted.\r
-\r
+  NOTE: It has not been implemented currently.\r
+    \r
   @param  This                     Pointer to the EFI_TCP4_PROTOCOL instance.\r
   @param  Token                    Pointer to a token that has been issued by\r
                                    Connect(), Accept(), Transmit() or Receive(). If\r
@@ -616,15 +617,15 @@ Tcp4Close (
   @retval  EFI_SUCCESS             The asynchronous I/O request is aborted and Token->Event\r
                                    is signaled.\r
   @retval  EFI_INVALID_PARAMETER   This is NULL.\r
-  @retval  EFI_NOT_STARTED         This instance hasn¡¯t been configured.\r
+  @retval  EFI_NOT_STARTED         This instance hasn\92t been configured.\r
   @retval  EFI_NO_MAPPING          When using the default address, configuration\r
-                                   (DHCP, BOOTP,RARP, etc.) hasn¡¯t finished yet.\r
-  @retval  EFI_NOT_FOUND           The asynchronous I/O request isn¡¯t found in the \r
+                                   (DHCP, BOOTP,RARP, etc.) hasn\92t finished yet.\r
+  @retval  EFI_NOT_FOUND           The asynchronous I/O request isn\92t found in the \r
                                    transmission or receive queue. It has either \r
-                                   completed or wasn¡¯t issued by Transmit() and Receive().\r
+                                   completed or wasn\92t issued by Transmit() and Receive().\r
   @retval  EFI_UNSUPPORTED         The operation is not supported in current\r
                                    implementation.\r
-\r
+  \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
index ca65f3e7568cc222ebef83114f27adff1b45bc65..6d7117a164e586c146ca32d454ca61837fa45b2f 100644 (file)
@@ -57,8 +57,6 @@ CHAR16   *mTcpStateName[] = {
 \r
   @param  Tcb                   Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 TcpInitTcbLocal (\r
@@ -85,7 +83,7 @@ TcpInitTcbLocal (
   Tcb->RcvWnd = GET_RCV_BUFFSIZE (Tcb->Sk);\r
 \r
   //\r
-  // Fisrt window size is never scaled\r
+  // First window size is never scaled\r
   //\r
   Tcb->RcvWndScale = 0;\r
 }\r
@@ -99,8 +97,6 @@ TcpInitTcbLocal (
                                 intial info.\r
   @param  Opt                   Pointer to the options announced by the peer.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 TcpInitTcbPeer (\r
@@ -183,7 +179,8 @@ TcpInitTcbPeer (
   @param  Local                 Pointer to the local (IP, Port).\r
   @param  Remote                Pointer to the remote (IP, Port).\r
 \r
-  @return Pointer to the TCP_CB with the least number of wildcard, if NULL no match is found.\r
+  @return  Pointer to the TCP_CB with the least number of wildcard, \r
+           if NULL no match is found.\r
 \r
 **/\r
 TCP_CB *\r
@@ -206,8 +203,7 @@ TcpLocateListenTcb (
 \r
     if ((Local->Port != Node->LocalEnd.Port) ||\r
         !TCP_PEER_MATCH (Remote, &Node->RemoteEnd) ||\r
-        !TCP_PEER_MATCH (Local, &Node->LocalEnd)\r
-          ) {\r
+        !TCP_PEER_MATCH (Local, &Node->LocalEnd)) {\r
 \r
       continue;\r
     }\r
@@ -248,7 +244,7 @@ TcpLocateListenTcb (
   @param  Addr                  Pointer to the IP address needs to match.\r
   @param  Port                  The port number needs to match.\r
 \r
-  @return The Tcb which matches the <Addr Port> paire exists or not.\r
+  @return  The Tcb which matches the <Addr Port> paire exists or not.\r
 \r
 **/\r
 BOOLEAN\r
@@ -299,7 +295,7 @@ TcpFindTcbByPeer (
   @param  Syn                   Whether to search the listen sockets, if TRUE, the\r
                                 listen sockets are searched.\r
 \r
-  @return Pointer to the related TCP_CB, if NULL no match is found.\r
+  @return  Pointer to the related TCP_CB, if NULL no match is found.\r
 \r
 **/\r
 TCP_CB *\r
@@ -369,13 +365,11 @@ TcpInsertTcb (
   TCP4_PROTO_DATA  *TcpProto;\r
 \r
   ASSERT (\r
-    Tcb &&\r
-    (\r
-    (Tcb->State == TCP_LISTEN) ||\r
-    (Tcb->State == TCP_SYN_SENT) ||\r
-    (Tcb->State == TCP_SYN_RCVD) ||\r
-    (Tcb->State == TCP_CLOSED)\r
-    )\r
+    (Tcb != NULL) &&\r
+    ((Tcb->State == TCP_LISTEN) ||\r
+     (Tcb->State == TCP_SYN_SENT) ||\r
+     (Tcb->State == TCP_SYN_RCVD) ||\r
+     (Tcb->State == TCP_CLOSED))\r
     );\r
 \r
   if (Tcb->LocalEnd.Port == 0) {\r
@@ -415,7 +409,7 @@ TcpInsertTcb (
 \r
   @param  Tcb                   Pointer to the TCP_CB to be cloned.\r
 \r
-  @return Pointer to the new cloned TCP_CB, if NULL error condition occurred.\r
+  @return  Pointer to the new cloned TCP_CB, if NULL error condition occurred.\r
 \r
 **/\r
 TCP_CB *\r
@@ -459,9 +453,7 @@ TcpCloneTcb (
 /**\r
   Compute an ISS to be used by a new connection.\r
 \r
-  None\r
-\r
-  @return The result ISS.\r
+  @return  The result ISS.\r
 \r
 **/\r
 TCP_SEQNO\r
@@ -479,7 +471,7 @@ TcpGetIss (
 \r
   @param  Sock        Pointer to the socket to get mss\r
 \r
-  @return The mss size.\r
+  @return  The mss size.\r
 \r
 **/\r
 UINT16\r
@@ -491,11 +483,11 @@ TcpGetRcvMss (
   TCP4_PROTO_DATA         *TcpProto;\r
   EFI_IP4_PROTOCOL        *Ip;\r
 \r
-  ASSERT (Sock);\r
+  ASSERT (Sock != NULL);\r
 \r
   TcpProto = (TCP4_PROTO_DATA *) Sock->ProtoReserved;\r
   Ip       = TcpProto->TcpService->IpIo->Ip;\r
-  ASSERT (Ip);\r
+  ASSERT (Ip != NULL);\r
 \r
   Ip->GetModeData (Ip, NULL, NULL, &SnpMode);\r
 \r
@@ -509,8 +501,6 @@ TcpGetRcvMss (
   @param  Tcb                   Pointer to the TCP_CB of this TCP instance.\r
   @param  State                 The state to be set.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 TcpSetState (\r
@@ -560,7 +550,7 @@ TcpSetState (
   @param  HeadSum               The checksum value of the fixed part of pseudo\r
                                 header.\r
 \r
-  @return The checksum value.\r
+  @return  The checksum value.\r
 \r
 **/\r
 UINT16\r
@@ -574,10 +564,10 @@ TcpChecksum (
   Checksum  = NetbufChecksum (Nbuf);\r
   Checksum  = NetAddChecksum (Checksum, HeadSum);\r
 \r
-  Checksum = NetAddChecksum (\r
-              Checksum,\r
-              HTONS ((UINT16) Nbuf->TotalSize)\r
-              );\r
+  Checksum  = NetAddChecksum (\r
+                Checksum,\r
+                HTONS ((UINT16) Nbuf->TotalSize)\r
+                );\r
 \r
   return (UINT16) ~Checksum;\r
 }\r
@@ -590,7 +580,7 @@ TcpChecksum (
   @param  Tcb                   Pointer to the TCP_CB of this TCP instance.\r
   @param  Nbuf                  Pointer to the buffer contains the TCP segment.\r
 \r
-  @return Pointer to the TCP_SEG that contains the translated TCP head information.\r
+  @return  Pointer to the TCP_SEG that contains the translated TCP head information.\r
 \r
 **/\r
 TCP_SEG *\r
@@ -639,8 +629,6 @@ TcpFormatNetbuf (
   @param  Tcb                   Pointer to the TCP_CB of the connection to be\r
                                 reset.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 TcpResetConnection (\r
@@ -685,13 +673,11 @@ TcpResetConnection (
 \r
 \r
 /**\r
-  Initialize an active connection,\r
+  Initialize an active connection.\r
 \r
   @param  Tcb                   Pointer to the TCP_CB that wants to initiate a\r
                                 connection.\r
 \r
-  @return None\r
-\r
 **/\r
 VOID\r
 TcpOnAppConnect (\r
@@ -712,17 +698,15 @@ TcpOnAppConnect (
 \r
   @param  Tcb                   Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpOnAppClose (\r
   IN TCP_CB *Tcb\r
   )\r
 {\r
-  ASSERT (Tcb);\r
+  ASSERT (Tcb != NULL);\r
 \r
-  if (!IsListEmpty (&Tcb->RcvQue) || GET_RCV_DATASIZE (Tcb->Sk)) {\r
+  if (!IsListEmpty (&Tcb->RcvQue) || GET_RCV_DATASIZE (Tcb->Sk) != 0) {\r
 \r
     DEBUG ((EFI_D_WARN, "TcpOnAppClose: connection reset "\r
       "because data is lost for TCB %p\n", Tcb));\r
@@ -754,8 +738,7 @@ TcpOnAppClose (
 \r
 \r
 /**\r
-  Check whether the application's newly delivered data\r
-  can be sent out.\r
+  Check whether the application's newly delivered data can be sent out.\r
 \r
   @param  Tcb                   Pointer to the TCP_CB of this TCP instance.\r
 \r
@@ -810,7 +793,6 @@ TcpOnAppSend (
 \r
   @param  Tcb                   Pointer to the TCP_CB of this TCP instance.\r
 \r
-\r
 **/\r
 INTN\r
 TcpOnAppConsume (\r
@@ -877,8 +859,6 @@ TcpOnAppConsume (
 \r
   @param  Tcb                   Pointer to the TCP_CB of the TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpOnAppAbort (\r
@@ -905,7 +885,7 @@ TcpOnAppAbort (
 /**\r
   Set the Tdp4 variable data.\r
 \r
-  @param  Tcp4Service           Tcp4 service data.\r
+  @param  Tcp4Service           Pointer to Tcp4 service data.\r
 \r
   @retval EFI_OUT_OF_RESOURCES  There are not enough resources to set the variable.\r
   @retval other                 Set variable failed.\r
@@ -1078,9 +1058,7 @@ ON_ERROR:
 /**\r
   Clear the variable and free the resource.\r
 \r
-  @param  Tcp4Service           Tcp4 service data.\r
-\r
-  @return None.\r
+  @param  Tcp4Service           Pointer to Tcp4 service data.\r
 \r
 **/\r
 VOID\r
@@ -1102,26 +1080,19 @@ TcpClearVariableData (
   Tcp4Service->MacString = NULL;\r
 }\r
 \r
-EFI_STATUS\r
-TcpInstallDevicePath (\r
-  IN SOCKET *Sock\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Install the device path protocol on the TCP instance.\r
 \r
-Arguments:\r
-\r
-  Sock - Pointer to the socket representing the TCP instance.\r
+  @param  Sock             Pointer to the socket representing the TCP instance.\r
 \r
-Returns:\r
+  @retval  EFI_SUCCESS     The device path protocol is installed.\r
+  @retval  other           Failed to install the device path protocol.\r
 \r
-  EFI_SUCCESS - The device path protocol is installed.\r
-  other       - Failed to install the device path protocol.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+TcpInstallDevicePath (\r
+  IN SOCKET *Sock\r
+  )\r
 {\r
   TCP4_PROTO_DATA    *TcpProto;\r
   TCP4_SERVICE_DATA  *TcpService;\r
@@ -1145,9 +1116,9 @@ Returns:
     );\r
 \r
   Sock->DevicePath = AppendDevicePathNode (\r
-                     Sock->ParentDevicePath,\r
-                     (EFI_DEVICE_PATH_PROTOCOL *) &Ip4DPathNode\r
-                     );\r
+                       Sock->ParentDevicePath,\r
+                       (EFI_DEVICE_PATH_PROTOCOL *) &Ip4DPathNode\r
+                       );\r
   if (Sock->DevicePath == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
index 95f5a8e44a754655d098607a23898f36f59339e8..35e858fb9a879ae7a61b94347832b439a9ce70a0 100644 (file)
@@ -22,6 +22,14 @@ Abstract:
 \r
 #include "Tcp4Main.h"\r
 \r
+/**\r
+    Get a UINT16 value from buffer.\r
+    \r
+    @param Buf                  Pointer to input buffer.\r
+    \r
+    @return                     The UINT16 value get from buffer.\r
+\r
+**/\r
 UINT16\r
 TcpGetUint16 (\r
   IN UINT8 *Buf\r
@@ -32,17 +40,14 @@ TcpGetUint16 (
   return NTOHS (Value);\r
 }\r
 \r
-// STATIC\r
-// VOID\r
-// TcpPutUint16 (\r
-//   IN UINT8  *Buf,\r
-//   IN UINT16 Data\r
-//   )\r
-// {\r
-//   Data = HTONS (Data);\r
-//   CopyMem (Buf, &Data, sizeof (UINT16));\r
-// }\r
+/**\r
+    Get a UINT32 value from buffer.\r
+    \r
+    @param Buf                  Pointer to input buffer.\r
+    \r
+    @return                     The UINT32 value get from buffer.\r
 \r
+**/\r
 UINT32\r
 TcpGetUint32 (\r
   IN UINT8 *Buf\r
@@ -53,6 +58,13 @@ TcpGetUint32 (
   return NTOHL (Value);\r
 }\r
 \r
+/**\r
+    Put a UINT32 value in buffer.\r
+    \r
+    @param Buf                  Pointer to the buffer.\r
+    @param Data                 The UINT32 Date to put in buffer \r
+\r
+**/\r
 VOID\r
 TcpPutUint32 (\r
   IN UINT8  *Buf,\r
@@ -65,12 +77,11 @@ TcpPutUint32 (
 \r
 \r
 /**\r
-  Compute the window scale value according to the given\r
-  buffer size.\r
+  Compute the window scale value according to the given buffer size.\r
 \r
   @param  Tcb     Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @retval UINT8   The scale value.\r
+  @return         The scale value.\r
 \r
 **/\r
 UINT8\r
@@ -81,7 +92,7 @@ TcpComputeScale (
   UINT8   Scale;\r
   UINT32  BufSize;\r
 \r
-  ASSERT (Tcb && Tcb->Sk);\r
+  ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL));\r
 \r
   BufSize = GET_RCV_BUFFSIZE (Tcb->Sk);\r
 \r
@@ -102,7 +113,7 @@ TcpComputeScale (
   @param  Tcb     Pointer to the TCP_CB of this TCP instance.\r
   @param  Nbuf    Pointer to the buffer to store the options.\r
 \r
-  @return The total length of the TCP option field.\r
+  @return         The total length of the TCP option field.\r
 \r
 **/\r
 UINT16\r
@@ -114,7 +125,7 @@ TcpSynBuildOption (
   UINT8   *Data;\r
   UINT16  Len;\r
 \r
-  ASSERT (Tcb && Nbuf && !Nbuf->Tcp);\r
+  ASSERT ((Tcb != NULL) && (Nbuf != NULL) && (Nbuf->Tcp == NULL));\r
 \r
   Len = 0;\r
 \r
@@ -125,7 +136,7 @@ TcpSynBuildOption (
   //\r
   if (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS) &&\r
       (!TCP_FLG_ON (TCPSEG_NETBUF (Nbuf)->Flag, TCP_FLG_ACK) ||\r
-      TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_TS))) {\r
+        TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_TS))) {\r
 \r
     Data = NetbufAllocSpace (\r
             Nbuf,\r
@@ -133,7 +144,7 @@ TcpSynBuildOption (
             NET_BUF_HEAD\r
             );\r
 \r
-    ASSERT (Data);\r
+    ASSERT (Data != NULL);\r
     Len += TCP_OPTION_TS_ALIGNED_LEN;\r
 \r
     TcpPutUint32 (Data, TCP_OPTION_TS_FAST);\r
@@ -148,7 +159,7 @@ TcpSynBuildOption (
   //\r
   if (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS) &&\r
       (!TCP_FLG_ON (TCPSEG_NETBUF (Nbuf)->Flag, TCP_FLG_ACK) ||\r
-      TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_WS))) {\r
+        TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_WS))) {\r
 \r
     Data = NetbufAllocSpace (\r
             Nbuf,\r
@@ -156,7 +167,7 @@ TcpSynBuildOption (
             NET_BUF_HEAD\r
             );\r
 \r
-    ASSERT (Data);\r
+    ASSERT (Data != NULL);\r
 \r
     Len += TCP_OPTION_WS_ALIGNED_LEN;\r
     TcpPutUint32 (Data, TCP_OPTION_WS_FAST | TcpComputeScale (Tcb));\r
@@ -166,7 +177,7 @@ TcpSynBuildOption (
   // Build MSS option\r
   //\r
   Data = NetbufAllocSpace (Nbuf, TCP_OPTION_MSS_LEN, 1);\r
-  ASSERT (Data);\r
+  ASSERT (Data != NULL);\r
 \r
   Len += TCP_OPTION_MSS_LEN;\r
   TcpPutUint32 (Data, TCP_OPTION_MSS_FAST | Tcb->RcvMss);\r
@@ -181,7 +192,7 @@ TcpSynBuildOption (
   @param  Tcb     Pointer to the TCP_CB of this TCP instance.\r
   @param  Nbuf    Pointer to the buffer to store the options.\r
 \r
-  @return The total length of the TCP option field.\r
+  @return         The total length of the TCP option field.\r
 \r
 **/\r
 UINT16\r
@@ -193,7 +204,7 @@ TcpBuildOption (
   UINT8   *Data;\r
   UINT16  Len;\r
 \r
-  ASSERT (Tcb && Nbuf && !Nbuf->Tcp);\r
+  ASSERT ((Tcb != NULL) && (Nbuf != NULL) && (Nbuf->Tcp == NULL));\r
   Len = 0;\r
 \r
   //\r
@@ -208,7 +219,7 @@ TcpBuildOption (
             NET_BUF_HEAD\r
             );\r
 \r
-    ASSERT (Data);\r
+    ASSERT (Data != NULL);\r
     Len += TCP_OPTION_TS_ALIGNED_LEN;\r
 \r
     TcpPutUint32 (Data, TCP_OPTION_TS_FAST);\r
@@ -243,7 +254,7 @@ TcpParseOption (
   UINT8 Type;\r
   UINT8 Len;\r
 \r
-  ASSERT (Tcp && Option);\r
+  ASSERT ((Tcp != NULL) && (Option != NULL));\r
 \r
   Option->Flag  = 0;\r
 \r
@@ -333,7 +344,7 @@ TcpParseOption (
     default:\r
       Len = Head[Cur + 1];\r
 \r
-      if (TotalLen - Cur < Len || Len < 2) {\r
+      if ((TotalLen - Cur) < Len || Len < 2) {\r
         return -1;\r
       }\r
 \r
index 39fbc3b73562c032a075986102dbee4c38fe7b03..187fd955a9bcc623618b3efc5d75701fd61994e9 100644 (file)
@@ -85,7 +85,7 @@ TcpRcvWinNow (
   UINT32  OldWin;\r
 \r
   Sk = Tcb->Sk;\r
-  ASSERT (Sk);\r
+  ASSERT (Sk != NULL);\r
 \r
   OldWin    = TcpRcvWinOld (Tcb);\r
 \r
@@ -199,7 +199,7 @@ TcpDataToSend (
   UINT32  Limit;\r
 \r
   Sk = Tcb->Sk;\r
-  ASSERT (Sk);\r
+  ASSERT (Sk != NULL);\r
 \r
   //\r
   // TCP should NOT send data beyond the send window\r
@@ -284,8 +284,7 @@ SetPersistTimer:
 \r
 \r
 /**\r
-  Build the TCP header of the TCP segment and transmit the\r
-  segment by IP.\r
+  Build the TCP header of the TCP segment and transmit the segment by IP.\r
 \r
   @param  Tcb     Pointer to the TCP_CB of this TCP instance.\r
   @param  Nbuf    Pointer to the buffer containing the segment to be sent out.\r
@@ -306,7 +305,7 @@ TcpTransmitSegment (
   BOOLEAN   Syn;\r
   UINT32    DataLen;\r
 \r
-  ASSERT (Nbuf && (Nbuf->Tcp == NULL) && TcpVerifySegment (Nbuf));\r
+  ASSERT ((Nbuf != NULL) && (Nbuf->Tcp == NULL) && (TcpVerifySegment (Nbuf) != 0));\r
 \r
   DataLen = Nbuf->TotalSize;\r
 \r
@@ -435,7 +434,7 @@ TcpGetSegmentSndQue (
   INT32           Offset;\r
   INT32           CopyLen;\r
 \r
-  ASSERT (Tcb && TCP_SEQ_LEQ (Seq, Tcb->SndNxt) && (Len > 0));\r
+  ASSERT ((Tcb != NULL) && TCP_SEQ_LEQ (Seq, Tcb->SndNxt) && (Len > 0));\r
 \r
   //\r
   // Find the segment that contains the Seq.\r
@@ -530,7 +529,7 @@ TcpGetSegmentSndQue (
   //\r
   if (CopyLen != 0) {\r
     Data = NetbufAllocSpace (Nbuf, CopyLen, NET_BUF_TAIL);\r
-    ASSERT (Data);\r
+    ASSERT (Data != NULL);\r
 \r
     if ((INT32) NetbufCopy (Node, Offset, CopyLen, Data) != CopyLen) {\r
       goto OnError;\r
@@ -572,7 +571,7 @@ TcpGetSegmentSock (
   UINT8   *Data;\r
   UINT32  DataGet;\r
 \r
-  ASSERT (Tcb && Tcb->Sk);\r
+  ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL));\r
 \r
   Nbuf = NetbufAlloc (Len + TCP_MAX_HEAD);\r
 \r
@@ -592,7 +591,7 @@ TcpGetSegmentSock (
     // copy data to the segment.\r
     //\r
     Data = NetbufAllocSpace (Nbuf, Len, NET_BUF_TAIL);\r
-    ASSERT (Data);\r
+    ASSERT (Data != NULL);\r
 \r
     DataGet = SockGetDataToSend (Tcb->Sk, 0, Len, Data);\r
   }\r
@@ -633,7 +632,7 @@ TcpGetSegment (
 {\r
   NET_BUF *Nbuf;\r
 \r
-  ASSERT (Tcb);\r
+  ASSERT (Tcb != NULL);\r
 \r
   //\r
   // Compare the SndNxt with the max sequence number sent.\r
@@ -646,7 +645,7 @@ TcpGetSegment (
     Nbuf = TcpGetSegmentSock (Tcb, Seq, Len);\r
   }\r
 \r
-  ASSERT (TcpVerifySegment (Nbuf));\r
+  ASSERT (TcpVerifySegment (Nbuf) != 0);\r
   return Nbuf;\r
 }\r
 \r
@@ -692,7 +691,7 @@ TcpRetransmit (
     return -1;\r
   }\r
 \r
-  ASSERT (TcpVerifySegment (Nbuf));\r
+  ASSERT (TcpVerifySegment (Nbuf) != 0);\r
 \r
   if (TcpTransmitSegment (Tcb, Nbuf) != 0) {\r
     goto OnError;\r
@@ -703,7 +702,7 @@ TcpRetransmit (
   // trim TCP head because all the buffer on SndQue\r
   // are headless.\r
   //\r
-  ASSERT (Nbuf->Tcp);\r
+  ASSERT (Nbuf->Tcp != NULL);\r
   NetbufTrim (Nbuf, (Nbuf->Tcp->HeadLen << 2), NET_BUF_HEAD);\r
   Nbuf->Tcp = NULL;\r
 \r
@@ -743,7 +742,7 @@ TcpToSendData (
   TCP_SEQNO Seq;\r
   TCP_SEQNO End;\r
 \r
-  ASSERT (Tcb && Tcb->Sk && (Tcb->State != TCP_LISTEN));\r
+  ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL) && (Tcb->State != TCP_LISTEN));\r
 \r
   Sent = 0;\r
 \r
@@ -807,8 +806,7 @@ SEND_AGAIN:
     //\r
     if ((TcpGetMaxSndNxt (Tcb) == Tcb->SndNxt) &&\r
         (GET_SND_DATASIZE (Tcb->Sk) == 0) &&\r
-        TCP_SEQ_LT (End + 1, Tcb->SndWnd + Tcb->SndWl2)\r
-          ) {\r
+        TCP_SEQ_LT (End + 1, Tcb->SndWnd + Tcb->SndWl2)) {\r
 \r
       DEBUG ((EFI_D_INFO, "TcpToSendData: send FIN "\r
         "to peer for TCB %p in state %d\n", Tcb, Tcb->State));\r
@@ -823,8 +821,8 @@ SEND_AGAIN:
   Seg->End  = End;\r
   Seg->Flag = Flag;\r
 \r
-  ASSERT (TcpVerifySegment (Nbuf));\r
-  ASSERT (TcpCheckSndQue (&Tcb->SndQue));\r
+  ASSERT (TcpVerifySegment (Nbuf) != 0);\r
+  ASSERT (TcpCheckSndQue (&Tcb->SndQue) != 0);\r
 \r
   //\r
   // don't send an empty segment here.\r
@@ -856,7 +854,7 @@ SEND_AGAIN:
   //\r
   // All the buffer in the SndQue is headless\r
   //\r
-  ASSERT (Nbuf->Tcp);\r
+  ASSERT (Nbuf->Tcp != NULL);\r
 \r
   NetbufTrim (Nbuf, (Nbuf->Tcp->HeadLen << 2), NET_BUF_HEAD);\r
   Nbuf->Tcp = NULL;\r
@@ -915,8 +913,6 @@ OnError:
 \r
   @param  Tcb     Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpSendAck (\r
@@ -949,8 +945,7 @@ TcpSendAck (
 \r
 \r
 /**\r
-  Send a zero probe segment. It can be used by keepalive\r
-  and zero window probe.\r
+  Send a zero probe segment. It can be used by keepalive and zero window probe.\r
 \r
   @param  Tcb     Pointer to the TCP_CB of this TCP instance.\r
 \r
@@ -996,8 +991,6 @@ TcpSendZeroProbe (
 \r
   @param  Tcb     Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpToSendAck (\r
@@ -1015,8 +1008,7 @@ TcpToSendAck (
   //\r
   if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW) ||\r
       (Tcb->DelayedAck >= 1) ||\r
-      (TcpNow > TcpRcvWinOld (Tcb))\r
-      ) {\r
+      (TcpNow > TcpRcvWinOld (Tcb))) {\r
     TcpSendAck (Tcb);\r
     return;\r
   }\r
@@ -1060,7 +1052,7 @@ TcpSendReset (
   //\r
   // Don't respond to a Reset with reset\r
   //\r
-  if (Head->Flag & TCP_FLG_RST) {\r
+  if ((Head->Flag & TCP_FLG_RST) != 0) {\r
     return 0;\r
   }\r
 \r
index 3c02c53912d19a56b404981d5a049064a2e812b2..65c98de048fff4379efe92a91def6874dc4d3402 100644 (file)
@@ -24,31 +24,67 @@ Abstract:
 \r
 UINT32    mTcpTick = 1000;\r
 \r
+/**\r
+  Connect timeout handler.\r
+\r
+  @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
 VOID\r
 TcpConnectTimeout (\r
   IN TCP_CB *Tcb\r
   );\r
 \r
+/**\r
+  Timeout handler for TCP retransmission timer.\r
+\r
+  @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
 VOID\r
 TcpRexmitTimeout (\r
   IN TCP_CB *Tcb\r
   );\r
+  \r
+/**\r
+  Timeout handler for window probe timer.\r
 \r
+  @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
 VOID\r
 TcpProbeTimeout (\r
   IN TCP_CB *Tcb\r
   );\r
 \r
+/**\r
+  Timeout handler for keepalive timer.\r
+\r
+  @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
 VOID\r
 TcpKeepaliveTimeout (\r
   IN TCP_CB *Tcb\r
   );\r
 \r
+/**\r
+  Timeout handler for FIN_WAIT_2 timer.\r
+\r
+  @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
 VOID\r
 TcpFinwait2Timeout (\r
   IN TCP_CB *Tcb\r
   );\r
 \r
+/**\r
+  Timeout handler for 2MSL timer.\r
+\r
+  @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
 VOID\r
 Tcp2MSLTimeout (\r
   IN TCP_CB *Tcb\r
@@ -63,14 +99,11 @@ TCP_TIMER_HANDLER mTcpTimerHandler[TCP_TIMER_NUMBER] = {
   Tcp2MSLTimeout,\r
 };\r
 \r
-\r
 /**\r
   Close the TCP connection.\r
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpClose (\r
@@ -89,8 +122,6 @@ TcpClose (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpConnectTimeout (\r
@@ -123,8 +154,6 @@ TcpConnectTimeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpRexmitTimeout (\r
@@ -148,7 +177,7 @@ TcpRexmitTimeout (
   Tcb->LossRecover  = Tcb->SndNxt;\r
 \r
   Tcb->LossTimes++;\r
-  if (Tcb->LossTimes > Tcb->MaxRexmit &&\r
+  if ((Tcb->LossTimes > Tcb->MaxRexmit) &&\r
       !TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_CONNECT)) {\r
 \r
     DEBUG ((EFI_D_ERROR, "TcpRexmitTimeout: connection closed "\r
@@ -167,7 +196,6 @@ TcpRexmitTimeout (
   TcpSetTimer (Tcb, TCP_TIMER_REXMIT, Tcb->Rto);\r
 \r
   Tcb->CongestState = TCP_CONGEST_LOSS;\r
-\r
   TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_RTT_ON);\r
 }\r
 \r
@@ -177,8 +205,6 @@ TcpRexmitTimeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpProbeTimeout (\r
@@ -207,8 +233,6 @@ TcpProbeTimeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpKeepaliveTimeout (\r
@@ -240,8 +264,6 @@ TcpKeepaliveTimeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpFinwait2Timeout (\r
@@ -260,8 +282,6 @@ TcpFinwait2Timeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 Tcp2MSLTimeout (\r
@@ -276,14 +296,11 @@ Tcp2MSLTimeout (
 \r
 \r
 /**\r
-  Update the timer status and the next expire time\r
-  according to the timers to expire in a specific\r
-  future time slot.\r
+  Update the timer status and the next expire time according to the timers \r
+  to expire in a specific future time slot.\r
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpUpdateTimer (\r
@@ -318,8 +335,6 @@ TcpUpdateTimer (
   @param  Timer    The index of the timer to be enabled.\r
   @param  TimeOut  The timeout value of this timer.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpSetTimer (\r
@@ -341,8 +356,6 @@ TcpSetTimer (
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
   @param  Timer    The index of the timer to be cleared.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpClearTimer (\r
@@ -360,8 +373,6 @@ TcpClearTimer (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpClearAllTimer (\r
@@ -378,8 +389,6 @@ TcpClearAllTimer (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpSetProbeTimer (\r
@@ -410,8 +419,6 @@ TcpSetProbeTimer (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpSetKeepaliveTimer (\r
@@ -448,8 +455,6 @@ TcpSetKeepaliveTimer (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 TcpBackoffRto (\r
@@ -481,9 +486,7 @@ TcpBackoffRto (
 /**\r
   Heart beat timer handler.\r
 \r
-  @param  Context  Context of the timer event, ignored.\r
-\r
-  @return None.\r
+  @param  Context        Context of the timer event, ignored.\r
 \r
 **/\r
 VOID\r
@@ -572,8 +575,6 @@ NextConnection:
   @param  Event    Timer event signaled, ignored.\r
   @param  Context  Context of the timer event, ignored.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 EFIAPI\r