iPXE
tftp.h
Go to the documentation of this file.
1 #ifndef _IPXE_TFTP_H
2 #define _IPXE_TFTP_H
3 
4 /** @file
5  *
6  * TFTP protocol
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 FILE_SECBOOT ( PERMITTED );
12 
13 #include <stdint.h>
14 
15 #define TFTP_PORT 69 /**< Default TFTP server port */
16 #define TFTP_DEFAULT_BLKSIZE 512 /**< Default TFTP data block size */
17 #define TFTP_MAX_BLKSIZE 1432
18 
19 #define TFTP_RRQ 1 /**< Read request opcode */
20 #define TFTP_WRQ 2 /**< Write request opcode */
21 #define TFTP_DATA 3 /**< Data block opcode */
22 #define TFTP_ACK 4 /**< Data block acknowledgement opcode */
23 #define TFTP_ERROR 5 /**< Error opcode */
24 #define TFTP_OACK 6 /**< Options acknowledgement opcode */
25 
26 #define TFTP_ERR_FILE_NOT_FOUND 1 /**< File not found */
27 #define TFTP_ERR_ACCESS_DENIED 2 /**< Access violation */
28 #define TFTP_ERR_DISK_FULL 3 /**< Disk full or allocation exceeded */
29 #define TFTP_ERR_ILLEGAL_OP 4 /**< Illegal TFTP operation */
30 #define TFTP_ERR_UNKNOWN_TID 5 /**< Unknown transfer ID */
31 #define TFTP_ERR_FILE_EXISTS 6 /**< File already exists */
32 #define TFTP_ERR_UNKNOWN_USER 7 /**< No such user */
33 #define TFTP_ERR_BAD_OPTS 8 /**< Option negotiation failed */
34 
35 #define MTFTP_PORT 1759 /**< Default MTFTP server port */
36 
37 /** A TFTP read request (RRQ) packet */
38 struct tftp_rrq {
40  char data[0];
41 } __attribute__ (( packed ));
42 
43 /** A TFTP data (DATA) packet */
44 struct tftp_data {
48 } __attribute__ (( packed ));
49 
50 /** A TFTP acknowledgement (ACK) packet */
51 struct tftp_ack {
54 } __attribute__ (( packed ));
55 
56 /** A TFTP error (ERROR) packet */
57 struct tftp_error {
60  char errmsg[0];
61 } __attribute__ (( packed ));
62 
63 /** A TFTP options acknowledgement (OACK) packet */
64 struct tftp_oack {
66  char data[0];
67 } __attribute__ (( packed ));
68 
69 /** The common header of all TFTP packets */
70 struct tftp_common {
72 } __attribute__ (( packed ));
73 
74 /** A union encapsulating all TFTP packet types */
75 union tftp_any {
77  struct tftp_rrq rrq;
78  struct tftp_data data;
79  struct tftp_ack ack;
80  struct tftp_error error;
81  struct tftp_oack oack;
82 };
83 
84 #endif /* _IPXE_TFTP_H */
unsigned short uint16_t
Definition: stdint.h:11
A TFTP options acknowledgement (OACK) packet.
Definition: tftp.h:64
uint16_t opcode
Definition: tftp.h:52
uint16_t block
Definition: tftp.h:53
struct tftp_rrq rrq
Definition: tftp.h:77
struct tftp_common common
Definition: tftp.h:76
A TFTP data (DATA) packet.
Definition: tftp.h:44
uint16_t opcode
Definition: tftp.h:71
uint16_t block
Definition: tftp.h:46
uint8_t data[0]
Definition: tftp.h:47
uint16_t errcode
Definition: tftp.h:59
FILE_SECBOOT(PERMITTED)
uint16_t opcode
Definition: tftp.h:39
uint16_t opcode
Definition: tftp.h:65
unsigned char uint8_t
Definition: stdint.h:10
char data[0]
Definition: tftp.h:66
The common header of all TFTP packets.
Definition: tftp.h:70
char data[0]
Definition: tftp.h:40
A TFTP read request (RRQ) packet.
Definition: tftp.h:38
uint16_t opcode
Definition: tftp.h:58
char errmsg[0]
Definition: tftp.h:60
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct tftp_oack oack
Definition: tftp.h:81
struct tftp_ack ack
Definition: tftp.h:79
struct tftp_error error
Definition: tftp.h:80
A union encapsulating all TFTP packet types.
Definition: tftp.h:75
struct tftp_data data
Definition: tftp.h:78
union tftp_any __attribute__
uint16_t opcode
Definition: tftp.h:45
A TFTP acknowledgement (ACK) packet.
Definition: tftp.h:51
A TFTP error (ERROR) packet.
Definition: tftp.h:57