1686cdd19SJun-ichiro itojun Hagino /* $FreeBSD$ */ 233841545SHajimu UMEMOTO /* $KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa Exp $ */ 3686cdd19SJun-ichiro itojun Hagino 4c398230bSWarner Losh /*- 582cd038dSYoshinobu Inoue * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 682cd038dSYoshinobu Inoue * All rights reserved. 782cd038dSYoshinobu Inoue * 882cd038dSYoshinobu Inoue * Redistribution and use in source and binary forms, with or without 982cd038dSYoshinobu Inoue * modification, are permitted provided that the following conditions 1082cd038dSYoshinobu Inoue * are met: 1182cd038dSYoshinobu Inoue * 1. Redistributions of source code must retain the above copyright 1282cd038dSYoshinobu Inoue * notice, this list of conditions and the following disclaimer. 1382cd038dSYoshinobu Inoue * 2. Redistributions in binary form must reproduce the above copyright 1482cd038dSYoshinobu Inoue * notice, this list of conditions and the following disclaimer in the 1582cd038dSYoshinobu Inoue * documentation and/or other materials provided with the distribution. 1682cd038dSYoshinobu Inoue * 3. Neither the name of the project nor the names of its contributors 1782cd038dSYoshinobu Inoue * may be used to endorse or promote products derived from this software 1882cd038dSYoshinobu Inoue * without specific prior written permission. 1982cd038dSYoshinobu Inoue * 2082cd038dSYoshinobu Inoue * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 2182cd038dSYoshinobu Inoue * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2282cd038dSYoshinobu Inoue * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2382cd038dSYoshinobu Inoue * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 2482cd038dSYoshinobu Inoue * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2582cd038dSYoshinobu Inoue * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2682cd038dSYoshinobu Inoue * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2782cd038dSYoshinobu Inoue * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2882cd038dSYoshinobu Inoue * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2982cd038dSYoshinobu Inoue * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3082cd038dSYoshinobu Inoue * SUCH DAMAGE. 3182cd038dSYoshinobu Inoue */ 3282cd038dSYoshinobu Inoue 3382cd038dSYoshinobu Inoue /* 3482cd038dSYoshinobu Inoue * if_gif.h 3582cd038dSYoshinobu Inoue */ 3682cd038dSYoshinobu Inoue 3782cd038dSYoshinobu Inoue #ifndef _NET_IF_GIF_H_ 3882cd038dSYoshinobu Inoue #define _NET_IF_GIF_H_ 3982cd038dSYoshinobu Inoue 40686cdd19SJun-ichiro itojun Hagino 4120af0ffaSBrooks Davis #ifdef _KERNEL 42686cdd19SJun-ichiro itojun Hagino #include "opt_inet.h" 4320af0ffaSBrooks Davis #include "opt_inet6.h" 44686cdd19SJun-ichiro itojun Hagino 45686cdd19SJun-ichiro itojun Hagino #include <netinet/in.h> 46686cdd19SJun-ichiro itojun Hagino /* xxx sigh, why route have struct route instead of pointer? */ 47686cdd19SJun-ichiro itojun Hagino 48686cdd19SJun-ichiro itojun Hagino struct encaptab; 49686cdd19SJun-ichiro itojun Hagino 5094408d94SBrooks Davis extern void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, 5194408d94SBrooks Davis int af); 5294408d94SBrooks Davis extern void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, 5394408d94SBrooks Davis int af); 5494408d94SBrooks Davis extern int (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp); 5594408d94SBrooks Davis extern void (*ng_gif_attach_p)(struct ifnet *ifp); 5694408d94SBrooks Davis extern void (*ng_gif_detach_p)(struct ifnet *ifp); 5794408d94SBrooks Davis 5882cd038dSYoshinobu Inoue struct gif_softc { 59686cdd19SJun-ichiro itojun Hagino struct ifnet gif_if; /* common area - must be at the top */ 6082cd038dSYoshinobu Inoue struct sockaddr *gif_psrc; /* Physical src addr */ 6182cd038dSYoshinobu Inoue struct sockaddr *gif_pdst; /* Physical dst addr */ 6282cd038dSYoshinobu Inoue union { 6382cd038dSYoshinobu Inoue struct route gifscr_ro; /* xxx */ 64686cdd19SJun-ichiro itojun Hagino #ifdef INET6 6582cd038dSYoshinobu Inoue struct route_in6 gifscr_ro6; /* xxx */ 66686cdd19SJun-ichiro itojun Hagino #endif 6782cd038dSYoshinobu Inoue } gifsc_gifscr; 6882cd038dSYoshinobu Inoue int gif_flags; 69686cdd19SJun-ichiro itojun Hagino const struct encaptab *encap_cookie4; 70686cdd19SJun-ichiro itojun Hagino const struct encaptab *encap_cookie6; 7194408d94SBrooks Davis void *gif_netgraph; /* ng_gif(4) netgraph node info */ 729426aedfSHajimu UMEMOTO LIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */ 7382cd038dSYoshinobu Inoue }; 7482cd038dSYoshinobu Inoue 7582cd038dSYoshinobu Inoue #define gif_ro gifsc_gifscr.gifscr_ro 76686cdd19SJun-ichiro itojun Hagino #ifdef INET6 7782cd038dSYoshinobu Inoue #define gif_ro6 gifsc_gifscr.gifscr_ro6 78686cdd19SJun-ichiro itojun Hagino #endif 7982cd038dSYoshinobu Inoue 8082cd038dSYoshinobu Inoue #define GIF_MTU (1280) /* Default MTU */ 8182cd038dSYoshinobu Inoue #define GIF_MTU_MIN (1280) /* Minimum MTU */ 8282cd038dSYoshinobu Inoue #define GIF_MTU_MAX (8192) /* Maximum MTU */ 8382cd038dSYoshinobu Inoue 848c7e1947SRuslan Ermilov #define MTAG_GIF 1080679712 858c7e1947SRuslan Ermilov #define MTAG_GIF_CALLED 0 868c7e1947SRuslan Ermilov 8782cd038dSYoshinobu Inoue /* Prototypes */ 889426aedfSHajimu UMEMOTO void gifattach0(struct gif_softc *); 89929ddbbbSAlfred Perlstein void gif_input(struct mbuf *, int, struct ifnet *); 9034fe62c7SBruce Evans int gif_output(struct ifnet *, struct mbuf *, struct sockaddr *, 9134fe62c7SBruce Evans struct rtentry *); 92929ddbbbSAlfred Perlstein int gif_ioctl(struct ifnet *, u_long, caddr_t); 939426aedfSHajimu UMEMOTO int gif_set_tunnel(struct ifnet *, struct sockaddr *, struct sockaddr *); 949426aedfSHajimu UMEMOTO void gif_delete_tunnel(struct ifnet *); 959426aedfSHajimu UMEMOTO int gif_encapcheck(const struct mbuf *, int, int, void *); 9682cd038dSYoshinobu Inoue 9720af0ffaSBrooks Davis #endif /* _KERNEL */ 9820af0ffaSBrooks Davis 9982cd038dSYoshinobu Inoue #endif /* _NET_IF_GIF_H_ */ 100