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