tftp-options.h revision 207614
167754Smsmith/*
267754Smsmith * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
367754Smsmith *
4167802Sjkim * Redistribution and use in source and binary forms, with or without
567754Smsmith * modification, are permitted provided that the following conditions
667754Smsmith * are met:
767754Smsmith * 1. Redistributions of source code must retain the above copyright
867754Smsmith *    notice, this list of conditions and the following disclaimer.
967754Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1067754Smsmith *    notice, this list of conditions and the following disclaimer in the
1167754Smsmith *    documentation and/or other materials provided with the distribution.
12167802Sjkim *
1370243Smsmith * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1467754Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1567754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1667754Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
1767754Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1867754Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1967754Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2067754Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2167754Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2267754Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2367754Smsmith * SUCH DAMAGE.
2467754Smsmith */
2567754Smsmith
2667754Smsmith#include <sys/cdefs.h>
2767754Smsmith__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-options.h 207614 2010-05-04 13:07:40Z imp $");
2867754Smsmith
2967754Smsmith/*
3067754Smsmith * Options
3167754Smsmith */
3267754Smsmith
3367754Smsmithvoid		init_options(void);
3467754Smsmithuint16_t	make_options(int peer, char *buffer, uint16_t size);
3567754Smsmithint		parse_options(int peer, char *buffer, uint16_t size);
3667754Smsmith
3767754Smsmith/* Call back functions */
3867754Smsmithint	option_tsize(int peer, struct tftphdr *, int, struct stat *);
3967754Smsmithint	option_timeout(int peer);
4067754Smsmithint	option_blksize(int peer);
4167754Smsmithint	option_blksize2(int peer);
4267754Smsmithint	option_rollover(int peer);
4367754Smsmith
4467754Smsmithextern int options_extra_enabled;
4567754Smsmithextern int options_rfc_enabled;
4667754Smsmith
4767754Smsmithstruct options {
4867754Smsmith	const char	*o_type;
4967754Smsmith	char		*o_request;
5067754Smsmith	char		*o_reply;
5167754Smsmith	int		(*o_handler)(int peer);
5267754Smsmith	int		rfc;
5367754Smsmith};
5467754Smsmith
5567754Smsmithextern struct options	options[];
5667754Smsmithenum opt_enum {
5767754Smsmith	OPT_TSIZE = 0,
5867754Smsmith	OPT_TIMEOUT,
5967754Smsmith	OPT_BLKSIZE,
6067754Smsmith	OPT_BLKSIZE2,
6167754Smsmith	OPT_ROLLOVER,
6267754Smsmith};
6367754Smsmith