ipcomp_var.h revision 253081
143412Snewton/*	$FreeBSD: head/sys/netipsec/ipcomp_var.h 253081 2013-07-09 09:32:06Z ae $	*/
243412Snewton/*	$KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $	*/
343412Snewton
443412Snewton/*-
543412Snewton * Copyright (C) 1999 WIDE Project.
643412Snewton * All rights reserved.
743412Snewton *
843412Snewton * Redistribution and use in source and binary forms, with or without
943412Snewton * modification, are permitted provided that the following conditions
1043412Snewton * are met:
1143412Snewton * 1. Redistributions of source code must retain the above copyright
1243412Snewton *    notice, this list of conditions and the following disclaimer.
1343412Snewton * 2. Redistributions in binary form must reproduce the above copyright
1443412Snewton *    notice, this list of conditions and the following disclaimer in the
1543412Snewton *    documentation and/or other materials provided with the distribution.
1643412Snewton * 3. Neither the name of the project nor the names of its contributors
1743412Snewton *    may be used to endorse or promote products derived from this software
1843412Snewton *    without specific prior written permission.
1943412Snewton *
2043412Snewton * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2143412Snewton * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2243412Snewton * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2343412Snewton * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2443412Snewton * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2543412Snewton * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2643412Snewton * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2749267Snewton * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2850477Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2943412Snewton * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3043412Snewton * SUCH DAMAGE.
3143412Snewton */
3243412Snewton
3343412Snewton#ifndef _NETIPSEC_IPCOMP_VAR_H_
3443412Snewton#define _NETIPSEC_IPCOMP_VAR_H_
3543412Snewton
3643412Snewton/*
3754300Snewton * These define the algorithm indices into the histogram.  They're
3854300Snewton * presently based on the PF_KEY v2 protocol values which is bogus;
3943412Snewton * they should be decoupled from the protocol at which time we can
4065302Sobrien * pack them and reduce the size of the array to a minimum.
4165302Sobrien */
4265302Sobrien#define	IPCOMP_ALG_MAX	8
4365302Sobrien
4465302Sobrien#define	IPCOMPSTAT_VERSION	2
4565302Sobrienstruct ipcompstat {
4665302Sobrien	uint64_t	ipcomps_hdrops;	/* Packet shorter than header shows */
4765302Sobrien	uint64_t	ipcomps_nopf;	/* Protocol family not supported */
4865302Sobrien	uint64_t	ipcomps_notdb;
4965302Sobrien	uint64_t	ipcomps_badkcr;
5065302Sobrien	uint64_t	ipcomps_qfull;
5143412Snewton	uint64_t	ipcomps_noxform;
5243412Snewton	uint64_t	ipcomps_wrap;
5343412Snewton	uint64_t	ipcomps_input;	/* Input IPcomp packets */
5443412Snewton	uint64_t	ipcomps_output;	/* Output IPcomp packets */
5543412Snewton	uint64_t	ipcomps_invalid;/* Trying to use an invalid TDB */
5643412Snewton	uint64_t	ipcomps_ibytes;	/* Input bytes */
5743412Snewton	uint64_t	ipcomps_obytes;	/* Output bytes */
5843412Snewton	uint64_t	ipcomps_toobig;	/* Packet got > IP_MAXPACKET */
5943412Snewton	uint64_t	ipcomps_pdrops;	/* Packet blocked due to policy */
6043412Snewton	uint64_t	ipcomps_crypto;	/* "Crypto" processing failure */
6143412Snewton	uint64_t	ipcomps_hist[IPCOMP_ALG_MAX];/* Per-algorithm op count */
6243412Snewton	uint64_t	ipcomps_threshold; /* Packet < comp. algo. threshold. */
6343412Snewton	uint64_t	ipcomps_uncompr; /* Compression was useles. */
6443412Snewton};
6543412Snewton
6643412Snewton#ifdef _KERNEL
6743412SnewtonVNET_DECLARE(int, ipcomp_enable);
6843412SnewtonVNET_DECLARE(struct ipcompstat, ipcompstat);
6943412Snewton
7043412Snewton#define	IPCOMPSTAT_ADD(name, val)	V_ipcompstat.name += (val)
7143412Snewton#define	IPCOMPSTAT_INC(name)		IPCOMPSTAT_ADD(name, 1)
7243412Snewton#define	V_ipcomp_enable		VNET(ipcomp_enable)
7343412Snewton#define	V_ipcompstat		VNET(ipcompstat)
7443412Snewton#endif /* _KERNEL */
7543412Snewton#endif /*_NETIPSEC_IPCOMP_VAR_H_*/
7643412Snewton