if_gif.h revision 83997
162587Sitojun/*	$FreeBSD: head/sys/net/if_gif.h 83997 2001-09-26 23:37:15Z brooks $	*/
278064Sume/*	$KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa Exp $	*/
362587Sitojun
453541Sshin/*
553541Sshin * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
653541Sshin * All rights reserved.
753541Sshin *
853541Sshin * Redistribution and use in source and binary forms, with or without
953541Sshin * modification, are permitted provided that the following conditions
1053541Sshin * are met:
1153541Sshin * 1. Redistributions of source code must retain the above copyright
1253541Sshin *    notice, this list of conditions and the following disclaimer.
1353541Sshin * 2. Redistributions in binary form must reproduce the above copyright
1453541Sshin *    notice, this list of conditions and the following disclaimer in the
1553541Sshin *    documentation and/or other materials provided with the distribution.
1653541Sshin * 3. Neither the name of the project nor the names of its contributors
1753541Sshin *    may be used to endorse or promote products derived from this software
1853541Sshin *    without specific prior written permission.
1953541Sshin *
2053541Sshin * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2153541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2253541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2353541Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2453541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2553541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2653541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2753541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2853541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2953541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3053541Sshin * SUCH DAMAGE.
3153541Sshin */
3253541Sshin
3353541Sshin/*
3453541Sshin * if_gif.h
3553541Sshin */
3653541Sshin
3753541Sshin#ifndef _NET_IF_GIF_H_
3853541Sshin#define _NET_IF_GIF_H_
3953541Sshin
4062587Sitojun
4183997Sbrooks#ifdef _KERNEL
4262587Sitojun#include "opt_inet.h"
4383997Sbrooks#include "opt_inet6.h"
4462587Sitojun
4562587Sitojun#include <netinet/in.h>
4662587Sitojun/* xxx sigh, why route have struct route instead of pointer? */
4762587Sitojun
4862587Sitojunstruct encaptab;
4962587Sitojun
5053541Sshinstruct gif_softc {
5162587Sitojun	struct ifnet	gif_if;	   /* common area - must be at the top */
5262587Sitojun	struct sockaddr	*gif_psrc; /* Physical src addr */
5362587Sitojun	struct sockaddr	*gif_pdst; /* Physical dst addr */
5453541Sshin	union {
5562587Sitojun		struct route  gifscr_ro;    /* xxx */
5662587Sitojun#ifdef INET6
5762587Sitojun		struct route_in6 gifscr_ro6; /* xxx */
5862587Sitojun#endif
5953541Sshin	} gifsc_gifscr;
6062587Sitojun	int		gif_flags;
6162587Sitojun	const struct encaptab *encap_cookie4;
6262587Sitojun	const struct encaptab *encap_cookie6;
6379106Sbrooks	struct resource *r_unit;	/* resource allocated for this unit */
6483997Sbrooks	LIST_ENTRY(gif_softc) gif_link; /* all gif's are linked */
6553541Sshin};
6653541Sshin
6762587Sitojun#define gif_ro gifsc_gifscr.gifscr_ro
6862587Sitojun#ifdef INET6
6962587Sitojun#define gif_ro6 gifsc_gifscr.gifscr_ro6
7062587Sitojun#endif
7153541Sshin
7262587Sitojun#define GIF_MTU		(1280)	/* Default MTU */
7353541Sshin#define	GIF_MTU_MIN	(1280)	/* Minimum MTU */
7453541Sshin#define	GIF_MTU_MAX	(8192)	/* Maximum MTU */
7553541Sshin
7653541Sshin/* Prototypes */
7762587Sitojunvoid gif_input __P((struct mbuf *, int, struct ifnet *));
7862587Sitojunint gif_output __P((struct ifnet *, struct mbuf *,
7953541Sshin		    struct sockaddr *, struct rtentry *));
8062587Sitojunint gif_ioctl __P((struct ifnet *, u_long, caddr_t));
8153541Sshin
8283997Sbrooks#endif /* _KERNEL */
8383997Sbrooks
8453541Sshin#endif /* _NET_IF_GIF_H_ */
85