tftp-options.h revision 207614
1290650Shselasky/*
2329200Shselasky * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
3290650Shselasky *
4290650Shselasky * Redistribution and use in source and binary forms, with or without
5290650Shselasky * modification, are permitted provided that the following conditions
6290650Shselasky * are met:
7290650Shselasky * 1. Redistributions of source code must retain the above copyright
8290650Shselasky *    notice, this list of conditions and the following disclaimer.
9290650Shselasky * 2. Redistributions in binary form must reproduce the above copyright
10290650Shselasky *    notice, this list of conditions and the following disclaimer in the
11290650Shselasky *    documentation and/or other materials provided with the distribution.
12290650Shselasky *
13290650Shselasky * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14290650Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15290650Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16290650Shselasky * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17290650Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18290650Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19290650Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20290650Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21290650Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22290650Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23290650Shselasky * SUCH DAMAGE.
24290650Shselasky */
25290650Shselasky
26290650Shselasky#include <sys/cdefs.h>
27290650Shselasky__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-options.h 207614 2010-05-04 13:07:40Z imp $");
28300676Shselasky
29300676Shselasky/*
30290650Shselasky * Options
31290650Shselasky */
32290650Shselasky
33290650Shselaskyvoid		init_options(void);
34290650Shselaskyuint16_t	make_options(int peer, char *buffer, uint16_t size);
35290650Shselaskyint		parse_options(int peer, char *buffer, uint16_t size);
36290650Shselasky
37290650Shselasky/* Call back functions */
38290650Shselaskyint	option_tsize(int peer, struct tftphdr *, int, struct stat *);
39290650Shselaskyint	option_timeout(int peer);
40290650Shselaskyint	option_blksize(int peer);
41290650Shselaskyint	option_blksize2(int peer);
42290650Shselaskyint	option_rollover(int peer);
43290650Shselasky
44290650Shselaskyextern int options_extra_enabled;
45329200Shselaskyextern int options_rfc_enabled;
46290650Shselasky
47290650Shselaskystruct options {
48290650Shselasky	const char	*o_type;
49290650Shselasky	char		*o_request;
50290650Shselasky	char		*o_reply;
51290650Shselasky	int		(*o_handler)(int peer);
52290650Shselasky	int		rfc;
53290650Shselasky};
54290650Shselasky
55290650Shselaskyextern struct options	options[];
56290650Shselaskyenum opt_enum {
57290650Shselasky	OPT_TSIZE = 0,
58290650Shselasky	OPT_TIMEOUT,
59290650Shselasky	OPT_BLKSIZE,
60290650Shselasky	OPT_BLKSIZE2,
61290650Shselasky	OPT_ROLLOVER,
62290650Shselasky};
63290650Shselasky