1165581Sglebius/*- 2165581Sglebius * Copyright (c) 2006 Alexander Motin <mav@alkar.net> 3165581Sglebius * All rights reserved. 4165581Sglebius * 5165581Sglebius * Redistribution and use in source and binary forms, with or without 6165581Sglebius * modification, are permitted provided that the following conditions 7165581Sglebius * are met: 8165581Sglebius * 1. Redistributions of source code must retain the above copyright 9165581Sglebius * notice unmodified, this list of conditions, and the following 10165581Sglebius * disclaimer. 11165581Sglebius * 2. Redistributions in binary form must reproduce the above copyright 12165581Sglebius * notice, this list of conditions and the following disclaimer in the 13165581Sglebius * documentation and/or other materials provided with the distribution. 14165581Sglebius * 15165581Sglebius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16165581Sglebius * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17165581Sglebius * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18165581Sglebius * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19165581Sglebius * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20165581Sglebius * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21165581Sglebius * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22165581Sglebius * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23165581Sglebius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24165581Sglebius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25165581Sglebius * SUCH DAMAGE. 26165581Sglebius * 27165581Sglebius * $FreeBSD$ 28165581Sglebius */ 29165581Sglebius 30165581Sglebius#ifndef _NETGRAPH_NG_DEFLATE_H_ 31165581Sglebius#define _NETGRAPH_NG_DEFLATE_H_ 32165581Sglebius 33165581Sglebius/* Node type name and magic cookie */ 34165581Sglebius#define NG_DEFLATE_NODE_TYPE "deflate" 35165581Sglebius#define NGM_DEFLATE_COOKIE 1166642656 36165581Sglebius 37165581Sglebius/* Hook names */ 38165581Sglebius#define NG_DEFLATE_HOOK_COMP "comp" /* compression hook */ 39165581Sglebius#define NG_DEFLATE_HOOK_DECOMP "decomp" /* decompression hook */ 40165581Sglebius 41165581Sglebius/* Config struct */ 42165581Sglebiusstruct ng_deflate_config { 43165581Sglebius u_char enable; /* node enabled */ 44165581Sglebius u_char windowBits; /* log2(Window size) */ 45165581Sglebius}; 46165581Sglebius 47165581Sglebius/* Keep this in sync with the above structure definition. */ 48165581Sglebius#define NG_DEFLATE_CONFIG_INFO { \ 49165581Sglebius { "enable", &ng_parse_uint8_type }, \ 50165581Sglebius { "windowBits", &ng_parse_uint8_type }, \ 51165581Sglebius { NULL } \ 52165581Sglebius} 53165581Sglebius 54165581Sglebius/* Statistics structure for one direction. */ 55165581Sglebiusstruct ng_deflate_stats { 56165581Sglebius uint64_t FramesPlain; 57165581Sglebius uint64_t FramesComp; 58165581Sglebius uint64_t FramesUncomp; 59165581Sglebius uint64_t InOctets; 60165581Sglebius uint64_t OutOctets; 61165581Sglebius uint64_t Errors; 62165581Sglebius}; 63165581Sglebius 64165581Sglebius/* Keep this in sync with the above structure definition. */ 65165581Sglebius#define NG_DEFLATE_STATS_INFO { \ 66165581Sglebius { "FramesPlain",&ng_parse_uint64_type }, \ 67165581Sglebius { "FramesComp", &ng_parse_uint64_type }, \ 68165581Sglebius { "FramesUncomp", &ng_parse_uint64_type }, \ 69165581Sglebius { "InOctets", &ng_parse_uint64_type }, \ 70165581Sglebius { "OutOctets", &ng_parse_uint64_type }, \ 71165581Sglebius { "Errors", &ng_parse_uint64_type }, \ 72165581Sglebius { NULL } \ 73165581Sglebius} 74165581Sglebius 75165581Sglebius/* Netgraph commands */ 76165581Sglebiusenum { 77165581Sglebius NGM_DEFLATE_CONFIG = 1, 78165581Sglebius NGM_DEFLATE_RESETREQ, /* sent either way! */ 79165581Sglebius NGM_DEFLATE_GET_STATS, 80165581Sglebius NGM_DEFLATE_CLR_STATS, 81165581Sglebius NGM_DEFLATE_GETCLR_STATS, 82165581Sglebius}; 83165581Sglebius 84165581Sglebius#endif /* _NETGRAPH_NG_DEFLATE_H_ */ 85165581Sglebius 86