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