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