if_gif.h revision 83998
162587Sitojun/* $FreeBSD: head/sys/net/if_gif.h 83998 2001-09-26 23:50:17Z 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 5083998Sbrooksextern void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, 5183998Sbrooks int af); 5283998Sbrooksextern void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, 5383998Sbrooks int af); 5483998Sbrooksextern int (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp); 5583998Sbrooksextern void (*ng_gif_attach_p)(struct ifnet *ifp); 5683998Sbrooksextern void (*ng_gif_detach_p)(struct ifnet *ifp); 5783998Sbrooks 5853541Sshinstruct gif_softc { 5962587Sitojun struct ifnet gif_if; /* common area - must be at the top */ 6062587Sitojun struct sockaddr *gif_psrc; /* Physical src addr */ 6162587Sitojun struct sockaddr *gif_pdst; /* Physical dst addr */ 6253541Sshin union { 6362587Sitojun struct route gifscr_ro; /* xxx */ 6462587Sitojun#ifdef INET6 6562587Sitojun struct route_in6 gifscr_ro6; /* xxx */ 6662587Sitojun#endif 6753541Sshin } gifsc_gifscr; 6862587Sitojun int gif_flags; 6962587Sitojun const struct encaptab *encap_cookie4; 7062587Sitojun const struct encaptab *encap_cookie6; 7179106Sbrooks struct resource *r_unit; /* resource allocated for this unit */ 7283998Sbrooks void *gif_netgraph; /* ng_gif(4) netgraph node info */ 7383997Sbrooks LIST_ENTRY(gif_softc) gif_link; /* all gif's are linked */ 7453541Sshin}; 7553541Sshin 7662587Sitojun#define gif_ro gifsc_gifscr.gifscr_ro 7762587Sitojun#ifdef INET6 7862587Sitojun#define gif_ro6 gifsc_gifscr.gifscr_ro6 7962587Sitojun#endif 8053541Sshin 8162587Sitojun#define GIF_MTU (1280) /* Default MTU */ 8253541Sshin#define GIF_MTU_MIN (1280) /* Minimum MTU */ 8353541Sshin#define GIF_MTU_MAX (8192) /* Maximum MTU */ 8453541Sshin 8553541Sshin/* Prototypes */ 8662587Sitojunvoid gif_input __P((struct mbuf *, int, struct ifnet *)); 8762587Sitojunint gif_output __P((struct ifnet *, struct mbuf *, 8853541Sshin struct sockaddr *, struct rtentry *)); 8962587Sitojunint gif_ioctl __P((struct ifnet *, u_long, caddr_t)); 9053541Sshin 9183997Sbrooks#endif /* _KERNEL */ 9283997Sbrooks 9353541Sshin#endif /* _NET_IF_GIF_H_ */ 94