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