]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
Clean up to update the reference of the these macros:
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Mtftp4Dxe / Mtftp4Impl.h
CommitLineData
83cbd279 1/** @file\r
2\r
3Copyright (c) 2006 - 2007, Intel Corporation\r
4All rights reserved. This 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
12Module Name:\r
13\r
14 Mtftp4Impl.h\r
15\r
16Abstract:\r
17\r
18 Mtftp4 Implementation, it supports the following RFCs:\r
19 RFC1350 - THE TFTP PROTOCOL (REVISION 2)\r
20 RFC2090 - TFTP Multicast Option\r
21 RFC2347 - TFTP Option Extension\r
22 RFC2348 - TFTP Blocksize Option\r
23 RFC2349 - TFTP Timeout Interval and Transfer Size Options\r
24\r
25\r
26**/\r
27\r
28#ifndef __EFI_MTFTP4_IMPL_H__\r
29#define __EFI_MTFTP4_IMPL_H__\r
30\r
772db4bb 31#include <PiDxe.h>\r
32\r
33#include <Protocol/Udp4.h>\r
34#include <Protocol/Mtftp4.h>\r
35\r
36#include <Library/DebugLib.h>\r
37#include <Library/UefiDriverEntryPoint.h>\r
38#include <Library/UefiBootServicesTableLib.h>\r
39#include <Library/UefiLib.h>\r
83cbd279 40#include <Library/BaseLib.h>\r
41#include <Library/UdpIoLib.h>\r
42#include <Library/MemoryAllocationLib.h>\r
43#include <Library/BaseMemoryLib.h>\r
44\r
45typedef struct _MTFTP4_SERVICE MTFTP4_SERVICE;\r
46typedef struct _MTFTP4_PROTOCOL MTFTP4_PROTOCOL;\r
47\r
48#include "Mtftp4Driver.h"\r
49#include "Mtftp4Option.h"\r
50#include "Mtftp4Support.h"\r
51\r
52enum {\r
f3f2e05d 53 MTFTP4_SERVICE_SIGNATURE = SIGNATURE_32 ('T', 'F', 'T', 'P'),\r
54 MTFTP4_PROTOCOL_SIGNATURE = SIGNATURE_32 ('t', 'f', 't', 'p'),\r
83cbd279 55\r
56 MTFTP4_DEFAULT_SERVER_PORT = 69,\r
57 MTFTP4_DEFAULT_TIMEOUT = 3,\r
58 MTFTP4_DEFAULT_RETRY = 5,\r
59 MTFTP4_DEFAULT_BLKSIZE = 512,\r
60 MTFTP4_TIME_TO_GETMAP = 5,\r
61\r
62 MTFTP4_STATE_UNCONFIGED = 0,\r
63 MTFTP4_STATE_CONFIGED,\r
64 MTFTP4_STATE_DESTORY\r
65};\r
66\r
67struct _MTFTP4_SERVICE {\r
68 UINT32 Signature;\r
69 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
70\r
71 BOOLEAN InDestory;\r
72\r
73 UINT16 ChildrenNum;\r
e48e37fc 74 LIST_ENTRY Children;\r
83cbd279 75\r
76 EFI_EVENT Timer; // Ticking timer for all the MTFTP clients\r
77 EFI_EVENT TimerToGetMap;\r
78\r
79 EFI_HANDLE Controller;\r
80 EFI_HANDLE Image;\r
81\r
82 //\r
83 // This UDP child is used to keep the connection between the UDP\r
84 // and MTFTP, so MTFTP will be notified when UDP is uninstalled.\r
85 //\r
86 UDP_IO_PORT *ConnectUdp;\r
87};\r
88\r
61066b8d 89typedef struct {\r
90 EFI_MTFTP4_PACKET **Packet;\r
91 UINT32 *PacketLen;\r
92 EFI_STATUS Status;\r
93} MTFTP4_GETINFO_STATE;\r
94\r
83cbd279 95struct _MTFTP4_PROTOCOL {\r
96 UINT32 Signature;\r
e48e37fc 97 LIST_ENTRY Link;\r
83cbd279 98 EFI_MTFTP4_PROTOCOL Mtftp4;\r
99\r
100 INTN State;\r
101 BOOLEAN Indestory;\r
102\r
103 MTFTP4_SERVICE *Service;\r
104 EFI_HANDLE Handle;\r
105\r
106 EFI_MTFTP4_CONFIG_DATA Config;\r
107\r
108 //\r
109 // Operation parameters: token and requested options.\r
110 //\r
111 EFI_MTFTP4_TOKEN *Token;\r
112 MTFTP4_OPTION RequestOption;\r
113 UINT16 Operation;\r
114\r
115 //\r
116 // Blocks is a list of MTFTP4_BLOCK_RANGE which contains\r
117 // holes in the file\r
118 //\r
119 UINT16 BlkSize;\r
120 UINT16 LastBlock;\r
e48e37fc 121 LIST_ENTRY Blocks;\r
83cbd279 122\r
123 //\r
124 // The server's communication end point: IP and two ports. one for\r
125 // initial request, one for its selected port.\r
126 //\r
127 IP4_ADDR ServerIp;\r
128 UINT16 ListeningPort;\r
129 UINT16 ConnectedPort;\r
130 IP4_ADDR Gateway;\r
131 UDP_IO_PORT *UnicastPort;\r
132\r
133 //\r
134 // Timeout and retransmit status\r
135 //\r
136 NET_BUF *LastPacket;\r
137 UINT32 PacketToLive;\r
138 UINT32 CurRetry;\r
139 UINT32 MaxRetry;\r
140 UINT32 Timeout;\r
141\r
142 //\r
143 // Parameter used by RRQ's multicast download.\r
144 //\r
145 IP4_ADDR McastIp;\r
146 UINT16 McastPort;\r
147 BOOLEAN Master;\r
148 UDP_IO_PORT *McastUdpPort;\r
83cbd279 149\r
61066b8d 150 MTFTP4_GETINFO_STATE GetInfoState;\r
151};\r
36ee91ca 152\r
83cbd279 153VOID\r
154Mtftp4CleanOperation (\r
155 IN MTFTP4_PROTOCOL *Instance,\r
156 IN EFI_STATUS Result\r
157 );\r
158\r
159EFI_STATUS\r
160Mtftp4WrqStart (\r
161 IN MTFTP4_PROTOCOL *Instance,\r
162 IN UINT16 Operation\r
163 );\r
164\r
165EFI_STATUS\r
166Mtftp4RrqStart (\r
167 IN MTFTP4_PROTOCOL *Instance,\r
168 IN UINT16 Operation\r
169 );\r
170\r
171#define MTFTP4_SERVICE_FROM_THIS(a) \\r
172 CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE)\r
173\r
174#define MTFTP4_PROTOCOL_FROM_THIS(a) \\r
175 CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE)\r
176\r
177extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate;\r
178#endif\r