xref: /illumos-gate/usr/src/head/arpa/tftp.h (revision b4203d75)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved	*/
29 
30 /*
31  * Portions of this source code were derived from Berkeley 4.3 BSD
32  * under license from the Regents of the University of California.
33  */
34 
35 #ifndef _ARPA_TFTP_H
36 #define	_ARPA_TFTP_H
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Trivial File Transfer Protocol (RFC 1350, RFC 2347)
44  */
45 #define	SEGSIZE		512		/* data segment size */
46 
47 /*
48  * Packet types.
49  */
50 #define	RRQ	01			/* read request */
51 #define	WRQ	02			/* write request */
52 #define	DATA	03			/* data packet */
53 #define	ACK	04			/* acknowledgement */
54 #define	ERROR	05			/* error code */
55 #define	OACK	06			/* option acknowledgement */
56 
57 struct	tftphdr {
58 	short		th_opcode;	/* packet type */
59 	ushort_t	th_block;	/* block # */
60 	char		th_data[1];	/* data or error string */
61 };
62 
63 #define	th_code		th_block	/* error code overlay on tu_block */
64 #define	th_stuff	th_block	/* ditto */
65 
66 #define	th_msg		th_data
67 
68 /*
69  * Error codes.
70  */
71 #define	EUNDEF		0		/* not defined */
72 #define	ENOTFOUND	1		/* file not found */
73 #define	EACCESS		2		/* access violation */
74 #define	ENOSPACE	3		/* disk full or allocation exceeded */
75 #define	EBADOP		4		/* illegal TFTP operation */
76 #define	EBADID		5		/* unknown transfer ID */
77 #define	EEXISTS		6		/* file already exists */
78 #define	ENOUSER		7		/* no such user */
79 #define	EOPTNEG		8		/* option negotiation error */
80 
81 #ifdef	__cplusplus
82 }
83 #endif
84 
85 #endif	/* _ARPA_TFTP_H */
86