]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/EfiSocketLib/Init.c
StdLib: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / StdLib / EfiSocketLib / Init.c
CommitLineData
d7ce7006 1/** @file\r
2 Implement the constructor and destructor for the EFI socket library\r
3\r
0a2530ea
MK
4 Copyright (c) 2011, Intel Corporation. All rights reserved.\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
d7ce7006 6\r
7**/\r
8\r
eb222aea 9#include "Socket.h"\r
d7ce7006 10\r
11\r
12/**\r
13 EFI Socket Library Constructor\r
14\r
a88c3163 15 This routine supports an implementation dependent constructor\r
16 depending upon whether the library is linked to a socket\r
17 application or the SocketDxe driver. The following modules\r
18 declare the redirection for the constructor in ::mpfnEslConstructor:\r
19 <ul>\r
20 <li>StdLib/EfiSocketLib/UseSocketLib.c - Application links against EfiSocketLib</li>\r
21 <li>StdLib/SocketDxe/EntryUnload.c - SocketDxe links against EfiSocketLib</li>\r
22 </ul>\r
23\r
24 The EfiSocketLib.inf file lists ::EslConstructor as the CONSTRUCTOR\r
25 in the [Defines] section. As a result, this routine is called by\r
26 the ProcessLibraryConstructorList routine of the AutoGen.c module\r
27 in the Build directory associated with the socket application or\r
28 the SocketDxe driver.\r
29\r
30 @retval EFI_SUCCESS The socket layer initialization was successful\r
d7ce7006 31\r
32 **/\r
33EFI_STATUS\r
34EFIAPI\r
35EslConstructor (\r
36 VOID\r
37 )\r
38{\r
39 EFI_STATUS Status;\r
40\r
41 DBG_ENTER ( );\r
42\r
43 //\r
44 // Assume success\r
45 //\r
46 Status = EFI_SUCCESS;\r
47\r
48 //\r
49 // Call the image dependent constructor if available\r
50 //\r
51 if ( NULL != mpfnEslConstructor ) {\r
52 Status = mpfnEslConstructor ( );\r
53 }\r
54\r
55 //\r
56 // Return the constructor status\r
57 //\r
58 DBG_EXIT_STATUS ( Status );\r
59 return Status;\r
60}\r
61\r
62\r
63/**\r
64 EFI Socket Library Destructor\r
65\r
a88c3163 66 This routine supports an implementation dependent destructor\r
67 depending upon whether the library is linked to a socket\r
68 application or the SocketDxe driver. The following modules\r
69 declare the redirection for the destructor in ::mpfnEslDestructor:\r
70 <ul>\r
71 <li>StdLib/EfiSocketLib/UseSocketLib.c - Application links against EfiSocketLib</li>\r
72 <li>StdLib/SocketDxe/EntryUnload.c - SocketDxe links against EfiSocketLib</li>\r
73 </ul>\r
74\r
75 The EfiSocketLib.inf file lists ::EslDestructor as the DESTRUCTOR\r
76 in the [Defines] section. As a result, this routine is called by\r
77 the ProcessLibraryDestructorList routine of the AutoGen.c module\r
78 in the Build directory associated with the socket application or\r
79 the SocketDxe driver.\r
80\r
81 @retval EFI_SUCCESS The socket layer shutdown was successful\r
d7ce7006 82\r
83 **/\r
84EFI_STATUS\r
85EFIAPI\r
86EslDestructor (\r
87 VOID\r
88 )\r
89{\r
90 EFI_STATUS Status;\r
91\r
92 DBG_ENTER ( );\r
93\r
94 //\r
95 // Assume success\r
96 //\r
97 Status = EFI_SUCCESS;\r
98\r
99 //\r
100 // Call the image dependent destructor if available\r
101 //\r
102 if ( NULL != mpfnEslDestructor ) {\r
103 Status = mpfnEslDestructor ( );\r
104 }\r
105\r
106 //\r
107 // Return the constructor status\r
108 //\r
109 DBG_EXIT_STATUS ( Status );\r
110 return Status;\r
111}\r