/* $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $ */12/*-3* SPDX-License-Identifier: BSD-3-Clause4*5* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.6* Copyright (c) 2018 Andrey V. Elsukov <[email protected]>7* All rights reserved.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17* 3. Neither the name of the project nor the names of its contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32*/3334#ifndef _NETINET_IP_ENCAP_H_35#define _NETINET_IP_ENCAP_H_3637#ifdef _KERNEL3839int encap4_input(struct mbuf **, int *, int);40int encap6_input(struct mbuf **, int *, int);4142typedef int (*encap_lookup_t)(const struct mbuf *, int, int, void **);43typedef int (*encap_check_t)(const struct mbuf *, int, int, void *);44typedef int (*encap_input_t)(struct mbuf *, int, int, void *);45typedef void (*encap_srcaddr_t)(void *, const struct sockaddr *, int);4647struct encap_config {48int proto; /* protocol */49int min_length; /* minimum packet length */50int max_hdrsize; /* maximum header size */51int exact_match; /* a packet is exactly matched */52#define ENCAP_DRV_LOOKUP 0x7fffffff5354encap_lookup_t lookup;55encap_check_t check;56encap_input_t input;5758void *pad[3];59};6061struct encaptab;62struct srcaddrtab;6364const struct encaptab *ip_encap_attach(const struct encap_config *,65void *arg, int mflags);66const struct encaptab *ip6_encap_attach(const struct encap_config *,67void *arg, int mflags);6869const struct srcaddrtab *ip_encap_register_srcaddr(encap_srcaddr_t,70void *arg, int mflags);71const struct srcaddrtab *ip6_encap_register_srcaddr(encap_srcaddr_t,72void *arg, int mflags);7374int ip_encap_unregister_srcaddr(const struct srcaddrtab *);75int ip6_encap_unregister_srcaddr(const struct srcaddrtab *);76int ip_encap_detach(const struct encaptab *);77int ip6_encap_detach(const struct encaptab *);78#endif7980#endif /*_NETINET_IP_ENCAP_H_*/818283