]>
Commit | Line | Data |
---|---|---|
a3bcde70 HT |
1 | /** @file\r |
2 | Declaration of external functions shared in TCP driver.\r | |
3 | \r | |
d551cc64 | 4 | Copyright (c) 2009 - 2014, 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_FUNC_H_\r | |
17 | #define _TCP_FUNC_H_\r | |
18 | \r | |
19 | #include "TcpOption.h"\r | |
20 | \r | |
21 | #define TCP_COMP_VAL(Min, Max, Default, Val) \\r | |
22 | ((((Val) <= (Max)) && ((Val) >= (Min))) ? (Val) : (Default))\r | |
23 | \r | |
24 | /**\r | |
25 | Timeout handler prototype.\r | |
26 | \r | |
27 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
28 | \r | |
29 | **/\r | |
30 | typedef\r | |
31 | VOID\r | |
32 | (*TCP_TIMER_HANDLER) (\r | |
33 | IN OUT TCP_CB *Tcb\r | |
34 | );\r | |
35 | \r | |
36 | //\r | |
37 | // Functions in TcpMisc.c\r | |
38 | //\r | |
39 | \r | |
40 | /**\r | |
41 | Initialize the Tcb locally related members.\r | |
42 | \r | |
43 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
44 | \r | |
45 | **/\r | |
46 | VOID\r | |
47 | TcpInitTcbLocal (\r | |
48 | IN OUT TCP_CB *Tcb\r | |
49 | );\r | |
50 | \r | |
51 | /**\r | |
52 | Initialize the peer related members.\r | |
53 | \r | |
54 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
55 | @param[in] Seg Pointer to the segment that contains the peer's intial information.\r | |
56 | @param[in] Opt Pointer to the options announced by the peer.\r | |
57 | \r | |
58 | **/\r | |
59 | VOID\r | |
60 | TcpInitTcbPeer (\r | |
61 | IN OUT TCP_CB *Tcb,\r | |
62 | IN TCP_SEG *Seg,\r | |
63 | IN TCP_OPTION *Opt\r | |
64 | );\r | |
65 | \r | |
66 | /**\r | |
67 | Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>.\r | |
68 | \r | |
69 | @param[in] Addr Pointer to the IP address needs to match.\r | |
70 | @param[in] Port The port number needs to match.\r | |
71 | @param[in] Version IP_VERSION_4 indicates TCP is running on IP4 stack.\r | |
72 | IP_VERSION_6 indicates TCP is running on IP6 stack.\r | |
73 | \r | |
74 | \r | |
75 | @retval TRUE The Tcb which matches the <Addr Port> pairs exists.\r | |
76 | @retval FALSE Otherwise\r | |
77 | \r | |
78 | **/\r | |
79 | BOOLEAN\r | |
80 | TcpFindTcbByPeer (\r | |
81 | IN EFI_IP_ADDRESS *Addr,\r | |
82 | IN TCP_PORTNO Port,\r | |
83 | IN UINT8 Version\r | |
84 | );\r | |
85 | \r | |
86 | /**\r | |
87 | Locate the TCP_CB related to the socket pair.\r | |
88 | \r | |
89 | @param[in] LocalPort The local port number.\r | |
90 | @param[in] LocalIp The local IP address.\r | |
91 | @param[in] RemotePort The remote port number.\r | |
92 | @param[in] RemoteIp The remote IP address.\r | |
93 | @param[in] Version IP_VERSION_4 indicates TCP is running on IP4 stack,\r | |
94 | IP_VERSION_6 indicates TCP is running on IP6 stack.\r | |
95 | @param[in] Syn If TRUE, the listen sockets are searched.\r | |
96 | \r | |
97 | @return Pointer to the related TCP_CB. If NULL, no match is found.\r | |
98 | \r | |
99 | **/\r | |
100 | TCP_CB *\r | |
101 | TcpLocateTcb (\r | |
102 | IN TCP_PORTNO LocalPort,\r | |
103 | IN EFI_IP_ADDRESS *LocalIp,\r | |
104 | IN TCP_PORTNO RemotePort,\r | |
105 | IN EFI_IP_ADDRESS *RemoteIp,\r | |
106 | IN UINT8 Version,\r | |
107 | IN BOOLEAN Syn\r | |
108 | );\r | |
109 | \r | |
110 | /**\r | |
111 | Insert a Tcb into the proper queue.\r | |
112 | \r | |
113 | @param[in] Tcb Pointer to the TCP_CB to be inserted.\r | |
114 | \r | |
115 | @retval 0 The Tcb was inserted successfully.\r | |
116 | @retval -1 An error condition occurred.\r | |
117 | \r | |
118 | **/\r | |
119 | INTN\r | |
120 | TcpInsertTcb (\r | |
121 | IN TCP_CB *Tcb\r | |
122 | );\r | |
123 | \r | |
124 | /**\r | |
125 | Clone a TCP_CB from Tcb.\r | |
126 | \r | |
127 | @param[in] Tcb Pointer to the TCP_CB to be cloned.\r | |
128 | \r | |
129 | @return Pointer to the new cloned TCP_CB. If NULL, an error condition occurred.\r | |
130 | \r | |
131 | **/\r | |
132 | TCP_CB *\r | |
133 | TcpCloneTcb (\r | |
134 | IN TCP_CB *Tcb\r | |
135 | );\r | |
136 | \r | |
137 | /**\r | |
138 | Compute an ISS to be used by a new connection.\r | |
139 | \r | |
140 | @return The result ISS.\r | |
141 | \r | |
142 | **/\r | |
143 | TCP_SEQNO\r | |
144 | TcpGetIss (\r | |
145 | VOID\r | |
146 | );\r | |
147 | \r | |
148 | /**\r | |
149 | Get the local mss.\r | |
150 | \r | |
151 | @param[in] Sock Pointer to the socket to get mss.\r | |
152 | \r | |
153 | @return The mss size.\r | |
154 | \r | |
155 | **/\r | |
156 | UINT16\r | |
157 | TcpGetRcvMss (\r | |
158 | IN SOCKET *Sock\r | |
159 | );\r | |
160 | \r | |
161 | /**\r | |
162 | Set the Tcb's state.\r | |
163 | \r | |
164 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
165 | @param[in] State The state to be set.\r | |
166 | \r | |
167 | **/\r | |
168 | VOID\r | |
169 | TcpSetState (\r | |
170 | IN TCP_CB *Tcb,\r | |
171 | IN UINT8 State\r | |
172 | );\r | |
173 | \r | |
174 | /**\r | |
175 | Compute the TCP segment's checksum.\r | |
176 | \r | |
177 | @param[in] Nbuf Pointer to the buffer that contains the TCP segment.\r | |
178 | @param[in] HeadSum The checksum value of the fixed part of pseudo header.\r | |
179 | \r | |
180 | @return The checksum value.\r | |
181 | \r | |
182 | **/\r | |
183 | UINT16\r | |
184 | TcpChecksum (\r | |
185 | IN NET_BUF *Nbuf,\r | |
186 | IN UINT16 HeadSum\r | |
187 | );\r | |
188 | \r | |
189 | /**\r | |
190 | Translate the information from the head of the received TCP\r | |
191 | segment Nbuf contains, and fill it into a TCP_SEG structure.\r | |
192 | \r | |
193 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
194 | @param[in, out] Nbuf Pointer to the buffer contains the TCP segment.\r | |
195 | \r | |
196 | @return Pointer to the TCP_SEG that contains the translated TCP head information.\r | |
197 | \r | |
198 | **/\r | |
199 | TCP_SEG *\r | |
200 | TcpFormatNetbuf (\r | |
201 | IN TCP_CB *Tcb,\r | |
202 | IN OUT NET_BUF *Nbuf\r | |
203 | );\r | |
204 | \r | |
205 | /**\r | |
206 | Initialize an active connection,\r | |
207 | \r | |
208 | @param[in, out] Tcb Pointer to the TCP_CB that wants to initiate a\r | |
209 | connection.\r | |
210 | \r | |
211 | **/\r | |
212 | VOID\r | |
213 | TcpOnAppConnect (\r | |
214 | IN OUT TCP_CB *Tcb\r | |
215 | );\r | |
216 | \r | |
217 | /**\r | |
218 | Application has consumed some data, check whether\r | |
219 | to send a window update ack or a delayed ack.\r | |
220 | \r | |
221 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
222 | \r | |
223 | **/\r | |
224 | VOID\r | |
225 | TcpOnAppConsume (\r | |
226 | IN TCP_CB *Tcb\r | |
227 | );\r | |
228 | \r | |
229 | /**\r | |
230 | Initiate the connection close procedure, called when\r | |
231 | applications want to close the connection.\r | |
232 | \r | |
233 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
234 | \r | |
235 | **/\r | |
236 | VOID\r | |
237 | TcpOnAppClose (\r | |
238 | IN OUT TCP_CB *Tcb\r | |
239 | );\r | |
240 | \r | |
241 | /**\r | |
242 | Check whether the application's newly delivered data can be sent out.\r | |
243 | \r | |
244 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
245 | \r | |
246 | @retval 0 The data has been sent out successfully.\r | |
247 | @retval -1 The Tcb is not in a state that data is permitted to\r | |
248 | be sent out.\r | |
249 | \r | |
250 | **/\r | |
251 | INTN\r | |
252 | TcpOnAppSend (\r | |
253 | IN OUT TCP_CB *Tcb\r | |
254 | );\r | |
255 | \r | |
256 | /**\r | |
257 | Abort the connection by sending a reset segment: called\r | |
258 | when the application wants to abort the connection.\r | |
259 | \r | |
260 | @param[in] Tcb Pointer to the TCP_CB of the TCP instance.\r | |
261 | \r | |
262 | **/\r | |
263 | VOID\r | |
264 | TcpOnAppAbort (\r | |
265 | IN TCP_CB *Tcb\r | |
266 | );\r | |
267 | \r | |
268 | /**\r | |
269 | Reset the connection related with Tcb.\r | |
270 | \r | |
271 | @param[in] Tcb Pointer to the TCP_CB of the connection to be reset.\r | |
272 | \r | |
273 | **/\r | |
274 | VOID\r | |
275 | TcpResetConnection (\r | |
276 | IN TCP_CB *Tcb\r | |
277 | );\r | |
278 | \r | |
a3bcde70 HT |
279 | /**\r |
280 | Install the device path protocol on the TCP instance.\r | |
281 | \r | |
282 | @param[in] Sock Pointer to the socket representing the TCP instance.\r | |
283 | \r | |
284 | @retval EFI_SUCCESS The device path protocol installed.\r | |
285 | @retval other Failed to install the device path protocol.\r | |
286 | \r | |
287 | **/\r | |
288 | EFI_STATUS\r | |
289 | TcpInstallDevicePath (\r | |
290 | IN SOCKET *Sock\r | |
291 | );\r | |
292 | \r | |
293 | \r | |
294 | //\r | |
295 | // Functions in TcpOutput.c\r | |
296 | //\r | |
297 | \r | |
298 | /**\r | |
299 | Compute the sequence space left in the old receive window.\r | |
300 | \r | |
301 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
302 | \r | |
303 | @return The sequence space left in the old receive window.\r | |
304 | \r | |
305 | **/\r | |
306 | UINT32\r | |
307 | TcpRcvWinOld (\r | |
308 | IN TCP_CB *Tcb\r | |
309 | );\r | |
310 | \r | |
311 | /**\r | |
312 | Compute the current receive window.\r | |
313 | \r | |
314 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
315 | \r | |
316 | @return The size of the current receive window, in bytes.\r | |
317 | \r | |
318 | **/\r | |
319 | UINT32\r | |
320 | TcpRcvWinNow (\r | |
321 | IN TCP_CB *Tcb\r | |
322 | );\r | |
323 | \r | |
324 | /**\r | |
325 | Get the maximum SndNxt.\r | |
326 | \r | |
327 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
328 | \r | |
329 | @return The sequence number of the maximum SndNxt.\r | |
330 | \r | |
331 | **/\r | |
332 | TCP_SEQNO\r | |
333 | TcpGetMaxSndNxt (\r | |
334 | IN TCP_CB *Tcb\r | |
335 | );\r | |
336 | \r | |
337 | /**\r | |
338 | Compute how much data to send.\r | |
339 | \r | |
340 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
341 | @param[in] Force If TRUE, ignore the sender's SWS avoidance algorithm\r | |
342 | and send out data by force.\r | |
343 | \r | |
344 | @return The length of the data that can be sent. If 0, no data can be sent.\r | |
345 | \r | |
346 | **/\r | |
347 | UINT32\r | |
348 | TcpDataToSend (\r | |
349 | IN TCP_CB *Tcb,\r | |
350 | IN INTN Force\r | |
351 | );\r | |
352 | \r | |
353 | /**\r | |
354 | Retransmit the segment from sequence Seq.\r | |
355 | \r | |
356 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
357 | @param[in] Seq The sequence number of the segment to be retransmitted.\r | |
358 | \r | |
359 | @retval 0 The retransmission succeeded.\r | |
360 | @retval -1 An error condition occurred.\r | |
361 | \r | |
362 | **/\r | |
363 | INTN\r | |
364 | TcpRetransmit (\r | |
365 | IN TCP_CB *Tcb,\r | |
366 | IN TCP_SEQNO Seq\r | |
367 | );\r | |
368 | \r | |
369 | /**\r | |
370 | Check whether to send data/SYN/FIN and piggyback an ACK.\r | |
371 | \r | |
372 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
373 | @param[in] Force If TRUE, ignore the sender's SWS avoidance algorithm\r | |
374 | and send out data by force.\r | |
375 | \r | |
376 | @return The number of bytes sent.\r | |
377 | \r | |
378 | **/\r | |
379 | INTN\r | |
380 | TcpToSendData (\r | |
381 | IN OUT TCP_CB *Tcb,\r | |
382 | IN INTN Force\r | |
383 | );\r | |
384 | \r | |
385 | /**\r | |
386 | Check whether to send an ACK or delayed ACK.\r | |
387 | \r | |
388 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
389 | \r | |
390 | **/\r | |
391 | VOID\r | |
392 | TcpToSendAck (\r | |
393 | IN OUT TCP_CB *Tcb\r | |
394 | );\r | |
395 | \r | |
396 | /**\r | |
397 | Send an ACK immediately.\r | |
398 | \r | |
399 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
400 | \r | |
401 | **/\r | |
402 | VOID\r | |
403 | TcpSendAck (\r | |
404 | IN OUT TCP_CB *Tcb\r | |
405 | );\r | |
406 | \r | |
407 | /**\r | |
408 | Send a zero probe segment. It can be used by keepalive and zero window probe.\r | |
409 | \r | |
410 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
411 | \r | |
412 | @retval 0 The zero probe segment was sent out successfully.\r | |
413 | @retval other An error condition occurred.\r | |
414 | \r | |
415 | **/\r | |
416 | INTN\r | |
417 | TcpSendZeroProbe (\r | |
418 | IN OUT TCP_CB *Tcb\r | |
419 | );\r | |
420 | \r | |
421 | /**\r | |
422 | Send a RESET segment in response to the segment received.\r | |
423 | \r | |
424 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance, may be NULL.\r | |
425 | @param[in] Head TCP header of the segment that triggers the reset.\r | |
426 | @param[in] Len Length of the segment that triggers the reset.\r | |
427 | @param[in] Local Local IP address.\r | |
428 | @param[in] Remote Remote peer's IP address.\r | |
429 | @param[in] Version IP_VERSION_4 indicates TCP is running on IP4 stack,\r | |
430 | IP_VERSION_6 indicates TCP is running on IP6 stack.\r | |
431 | \r | |
432 | @retval 0 A reset is sent or no need to send it.\r | |
433 | @retval -1 No reset is sent.\r | |
434 | \r | |
435 | **/\r | |
436 | INTN\r | |
437 | TcpSendReset (\r | |
438 | IN TCP_CB *Tcb,\r | |
439 | IN TCP_HEAD *Head,\r | |
440 | IN INT32 Len,\r | |
441 | IN EFI_IP_ADDRESS *Local,\r | |
442 | IN EFI_IP_ADDRESS *Remote,\r | |
443 | IN UINT8 Version\r | |
444 | );\r | |
445 | \r | |
446 | /**\r | |
447 | Verify that the segment is in good shape.\r | |
448 | \r | |
449 | @param[in] Nbuf Buffer that contains the segment to be checked.\r | |
450 | \r | |
451 | @retval 0 The segment is broken.\r | |
452 | @retval 1 The segment is in good shape.\r | |
453 | \r | |
454 | **/\r | |
455 | INTN\r | |
456 | TcpVerifySegment (\r | |
457 | IN NET_BUF *Nbuf\r | |
458 | );\r | |
459 | \r | |
460 | //\r | |
461 | // Functions from TcpInput.c\r | |
462 | //\r | |
463 | \r | |
464 | /**\r | |
465 | Process the received ICMP error messages for TCP.\r | |
466 | \r | |
467 | @param[in] Nbuf Buffer that contains part of the TCP segment without IP header\r | |
468 | truncated from the ICMP error packet.\r | |
469 | @param[in] IcmpErr The ICMP error code interpreted from an ICMP error packet.\r | |
470 | @param[in] Src Source address of the ICMP error message.\r | |
471 | @param[in] Dst Destination address of the ICMP error message.\r | |
472 | @param[in] Version IP_VERSION_4 indicates IP4 stack, IP_VERSION_6 indicates\r | |
473 | IP6 stack.\r | |
474 | \r | |
475 | **/\r | |
476 | VOID\r | |
477 | TcpIcmpInput (\r | |
478 | IN NET_BUF *Nbuf,\r | |
479 | IN UINT8 IcmpErr,\r | |
480 | IN EFI_IP_ADDRESS *Src,\r | |
481 | IN EFI_IP_ADDRESS *Dst,\r | |
482 | IN UINT8 Version\r | |
483 | );\r | |
484 | \r | |
485 | /**\r | |
486 | Process the received TCP segments.\r | |
487 | \r | |
488 | @param[in] Nbuf Buffer that contains received TCP segment without an IP header.\r | |
489 | @param[in] Src Source address of the segment, or the peer's IP address.\r | |
490 | @param[in] Dst Destination address of the segment, or the local end's IP\r | |
491 | address.\r | |
492 | @param[in] Version IP_VERSION_4 indicates IP4 stack, IP_VERSION_6 indicates\r | |
493 | IP6 stack.\r | |
494 | \r | |
495 | @retval 0 The segment processed successfully. It is either accepted or\r | |
496 | discarded. But no connection is reset by the segment.\r | |
497 | @retval -1 A connection is reset by the segment.\r | |
498 | \r | |
499 | **/\r | |
500 | INTN\r | |
501 | TcpInput (\r | |
502 | IN NET_BUF *Nbuf,\r | |
503 | IN EFI_IP_ADDRESS *Src,\r | |
504 | IN EFI_IP_ADDRESS *Dst,\r | |
505 | IN UINT8 Version\r | |
506 | );\r | |
507 | \r | |
508 | //\r | |
509 | // Functions in TcpTimer.c\r | |
510 | //\r | |
511 | \r | |
512 | /**\r | |
513 | Close the TCP connection.\r | |
514 | \r | |
515 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
516 | \r | |
517 | **/\r | |
518 | VOID\r | |
519 | TcpClose (\r | |
520 | IN OUT TCP_CB *Tcb\r | |
521 | );\r | |
522 | \r | |
523 | /**\r | |
524 | Heart beat timer handler, queues the DPC at TPL_CALLBACK.\r | |
525 | \r | |
526 | @param[in] Event Timer event signaled, ignored.\r | |
527 | @param[in] Context Context of the timer event, ignored.\r | |
528 | \r | |
529 | **/\r | |
530 | VOID\r | |
531 | EFIAPI\r | |
532 | TcpTicking (\r | |
533 | IN EFI_EVENT Event,\r | |
534 | IN VOID *Context\r | |
535 | );\r | |
536 | \r | |
537 | /**\r | |
538 | Enable a TCP timer.\r | |
539 | \r | |
540 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
541 | @param[in] Timer The index of the timer to be enabled.\r | |
542 | @param[in] TimeOut The timeout value of this timer.\r | |
543 | \r | |
544 | **/\r | |
545 | VOID\r | |
546 | TcpSetTimer (\r | |
547 | IN OUT TCP_CB *Tcb,\r | |
548 | IN UINT16 Timer,\r | |
549 | IN UINT32 TimeOut\r | |
550 | );\r | |
551 | \r | |
552 | /**\r | |
553 | Clear one TCP timer.\r | |
554 | \r | |
555 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
556 | @param[in] Timer The index of the timer to be cleared.\r | |
557 | \r | |
558 | **/\r | |
559 | VOID\r | |
560 | TcpClearTimer (\r | |
561 | IN OUT TCP_CB *Tcb,\r | |
562 | IN UINT16 Timer\r | |
563 | );\r | |
564 | \r | |
565 | /**\r | |
566 | Clear all TCP timers.\r | |
567 | \r | |
568 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
569 | \r | |
570 | **/\r | |
571 | VOID\r | |
572 | TcpClearAllTimer (\r | |
573 | IN OUT TCP_CB *Tcb\r | |
574 | );\r | |
575 | \r | |
576 | /**\r | |
577 | Enable the window prober timer and set the timeout value.\r | |
578 | \r | |
579 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
580 | \r | |
581 | **/\r | |
582 | VOID\r | |
583 | TcpSetProbeTimer (\r | |
584 | IN OUT TCP_CB *Tcb\r | |
585 | );\r | |
586 | \r | |
587 | /**\r | |
588 | Enable the keepalive timer and set the timeout value.\r | |
589 | \r | |
590 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
591 | \r | |
592 | **/\r | |
593 | VOID\r | |
594 | TcpSetKeepaliveTimer (\r | |
595 | IN OUT TCP_CB *Tcb\r | |
596 | );\r | |
597 | \r | |
598 | //\r | |
599 | // Functions in TcpIo.c\r | |
600 | //\r | |
601 | \r | |
602 | /**\r | |
603 | Packet receive callback function provided to IP_IO. Used to call\r | |
604 | the proper function to handle the packet received by IP.\r | |
605 | \r | |
606 | @param[in] Status Result of the receive request.\r | |
607 | @param[in] IcmpErr Valid when Status is EFI_ICMP_ERROR.\r | |
608 | @param[in] NetSession The IP session for the received packet.\r | |
609 | @param[in] Pkt Packet received.\r | |
610 | @param[in] Context The data provided by the user for the received packet when\r | |
611 | the callback is registered in IP_IO_OPEN_DATA::RcvdContext.\r | |
612 | This is an optional parameter that may be NULL.\r | |
613 | \r | |
614 | **/\r | |
615 | VOID\r | |
616 | EFIAPI\r | |
617 | TcpRxCallback (\r | |
618 | IN EFI_STATUS Status,\r | |
619 | IN UINT8 IcmpErr,\r | |
620 | IN EFI_NET_SESSION_DATA *NetSession,\r | |
621 | IN NET_BUF *Pkt,\r | |
622 | IN VOID *Context OPTIONAL\r | |
623 | );\r | |
624 | \r | |
625 | /**\r | |
626 | Send the segment to IP via IpIo function.\r | |
627 | \r | |
628 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
629 | @param[in] Nbuf Pointer to the TCP segment to be sent.\r | |
630 | @param[in] Src Source address of the TCP segment.\r | |
631 | @param[in] Dest Destination address of the TCP segment.\r | |
632 | @param[in] Version IP_VERSION_4 or IP_VERSION_6\r | |
633 | \r | |
634 | @retval 0 The segment was sent out successfully.\r | |
635 | @retval -1 The segment failed to be sent.\r | |
636 | \r | |
637 | **/\r | |
638 | INTN\r | |
639 | TcpSendIpPacket (\r | |
640 | IN TCP_CB *Tcb,\r | |
641 | IN NET_BUF *Nbuf,\r | |
642 | IN EFI_IP_ADDRESS *Src,\r | |
643 | IN EFI_IP_ADDRESS *Dest,\r | |
644 | IN UINT8 Version\r | |
645 | );\r | |
646 | \r | |
647 | /**\r | |
648 | Refresh the remote peer's Neighbor Cache State if already exists.\r | |
649 | \r | |
650 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.\r | |
651 | @param[in] Neighbor Source address of the TCP segment.\r | |
652 | @param[in] Timeout Time in 100-ns units that this entry will remain\r | |
653 | in the neighbor cache. A value of zero means that\r | |
654 | the entry is permanent. A value of non-zero means\r | |
655 | that the entry is dynamic and will be deleted\r | |
656 | after Timeout.\r | |
657 | \r | |
658 | @retval EFI_SUCCESS Successfully updated the neighbor relationship.\r | |
659 | @retval EFI_NOT_STARTED The IpIo is not configured.\r | |
660 | @retval EFI_INVALID_PARAMETER Any input parameter is invalid.\r | |
661 | @retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.\r | |
662 | @retval EFI_NOT_FOUND This entry is not in the neighbor table.\r | |
663 | \r | |
664 | **/\r | |
665 | EFI_STATUS\r | |
666 | Tcp6RefreshNeighbor (\r | |
667 | IN TCP_CB *Tcb,\r | |
668 | IN EFI_IP_ADDRESS *Neighbor,\r | |
669 | IN UINT32 Timeout\r | |
670 | );\r | |
671 | \r | |
672 | //\r | |
673 | // Functions in TcpDispatcher.c\r | |
674 | //\r | |
675 | \r | |
676 | /**\r | |
677 | The procotol handler provided to the socket layer, used to\r | |
678 | dispatch the socket level requests by calling the corresponding\r | |
679 | TCP layer functions.\r | |
680 | \r | |
681 | @param[in] Sock Pointer to the socket of this TCP instance.\r | |
682 | @param[in] Request The code of this operation request.\r | |
683 | @param[in] Data Pointer to the operation specific data passed in\r | |
684 | together with the operation request. This is an\r | |
685 | optional parameter that may be NULL.\r | |
686 | \r | |
687 | @retval EFI_SUCCESS The socket request completed successfully.\r | |
688 | @retval other The error status returned by the corresponding TCP\r | |
689 | layer function.\r | |
690 | \r | |
691 | **/\r | |
692 | EFI_STATUS\r | |
693 | TcpDispatcher (\r | |
694 | IN SOCKET *Sock,\r | |
695 | IN UINT8 Request,\r | |
696 | IN VOID *Data OPTIONAL\r | |
697 | );\r | |
698 | \r | |
699 | #endif\r |