Blame inet/arpa/tftp.h

Packit 6c4009
/*
Packit 6c4009
 * Copyright (c) 1983, 1993
Packit 6c4009
 *	The Regents of the University of California.  All rights reserved.
Packit 6c4009
 *
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions
Packit 6c4009
 * are met:
Packit 6c4009
 * 1. Redistributions of source code must retain the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer.
Packit 6c4009
 * 2. Redistributions in binary form must reproduce the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer in the
Packit 6c4009
 *    documentation and/or other materials provided with the distribution.
Packit 6c4009
 * 4. Neither the name of the University nor the names of its contributors
Packit 6c4009
 *    may be used to endorse or promote products derived from this software
Packit 6c4009
 *    without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit 6c4009
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 6c4009
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 6c4009
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit 6c4009
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit 6c4009
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit 6c4009
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit 6c4009
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit 6c4009
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit 6c4009
 * SUCH DAMAGE.
Packit 6c4009
 *
Packit 6c4009
 *	@(#)tftp.h	8.1 (Berkeley) 6/2/93
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef _ARPA_TFTP_H
Packit 6c4009
#define	_ARPA_TFTP_H 1
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Trivial File Transfer Protocol (IEN-133)
Packit 6c4009
 */
Packit 6c4009
#define	SEGSIZE		512		/* data segment size */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Packet types.
Packit 6c4009
 */
Packit 6c4009
#define	RRQ	01				/* read request */
Packit 6c4009
#define	WRQ	02				/* write request */
Packit 6c4009
#define	DATA	03				/* data packet */
Packit 6c4009
#define	ACK	04				/* acknowledgement */
Packit 6c4009
#define	ERROR	05				/* error code */
Packit 6c4009
Packit 6c4009
struct	tftphdr {
Packit 6c4009
	short	th_opcode;			/* packet type */
Packit 6c4009
	union {
Packit 6c4009
		char	tu_padding[3];		/* sizeof() compat */
Packit 6c4009
		struct {
Packit 6c4009
			union {
Packit 6c4009
				unsigned short	tu_block;	/* block # */
Packit 6c4009
				short	tu_code;		/* error code */
Packit 6c4009
			} __attribute__ ((__packed__)) th_u3;
Packit 6c4009
			char tu_data[0];	/* data or error string */
Packit 6c4009
		} __attribute__ ((__packed__)) th_u2;
Packit 6c4009
		char	tu_stuff[0];		/* request packet stuff */
Packit 6c4009
	} __attribute__ ((__packed__)) th_u1;
Packit 6c4009
} __attribute__ ((__packed__));
Packit 6c4009
Packit 6c4009
#define	th_block	th_u1.th_u2.th_u3.tu_block
Packit 6c4009
#define	th_code		th_u1.th_u2.th_u3.tu_code
Packit 6c4009
#define	th_stuff	th_u1.tu_stuff
Packit 6c4009
#define	th_data		th_u1.th_u2.tu_data
Packit 6c4009
#define	th_msg		th_u1.th_u2.tu_data
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Error codes.
Packit 6c4009
 */
Packit 6c4009
#define	EUNDEF		0		/* not defined */
Packit 6c4009
#define	ENOTFOUND	1		/* file not found */
Packit 6c4009
#define	EACCESS		2		/* access violation */
Packit 6c4009
#define	ENOSPACE	3		/* disk full or allocation exceeded */
Packit 6c4009
#define	EBADOP		4		/* illegal TFTP operation */
Packit 6c4009
#define	EBADID		5		/* unknown transfer ID */
Packit 6c4009
#define	EEXISTS		6		/* file already exists */
Packit 6c4009
#define	ENOUSER		7		/* no such user */
Packit 6c4009
Packit 6c4009
#endif /* arpa/tftp.h */