]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/Ip4Dxe/Ip4Output.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / Ip4Dxe / Ip4Output.h
1 /** @file
2
3 Copyright (c) 2005 - 2006, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6 **/
7
8 #ifndef __EFI_IP4_OUTPUT_H__
9 #define __EFI_IP4_OUTPUT_H__
10
11 /**
12 The default callback function for system generated packet.
13 It will free the packet.
14
15 @param Ip4Instance The IP4 child that issued the transmission. It most
16 like is NULL.
17 @param Packet The packet that transmitted.
18 @param IoStatus The result of the transmission, succeeded or failed.
19 @param LinkFlag Not used when transmission. check IP4_FRAME_CALLBACK
20 for reference.
21 @param Context The context provided by us
22
23 **/
24 VOID
25 Ip4SysPacketSent (
26 IP4_PROTOCOL *Ip4Instance,
27 NET_BUF *Packet,
28 EFI_STATUS IoStatus,
29 UINT32 LinkFlag,
30 VOID *Context
31 );
32
33 /**
34 Transmit an IP4 packet. The packet comes either from the IP4
35 child's consumer (IpInstance != NULL) or the IP4 driver itself
36 (IpInstance == NULL). It will route the packet, fragment it,
37 then transmit all the fragments through some interface.
38
39 @param[in] IpSb The IP4 service instance to transmit the packet
40 @param[in] IpInstance The IP4 child that issues the transmission. It is
41 NULL if the packet is from the system.
42 @param[in] Packet The user data to send, excluding the IP header.
43 @param[in] Head The caller supplied header. The caller should set
44 the following header fields: Tos, TotalLen, Id, tl,
45 Fragment, Protocol, Src and Dst. All the fields are
46 in host byte order. This function will fill in the
47 Ver, HeadLen, Fragment, and checksum. The Fragment
48 only need to include the DF flag. Ip4Output will
49 compute the MF and offset for you.
50 @param[in] Option The original option to append to the IP headers
51 @param[in] OptLen The length of the option
52 @param[in] GateWay The next hop address to transmit packet to.
53 255.255.255.255 means broadcast.
54 @param[in] Callback The callback function to issue when transmission
55 completed.
56 @param[in] Context The opaque context for the callback
57
58 @retval EFI_NO_MAPPING There is no interface to the destination.
59 @retval EFI_NOT_FOUND There is no route to the destination
60 @retval EFI_SUCCESS The packet is successfully transmitted.
61 @retval Others Failed to transmit the packet.
62
63 **/
64 EFI_STATUS
65 Ip4Output (
66 IN IP4_SERVICE *IpSb,
67 IN IP4_PROTOCOL *IpInstance OPTIONAL,
68 IN NET_BUF *Packet,
69 IN IP4_HEAD *Head,
70 IN UINT8 *Option,
71 IN UINT32 OptLen,
72 IN IP4_ADDR GateWay,
73 IN IP4_FRAME_CALLBACK Callback,
74 IN VOID *Context
75 );
76
77 /**
78 Cancel the Packet and all its fragments.
79
80 @param IpIf The interface from which the Packet is sent
81 @param Packet The Packet to cancel
82 @param IoStatus The status returns to the sender.
83
84 **/
85 VOID
86 Ip4CancelPacket (
87 IN IP4_INTERFACE *IpIf,
88 IN NET_BUF *Packet,
89 IN EFI_STATUS IoStatus
90 );
91
92 /**
93 Prepend an IP4 head to the Packet. It will copy the options and
94 build the IP4 header fields. Used for IP4 fragmentation.
95
96 @param Packet The packet to prepend IP4 header to
97 @param Head The caller supplied header. The caller should set
98 the following header fields: Tos, TotalLen, Id,
99 Fragment, Ttl, Protocol, Src and Dst. All the fields
100 are in host byte order. This function will fill in
101 the Ver, HeadLen, and checksum.
102 @param Option The original IP4 option to copy from
103 @param OptLen The length of the IP4 option
104
105 @retval EFI_BAD_BUFFER_SIZE There is no enough room in the head space of
106 Packet.
107 @retval EFI_SUCCESS The IP4 header is successfully added to the packet.
108
109 **/
110 EFI_STATUS
111 Ip4PrependHead (
112 IN OUT NET_BUF *Packet,
113 IN IP4_HEAD *Head,
114 IN UINT8 *Option,
115 IN UINT32 OptLen
116 );
117
118 extern UINT16 mIp4Id;
119
120 #endif