]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/TcpDxe/TcpDriver.h
EDK II Packages: Add Contributions.txt and License.txt files
[mirror_edk2.git] / NetworkPkg / TcpDxe / TcpDriver.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 The prototype of driver binding and service binding protocol for TCP driver.\r
3\r
15ee13fc 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
a3bcde70
HT
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _TCP_DRIVER_H_\r
17#define _TCP_DRIVER_H_\r
18\r
19#define TCP_DRIVER_SIGNATURE SIGNATURE_32 ('T', 'C', 'P', 'D')\r
20\r
21#define TCP_PORT_KNOWN 1024\r
22#define TCP_PORT_USER_RESERVED 65535\r
23\r
24typedef struct _TCP_HEARTBEAT_TIMER {\r
25 EFI_EVENT TimerEvent;\r
26 INTN RefCnt;\r
27} TCP_HEARTBEAT_TIMER;\r
28\r
29typedef struct _TCP_SERVICE_DATA {\r
30 UINT32 Signature;\r
31 EFI_HANDLE ControllerHandle;\r
32 EFI_HANDLE DriverBindingHandle;\r
33 UINT8 IpVersion;\r
34 IP_IO *IpIo;\r
35 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
36 CHAR16 *MacString;\r
37 LIST_ENTRY SocketList;\r
38} TCP_SERVICE_DATA;\r
39\r
40typedef struct _TCP_PROTO_DATA {\r
41 TCP_SERVICE_DATA *TcpService;\r
42 TCP_CB *TcpPcb;\r
43} TCP_PROTO_DATA;\r
44\r
45#define TCP_SERVICE_FROM_THIS(a) \\r
46 CR ( \\r
47 (a), \\r
48 TCP_SERVICE_DATA, \\r
49 ServiceBinding, \\r
50 TCP_DRIVER_SIGNATURE \\r
51 )\r
52\r
53//\r
54// Function prototype for the driver's entry point\r
55//\r
56\r
57/**\r
58 The entry point for Tcp driver, used to install Tcp driver on the ImageHandle.\r
59\r
60 @param[in] ImageHandle The firmware allocated handle for this driver image.\r
61 @param[in] SystemTable Pointer to the EFI system table.\r
62\r
63 @retval EFI_SUCCESS The driver loaded.\r
64 @retval other The driver did not load.\r
65\r
66**/\r
67EFI_STATUS\r
68EFIAPI\r
69TcpDriverEntryPoint (\r
70 IN EFI_HANDLE ImageHandle,\r
71 IN EFI_SYSTEM_TABLE *SystemTable\r
72 );\r
73\r
74//\r
75// Function prototypes for the Driver Binding Protocol\r
76//\r
77\r
78/**\r
79 Test to see if this driver supports ControllerHandle.\r
80\r
81 @param[in] This Protocol instance pointer.\r
82 @param[in] ControllerHandle Handle of the device to test.\r
83 @param[in] RemainingDevicePath Optional parameter use to pick a specific\r
84 child device to start.\r
85\r
86 @retval EFI_SUCCESS This driver supports this device.\r
87 @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
88 @retval other This driver does not support this device.\r
89\r
90**/\r
91EFI_STATUS\r
92EFIAPI\r
93TcpDriverBindingSupported (\r
94 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
95 IN EFI_HANDLE ControllerHandle,\r
96 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
97 );\r
98\r
99/**\r
100 Start this driver on ControllerHandle.\r
101\r
102 @param[in] This Protocol instance pointer.\r
103 @param[in] ControllerHandle Handle of device to bind driver to.\r
104 @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r
105 device to start.\r
106\r
107 @retval EFI_SUCCESS The driver was added to ControllerHandle.\r
108 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the\r
109 driver.\r
110 @retval other The driver cannot be added to ControllerHandle.\r
111\r
112**/\r
113EFI_STATUS\r
114EFIAPI\r
115TcpDriverBindingStart (\r
116 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
117 IN EFI_HANDLE ControllerHandle,\r
118 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
119 );\r
120\r
121/**\r
122 Stop this driver on ControllerHandle.\r
123\r
124 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
125 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
126 support a bus specific I/O protocol for the driver\r
127 to use to stop the device.\r
128 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
129 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
130 if NumberOfChildren is 0.\r
131\r
132 @retval EFI_SUCCESS The device was stopped.\r
133 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
134\r
135**/\r
136EFI_STATUS\r
137EFIAPI\r
138TcpDriverBindingStop (\r
139 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
140 IN EFI_HANDLE ControllerHandle,\r
141 IN UINTN NumberOfChildren,\r
142 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
143 );\r
144\r
145/**\r
146 The Callback funtion called after the TCP socket is created.\r
147\r
148 @param[in] This Pointer to the socket just created.\r
149 @param[in] Context The context of the socket.\r
150\r
151 @retval EFI_SUCCESS This protocol is installed successfully.\r
152 @retval other An error occured.\r
153\r
154**/\r
155EFI_STATUS\r
156TcpCreateSocketCallback (\r
157 IN SOCKET *This,\r
158 IN VOID *Context\r
159 );\r
160\r
161/**\r
162 The callback function called before the TCP socket is to be destroyed.\r
163\r
164 @param[in] This The TCP socket to be destroyed.\r
165 @param[in] Context The context of the socket.\r
166\r
167**/\r
168VOID\r
169TcpDestroySocketCallback (\r
170 IN SOCKET *This,\r
171 IN VOID *Context\r
172 );\r
173\r
174//\r
175// Function ptototypes for the ServiceBinding Prococol\r
176//\r
177\r
178/**\r
179 Creates a child handle with a set of TCP services.\r
180\r
181 The CreateChild() function installs a protocol on ChildHandle.\r
182 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
183 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
184\r
185 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
186 @param[in, out] ChildHandle Pointer to the handle of the child to create.\r
187 If it is NULL, then a new handle is created.\r
188 If it is a pointer to an existing UEFI handle,\r
189 then the protocol is added to the existing UEFI handle.\r
190\r
191 @retval EFI_SUCCES The protocol was added to ChildHandle.\r
192 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
193 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r
194 the child.\r
195 @retval other The child handle was not created.\r
196\r
197**/\r
198EFI_STATUS\r
199EFIAPI\r
200TcpServiceBindingCreateChild (\r
201 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
202 IN OUT EFI_HANDLE *ChildHandle\r
203 );\r
204\r
205/**\r
206 Destroys a child handle with a set of TCP services.\r
207\r
208 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
209 that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
210 last protocol on ChildHandle, then ChildHandle is destroyed.\r
211\r
212 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
213 @param ChildHandle Handle of the child to destroy.\r
214\r
215 @retval EFI_SUCCES The protocol was removed from ChildHandle.\r
216 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r
15ee13fc 217 @retval EFI_INVALID_PARAMETER The child handle is NULL.\r
a3bcde70
HT
218 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r
219 because its services are being used.\r
220 @retval other The child handle was not destroyed.\r
221\r
222**/\r
223EFI_STATUS\r
224EFIAPI\r
225TcpServiceBindingDestroyChild (\r
226 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
227 IN EFI_HANDLE ChildHandle\r
228 );\r
229\r
230#endif\r