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 *	@(#)interface.h	8.1 (Berkeley) 6/5/93
3611820Sjulian *
3750479Speter * $FreeBSD$
3811820Sjulian */
3911820Sjulian
4011820Sjulian/*
4111820Sjulian * Routing table management daemon.
4211820Sjulian */
4311820Sjulian
4411820Sjulian/*
4511820Sjulian * An ``interface'' is similar to an ifnet structure,
4611820Sjulian * except it doesn't contain q'ing info, and it also
4711820Sjulian * handles ``logical'' interfaces (remote gateways
4811820Sjulian * that we want to keep polling even if they go down).
4911820Sjulian * The list of interfaces which we maintain is used
5011820Sjulian * in supplying the gratuitous routing table updates.
5111820Sjulian * We list only one address for  each interface, the AF_IPX one.
5211820Sjulian */
5311820Sjulianstruct interface {
5411820Sjulian	struct	interface *int_next;
5511820Sjulian	struct	sockaddr int_addr;		/* address on this host */
5611820Sjulian	union {
5711820Sjulian		struct	sockaddr intu_broadaddr;
5811820Sjulian		struct	sockaddr intu_dstaddr;
5911820Sjulian	} int_intu;
6011820Sjulian#define	int_broadaddr	int_intu.intu_broadaddr	/* broadcast address */
6111820Sjulian#define	int_dstaddr	int_intu.intu_dstaddr	/* other end of p-to-p link */
6211820Sjulian	int	int_metric;			/* init's routing entry */
6311820Sjulian	int	int_flags;			/* see below */
6411820Sjulian	struct	ifdebug int_input, int_output;	/* packet tracing stuff */
6511820Sjulian	int	int_ipackets;			/* input packets received */
6611820Sjulian	int	int_opackets;			/* output packets sent */
6711820Sjulian	char	*int_name;			/* from kernel if structure */
6811820Sjulian	u_short	int_transitions;		/* times gone up-down */
6911820Sjulian
7011820Sjulian	/* XXX IPX Specific entry */
7111820Sjulian	struct	sameq {
7211820Sjulian		struct sameq *n;		/* q of other pt-to-pt links */
7311820Sjulian		struct sameq *p;		/* with same net # */
7411820Sjulian	}	int_sq;
7511820Sjulian};
7611820Sjulian
7711820Sjulian/*
7811820Sjulian * 0x1 to 0x10 are reused from the kernel's ifnet definitions,
7911820Sjulian * the others agree with the RTS_ flags defined elsewhere.
8011820Sjulian */
8111820Sjulian#define	IFF_UP		0x1		/* interface is up */
8211820Sjulian#define	IFF_BROADCAST	0x2		/* broadcast address valid */
8311820Sjulian#define	IFF_DEBUG	0x4		/* turn on debugging */
8411820Sjulian#define	IFF_ROUTE	0x8		/* routing entry installed */
8511820Sjulian#define	IFF_POINTOPOINT	0x10		/* interface is point-to-point link */
8611820Sjulian
8711820Sjulian#define	IFF_PASSIVE	0x200000	/* can't tell if up/down */
8811820Sjulian#define	IFF_INTERFACE	0x400000	/* hardware interface */
8911820Sjulian#define	IFF_REMOTE	0x800000	/* interface isn't on this machine */
9011820Sjulian
9111820Sjulianstruct	interface *if_ifwithaddr(struct sockaddr *);
9211820Sjulianstruct	interface *if_ifwithdstaddr(struct sockaddr *);
9311820Sjulianstruct	interface *if_ifwithnet(struct sockaddr *);
9411820Sjulianstruct	interface *if_iflookup(struct sockaddr *);
9511820Sjulian
96