Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/ip_encap.h
/* $FreeBSD$ */ | /* $FreeBSD$ */ | ||||
/* $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $ */ | /* $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $ */ | ||||
/*- | /*- | ||||
* SPDX-License-Identifier: BSD-3-Clause | * SPDX-License-Identifier: BSD-3-Clause | ||||
* | * | ||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | ||||
* Copyright (c) 2018 Andrey V. Elsukov <ae@FreeBSD.org> | |||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
* notice, this list of conditions and the following disclaimer. | * notice, this list of conditions and the following disclaimer. | ||||
* 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
Show All 16 Lines | |||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#ifndef _NETINET_IP_ENCAP_H_ | #ifndef _NETINET_IP_ENCAP_H_ | ||||
#define _NETINET_IP_ENCAP_H_ | #define _NETINET_IP_ENCAP_H_ | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
struct encaptab { | |||||
LIST_ENTRY(encaptab) chain; | |||||
int af; | |||||
int proto; /* -1: don't care, I'll check myself */ | |||||
struct sockaddr_storage src; /* my addr */ | |||||
struct sockaddr_storage srcmask; | |||||
struct sockaddr_storage dst; /* remote addr */ | |||||
struct sockaddr_storage dstmask; | |||||
int (*func)(const struct mbuf *, int, int, void *); | |||||
const struct protosw *psw; /* only pr_input will be used */ | |||||
void *arg; /* passed via m->m_pkthdr.aux */ | |||||
}; | |||||
int encap4_input(struct mbuf **, int *, int); | int encap4_input(struct mbuf **, int *, int); | ||||
int encap6_input(struct mbuf **, int *, int); | int encap6_input(struct mbuf **, int *, int); | ||||
const struct encaptab *encap_attach(int, int, const struct sockaddr *, | |||||
const struct sockaddr *, const struct sockaddr *, | typedef int (*encap_lookup_t)(const struct mbuf *, int, int, void **); | ||||
const struct sockaddr *, const struct protosw *, void *); | typedef int (*encap_check_t)(const struct mbuf *, int, int, void *); | ||||
const struct encaptab *encap_attach_func(int, int, | typedef int (*encap_input_t)(struct mbuf *, int , int, void *); | ||||
int (*)(const struct mbuf *, int, int, void *), | |||||
const struct protosw *, void *); | struct encap_config { | ||||
int encap_detach(const struct encaptab *); | int proto; /* protocol */ | ||||
void *encap_getarg(struct mbuf *); | int min_length; /* minimum packet length */ | ||||
int exact_match; /* a packet is exactly matched */ | |||||
#define ENCAP_DRV_LOOKUP 0x7fffffff | |||||
encap_lookup_t lookup; | |||||
encap_check_t check; | |||||
encap_input_t input; | |||||
}; | |||||
struct encaptab; | |||||
const struct encaptab *ip_encap_attach(const struct encap_config *, | |||||
void *arg, int mflags); | |||||
const struct encaptab *ip6_encap_attach(const struct encap_config *, | |||||
void *arg, int mflags); | |||||
int ip_encap_detach(const struct encaptab *); | |||||
int ip6_encap_detach(const struct encaptab *); | |||||
#endif | #endif | ||||
#endif /*_NETINET_IP_ENCAP_H_*/ | #endif /*_NETINET_IP_ENCAP_H_*/ |