111820Sjulian/*
211820Sjulian * Copyright (c) 1983, 1993
311820Sjulian *	The Regents of the University of California.  All rights reserved.
411820Sjulian *
511820Sjulian * Copyright (c) 1995 John Hay.  All rights reserved.
611820Sjulian *
711820Sjulian * Redistribution and use in source and binary forms, with or without
811820Sjulian * modification, are permitted provided that the following conditions
911820Sjulian * are met:
1011820Sjulian * 1. Redistributions of source code must retain the above copyright
1111820Sjulian *    notice, this list of conditions and the following disclaimer.
1211820Sjulian * 2. Redistributions in binary form must reproduce the above copyright
1311820Sjulian *    notice, this list of conditions and the following disclaimer in the
1411820Sjulian *    documentation and/or other materials provided with the distribution.
1511820Sjulian * 3. All advertising materials mentioning features or use of this software
1611820Sjulian *    must display the following acknowledgement:
1711820Sjulian *	This product includes software developed by the University of
1811820Sjulian *	California, Berkeley and its contributors.
1911820Sjulian * 4. Neither the name of the University nor the names of its contributors
2011820Sjulian *    may be used to endorse or promote products derived from this software
2111820Sjulian *    without specific prior written permission.
2211820Sjulian *
2311820Sjulian * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2411820Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2511820Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2611820Sjulian * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2711820Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2811820Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2911820Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3011820Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3111820Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3211820Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3311820Sjulian * SUCH DAMAGE.
3411820Sjulian *
3511820Sjulian *	@(#)af.h	5.1 (Berkeley) 6/4/85 (routed/af.h)
3611820Sjulian *
3711820Sjulian *	@(#)af.h	8.1 (Berkeley) 6/5/93
3811820Sjulian *
3950479Speter * $FreeBSD$
4011820Sjulian */
4111820Sjulian
4211820Sjulian/*
4311820Sjulian * Routing table management daemon.
4411820Sjulian */
4511820Sjulian
4611820Sjulian/*
4711820Sjulian * Structure returned by af_hash routines.
4811820Sjulian */
4911820Sjulianstruct afhash {
5011820Sjulian	u_int	afh_hosthash;		/* host based hash */
5111820Sjulian	u_int	afh_nethash;		/* network based hash */
5211820Sjulian};
5311820Sjulian
5411820Sjulian/*
5511820Sjulian * Per address family routines.
5611820Sjulian */
5711820Sjuliantypedef void af_hash_t(struct sockaddr *, struct afhash *);
5811820Sjuliantypedef int  af_netmatch_t(struct sockaddr *, struct sockaddr *);
5911820Sjuliantypedef void af_output_t(int, int, struct sockaddr *, int);
6011820Sjuliantypedef int  af_portmatch_t(struct sockaddr *);
6111820Sjuliantypedef int  af_portcheck_t(struct sockaddr *);
6211820Sjuliantypedef int  af_checkhost_t(struct sockaddr *);
6311820Sjuliantypedef int  af_ishost_t(struct sockaddr *);
6411820Sjuliantypedef void af_canon_t(struct sockaddr *);
6511820Sjulian
6611820Sjulianstruct afswitch {
6711820Sjulian	af_hash_t	*af_hash;	/* returns keys based on address */
6811820Sjulian	af_netmatch_t	*af_netmatch;	/* verifies net # matching */
6911820Sjulian	af_output_t	*af_output;	/* interprets address for sending */
7011820Sjulian	af_portmatch_t	*af_portmatch;	/* packet from some other router? */
7111820Sjulian	af_portcheck_t	*af_portcheck;	/* packet from privileged peer? */
7211820Sjulian	af_checkhost_t	*af_checkhost;	/* tells if address for host or net */
7311820Sjulian	af_ishost_t	*af_ishost;	/* tells if address is valid */
7411820Sjulian	af_canon_t	*af_canon;	/* canonicalize address for compares */
7511820Sjulian};
7611820Sjulian
7711820Sjulianstruct	afswitch afswitch[AF_MAX];	/* table proper */
78