tftp-io.h revision 207614
1139969Simp/*
22862Swollman * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
32862Swollman *
42862Swollman * Redistribution and use in source and binary forms, with or without
52862Swollman * modification, are permitted provided that the following conditions
62862Swollman * are met:
72862Swollman * 1. Redistributions of source code must retain the above copyright
82862Swollman *    notice, this list of conditions and the following disclaimer.
92862Swollman * 2. Redistributions in binary form must reproduce the above copyright
102862Swollman *    notice, this list of conditions and the following disclaimer in the
112862Swollman *    documentation and/or other materials provided with the distribution.
122862Swollman *
132862Swollman * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
142862Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
152862Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
162862Swollman * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
172862Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
182862Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
192862Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
202862Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
212862Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
222862Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
232862Swollman * SUCH DAMAGE.
242862Swollman */
252862Swollman
262862Swollman#include <sys/cdefs.h>
272862Swollman__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-io.h 207614 2010-05-04 13:07:40Z imp $");
282862Swollman
292862Swollman#define RP_NONE		0
30114433Sobrien#define	RP_RECVFROM	-1
312862Swollman#define	RP_TOOSMALL	-2
3220420Ssteve#define RP_ERROR	-3
332862Swollman#define RP_WRONGSOURCE	-4
342862Swollman#define	RP_TIMEOUT	-5
352862Swollman#define	RP_TOOBIG	-6
362862Swollman
372862Swollmanconst char *errtomsg(int);
3820420Sstevevoid	send_error(int peer, int);
39114433Sobrienint	send_wrq(int peer, char *, char *);
4036009Scharnierint	send_rrq(int peer, char *, char *);
4199109Sobrienint	send_oack(int peer);
4299109Sobrienint	send_ack(int peer, unsigned short);
432862Swollmanint	send_data(int peer, uint16_t, char *, int);
442862Swollmanint	receive_packet(int peer, char *, int, struct sockaddr_storage *, int);
452862Swollman
462862Swollmanextern struct sockaddr_storage peer_sock;
472862Swollmanextern struct sockaddr_storage me_sock;
482862Swollman