From d3594ddad8fdd4f28f2362ad288acd03ed60eb41 Mon Sep 17 00:00:00 2001 From: Joan Lledó Date: Mon, 13 Nov 2017 08:31:46 +0100 Subject: lwip: Add LwIP-based TCP/IP translator * Makefile (prog-subdirs): Add lwip. * config.make.in (HAVE_LIBLWIP, liblwip_CFLAGS, liblwip_LIBS): Define variables. * configure.ac: Check for liblwip. * lwip/: New directory. --- lwip/options.h | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 lwip/options.h (limited to 'lwip/options.h') diff --git a/lwip/options.h b/lwip/options.h new file mode 100644 index 00000000..e370fab0 --- /dev/null +++ b/lwip/options.h @@ -0,0 +1,81 @@ +/* + Copyright (C) 1996, 1997, 2000, 2001, 2006, 2007, 2017 + Free Software Foundation, Inc. + + Written by Miles Bader + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see . +*/ + +/* Fsysopts and command line option parsing */ + +#ifndef OPTIONS_H +#define OPTIONS_H + +#include +#include +#include +#include + +#include +#include + +#define DEV_NAME_LEN 256 + +/* Used to describe a particular interface during argument parsing. */ +struct parse_interface +{ + /* The network interface in question. */ + char dev_name[DEV_NAME_LEN]; + + /* New values to apply to it. (IPv4) */ + ip4_addr_t address, netmask, peer, gateway; + + /* New IPv6 configuration to apply. */ + uint32_t addr6[LWIP_IPV6_NUM_ADDRESSES][4]; +}; + +/* Used to hold data during argument parsing. */ +struct parse_hook +{ + /* A list of specified interfaces and their corresponding options. */ + struct parse_interface *interfaces; + size_t num_interfaces; + + /* Interface to which options apply. If the device field isn't filled in + then it should be by the next --interface option. */ + struct parse_interface *curint; +}; + +/* Lwip translator options. Used for both startup and runtime. */ +static const struct argp_option options[] = { + {"interface", 'i', "DEVICE", 0, "Network interface to use", 1}, + {0, 0, 0, 0, "These apply to a given interface:", 2}, + {"address", 'a', "ADDRESS", OPTION_ARG_OPTIONAL, "Set the network address"}, + {"netmask", 'm', "MASK", OPTION_ARG_OPTIONAL, "Set the netmask"}, + {"gateway", 'g', "ADDRESS", OPTION_ARG_OPTIONAL, "Set the default gateway"}, + {"ipv4", '4', "NAME", 0, "Put active IPv4 translator on NAME"}, + {"ipv6", '6', "NAME", 0, "Put active IPv6 translator on NAME"}, + {"address6", 'A', "ADDR/LEN", OPTION_ARG_OPTIONAL, + "Set the global IPv6 address"}, + {0} +}; + +static const char doc[] = "Interface-specific options before the first \ +interface specification apply to the first following interface; otherwise \ +they apply to the previously specified interface."; + +#endif // OPTIONS_H -- cgit v1.2.3