Commit | Line | Data |
---|---|---|
a4f80d4c | 1 | /* tftp.h 4.2 83/06/11 */ |
1e82972c SL |
2 | |
3 | /* | |
4 | * Trivial File Transfer Protocol (IEN-133) | |
5 | */ | |
6 | #define SEGSIZE 512 /* data segment size */ | |
1e82972c SL |
7 | |
8 | /* | |
9 | * Packet types. | |
10 | */ | |
11 | #define RRQ 01 /* read request */ | |
12 | #define WRQ 02 /* write request */ | |
13 | #define DATA 03 /* data packet */ | |
14 | #define ACK 04 /* acknowledgement */ | |
15 | #define ERROR 05 /* error code */ | |
16 | ||
17 | struct tftphdr { | |
18 | short th_opcode; /* packet type */ | |
19 | union { | |
20 | short tu_block; /* block # */ | |
21 | short tu_code; /* error code */ | |
22 | char tu_stuff[1]; /* request packet stuff */ | |
23 | } th_u; | |
24 | char th_data[1]; /* data or error string */ | |
25 | }; | |
26 | ||
27 | #define th_block th_u.tu_block | |
28 | #define th_code th_u.tu_code | |
29 | #define th_stuff th_u.tu_stuff | |
30 | #define th_msg th_data | |
31 | ||
32 | /* | |
33 | * Error codes. | |
34 | */ | |
35 | #define EUNDEF 0 /* not defined */ | |
36 | #define ENOTFOUND 1 /* file not found */ | |
37 | #define EACCESS 2 /* access violation */ | |
38 | #define ENOSPACE 3 /* disk full or allocation exceeded */ | |
39 | #define EBADOP 4 /* illegal TFTP operation */ | |
40 | #define EBADID 5 /* unknown transfer ID */ | |
41 | #define EEXISTS 6 /* file already exists */ | |
42 | #define ENOUSER 7 /* no such user */ |