TianoCore EDK2 master
Loading...
Searching...
No Matches
Mtftp4Impl.h
Go to the documentation of this file.
1
18#ifndef __EFI_MTFTP4_IMPL_H__
19#define __EFI_MTFTP4_IMPL_H__
20
21#include <Uefi.h>
22
23#include <Protocol/Udp4.h>
24#include <Protocol/Mtftp4.h>
25
26#include <Library/DebugLib.h>
30#include <Library/UdpIoLib.h>
31#include <Library/PrintLib.h>
32
33extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate;
34
35typedef struct _MTFTP4_SERVICE MTFTP4_SERVICE;
37
38#include "Mtftp4Driver.h"
39#include "Mtftp4Option.h"
40#include "Mtftp4Support.h"
41
45#define MTFTP4_SERVICE_SIGNATURE SIGNATURE_32 ('T', 'F', 'T', 'P')
46#define MTFTP4_PROTOCOL_SIGNATURE SIGNATURE_32 ('t', 'f', 't', 'p')
47
48#define MTFTP4_DEFAULT_SERVER_PORT 69
49#define MTFTP4_DEFAULT_TIMEOUT 3
50#define MTFTP4_DEFAULT_RETRY 5
51#define MTFTP4_DEFAULT_BLKSIZE 512
52#define MTFTP4_DEFAULT_WINDOWSIZE 1
53#define MTFTP4_TIME_TO_GETMAP 5
54
55#define MTFTP4_STATE_UNCONFIGED 0
56#define MTFTP4_STATE_CONFIGED 1
57#define MTFTP4_STATE_DESTROY 2
58
63 UINT32 Signature;
64 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
65
66 UINT16 ChildrenNum;
67 LIST_ENTRY Children;
68
71 EFI_EVENT TimerToGetMap;
72
73 EFI_HANDLE Controller;
74 EFI_HANDLE Image;
75
76 //
77 // This UDP child is used to keep the connection between the UDP
78 // and MTFTP, so MTFTP will be notified when UDP is uninstalled.
79 //
80 UDP_IO *ConnectUdp;
81};
82
83typedef struct {
84 EFI_MTFTP4_PACKET **Packet;
85 UINT32 *PacketLen;
86 EFI_STATUS Status;
88
90 UINT32 Signature;
91 LIST_ENTRY Link;
93
94 INTN State;
95 BOOLEAN InDestroy;
96
97 MTFTP4_SERVICE *Service;
98 EFI_HANDLE Handle;
99
101
102 //
103 // Operation parameters: token and requested options.
104 //
105 EFI_MTFTP4_TOKEN *Token;
106 MTFTP4_OPTION RequestOption;
107 UINT16 Operation;
108
109 //
110 // Blocks is a list of MTFTP4_BLOCK_RANGE which contains
111 // holes in the file
112 //
113 UINT16 BlkSize;
114 UINT16 LastBlock;
115 LIST_ENTRY Blocks;
116
117 UINT16 WindowSize;
118
119 //
120 // Record the total received and saved block number.
121 //
122 UINT64 TotalBlock;
123
124 //
125 // Record the acked block number.
126 //
127 UINT64 AckedBlock;
128
129 //
130 // The server's communication end point: IP and two ports. one for
131 // initial request, one for its selected port.
132 //
133 IP4_ADDR ServerIp;
134 UINT16 ListeningPort;
135 UINT16 ConnectedPort;
136 IP4_ADDR Gateway;
137 UDP_IO *UnicastPort;
138
139 //
140 // Timeout and retransmit status
141 //
142 NET_BUF *LastPacket;
143 UINT32 PacketToLive;
144 BOOLEAN HasTimeout;
145 UINT32 CurRetry;
146 UINT32 MaxRetry;
147 UINT32 Timeout;
148
149 //
150 // Parameter used by RRQ's multicast download.
151 //
152 IP4_ADDR McastIp;
153 UINT16 McastPort;
154 BOOLEAN Master;
155 UDP_IO *McastUdpPort;
156};
157
158typedef struct {
159 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
160 UINTN NumberOfChildren;
161 EFI_HANDLE *ChildHandleBuffer;
163
171VOID
173 IN OUT MTFTP4_PROTOCOL *Instance,
174 IN EFI_STATUS Result
175 );
176
193 IN MTFTP4_PROTOCOL *Instance,
194 IN UINT16 Operation
195 );
196
213 IN MTFTP4_PROTOCOL *Instance,
214 IN UINT16 Operation
215 );
216
217#define MTFTP4_SERVICE_FROM_THIS(a) \
218 CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE)
219
220#define MTFTP4_PROTOCOL_FROM_THIS(a) \
221 CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE)
222
223#endif
UINT64 UINTN
INT64 INTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS Mtftp4RrqStart(IN MTFTP4_PROTOCOL *Instance, IN UINT16 Operation)
Definition: Mtftp4Rrq.c:45
EFI_STATUS Mtftp4WrqStart(IN MTFTP4_PROTOCOL *Instance, IN UINT16 Operation)
Definition: Mtftp4Wrq.c:491
VOID Mtftp4CleanOperation(IN OUT MTFTP4_PROTOCOL *Instance, IN EFI_STATUS Result)
Definition: Mtftp4Impl.c:20
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_EVENT Timer
Ticking timer for all the MTFTP clients to handle the packet timeout case.
Definition: Mtftp4Impl.h:69
EFI_EVENT TimerNotifyLevel
Ticking timer for all the MTFTP clients to calculate the packet live time.
Definition: Mtftp4Impl.h:70