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