/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2006 Alexander Motin <[email protected]>4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice unmodified, this list of conditions, and the following11* disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _NETGRAPH_NG_DEFLATE_H_30#define _NETGRAPH_NG_DEFLATE_H_3132/* Node type name and magic cookie */33#define NG_DEFLATE_NODE_TYPE "deflate"34#define NGM_DEFLATE_COOKIE 11666426563536/* Hook names */37#define NG_DEFLATE_HOOK_COMP "comp" /* compression hook */38#define NG_DEFLATE_HOOK_DECOMP "decomp" /* decompression hook */3940/* Config struct */41struct ng_deflate_config {42u_char enable; /* node enabled */43u_char windowBits; /* log2(Window size) */44};4546/* Keep this in sync with the above structure definition. */47#define NG_DEFLATE_CONFIG_INFO { \48{ "enable", &ng_parse_uint8_type }, \49{ "windowBits", &ng_parse_uint8_type }, \50{ NULL } \51}5253/* Statistics structure for one direction. */54struct ng_deflate_stats {55uint64_t FramesPlain;56uint64_t FramesComp;57uint64_t FramesUncomp;58uint64_t InOctets;59uint64_t OutOctets;60uint64_t Errors;61};6263/* Keep this in sync with the above structure definition. */64#define NG_DEFLATE_STATS_INFO { \65{ "FramesPlain",&ng_parse_uint64_type }, \66{ "FramesComp", &ng_parse_uint64_type }, \67{ "FramesUncomp", &ng_parse_uint64_type }, \68{ "InOctets", &ng_parse_uint64_type }, \69{ "OutOctets", &ng_parse_uint64_type }, \70{ "Errors", &ng_parse_uint64_type }, \71{ NULL } \72}7374/* Netgraph commands */75enum {76NGM_DEFLATE_CONFIG = 1,77NGM_DEFLATE_RESETREQ, /* sent either way! */78NGM_DEFLATE_GET_STATS,79NGM_DEFLATE_CLR_STATS,80NGM_DEFLATE_GETCLR_STATS,81};8283#endif /* _NETGRAPH_NG_DEFLATE_H_ */848586