169d94ecaSdist /* 2*8b1e416aSbostic * Copyright (c) 1983, 1993 3*8b1e416aSbostic * The Regents of the University of California. All rights reserved. 469d94ecaSdist * 5cc3d99f9Sbostic * %sccs.include.redist.c% 6e07d0983Sbostic * 7*8b1e416aSbostic * @(#)tftp.h 8.1 (Berkeley) 06/02/93 869d94ecaSdist */ 99de3f1a2Ssam 1071dbeec7Sbostic #ifndef _TFTP_H_ 1171dbeec7Sbostic #define _TFTP_H_ 1271dbeec7Sbostic 139de3f1a2Ssam /* 149de3f1a2Ssam * Trivial File Transfer Protocol (IEN-133) 159de3f1a2Ssam */ 169de3f1a2Ssam #define SEGSIZE 512 /* data segment size */ 179de3f1a2Ssam 189de3f1a2Ssam /* 199de3f1a2Ssam * Packet types. 209de3f1a2Ssam */ 219de3f1a2Ssam #define RRQ 01 /* read request */ 229de3f1a2Ssam #define WRQ 02 /* write request */ 239de3f1a2Ssam #define DATA 03 /* data packet */ 249de3f1a2Ssam #define ACK 04 /* acknowledgement */ 259de3f1a2Ssam #define ERROR 05 /* error code */ 269de3f1a2Ssam 279de3f1a2Ssam struct tftphdr { 289de3f1a2Ssam short th_opcode; /* packet type */ 299de3f1a2Ssam union { 309de3f1a2Ssam short tu_block; /* block # */ 319de3f1a2Ssam short tu_code; /* error code */ 329de3f1a2Ssam char tu_stuff[1]; /* request packet stuff */ 339de3f1a2Ssam } th_u; 349de3f1a2Ssam char th_data[1]; /* data or error string */ 359de3f1a2Ssam }; 369de3f1a2Ssam 379de3f1a2Ssam #define th_block th_u.tu_block 389de3f1a2Ssam #define th_code th_u.tu_code 399de3f1a2Ssam #define th_stuff th_u.tu_stuff 409de3f1a2Ssam #define th_msg th_data 419de3f1a2Ssam 429de3f1a2Ssam /* 439de3f1a2Ssam * Error codes. 449de3f1a2Ssam */ 459de3f1a2Ssam #define EUNDEF 0 /* not defined */ 469de3f1a2Ssam #define ENOTFOUND 1 /* file not found */ 479de3f1a2Ssam #define EACCESS 2 /* access violation */ 489de3f1a2Ssam #define ENOSPACE 3 /* disk full or allocation exceeded */ 499de3f1a2Ssam #define EBADOP 4 /* illegal TFTP operation */ 509de3f1a2Ssam #define EBADID 5 /* unknown transfer ID */ 519de3f1a2Ssam #define EEXISTS 6 /* file already exists */ 529de3f1a2Ssam #define ENOUSER 7 /* no such user */ 5371dbeec7Sbostic 5471dbeec7Sbostic #endif /* !_TFTP_H_ */ 55