1 /* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)tftp.h 8.1 (Berkeley) 06/02/93 8 */ 9 10 #ifndef _TFTP_H_ 11 #define _TFTP_H_ 12 13 /* 14 * Trivial File Transfer Protocol (IEN-133) 15 */ 16 #define SEGSIZE 512 /* data segment size */ 17 18 /* 19 * Packet types. 20 */ 21 #define RRQ 01 /* read request */ 22 #define WRQ 02 /* write request */ 23 #define DATA 03 /* data packet */ 24 #define ACK 04 /* acknowledgement */ 25 #define ERROR 05 /* error code */ 26 27 struct tftphdr { 28 short th_opcode; /* packet type */ 29 union { 30 short tu_block; /* block # */ 31 short tu_code; /* error code */ 32 char tu_stuff[1]; /* request packet stuff */ 33 } th_u; 34 char th_data[1]; /* data or error string */ 35 }; 36 37 #define th_block th_u.tu_block 38 #define th_code th_u.tu_code 39 #define th_stuff th_u.tu_stuff 40 #define th_msg th_data 41 42 /* 43 * Error codes. 44 */ 45 #define EUNDEF 0 /* not defined */ 46 #define ENOTFOUND 1 /* file not found */ 47 #define EACCESS 2 /* access violation */ 48 #define ENOSPACE 3 /* disk full or allocation exceeded */ 49 #define EBADOP 4 /* illegal TFTP operation */ 50 #define EBADID 5 /* unknown transfer ID */ 51 #define EEXISTS 6 /* file already exists */ 52 #define ENOUSER 7 /* no such user */ 53 54 #endif /* !_TFTP_H_ */ 55