195023Ssuz/* $KAME: prefix.h,v 1.4 2001/09/05 03:04:21 itojun Exp $ */ 278064Sume/* $FreeBSD$ */ 378064Sume 478064Sume/* 578064Sume * Copyright (C) 2000 WIDE Project. 678064Sume * All rights reserved. 778064Sume * 878064Sume * Redistribution and use in source and binary forms, with or without 978064Sume * modification, are permitted provided that the following conditions 1078064Sume * are met: 1178064Sume * 1. Redistributions of source code must retain the above copyright 1278064Sume * notice, this list of conditions and the following disclaimer. 1378064Sume * 2. Redistributions in binary form must reproduce the above copyright 1478064Sume * notice, this list of conditions and the following disclaimer in the 1578064Sume * documentation and/or other materials provided with the distribution. 1678064Sume * 3. Neither the name of the project nor the names of its contributors 1778064Sume * may be used to endorse or promote products derived from this software 1878064Sume * without specific prior written permission. 1978064Sume * 2078064Sume * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 2178064Sume * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2278064Sume * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2378064Sume * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 2478064Sume * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2578064Sume * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2678064Sume * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2778064Sume * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2878064Sume * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2978064Sume * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3078064Sume * SUCH DAMAGE. 3178064Sume */ 3278064Sume 3378064Sumestruct prefix { 3478064Sume struct sockaddr_storage a; 3578064Sume int l; 3678064Sume}; 3778064Sume 3878064Sumestruct config { 3978064Sume struct config *next; 4078064Sume 4178064Sume int permit; 4278064Sume struct prefix match; 4378064Sume struct prefix dest; 4478064Sume struct prefix src; /* src to use for outgoing connection */ 4578064Sume}; 4678064Sume 4778064Sume#define _PATH_PREFIX_CONF "/etc/faithd.conf" 4878064Sume 49173412Skevloextern const char *prefix_string(const struct prefix *); 50173412Skevloextern int prefix_match(const struct prefix *, const struct sockaddr *); 51173412Skevloextern int config_load(const char *); 52173412Skevloextern const struct config *config_match(struct sockaddr *, struct sockaddr *); 53