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/* 30207614Simp * Options 31207614Simp */ 32207614Simp 33207614Simpvoid init_options(void); 34207614Simpuint16_t make_options(int peer, char *buffer, uint16_t size); 35207614Simpint parse_options(int peer, char *buffer, uint16_t size); 36207614Simp 37207614Simp/* Call back functions */ 38207614Simpint option_tsize(int peer, struct tftphdr *, int, struct stat *); 39207614Simpint option_timeout(int peer); 40207614Simpint option_blksize(int peer); 41207614Simpint option_blksize2(int peer); 42207614Simpint option_rollover(int peer); 43207614Simp 44207614Simpextern int options_extra_enabled; 45207614Simpextern int options_rfc_enabled; 46207614Simp 47207614Simpstruct options { 48207614Simp const char *o_type; 49207614Simp char *o_request; 50207614Simp char *o_reply; 51207614Simp int (*o_handler)(int peer); 52207614Simp int rfc; 53207614Simp}; 54207614Simp 55207614Simpextern struct options options[]; 56207614Simpenum opt_enum { 57207614Simp OPT_TSIZE = 0, 58207614Simp OPT_TIMEOUT, 59207614Simp OPT_BLKSIZE, 60207614Simp OPT_BLKSIZE2, 61207614Simp OPT_ROLLOVER, 62207614Simp}; 63