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
;
74 NET_LIST_ENTRY Children
;
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
;
89 struct _MTFTP4_PROTOCOL
{
92 EFI_MTFTP4_PROTOCOL Mtftp4
;
97 MTFTP4_SERVICE
*Service
;
100 EFI_MTFTP4_CONFIG_DATA Config
;
103 // Operation parameters: token and requested options.
105 EFI_MTFTP4_TOKEN
*Token
;
106 MTFTP4_OPTION RequestOption
;
110 // Blocks is a list of MTFTP4_BLOCK_RANGE which contains
115 NET_LIST_ENTRY Blocks
;
118 // The server's communication end point: IP and two ports. one for
119 // initial request, one for its selected port.
122 UINT16 ListeningPort
;
123 UINT16 ConnectedPort
;
125 UDP_IO_PORT
*UnicastPort
;
128 // Timeout and retransmit status
137 // Parameter used by RRQ's multicast download.
142 UDP_IO_PORT
*McastUdpPort
;
146 EFI_MTFTP4_PACKET
**Packet
;
149 } MTFTP4_GETINFO_STATE
;
152 Mtftp4CleanOperation (
153 IN MTFTP4_PROTOCOL
*Instance
,
159 IN MTFTP4_PROTOCOL
*Instance
,
165 IN MTFTP4_PROTOCOL
*Instance
,
169 #define MTFTP4_SERVICE_FROM_THIS(a) \
170 CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE)
172 #define MTFTP4_PROTOCOL_FROM_THIS(a) \
173 CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE)
175 extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate
;