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
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_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 */
38struct tftp_rrq {
40 char data[0];
41} __attribute__ (( packed ));
42
43/** A TFTP data (DATA) packet */
49
50/** A TFTP acknowledgement (ACK) packet */
55
56/** A TFTP error (ERROR) packet */
62
63/** A TFTP options acknowledgement (OACK) packet */
64struct tftp_oack {
66 char data[0];
67} __attribute__ (( packed ));
68
69/** The common header of all TFTP packets */
72} __attribute__ (( packed ));
73
74/** A union encapsulating all TFTP packet types */
83
84#endif /* _IPXE_TFTP_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned char uint8_t
Definition stdint.h:10
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
union tftp_any __attribute__
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
A TFTP acknowledgement (ACK) packet.
Definition tftp.h:51
uint16_t block
Definition tftp.h:53
uint16_t opcode
Definition tftp.h:52
The common header of all TFTP packets.
Definition tftp.h:70
uint16_t opcode
Definition tftp.h:71
A TFTP data (DATA) packet.
Definition tftp.h:44
uint16_t opcode
Definition tftp.h:45
uint8_t data[0]
Definition tftp.h:47
uint16_t block
Definition tftp.h:46
A TFTP error (ERROR) packet.
Definition tftp.h:57
char errmsg[0]
Definition tftp.h:60
uint16_t errcode
Definition tftp.h:59
uint16_t opcode
Definition tftp.h:58
A TFTP options acknowledgement (OACK) packet.
Definition tftp.h:64
char data[0]
Definition tftp.h:66
uint16_t opcode
Definition tftp.h:65
A TFTP read request (RRQ) packet.
Definition tftp.h:38
uint16_t opcode
Definition tftp.h:39
char data[0]
Definition tftp.h:40
A union encapsulating all TFTP packet types.
Definition tftp.h:75
struct tftp_rrq rrq
Definition tftp.h:77
struct tftp_oack oack
Definition tftp.h:81
struct tftp_error error
Definition tftp.h:80
struct tftp_common common
Definition tftp.h:76
struct tftp_data data
Definition tftp.h:78
struct tftp_ack ack
Definition tftp.h:79