]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/PxeBcDxe/Tftp.h
3 Copyright (c) 2004, 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.
24 // Definitions for trivial file transfer protocol functionality with IP v4
25 // Per RFC 1350, July 1992 and RFC 2347, 8, and 9, May 1998
29 // max and min packet sizes
30 // (all data packets in transmission except last)
32 #define MAX_TFTP_PKT_SIZE (BUFFER_ALLOCATE_SIZE - 512)
33 #define MIN_TFTP_PKT_SIZE 512
38 #define TFTP_RRQ 1 // read request
39 #define TFTP_WRQ 2 // write request
40 #define TFTP_DATA 3 // data
41 #define TFTP_ACK 4 // acknowledgement
42 #define TFTP_ERROR 5 // error packet
43 #define TFTP_OACK 6 // option acknowledge
44 #define TFTP_DIR 7 // read directory request
49 // request packet (read or write)
50 // Fields shown (except file name) are not to be referenced directly,
51 // since their placement is variable within a request packet.
52 // All are null terminated case insensitive ascii strings.
55 UINT16 OpCode
; // TFTP Op code
56 UINT8 FileName
[2]; // file name
57 UINT8 Mode
[2]; // "netascii" or "octet"
58 struct { // optionally, one or more option requests
59 UINT8 Option
[2]; // option name
60 UINT8 Value
[2]; // value requested
67 #define MODE_ASCII "netascii"
68 #define MODE_BINARY "octet"
73 #define OP_BLKSIZE "blksize" // block size option
74 #define OP_TIMEOUT "timeout" // time to wait before retransmitting
75 #define OP_TFRSIZE "tsize" // total transfer size option
76 #define OP_OVERWRITE "overwrite" // overwrite file option
77 #define OP_BIGBLKNUM "bigblk#" // big block number
78 // See RFC 2347, 8, and 9 for more information on TFTP options
79 // option acknowledge packet (optional)
80 // options not acknowledged are rejected
83 UINT16 OpCode
; // TFTP Op code
84 struct { // optionally, one or more option acknowledgements
85 UINT8 Option
[2]; // option name (of those requested)
86 UINT8 Value
[2]; // value acknowledged
94 UINT16 OpCode
; // TFTP Op code
102 struct Tftpv4Ack Header
;
107 // big block number ack packet
115 // big block number data packet
118 struct Tftpv4Ack8 Header
;
126 UINT16 OpCode
; // TFTP Op code
127 UINT16 ErrCode
; // error code
128 UINT8 ErrMsg
[1]; // error message (nul terminated)
135 #define TFTP_ERR_UNDEF 0 // Not defined, see error message (if any).
136 #define TFTP_ERR_NOT_FOUND 1 // File not found.
137 #define TFTP_ERR_ACCESS 2 // Access violation.
138 #define TFTP_ERR_FULL 3 // Disk full or allocation exceeded.
139 #define TFTP_ERR_ILLEGAL 4 // Illegal TFTP operation.
140 #define TFTP_ERR_BAD_ID 5 // Unknown transfer ID.
141 #define TFTP_ERR_EXISTS 6 // File already exists.
142 #define TFTP_ERR_NO_USER 7 // No such user.
143 #define TFTP_ERR_OPTION 8 // Option negotiation termination
147 #define REQ_RESP_TIMEOUT 5 // Wait five seconds for request response.
148 #define ACK_TIMEOUT 4 // Wait four seconds for ack response.
149 #define NUM_ACK_RETRIES 3
150 #define NUM_MTFTP_OPEN_RETRIES 3
152 #endif /* __TFTP_H__ */