#include <Protocol/ServiceBinding.h>\r
\r
\r
+/**\r
+ Free the socket resources\r
+\r
+ This releases the socket resources allocated by calling\r
+ EslServiceGetProtocol.\r
+\r
+ This routine is called from the ::close routine in BsdSocketLib\r
+ to release the socket resources.\r
+\r
+ @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL\r
+ structure\r
+\r
+ @return Value for ::errno, zero (0) indicates success.\r
+\r
+ **/\r
+int\r
+EslServiceFreeProtocol (\r
+ IN EFI_SOCKET_PROTOCOL * pSocketProtocol\r
+ )\r
+{\r
+ EFI_SERVICE_BINDING_PROTOCOL * pServiceBinding;\r
+ int RetVal;\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Assume success\r
+ //\r
+ RetVal = 0;\r
+\r
+ //\r
+ // Locate the socket protocol\r
+ //\r
+ Status = gBS->LocateProtocol ( &gEfiSocketServiceBindingProtocolGuid,\r
+ NULL,\r
+ (VOID **) &pServiceBinding );\r
+ if ( !EFI_ERROR ( Status )) {\r
+ //\r
+ // Release the handle\r
+ //\r
+ Status = pServiceBinding->DestroyChild ( pServiceBinding,\r
+ pSocketProtocol->SocketHandle );\r
+ }\r
+ if ( EFI_ERROR ( Status )) {\r
+ RetVal = EIO;\r
+ }\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
+\r
+\r
/**\r
Connect to the EFI socket library\r
\r