Blame tftp.h

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