162587Sitojun/* $FreeBSD$ */ 262587Sitojun/* $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $ */ 362587Sitojun 4139823Simp/*- 562587Sitojun * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 662587Sitojun * All rights reserved. 762587Sitojun * 862587Sitojun * Redistribution and use in source and binary forms, with or without 962587Sitojun * modification, are permitted provided that the following conditions 1062587Sitojun * are met: 1162587Sitojun * 1. Redistributions of source code must retain the above copyright 1262587Sitojun * notice, this list of conditions and the following disclaimer. 1362587Sitojun * 2. Redistributions in binary form must reproduce the above copyright 1462587Sitojun * notice, this list of conditions and the following disclaimer in the 1562587Sitojun * documentation and/or other materials provided with the distribution. 1662587Sitojun * 3. Neither the name of the project nor the names of its contributors 1762587Sitojun * may be used to endorse or promote products derived from this software 1862587Sitojun * without specific prior written permission. 1962587Sitojun * 2062587Sitojun * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 2162587Sitojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2262587Sitojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2362587Sitojun * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 2462587Sitojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2562587Sitojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2662587Sitojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2762587Sitojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2862587Sitojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2962587Sitojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3062587Sitojun * SUCH DAMAGE. 3162587Sitojun */ 3262587Sitojun 3362587Sitojun#ifndef _NETINET_IP_ENCAP_H_ 3462587Sitojun#define _NETINET_IP_ENCAP_H_ 3562587Sitojun 3662587Sitojun#ifdef _KERNEL 3762587Sitojun 3862587Sitojunstruct encaptab { 3962587Sitojun LIST_ENTRY(encaptab) chain; 4062587Sitojun int af; 4162587Sitojun int proto; /* -1: don't care, I'll check myself */ 4262587Sitojun struct sockaddr_storage src; /* my addr */ 4362587Sitojun struct sockaddr_storage srcmask; 4462587Sitojun struct sockaddr_storage dst; /* remote addr */ 4562587Sitojun struct sockaddr_storage dstmask; 4692723Salfred int (*func)(const struct mbuf *, int, int, void *); 4762587Sitojun const struct protosw *psw; /* only pr_input will be used */ 4862587Sitojun void *arg; /* passed via m->m_pkthdr.aux */ 4962587Sitojun}; 5062587Sitojun 5192723Salfredvoid encap_init(void); 5292723Salfredvoid encap4_input(struct mbuf *, int); 5392723Salfredint encap6_input(struct mbuf **, int *, int); 5492723Salfredconst struct encaptab *encap_attach(int, int, const struct sockaddr *, 5562587Sitojun const struct sockaddr *, const struct sockaddr *, 5692723Salfred const struct sockaddr *, const struct protosw *, void *); 5792723Salfredconst struct encaptab *encap_attach_func(int, int, 5892723Salfred int (*)(const struct mbuf *, int, int, void *), 5992723Salfred const struct protosw *, void *); 6092723Salfredint encap_detach(const struct encaptab *); 6192723Salfredvoid *encap_getarg(struct mbuf *); 6262587Sitojun#endif 6362587Sitojun 6462587Sitojun#endif /*_NETINET_IP_ENCAP_H_*/ 65