1207614Simp/*
2207614Simp * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
3207614Simp *
4207614Simp * Redistribution and use in source and binary forms, with or without
5207614Simp * modification, are permitted provided that the following conditions
6207614Simp * are met:
7207614Simp * 1. Redistributions of source code must retain the above copyright
8207614Simp *    notice, this list of conditions and the following disclaimer.
9207614Simp * 2. Redistributions in binary form must reproduce the above copyright
10207614Simp *    notice, this list of conditions and the following disclaimer in the
11207614Simp *    documentation and/or other materials provided with the distribution.
12207614Simp *
13207614Simp * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14207614Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15207614Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16207614Simp * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17207614Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18207614Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19207614Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20207614Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21207614Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22207614Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23207614Simp * SUCH DAMAGE.
24207614Simp */
25207614Simp
26207614Simp#include <sys/cdefs.h>
27207614Simp__FBSDID("$FreeBSD$");
28207614Simp
29207614Simp#define RP_NONE		0
30207614Simp#define	RP_RECVFROM	-1
31207614Simp#define	RP_TOOSMALL	-2
32207614Simp#define RP_ERROR	-3
33207614Simp#define RP_WRONGSOURCE	-4
34207614Simp#define	RP_TIMEOUT	-5
35207614Simp#define	RP_TOOBIG	-6
36207614Simp
37207614Simpconst char *errtomsg(int);
38207614Simpvoid	send_error(int peer, int);
39207614Simpint	send_wrq(int peer, char *, char *);
40207614Simpint	send_rrq(int peer, char *, char *);
41207614Simpint	send_oack(int peer);
42207614Simpint	send_ack(int peer, unsigned short);
43207614Simpint	send_data(int peer, uint16_t, char *, int);
44207614Simpint	receive_packet(int peer, char *, int, struct sockaddr_storage *, int);
45207614Simp
46207614Simpextern struct sockaddr_storage peer_sock;
47207614Simpextern struct sockaddr_storage me_sock;
48