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