]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Io.c
3 Copyright (c) 2005 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 I/O interfaces between TCP and IpIo.
28 Packet receive callback function provided to IP_IO, used to call
29 the proper function to handle the packet received by IP.
31 @param Status Status of the received packet.
32 @param IcmpErr ICMP error number.
33 @param NetSession Pointer to the net session of this packet.
34 @param Pkt Pointer to the recieved packet.
35 @param Context Pointer to the context configured in IpIoOpen(), not used
44 IN ICMP_ERROR IcmpErr
,
45 IN EFI_NET_SESSION_DATA
*NetSession
,
47 IN VOID
*Context OPTIONAL
50 if (EFI_SUCCESS
== Status
) {
51 TcpInput (Pkt
, NetSession
->Source
, NetSession
->Dest
);
53 TcpIcmpInput (Pkt
, IcmpErr
, NetSession
->Source
, NetSession
->Dest
);
59 Send the segment to IP via IpIo function.
61 @param Tcb Pointer to the TCP_CB of this TCP instance.
62 @param Nbuf Pointer to the TCP segment to be sent.
63 @param Src Source address of the TCP segment.
64 @param Dest Destination address of the TCP segment.
66 @retval 0 The segment was sent out successfully.
67 @retval -1 The segment was failed to send.
80 IP_IO_OVERRIDE Override
;
83 TCP4_PROTO_DATA
*TcpProto
;
88 IpSender
= IpIoFindSender (&IpIo
, Src
);
90 if (IpSender
== NULL
) {
91 DEBUG ((EFI_D_WARN
, "TcpSendIpPacket: No appropriate IpSender.\n"));
97 TcpProto
= (TCP4_PROTO_DATA
*) Sock
->ProtoReserved
;
98 IpIo
= TcpProto
->TcpService
->IpIo
;
99 IpSender
= Tcb
->IpInfo
;
102 Override
.TypeOfService
= 0;
103 Override
.TimeToLive
= 255;
104 Override
.DoNotFragment
= FALSE
;
105 Override
.Protocol
= EFI_IP_PROTO_TCP
;
106 ZeroMem (&Override
.GatewayAddress
, sizeof (EFI_IPv4_ADDRESS
));
107 CopyMem (&Override
.SourceAddress
, &Src
, sizeof (EFI_IPv4_ADDRESS
));
109 Status
= IpIoSend (IpIo
, Nbuf
, IpSender
, NULL
, NULL
, Dest
, &Override
);
111 if (EFI_ERROR (Status
)) {
112 DEBUG ((EFI_D_ERROR
, "TcpSendIpPacket: return %r error\n", Status
));