1214478Srpaulo/* @(#) $Header: /tcpdump/master/tcpdump/tftp.h,v 1.2 2008-04-11 16:47:38 gianluca Exp $ (LBL) */ 2172683Smlaier/* 3172683Smlaier * Copyright (c) 1983, 1993 4172683Smlaier * The Regents of the University of California. All rights reserved. 5172683Smlaier * 6172683Smlaier * Redistribution and use in source and binary forms, with or without 7172683Smlaier * modification, are permitted provided that the following conditions 8172683Smlaier * are met: 9172683Smlaier * 1. Redistributions of source code must retain the above copyright 10172683Smlaier * notice, this list of conditions and the following disclaimer. 11172683Smlaier * 2. Redistributions in binary form must reproduce the above copyright 12172683Smlaier * notice, this list of conditions and the following disclaimer in the 13172683Smlaier * documentation and/or other materials provided with the distribution. 14172683Smlaier * 3. All advertising materials mentioning features or use of this software 15172683Smlaier * must display the following acknowledgement: 16172683Smlaier * This product includes software developed by the University of 17172683Smlaier * California, Berkeley and its contributors. 18172683Smlaier * 4. Neither the name of the University nor the names of its contributors 19172683Smlaier * may be used to endorse or promote products derived from this software 20172683Smlaier * without specific prior written permission. 21172683Smlaier * 22172683Smlaier * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23172683Smlaier * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24172683Smlaier * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25172683Smlaier * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26172683Smlaier * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27172683Smlaier * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28172683Smlaier * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29172683Smlaier * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30172683Smlaier * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31172683Smlaier * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32172683Smlaier * SUCH DAMAGE. 33172683Smlaier * 34172683Smlaier * @(#)tftp.h 8.1 (Berkeley) 6/2/93 35172683Smlaier */ 36172683Smlaier 37172683Smlaier#ifndef _TFTP_H_ 38172683Smlaier#define _TFTP_H_ 39172683Smlaier 40172683Smlaier/* 41172683Smlaier * Trivial File Transfer Protocol (IEN-133) 42172683Smlaier */ 43172683Smlaier#define SEGSIZE 512 /* data segment size */ 44172683Smlaier 45172683Smlaier/* 46172683Smlaier * Packet types. 47172683Smlaier */ 48172683Smlaier#define RRQ 01 /* read request */ 49172683Smlaier#define WRQ 02 /* write request */ 50172683Smlaier#define DATA 03 /* data packet */ 51172683Smlaier#define ACK 04 /* acknowledgement */ 52190207Srpaulo#define TFTP_ERROR 05 /* error code */ 53172683Smlaier#define OACK 06 /* option acknowledgement */ 54172683Smlaier 55172683Smlaierstruct tftphdr { 56172683Smlaier unsigned short th_opcode; /* packet type */ 57172683Smlaier union { 58172683Smlaier unsigned short tu_block; /* block # */ 59172683Smlaier unsigned short tu_code; /* error code */ 60172683Smlaier char tu_stuff[1]; /* request packet stuff */ 61172683Smlaier } th_u; 62172683Smlaier char th_data[1]; /* data or error string */ 63172683Smlaier}; 64172683Smlaier 65172683Smlaier#define th_block th_u.tu_block 66172683Smlaier#define th_code th_u.tu_code 67172683Smlaier#define th_stuff th_u.tu_stuff 68172683Smlaier#define th_msg th_data 69172683Smlaier 70172683Smlaier/* 71172683Smlaier * Error codes. 72172683Smlaier */ 73172683Smlaier#define EUNDEF 0 /* not defined */ 74172683Smlaier#define ENOTFOUND 1 /* file not found */ 75172683Smlaier#define EACCESS 2 /* access violation */ 76172683Smlaier#define ENOSPACE 3 /* disk full or allocation exceeded */ 77172683Smlaier#define EBADOP 4 /* illegal TFTP operation */ 78172683Smlaier#define EBADID 5 /* unknown transfer ID */ 79172683Smlaier#define EEXISTS 6 /* file already exists */ 80172683Smlaier#define ENOUSER 7 /* no such user */ 81172683Smlaier 82172683Smlaier#endif /* !_TFTP_H_ */ 83