af.h revision 21673
1223828Sneel/*
2223828Sneel * Copyright (c) 1983, 1993
3223828Sneel *	The Regents of the University of California.  All rights reserved.
4223828Sneel *
5223828Sneel * Copyright (c) 1995 John Hay.  All rights reserved.
6223828Sneel *
7223828Sneel * Redistribution and use in source and binary forms, with or without
8223828Sneel * modification, are permitted provided that the following conditions
9223828Sneel * are met:
10223828Sneel * 1. Redistributions of source code must retain the above copyright
11223828Sneel *    notice, this list of conditions and the following disclaimer.
12223828Sneel * 2. Redistributions in binary form must reproduce the above copyright
13223828Sneel *    notice, this list of conditions and the following disclaimer in the
14223828Sneel *    documentation and/or other materials provided with the distribution.
15223828Sneel * 3. All advertising materials mentioning features or use of this software
16223828Sneel *    must display the following acknowledgement:
17223828Sneel *	This product includes software developed by the University of
18223828Sneel *	California, Berkeley and its contributors.
19223828Sneel * 4. Neither the name of the University nor the names of its contributors
20223828Sneel *    may be used to endorse or promote products derived from this software
21223828Sneel *    without specific prior written permission.
22223828Sneel *
23223828Sneel * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24223828Sneel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25223828Sneel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26223828Sneel * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27223828Sneel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28223828Sneel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29223828Sneel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30223828Sneel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31223828Sneel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32223828Sneel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33223828Sneel * SUCH DAMAGE.
34223828Sneel *
35223828Sneel *	@(#)af.h	5.1 (Berkeley) 6/4/85 (routed/af.h)
36223828Sneel *
37223828Sneel *	@(#)af.h	8.1 (Berkeley) 6/5/93
38223828Sneel *
39223828Sneel *	$FreeBSD: head/usr.sbin/IPXrouted/af.h 21673 1997-01-14 07:20:47Z jkh $
40223828Sneel */
41223828Sneel
42223828Sneel/*
43223828Sneel * Routing table management daemon.
44223828Sneel */
45223828Sneel
46223828Sneel/*
47223828Sneel * Structure returned by af_hash routines.
48223828Sneel */
49223828Sneelstruct afhash {
50223828Sneel	u_int	afh_hosthash;		/* host based hash */
51223828Sneel	u_int	afh_nethash;		/* network based hash */
52223828Sneel};
53223828Sneel
54223828Sneel/*
55223828Sneel * Per address family routines.
56223828Sneel */
57223828Sneeltypedef void af_hash_t(struct sockaddr *, struct afhash *);
58223828Sneeltypedef int  af_netmatch_t(struct sockaddr *, struct sockaddr *);
59223828Sneeltypedef void af_output_t(int, int, struct sockaddr *, int);
60223828Sneeltypedef int  af_portmatch_t(struct sockaddr *);
61223828Sneeltypedef int  af_portcheck_t(struct sockaddr *);
62242882Sneeltypedef int  af_checkhost_t(struct sockaddr *);
63259301Sgrehantypedef int  af_ishost_t(struct sockaddr *);
64223828Sneeltypedef void af_canon_t(struct sockaddr *);
65223828Sneel
66223828Sneelstruct afswitch {
67223828Sneel	af_hash_t	*af_hash;	/* returns keys based on address */
68223828Sneel	af_netmatch_t	*af_netmatch;	/* verifies net # matching */
69223828Sneel	af_output_t	*af_output;	/* interprets address for sending */
70223828Sneel	af_portmatch_t	*af_portmatch;	/* packet from some other router? */
71256176Sneel	af_portcheck_t	*af_portcheck;	/* packet from privileged peer? */
72223828Sneel	af_checkhost_t	*af_checkhost;	/* tells if address for host or net */
73223828Sneel	af_ishost_t	*af_ishost;	/* tells if address is valid */
74259301Sgrehan	af_canon_t	*af_canon;	/* canonicalize address for compares */
75223828Sneel};
76223828Sneel
77223828Sneelstruct	afswitch afswitch[AF_MAX];	/* table proper */
78223828Sneel