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