xref: /titanic_41/usr/src/head/arpa/tftp.h (revision cde2885fdf538266ee2a3b08dee2d5075ce8fa2b)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  * Trivial File Transfer Protocol (RFC 1350, RFC 2347)
46  */
47 #define	SEGSIZE		512		/* data segment size */
48 
49 /*
50  * Packet types.
51  */
52 #define	RRQ	01			/* read request */
53 #define	WRQ	02			/* write request */
54 #define	DATA	03			/* data packet */
55 #define	ACK	04			/* acknowledgement */
56 #define	ERROR	05			/* error code */
57 #define	OACK	06			/* option acknowledgement */
58 
59 struct	tftphdr {
60 	short		th_opcode;	/* packet type */
61 	ushort_t	th_block;	/* block # */
62 	char		th_data[1];	/* data or error string */
63 };
64 
65 #define	th_code		th_block	/* error code overlay on tu_block */
66 #define	th_stuff	th_block	/* ditto */
67 
68 #define	th_msg		th_data
69 
70 /*
71  * Error codes.
72  */
73 #define	EUNDEF		0		/* not defined */
74 #define	ENOTFOUND	1		/* file not found */
75 #define	EACCESS		2		/* access violation */
76 #define	ENOSPACE	3		/* disk full or allocation exceeded */
77 #define	EBADOP		4		/* illegal TFTP operation */
78 #define	EBADID		5		/* unknown transfer ID */
79 #define	EEXISTS		6		/* file already exists */
80 #define	ENOUSER		7		/* no such user */
81 #define	EOPTNEG		8		/* option negotiation error */
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _ARPA_TFTP_H */
88