tftp.h revision 83047
1201360Srdivacky/*
2201360Srdivacky * Copyright (c) 1983, 1993
3201360Srdivacky *	The Regents of the University of California.  All rights reserved.
4201360Srdivacky *
5201360Srdivacky * Redistribution and use in source and binary forms, with or without
6201360Srdivacky * modification, are permitted provided that the following conditions
7201360Srdivacky * are met:
8201360Srdivacky * 1. Redistributions of source code must retain the above copyright
9201360Srdivacky *    notice, this list of conditions and the following disclaimer.
10201360Srdivacky * 2. Redistributions in binary form must reproduce the above copyright
11201360Srdivacky *    notice, this list of conditions and the following disclaimer in the
12201360Srdivacky *    documentation and/or other materials provided with the distribution.
13249423Sdim * 3. All advertising materials mentioning features or use of this software
14201360Srdivacky *    must display the following acknowledgement:
15201360Srdivacky *	This product includes software developed by the University of
16201360Srdivacky *	California, Berkeley and its contributors.
17239462Sdim * 4. Neither the name of the University nor the names of its contributors
18201360Srdivacky *    may be used to endorse or promote products derived from this software
19201360Srdivacky *    without specific prior written permission.
20201360Srdivacky *
21201360Srdivacky * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22201360Srdivacky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23201360Srdivacky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24201360Srdivacky * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25201360Srdivacky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26201360Srdivacky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27201360Srdivacky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28201360Srdivacky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29201360Srdivacky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30201360Srdivacky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31201360Srdivacky * SUCH DAMAGE.
32201360Srdivacky *
33201360Srdivacky *	@(#)tftp.h	8.1 (Berkeley) 6/2/93
34201360Srdivacky * $FreeBSD: head/include/arpa/tftp.h 83047 2001-09-05 01:36:46Z obrien $
35201360Srdivacky */
36201360Srdivacky
37201360Srdivacky#ifndef _ARPA_TFTP_H_
38201360Srdivacky#define	_ARPA_TFTP_H_
39201360Srdivacky
40/*
41 * Trivial File Transfer Protocol (IEN-133)
42 */
43#define	SEGSIZE		512		/* data segment size */
44
45/*
46 * Packet types.
47 */
48#define	RRQ	01			/* read request */
49#define	WRQ	02			/* write request */
50#define	DATA	03			/* data packet */
51#define	ACK	04			/* acknowledgement */
52#define	ERROR	05			/* error code */
53
54struct tftphdr {
55	unsigned short	th_opcode;		/* packet type */
56	union {
57		unsigned short	tu_block;	/* block # */
58		unsigned short	tu_code;	/* error code */
59		char	tu_stuff[1];	/* request packet stuff */
60	} th_u;
61	char	th_data[1];		/* data or error string */
62};
63
64#define	th_block	th_u.tu_block
65#define	th_code		th_u.tu_code
66#define	th_stuff	th_u.tu_stuff
67#define	th_msg		th_data
68
69/*
70 * Error codes.
71 */
72#define	EUNDEF		0		/* not defined */
73#define	ENOTFOUND	1		/* file not found */
74#define	EACCESS		2		/* access violation */
75#define	ENOSPACE	3		/* disk full or allocation exceeded */
76#define	EBADOP		4		/* illegal TFTP operation */
77#define	EBADID		5		/* unknown transfer ID */
78#define	EEXISTS		6		/* file already exists */
79#define	ENOUSER		7		/* no such user */
80
81#endif /* !_TFTP_H_ */
82