tftp.h revision 171680
1193323Sed/* 2193323Sed * Copyright (c) 1983, 1993 3193323Sed * The Regents of the University of California. All rights reserved. 4193323Sed * 5193323Sed * Redistribution and use in source and binary forms, with or without 6193323Sed * modification, are permitted provided that the following conditions 7193323Sed * are met: 8193323Sed * 1. Redistributions of source code must retain the above copyright 9193323Sed * notice, this list of conditions and the following disclaimer. 10193323Sed * 2. Redistributions in binary form must reproduce the above copyright 11193323Sed * notice, this list of conditions and the following disclaimer in the 12193323Sed * documentation and/or other materials provided with the distribution. 13193323Sed * 3. All advertising materials mentioning features or use of this software 14193323Sed * must display the following acknowledgement: 15193323Sed * This product includes software developed by the University of 16193323Sed * California, Berkeley and its contributors. 17193323Sed * 4. Neither the name of the University nor the names of its contributors 18193323Sed * may be used to endorse or promote products derived from this software 19193323Sed * without specific prior written permission. 20193323Sed * 21193323Sed * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22193323Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23193323Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24193323Sed * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25195340Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26193323Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27193323Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28193323Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29193323Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30193323Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31193323Sed * SUCH DAMAGE. 32193323Sed * 33193323Sed * @(#)tftp.h 8.1 (Berkeley) 6/2/93 34193323Sed * $FreeBSD: head/include/arpa/tftp.h 171680 2007-08-01 11:59:09Z ticso $ 35193323Sed */ 36193323Sed 37193323Sed#ifndef _ARPA_TFTP_H_ 38193323Sed#define _ARPA_TFTP_H_ 39193323Sed 40193323Sed/* 41193323Sed * Trivial File Transfer Protocol (IEN-133) 42193323Sed */ 43193323Sed#define SEGSIZE 512 /* data segment size */ 44193323Sed 45193323Sed/* 46193323Sed * Packet types. 47193323Sed */ 48193323Sed#define RRQ 01 /* read request */ 49193323Sed#define WRQ 02 /* write request */ 50193323Sed#define DATA 03 /* data packet */ 51193323Sed#define ACK 04 /* acknowledgement */ 52193323Sed#define ERROR 05 /* error code */ 53193323Sed#define OACK 06 /* option acknowledgement */ 54193323Sed 55193323Sedstruct tftphdr { 56193323Sed unsigned short th_opcode; /* packet type */ 57193323Sed union { 58193323Sed unsigned short tu_block; /* block # */ 59193323Sed unsigned short tu_code; /* error code */ 60193323Sed char tu_stuff[1]; /* request packet stuff */ 61193323Sed } __packed th_u; 62193323Sed char th_data[1]; /* data or error string */ 63193323Sed} __packed; 64193323Sed 65195340Sed#define th_block th_u.tu_block 66193323Sed#define th_code th_u.tu_code 67193323Sed#define th_stuff th_u.tu_stuff 68193323Sed#define th_msg th_data 69193323Sed 70193323Sed/* 71193323Sed * Error codes. 72193323Sed */ 73193323Sed#define EUNDEF 0 /* not defined */ 74193323Sed#define ENOTFOUND 1 /* file not found */ 75193323Sed#define EACCESS 2 /* access violation */ 76193323Sed#define ENOSPACE 3 /* disk full or allocation exceeded */ 77193323Sed#define EBADOP 4 /* illegal TFTP operation */ 78193323Sed#define EBADID 5 /* unknown transfer ID */ 79195340Sed#define EEXISTS 6 /* file already exists */ 80193323Sed#define ENOUSER 7 /* no such user */ 81193323Sed#define EOPTNEG 8 /* option negotiation failed */ 82193323Sed 83193323Sed#endif /* !_TFTP_H_ */ 84193323Sed