]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Io.c
Fix a missing doxygen parameter entry.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Io.c
CommitLineData
8a67d61d 1/** @file\r
2\r
3Copyright (c) 2005 - 2006, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 Tcp4Io.c\r
15\r
16Abstract:\r
17\r
18 I/O interfaces between TCP and IpIo.\r
19\r
20\r
21**/\r
22\r
23\r
24#include "Tcp4Main.h"\r
25\r
26\r
27/**\r
28 Packet receive callback function provided to IP_IO, used to call\r
29 the proper function to handle the packet received by IP.\r
30\r
31 @param Status Status of the received packet.\r
32 @param IcmpErr ICMP error number.\r
33 @param NetSession Pointer to the net session of this packet.\r
34 @param Pkt Pointer to the recieved packet.\r
35 @param Context Pointer to the context configured in IpIoOpen(), not used\r
36 now.\r
37\r
38 @return None\r
39\r
40**/\r
41VOID\r
42Tcp4RxCallback (\r
43 IN EFI_STATUS Status,\r
44 IN ICMP_ERROR IcmpErr,\r
45 IN EFI_NET_SESSION_DATA *NetSession,\r
46 IN NET_BUF *Pkt,\r
47 IN VOID *Context OPTIONAL\r
48 )\r
49{\r
50 if (EFI_SUCCESS == Status) {\r
51 TcpInput (Pkt, NetSession->Source, NetSession->Dest);\r
52 } else {\r
53 TcpIcmpInput (Pkt, IcmpErr, NetSession->Source, NetSession->Dest);\r
54 }\r
55}\r
56\r
57\r
58/**\r
59 Send the segment to IP via IpIo function.\r
60\r
61 @param Tcb Pointer to the TCP_CB of this TCP instance.\r
62 @param Nbuf Pointer to the TCP segment to be sent.\r
63 @param Src Source address of the TCP segment.\r
64 @param Dest Destination address of the TCP segment.\r
65\r
66 @retval 0 The segment was sent out successfully.\r
67 @retval -1 The segment was failed to send.\r
68\r
69**/\r
70INTN\r
71TcpSendIpPacket (\r
72 IN TCP_CB *Tcb,\r
73 IN NET_BUF *Nbuf,\r
74 IN UINT32 Src,\r
75 IN UINT32 Dest\r
76 )\r
77{\r
78 EFI_STATUS Status;\r
79 IP_IO *IpIo;\r
80 IP_IO_OVERRIDE Override;\r
81 SOCKET *Sock;\r
82 VOID *IpSender;\r
83 TCP4_PROTO_DATA *TcpProto;\r
84\r
85 if (NULL == Tcb) {\r
86\r
87 IpIo = NULL;\r
88 IpSender = IpIoFindSender (&IpIo, Src);\r
89\r
90 if (IpSender == NULL) {\r
e48e37fc 91 DEBUG ((EFI_D_WARN, "TcpSendIpPacket: No appropriate IpSender.\n"));\r
8a67d61d 92 return -1;\r
93 }\r
94 } else {\r
95\r
96 Sock = Tcb->Sk;\r
97 TcpProto = (TCP4_PROTO_DATA *) Sock->ProtoReserved;\r
98 IpIo = TcpProto->TcpService->IpIo;\r
99 IpSender = Tcb->IpInfo;\r
100 }\r
101\r
102 Override.TypeOfService = 0;\r
103 Override.TimeToLive = 255;\r
104 Override.DoNotFragment = FALSE;\r
105 Override.Protocol = EFI_IP_PROTO_TCP;\r
e48e37fc 106 ZeroMem (&Override.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
107 CopyMem (&Override.SourceAddress, &Src, sizeof (EFI_IPv4_ADDRESS));\r
8a67d61d 108\r
109 Status = IpIoSend (IpIo, Nbuf, IpSender, NULL, NULL, Dest, &Override);\r
110\r
111 if (EFI_ERROR (Status)) {\r
e48e37fc 112 DEBUG ((EFI_D_ERROR, "TcpSendIpPacket: return %r error\n", Status));\r
8a67d61d 113 return -1;\r
114 }\r
115\r
116 return 0;\r
117}\r