]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Timer.c
Fixing function headers.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Timer.c
index 7802ba0119bbb33497d52c501c905f38918d2b62..945a5cac22f00a317fecb3c76ad5b13b58e54395 100644 (file)
@@ -1,60 +1,82 @@
 /** @file\r
-\r
-Copyright (c) 2005 - 2007, Intel Corporation\r
+  TCP timer related functions.\r
+    \r
+Copyright (c) 2005 - 2007, 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
-  Tcp4Timer.c\r
-\r
-Abstract:\r
-\r
-  TCP timer related functions.\r
-\r
-\r
 **/\r
 \r
 #include "Tcp4Main.h"\r
 \r
 UINT32    mTcpTick = 1000;\r
 \r
-STATIC\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
-STATIC\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
-STATIC\r
+**/\r
 VOID\r
 TcpProbeTimeout (\r
   IN TCP_CB *Tcb\r
   );\r
 \r
-STATIC\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
-STATIC\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
-STATIC\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
@@ -69,14 +91,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
@@ -95,26 +114,23 @@ TcpClose (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
-STATIC\r
 VOID\r
 TcpConnectTimeout (\r
   IN TCP_CB *Tcb\r
   )\r
 {\r
   if (!TCP_CONNECTED (Tcb->State)) {\r
-    TCP4_DEBUG_ERROR (("TcpConnectTimeout: connection closed "\r
-      "because conenction timer timeout for TCB %x\n", Tcb));\r
+    DEBUG ((EFI_D_ERROR, "TcpConnectTimeout: connection closed "\r
+      "because conenction timer timeout for TCB %p\n", Tcb));\r
 \r
     if (EFI_ABORTED == Tcb->Sk->SockError) {\r
       SOCK_ERROR (Tcb->Sk, EFI_TIMEOUT);\r
     }\r
 \r
     if (TCP_SYN_RCVD == Tcb->State) {\r
-      TCP4_DEBUG_WARN (("TcpConnectTimeout: send reset because "\r
-        "connection timer timeout for TCB %x\n", Tcb));\r
+      DEBUG ((EFI_D_WARN, "TcpConnectTimeout: send reset because "\r
+        "connection timer timeout for TCB %p\n", Tcb));\r
 \r
       TcpResetConnection (Tcb);\r
 \r
@@ -130,10 +146,7 @@ TcpConnectTimeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
-STATIC\r
 VOID\r
 TcpRexmitTimeout (\r
   IN TCP_CB *Tcb\r
@@ -141,8 +154,8 @@ TcpRexmitTimeout (
 {\r
   UINT32  FlightSize;\r
 \r
-  TCP4_DEBUG_WARN (("TcpRexmitTimeout: transmission "\r
-    "timeout for TCB %x\n", Tcb));\r
+  DEBUG ((EFI_D_WARN, "TcpRexmitTimeout: transmission "\r
+    "timeout for TCB %p\n", Tcb));\r
 \r
   //\r
   // Set the congestion window. FlightSize is the\r
@@ -156,11 +169,11 @@ 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
-    TCP4_DEBUG_ERROR (("TcpRexmitTimeout: connection closed "\r
-      "because too many timeouts for TCB %x\n", Tcb));\r
+    DEBUG ((EFI_D_ERROR, "TcpRexmitTimeout: connection closed "\r
+      "because too many timeouts for TCB %p\n", Tcb));\r
 \r
     if (EFI_ABORTED == Tcb->Sk->SockError) {\r
       SOCK_ERROR (Tcb->Sk, EFI_TIMEOUT);\r
@@ -175,7 +188,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
@@ -185,10 +197,7 @@ TcpRexmitTimeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
-STATIC\r
 VOID\r
 TcpProbeTimeout (\r
   IN TCP_CB *Tcb\r
@@ -202,7 +211,7 @@ TcpProbeTimeout (
   //\r
   if ((TcpDataToSend (Tcb, 1) != 0) && (TcpToSendData (Tcb, 1) > 0)) {\r
 \r
-    ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT));\r
+    ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT) != 0);\r
     return ;\r
   }\r
 \r
@@ -216,10 +225,7 @@ TcpProbeTimeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
-STATIC\r
 VOID\r
 TcpKeepaliveTimeout (\r
   IN TCP_CB *Tcb\r
@@ -250,17 +256,14 @@ TcpKeepaliveTimeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
-STATIC\r
 VOID\r
 TcpFinwait2Timeout (\r
   IN TCP_CB *Tcb\r
   )\r
 {\r
-  TCP4_DEBUG_WARN (("TcpFinwait2Timeout: connection closed "\r
-    "because FIN_WAIT2 timer timeouts for TCB %x\n", Tcb));\r
+  DEBUG ((EFI_D_WARN, "TcpFinwait2Timeout: connection closed "\r
+    "because FIN_WAIT2 timer timeouts for TCB %p\n", Tcb));\r
 \r
   TcpClose (Tcb);\r
 }\r
@@ -271,33 +274,26 @@ TcpFinwait2Timeout (
 \r
   @param  Tcb      Pointer to the TCP_CB of this TCP instance.\r
 \r
-  @return None.\r
-\r
 **/\r
-STATIC\r
 VOID\r
 Tcp2MSLTimeout (\r
   IN TCP_CB *Tcb\r
   )\r
 {\r
-  TCP4_DEBUG_WARN (("Tcp2MSLTimeout: connection closed "\r
-    "because TIME_WAIT timer timeouts for TCB %x\n", Tcb));\r
+  DEBUG ((EFI_D_WARN, "Tcp2MSLTimeout: connection closed "\r
+    "because TIME_WAIT timer timeouts for TCB %p\n", Tcb));\r
 \r
   TcpClose (Tcb);\r
 }\r
 \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
-STATIC\r
 VOID\r
 TcpUpdateTimer (\r
   IN TCP_CB *Tcb\r
@@ -331,8 +327,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
@@ -354,8 +348,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
@@ -373,8 +365,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
@@ -391,8 +381,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
@@ -423,8 +411,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
@@ -461,8 +447,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
@@ -474,7 +458,7 @@ TcpBackoffRto (
   // may be wrong, fold it. So the next time a valid\r
   // measurement is sampled, we can start fresh.\r
   //\r
-  if ((Tcb->LossTimes >= TCP_FOLD_RTT) && Tcb->SRtt) {\r
+  if ((Tcb->LossTimes >= TCP_FOLD_RTT) && (Tcb->SRtt != 0)) {\r
     Tcb->RttVar += Tcb->SRtt >> 2;\r
     Tcb->SRtt = 0;\r
   }\r
@@ -494,9 +478,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
@@ -505,8 +487,8 @@ TcpTickingDpc (
   IN VOID      *Context\r
   )\r
 {\r
-  NET_LIST_ENTRY  *Entry;\r
-  NET_LIST_ENTRY  *Next;\r
+  LIST_ENTRY      *Entry;\r
+  LIST_ENTRY      *Next;\r
   TCP_CB          *Tcb;\r
   INT16           Index;\r
 \r
@@ -534,7 +516,7 @@ TcpTickingDpc (
 \r
     Tcb->Idle++;\r
 \r
-    if (Tcb->DelayedAck) {\r
+    if (Tcb->DelayedAck != 0) {\r
       TcpSendAck (Tcb);\r
     }\r
 \r
@@ -585,8 +567,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