]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
Add comments for functions and fix some coding style issue.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Input.c
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