]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c
1. Add EFI_COMPONENT_NAME2_PROTOCOL.GetControllerName() support.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / SockInterface.c
index c0756954674acf868ce13c48243ff237a9866827..feed86c5903eef3e5e7ffb6238d331ea55bbb1d8 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
+  Interface function of the Socket.\r
 \r
-Copyright (c) 2005 - 2006, Intel Corporation<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>\r
+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<BR>\r
@@ -22,7 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @param  Event                The event to be checked.\r
 \r
   @retval  TRUE                The specific Event exists in the List. \r
-  @retval  False               The specific Event is not in the List.\r
+  @retval  FALSE               The specific Event is not in the List.\r
 \r
 **/\r
 BOOLEAN\r
@@ -57,7 +58,8 @@ SockTokenExistedInList (
   @param  Sock                 Pointer to the instance's socket.\r
   @param  Event                The event to be checked.\r
 \r
-  @return The specific Event exists in one of socket's lists or not.\r
+  @retval  TRUE                The Event exists in related socket's lists. \r
+  @retval  FALSE               The Event is not in related socket's lists.\r
 \r
 **/\r
 BOOLEAN\r
@@ -129,7 +131,7 @@ SockBufferToken (
 \r
 \r
 /**\r
-  Destory the socket Sock and its associated protocol control block.\r
+  Destroy the socket Sock and its associated protocol control block.\r
 \r
   @param  Sock                 The socket to be destroyed.\r
 \r
@@ -139,18 +141,18 @@ SockBufferToken (
 **/\r
 EFI_STATUS\r
 SockDestroyChild (\r
-  IN   SOCKET *Sock\r
+  IN SOCKET *Sock\r
   )\r
 {\r
   EFI_STATUS  Status;\r
 \r
   ASSERT ((Sock != NULL) && (Sock->ProtoHandler != NULL));\r
 \r
-  if (Sock->IsDestroyed) {\r
+  if (Sock->InDestroy) {\r
     return EFI_SUCCESS;\r
   }\r
 \r
-  Sock->IsDestroyed = TRUE;\r
+  Sock->InDestroy = TRUE;\r
 \r
   Status = EfiAcquireLockOrFail (&(Sock->Lock));\r
   if (EFI_ERROR (Status)) {\r
@@ -171,7 +173,7 @@ SockDestroyChild (
     DEBUG ((EFI_D_ERROR, "SockDestroyChild: Protocol detach socket"\r
       " failed with %r\n", Status));\r
 \r
-    Sock->IsDestroyed = FALSE;\r
+    Sock->InDestroy = FALSE;\r
   } else if (SOCK_IS_CONFIGURED (Sock)) {\r
 \r
     SockConnFlush (Sock);\r
@@ -235,6 +237,7 @@ SockCreateChild (
   // with a new protocol control block\r
   //\r
   Status = Sock->ProtoHandler (Sock, SOCK_ATTACH, NULL);\r
+  EfiReleaseLock (&(Sock->Lock));\r
   if (EFI_ERROR (Status)) {\r
 \r
     DEBUG ((EFI_D_ERROR, "SockCreateChild: Protocol failed to"\r
@@ -244,7 +247,6 @@ SockCreateChild (
     Sock = NULL;\r
   }\r
 \r
-  EfiReleaseLock (&(Sock->Lock));\r
   return Sock;\r
 }\r
 \r
@@ -395,7 +397,7 @@ SockAccept (
   SOCKET                *Socket;\r
   EFI_EVENT             Event;\r
 \r
-  ASSERT (SOCK_STREAM == Sock->Type);\r
+  ASSERT (SockStream == Sock->Type);\r
 \r
   Status = EfiAcquireLockOrFail (&(Sock->Lock));\r
   if (EFI_ERROR (Status)) {\r
@@ -508,7 +510,7 @@ SockSend (
   SOCK_TOKEN              *SockToken;\r
   UINT32                  DataLen;\r
 \r
-  ASSERT (SOCK_STREAM == Sock->Type);\r
+  ASSERT (SockStream == Sock->Type);\r
 \r
   Status = EfiAcquireLockOrFail (&(Sock->Lock));\r
   if (EFI_ERROR (Status)) {\r
@@ -591,7 +593,7 @@ SockSend (
         "Snd Data\n", Status));\r
 \r
       RemoveEntryList (&(SockToken->TokenList));\r
-      gBS->FreePool (SockToken);\r
+      FreePool (SockToken);\r
     }\r
   }\r
 \r
@@ -631,7 +633,7 @@ SockRcv (
   EFI_STATUS    Status;\r
   EFI_EVENT     Event;\r
 \r
-  ASSERT (SOCK_STREAM == Sock->Type);\r
+  ASSERT (SockStream == Sock->Type);\r
 \r
   Status = EfiAcquireLockOrFail (&(Sock->Lock));\r
   if (EFI_ERROR (Status)) {\r
@@ -731,7 +733,7 @@ SockFlush (
 {\r
   EFI_STATUS  Status;\r
 \r
-  ASSERT (SOCK_STREAM == Sock->Type);\r
+  ASSERT (SockStream == Sock->Type);\r
 \r
   Status = EfiAcquireLockOrFail (&(Sock->Lock));\r
   if (EFI_ERROR (Status)) {\r
@@ -796,7 +798,7 @@ SockClose (
   EFI_STATUS  Status;\r
   EFI_EVENT   Event;\r
 \r
-  ASSERT (SOCK_STREAM == Sock->Type);\r
+  ASSERT (SockStream == Sock->Type);\r
 \r
   Status = EfiAcquireLockOrFail (&(Sock->Lock));\r
   if (EFI_ERROR (Status)) {\r