179455Sobrien/*
279455Sobrien * Copyright (c) 1983, 1993
379455Sobrien *	The Regents of the University of California.  All rights reserved.
479455Sobrien *
579455Sobrien * Copyright (c) 1995 John Hay.  All rights reserved.
679455Sobrien *
779455Sobrien * Redistribution and use in source and binary forms, with or without
879455Sobrien * modification, are permitted provided that the following conditions
979455Sobrien * are met:
1079455Sobrien * 1. Redistributions of source code must retain the above copyright
1179455Sobrien *    notice, this list of conditions and the following disclaimer.
1279455Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1379455Sobrien *    notice, this list of conditions and the following disclaimer in the
1479455Sobrien *    documentation and/or other materials provided with the distribution.
1579455Sobrien * 3. All advertising materials mentioning features or use of this software
1679455Sobrien *    must display the following acknowledgement:
1779455Sobrien *	This product includes software developed by the University of
1879455Sobrien *	California, Berkeley and its contributors.
1979455Sobrien * 4. Neither the name of the University nor the names of its contributors
2079455Sobrien *    may be used to endorse or promote products derived from this software
2179455Sobrien *    without specific prior written permission.
2279455Sobrien *
2379455Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2479455Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2579455Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26141612Sru * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2779455Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28193943Savg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2979578Sru * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3079578Sru * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3179455Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3279578Sru * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33102231Strhodes * SUCH DAMAGE.
3479455Sobrien *
3579578Sru *	@(#)af.h	5.1 (Berkeley) 6/4/85 (routed/af.h)
3679455Sobrien *
37193943Savg *	@(#)af.h	8.1 (Berkeley) 6/5/93
38102464Strhodes *
3979578Sru * $FreeBSD$
40193943Savg */
41102464Strhodes
4279455Sobrien/*
4379455Sobrien * Routing table management daemon.
4479455Sobrien */
4579455Sobrien
4679455Sobrien/*
47102231Strhodes * Structure returned by af_hash routines.
4879455Sobrien */
4979455Sobrienstruct afhash {
50102231Strhodes	u_int	afh_hosthash;		/* host based hash */
5179455Sobrien	u_int	afh_nethash;		/* network based hash */
5279455Sobrien};
5379455Sobrien
54102231Strhodes/*
5579455Sobrien * Per address family routines.
5679455Sobrien */
5779455Sobrientypedef void af_hash_t(struct sockaddr *, struct afhash *);
5879455Sobrientypedef int  af_netmatch_t(struct sockaddr *, struct sockaddr *);
59102231Strhodestypedef void af_output_t(int, int, struct sockaddr *, int);
60102231Strhodestypedef int  af_portmatch_t(struct sockaddr *);
6179455Sobrientypedef int  af_portcheck_t(struct sockaddr *);
6279578Srutypedef int  af_checkhost_t(struct sockaddr *);
6379578Srutypedef int  af_ishost_t(struct sockaddr *);
6479455Sobrientypedef void af_canon_t(struct sockaddr *);
6579455Sobrien
6679455Sobrienstruct afswitch {
6779455Sobrien	af_hash_t	*af_hash;	/* returns keys based on address */
6879455Sobrien	af_netmatch_t	*af_netmatch;	/* verifies net # matching */
6979455Sobrien	af_output_t	*af_output;	/* interprets address for sending */
70102231Strhodes	af_portmatch_t	*af_portmatch;	/* packet from some other router? */
7179455Sobrien	af_portcheck_t	*af_portcheck;	/* packet from privileged peer? */
7279455Sobrien	af_checkhost_t	*af_checkhost;	/* tells if address for host or net */
7379455Sobrien	af_ishost_t	*af_ishost;	/* tells if address is valid */
7479455Sobrien	af_canon_t	*af_canon;	/* canonicalize address for compares */
7579578Sru};
76193943Savg
77193943Savgstruct	afswitch afswitch[AF_MAX];	/* table proper */
78193943Savg