if_gif.h revision 153621
1285612Sdelphij/* $FreeBSD: head/sys/net/if_gif.h 153621 2005-12-21 21:29:45Z thompsa $ */ 2132451Sroberto/* $KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa Exp $ */ 354359Sroberto 4285612Sdelphij/*- 5285612Sdelphij * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 654359Sroberto * All rights reserved. 754359Sroberto * 854359Sroberto * Redistribution and use in source and binary forms, with or without 954359Sroberto * modification, are permitted provided that the following conditions 1054359Sroberto * are met: 1154359Sroberto * 1. Redistributions of source code must retain the above copyright 1254359Sroberto * notice, this list of conditions and the following disclaimer. 1354359Sroberto * 2. Redistributions in binary form must reproduce the above copyright 1454359Sroberto * notice, this list of conditions and the following disclaimer in the 15106163Sroberto * documentation and/or other materials provided with the distribution. 16106163Sroberto * 3. Neither the name of the project nor the names of its contributors 17285612Sdelphij * may be used to endorse or promote products derived from this software 18285612Sdelphij * without specific prior written permission. 19285612Sdelphij * 20182007Sroberto * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 21285612Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22285612Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23285612Sdelphij * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 2454359Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25285612Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26285612Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27285612Sdelphij * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28285612Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29285612Sdelphij * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30285612Sdelphij * SUCH DAMAGE. 31285612Sdelphij */ 32285612Sdelphij 33285612Sdelphij/* 34285612Sdelphij * if_gif.h 35285612Sdelphij */ 36285612Sdelphij 37285612Sdelphij#ifndef _NET_IF_GIF_H_ 38285612Sdelphij#define _NET_IF_GIF_H_ 39285612Sdelphij 40285612Sdelphij 41285612Sdelphij#ifdef _KERNEL 42285612Sdelphij#include "opt_inet.h" 43285612Sdelphij#include "opt_inet6.h" 44285612Sdelphij 45285612Sdelphij#include <netinet/in.h> 46285612Sdelphij/* xxx sigh, why route have struct route instead of pointer? */ 47285612Sdelphij 48285612Sdelphijstruct encaptab; 49285612Sdelphij 50285612Sdelphijextern void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, 51285612Sdelphij int af); 52285612Sdelphijextern void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, 53285612Sdelphij int af); 54285612Sdelphijextern int (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp); 55285612Sdelphijextern void (*ng_gif_attach_p)(struct ifnet *ifp); 56285612Sdelphijextern void (*ng_gif_detach_p)(struct ifnet *ifp); 57285612Sdelphij 58285612Sdelphijstruct gif_softc { 59285612Sdelphij struct ifnet *gif_ifp; 60285612Sdelphij struct sockaddr *gif_psrc; /* Physical src addr */ 61285612Sdelphij struct sockaddr *gif_pdst; /* Physical dst addr */ 62285612Sdelphij union { 63285612Sdelphij struct route gifscr_ro; /* xxx */ 64285612Sdelphij#ifdef INET6 65285612Sdelphij struct route_in6 gifscr_ro6; /* xxx */ 66285612Sdelphij#endif 67285612Sdelphij } gifsc_gifscr; 68285612Sdelphij int gif_flags; 69285612Sdelphij const struct encaptab *encap_cookie4; 70285612Sdelphij const struct encaptab *encap_cookie6; 71285612Sdelphij void *gif_netgraph; /* ng_gif(4) netgraph node info */ 72285612Sdelphij LIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */ 73285612Sdelphij}; 74285612Sdelphij#define GIF2IFP(sc) ((sc)->gif_ifp) 75285612Sdelphij 76285612Sdelphij#define gif_ro gifsc_gifscr.gifscr_ro 77285612Sdelphij#ifdef INET6 78285612Sdelphij#define gif_ro6 gifsc_gifscr.gifscr_ro6 79285612Sdelphij#endif 8054359Sroberto 81200576Sroberto#define GIF_MTU (1280) /* Default MTU */ 8254359Sroberto#define GIF_MTU_MIN (1280) /* Minimum MTU */ 83200576Sroberto#define GIF_MTU_MAX (8192) /* Maximum MTU */ 84132451Sroberto 85132451Sroberto#define MTAG_GIF 1080679712 86132451Sroberto#define MTAG_GIF_CALLED 0 87132451Sroberto 8882498Srobertostruct etherip_header { 89132451Sroberto u_int8_t eip_ver; /* version/reserved */ 9054359Sroberto u_int8_t eip_pad; /* required padding byte */ 9154359Sroberto}; 9254359Sroberto#define ETHERIP_VER_VERS_MASK 0x0f 9354359Sroberto#define ETHERIP_VER_RSVD_MASK 0xf0 9454359Sroberto#define ETHERIP_VERSION 0x03 9554359Sroberto 9654359Sroberto/* Prototypes */ 9754359Srobertovoid gifattach0(struct gif_softc *); 98285612Sdelphijvoid gif_input(struct mbuf *, int, struct ifnet *); 99182007Srobertoint gif_output(struct ifnet *, struct mbuf *, struct sockaddr *, 100182007Sroberto struct rtentry *); 101285612Sdelphijint gif_ioctl(struct ifnet *, u_long, caddr_t); 102285612Sdelphijint gif_set_tunnel(struct ifnet *, struct sockaddr *, struct sockaddr *); 103285612Sdelphijvoid gif_delete_tunnel(struct ifnet *); 104285612Sdelphijint gif_encapcheck(const struct mbuf *, int, int, void *); 105285612Sdelphij 106285612Sdelphij#endif /* _KERNEL */ 107285612Sdelphij 108285612Sdelphij#endif /* _NET_IF_GIF_H_ */ 109285612Sdelphij