]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/EfiSocketLib/Init.c
Fix a bug about the iSCSI DHCP dependency issue.
[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
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "Socket.h"
16
17
18 /**
19 EFI Socket Library Constructor
20
21 This routine supports an implementation dependent constructor
22 depending upon whether the library is linked to a socket
23 application or the SocketDxe driver. The following modules
24 declare the redirection for the constructor in ::mpfnEslConstructor:
25 <ul>
26 <li>StdLib/EfiSocketLib/UseSocketLib.c - Application links against EfiSocketLib</li>
27 <li>StdLib/SocketDxe/EntryUnload.c - SocketDxe links against EfiSocketLib</li>
28 </ul>
29
30 The EfiSocketLib.inf file lists ::EslConstructor as the CONSTRUCTOR
31 in the [Defines] section. As a result, this routine is called by
32 the ProcessLibraryConstructorList routine of the AutoGen.c module
33 in the Build directory associated with the socket application or
34 the SocketDxe driver.
35
36 @retval EFI_SUCCESS The socket layer initialization was successful
37
38 **/
39 EFI_STATUS
40 EFIAPI
41 EslConstructor (
42 VOID
43 )
44 {
45 EFI_STATUS Status;
46
47 DBG_ENTER ( );
48
49 //
50 // Assume success
51 //
52 Status = EFI_SUCCESS;
53
54 //
55 // Call the image dependent constructor if available
56 //
57 if ( NULL != mpfnEslConstructor ) {
58 Status = mpfnEslConstructor ( );
59 }
60
61 //
62 // Return the constructor status
63 //
64 DBG_EXIT_STATUS ( Status );
65 return Status;
66 }
67
68
69 /**
70 EFI Socket Library Destructor
71
72 This routine supports an implementation dependent destructor
73 depending upon whether the library is linked to a socket
74 application or the SocketDxe driver. The following modules
75 declare the redirection for the destructor in ::mpfnEslDestructor:
76 <ul>
77 <li>StdLib/EfiSocketLib/UseSocketLib.c - Application links against EfiSocketLib</li>
78 <li>StdLib/SocketDxe/EntryUnload.c - SocketDxe links against EfiSocketLib</li>
79 </ul>
80
81 The EfiSocketLib.inf file lists ::EslDestructor as the DESTRUCTOR
82 in the [Defines] section. As a result, this routine is called by
83 the ProcessLibraryDestructorList routine of the AutoGen.c module
84 in the Build directory associated with the socket application or
85 the SocketDxe driver.
86
87 @retval EFI_SUCCESS The socket layer shutdown was successful
88
89 **/
90 EFI_STATUS
91 EFIAPI
92 EslDestructor (
93 VOID
94 )
95 {
96 EFI_STATUS Status;
97
98 DBG_ENTER ( );
99
100 //
101 // Assume success
102 //
103 Status = EFI_SUCCESS;
104
105 //
106 // Call the image dependent destructor if available
107 //
108 if ( NULL != mpfnEslDestructor ) {
109 Status = mpfnEslDestructor ( );
110 }
111
112 //
113 // Return the constructor status
114 //
115 DBG_EXIT_STATUS ( Status );
116 return Status;
117 }