]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
1. Add DPC protocol and DpcLib library in MdeModulePkg.
[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
53 MTFTP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('T', 'F', 'T', 'P'),\r
54 MTFTP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('t', 'f', 't', 'p'),\r
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
74 NET_LIST_ENTRY Children;\r
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
83cbd279 89struct _MTFTP4_PROTOCOL {\r
90 UINT32 Signature;\r
91 NET_LIST_ENTRY Link;\r
92 EFI_MTFTP4_PROTOCOL Mtftp4;\r
93\r
94 INTN State;\r
95 BOOLEAN Indestory;\r
96\r
97 MTFTP4_SERVICE *Service;\r
98 EFI_HANDLE Handle;\r
99\r
100 EFI_MTFTP4_CONFIG_DATA Config;\r
101\r
102 //\r
103 // Operation parameters: token and requested options.\r
104 //\r
105 EFI_MTFTP4_TOKEN *Token;\r
106 MTFTP4_OPTION RequestOption;\r
107 UINT16 Operation;\r
108\r
109 //\r
110 // Blocks is a list of MTFTP4_BLOCK_RANGE which contains\r
111 // holes in the file\r
112 //\r
113 UINT16 BlkSize;\r
114 UINT16 LastBlock;\r
115 NET_LIST_ENTRY Blocks;\r
116\r
117 //\r
118 // The server's communication end point: IP and two ports. one for\r
119 // initial request, one for its selected port.\r
120 //\r
121 IP4_ADDR ServerIp;\r
122 UINT16 ListeningPort;\r
123 UINT16 ConnectedPort;\r
124 IP4_ADDR Gateway;\r
125 UDP_IO_PORT *UnicastPort;\r
126\r
127 //\r
128 // Timeout and retransmit status\r
129 //\r
130 NET_BUF *LastPacket;\r
131 UINT32 PacketToLive;\r
132 UINT32 CurRetry;\r
133 UINT32 MaxRetry;\r
134 UINT32 Timeout;\r
135\r
136 //\r
137 // Parameter used by RRQ's multicast download.\r
138 //\r
139 IP4_ADDR McastIp;\r
140 UINT16 McastPort;\r
141 BOOLEAN Master;\r
142 UDP_IO_PORT *McastUdpPort;\r
83cbd279 143};\r
144\r
36ee91ca 145typedef struct {\r
146 EFI_MTFTP4_PACKET **Packet;\r
147 UINT32 *PacketLen;\r
148 EFI_STATUS Status;\r
149} MTFTP4_GETINFO_STATE;\r
150\r
83cbd279 151VOID\r
152Mtftp4CleanOperation (\r
153 IN MTFTP4_PROTOCOL *Instance,\r
154 IN EFI_STATUS Result\r
155 );\r
156\r
157EFI_STATUS\r
158Mtftp4WrqStart (\r
159 IN MTFTP4_PROTOCOL *Instance,\r
160 IN UINT16 Operation\r
161 );\r
162\r
163EFI_STATUS\r
164Mtftp4RrqStart (\r
165 IN MTFTP4_PROTOCOL *Instance,\r
166 IN UINT16 Operation\r
167 );\r
168\r
169#define MTFTP4_SERVICE_FROM_THIS(a) \\r
170 CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE)\r
171\r
172#define MTFTP4_PROTOCOL_FROM_THIS(a) \\r
173 CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE)\r
174\r
175extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate;\r
176#endif\r