3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. 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
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.
18 Mtftp4 Implementation, it supports the following RFCs:
19 RFC1350 - THE TFTP PROTOCOL (REVISION 2)
20 RFC2090 - TFTP Multicast Option
21 RFC2347 - TFTP Option Extension
22 RFC2348 - TFTP Blocksize Option
23 RFC2349 - TFTP Timeout Interval and Transfer Size Options
28 #ifndef __EFI_MTFTP4_IMPL_H__
29 #define __EFI_MTFTP4_IMPL_H__
33 #include <Protocol/Udp4.h>
34 #include <Protocol/Mtftp4.h>
36 #include <Library/DebugLib.h>
37 #include <Library/UefiDriverEntryPoint.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/UefiLib.h>
40 #include <Library/BaseLib.h>
41 #include <Library/UdpIoLib.h>
42 #include <Library/MemoryAllocationLib.h>
43 #include <Library/BaseMemoryLib.h>
45 typedef struct _MTFTP4_SERVICE MTFTP4_SERVICE
;
46 typedef struct _MTFTP4_PROTOCOL MTFTP4_PROTOCOL
;
48 #include "Mtftp4Driver.h"
49 #include "Mtftp4Option.h"
50 #include "Mtftp4Support.h"
53 MTFTP4_SERVICE_SIGNATURE
= EFI_SIGNATURE_32 ('T', 'F', 'T', 'P'),
54 MTFTP4_PROTOCOL_SIGNATURE
= EFI_SIGNATURE_32 ('t', 'f', 't', 'p'),
56 MTFTP4_DEFAULT_SERVER_PORT
= 69,
57 MTFTP4_DEFAULT_TIMEOUT
= 3,
58 MTFTP4_DEFAULT_RETRY
= 5,
59 MTFTP4_DEFAULT_BLKSIZE
= 512,
60 MTFTP4_TIME_TO_GETMAP
= 5,
62 MTFTP4_STATE_UNCONFIGED
= 0,
63 MTFTP4_STATE_CONFIGED
,
67 struct _MTFTP4_SERVICE
{
69 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
76 EFI_EVENT Timer
; // Ticking timer for all the MTFTP clients
77 EFI_EVENT TimerToGetMap
;
79 EFI_HANDLE Controller
;
83 // This UDP child is used to keep the connection between the UDP
84 // and MTFTP, so MTFTP will be notified when UDP is uninstalled.
86 UDP_IO_PORT
*ConnectUdp
;
90 EFI_MTFTP4_PACKET
**Packet
;
93 } MTFTP4_GETINFO_STATE
;
95 struct _MTFTP4_PROTOCOL
{
98 EFI_MTFTP4_PROTOCOL Mtftp4
;
103 MTFTP4_SERVICE
*Service
;
106 EFI_MTFTP4_CONFIG_DATA Config
;
109 // Operation parameters: token and requested options.
111 EFI_MTFTP4_TOKEN
*Token
;
112 MTFTP4_OPTION RequestOption
;
116 // Blocks is a list of MTFTP4_BLOCK_RANGE which contains
124 // The server's communication end point: IP and two ports. one for
125 // initial request, one for its selected port.
128 UINT16 ListeningPort
;
129 UINT16 ConnectedPort
;
131 UDP_IO_PORT
*UnicastPort
;
134 // Timeout and retransmit status
143 // Parameter used by RRQ's multicast download.
148 UDP_IO_PORT
*McastUdpPort
;
150 MTFTP4_GETINFO_STATE GetInfoState
;
154 Mtftp4CleanOperation (
155 IN MTFTP4_PROTOCOL
*Instance
,
161 IN MTFTP4_PROTOCOL
*Instance
,
167 IN MTFTP4_PROTOCOL
*Instance
,
171 #define MTFTP4_SERVICE_FROM_THIS(a) \
172 CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE)
174 #define MTFTP4_PROTOCOL_FROM_THIS(a) \
175 CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE)
177 extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate
;