ipcomp_var.h revision 252028
1208963Srdivacky/*	$FreeBSD: head/sys/netipsec/ipcomp_var.h 252028 2013-06-20 11:44:16Z ae $	*/
2208963Srdivacky/*	$KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $	*/
3239614Sdim
4208963Srdivacky/*-
5239614Sdim * Copyright (C) 1999 WIDE Project.
6239614Sdim * All rights reserved.
7239614Sdim *
8239614Sdim * Redistribution and use in source and binary forms, with or without
9239614Sdim * modification, are permitted provided that the following conditions
10208963Srdivacky * are met:
11229169Snwhitehorn * 1. Redistributions of source code must retain the above copyright
12239614Sdim *    notice, this list of conditions and the following disclaimer.
13209153Sed * 2. Redistributions in binary form must reproduce the above copyright
14208963Srdivacky *    notice, this list of conditions and the following disclaimer in the
15239462Sdim *    documentation and/or other materials provided with the distribution.
16239462Sdim * 3. Neither the name of the project nor the names of its contributors
17239462Sdim *    may be used to endorse or promote products derived from this software
18239462Sdim *    without specific prior written permission.
19239462Sdim *
20208963Srdivacky * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21210388Srpaulo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22239614Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23210388Srpaulo * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24210388Srpaulo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25210388Srpaulo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26210388Srpaulo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27210388Srpaulo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28210388Srpaulo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29239614Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30210388Srpaulo * SUCH DAMAGE.
31210388Srpaulo */
32239614Sdim
33211573Srpaulo#ifndef _NETIPSEC_IPCOMP_VAR_H_
34208963Srdivacky#define _NETIPSEC_IPCOMP_VAR_H_
35208963Srdivacky
36239614Sdim/*
37239614Sdim * These define the algorithm indices into the histogram.  They're
38239614Sdim * presently based on the PF_KEY v2 protocol values which is bogus;
39208963Srdivacky * they should be decoupled from the protocol at which time we can
40208963Srdivacky * pack them and reduce the size of the array to a minimum.
41224145Sdim */
42224145Sdim#define	IPCOMP_ALG_MAX	8
43208963Srdivacky
44208963Srdivacky#define	IPCOMPSTAT_VERSION	1
45208963Srdivackystruct ipcompstat {
46208963Srdivacky	u_int32_t	ipcomps_hdrops;	/* Packet shorter than header shows */
47208963Srdivacky	u_int32_t	ipcomps_nopf;	/* Protocol family not supported */
48208963Srdivacky	u_int32_t	ipcomps_notdb;
49208963Srdivacky	u_int32_t	ipcomps_badkcr;
50208963Srdivacky	u_int32_t	ipcomps_qfull;
51208963Srdivacky	u_int32_t	ipcomps_noxform;
52212904Sdim	u_int32_t	ipcomps_wrap;
53212904Sdim	u_int32_t	ipcomps_input;	/* Input IPcomp packets */
54208963Srdivacky	u_int32_t	ipcomps_output;	/* Output IPcomp packets */
55224145Sdim	u_int32_t	ipcomps_invalid;/* Trying to use an invalid TDB */
56218893Sdim	u_int64_t	ipcomps_ibytes;	/* Input bytes */
57224145Sdim	u_int64_t	ipcomps_obytes;	/* Output bytes */
58224145Sdim	u_int32_t	ipcomps_toobig;	/* Packet got > IP_MAXPACKET */
59224145Sdim	u_int32_t	ipcomps_pdrops;	/* Packet blocked due to policy */
60208963Srdivacky	u_int32_t	ipcomps_crypto;	/* "Crypto" processing failure */
61224145Sdim	u_int32_t	ipcomps_hist[IPCOMP_ALG_MAX];/* Per-algorithm op count */
62224145Sdim	u_int32_t	version;	/* Version of this structure. */
63224145Sdim	u_int32_t	ipcomps_threshold; /* Packet < comp. algo. threshold. */
64208963Srdivacky	u_int32_t	ipcomps_uncompr; /* Compression was useles. */
65208963Srdivacky};
66208963Srdivacky
67210299Sed#ifdef _KERNEL
68226633SdimVNET_DECLARE(int, ipcomp_enable);
69224145SdimVNET_DECLARE(struct ipcompstat, ipcompstat);
70224145Sdim
71210299Sed#define	IPCOMPSTAT_ADD(name, val)	V_ipcompstat.name += (val)
72212904Sdim#define	IPCOMPSTAT_INC(name)		IPCOMPSTAT_ADD(name, 1)
73226633Sdim#define	V_ipcomp_enable		VNET(ipcomp_enable)
74224145Sdim#define	V_ipcompstat		VNET(ipcompstat)
75224145Sdim#endif /* _KERNEL */
76212904Sdim#endif /*_NETIPSEC_IPCOMP_VAR_H_*/
77226633Sdim