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