181ccbd95SGleb Smirnoff /*- 2*fe267a55SPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*fe267a55SPedro F. Giffuni * 481ccbd95SGleb Smirnoff * Copyright (c) 2006 Alexander Motin <mav@alkar.net> 581ccbd95SGleb Smirnoff * All rights reserved. 681ccbd95SGleb Smirnoff * 781ccbd95SGleb Smirnoff * Redistribution and use in source and binary forms, with or without 881ccbd95SGleb Smirnoff * modification, are permitted provided that the following conditions 981ccbd95SGleb Smirnoff * are met: 1081ccbd95SGleb Smirnoff * 1. Redistributions of source code must retain the above copyright 1181ccbd95SGleb Smirnoff * notice unmodified, this list of conditions, and the following 1281ccbd95SGleb Smirnoff * disclaimer. 1381ccbd95SGleb Smirnoff * 2. Redistributions in binary form must reproduce the above copyright 1481ccbd95SGleb Smirnoff * notice, this list of conditions and the following disclaimer in the 1581ccbd95SGleb Smirnoff * documentation and/or other materials provided with the distribution. 1681ccbd95SGleb Smirnoff * 1781ccbd95SGleb Smirnoff * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1881ccbd95SGleb Smirnoff * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1981ccbd95SGleb Smirnoff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2081ccbd95SGleb Smirnoff * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2181ccbd95SGleb Smirnoff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2281ccbd95SGleb Smirnoff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2381ccbd95SGleb Smirnoff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2481ccbd95SGleb Smirnoff * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2581ccbd95SGleb Smirnoff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2681ccbd95SGleb Smirnoff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2781ccbd95SGleb Smirnoff * SUCH DAMAGE. 2881ccbd95SGleb Smirnoff * 2981ccbd95SGleb Smirnoff * $FreeBSD$ 3081ccbd95SGleb Smirnoff */ 3181ccbd95SGleb Smirnoff 3281ccbd95SGleb Smirnoff #ifndef _NETGRAPH_NG_DEFLATE_H_ 3381ccbd95SGleb Smirnoff #define _NETGRAPH_NG_DEFLATE_H_ 3481ccbd95SGleb Smirnoff 3581ccbd95SGleb Smirnoff /* Node type name and magic cookie */ 3681ccbd95SGleb Smirnoff #define NG_DEFLATE_NODE_TYPE "deflate" 3781ccbd95SGleb Smirnoff #define NGM_DEFLATE_COOKIE 1166642656 3881ccbd95SGleb Smirnoff 3981ccbd95SGleb Smirnoff /* Hook names */ 4081ccbd95SGleb Smirnoff #define NG_DEFLATE_HOOK_COMP "comp" /* compression hook */ 4181ccbd95SGleb Smirnoff #define NG_DEFLATE_HOOK_DECOMP "decomp" /* decompression hook */ 4281ccbd95SGleb Smirnoff 4381ccbd95SGleb Smirnoff /* Config struct */ 4481ccbd95SGleb Smirnoff struct ng_deflate_config { 4581ccbd95SGleb Smirnoff u_char enable; /* node enabled */ 4681ccbd95SGleb Smirnoff u_char windowBits; /* log2(Window size) */ 4781ccbd95SGleb Smirnoff }; 4881ccbd95SGleb Smirnoff 4981ccbd95SGleb Smirnoff /* Keep this in sync with the above structure definition. */ 5081ccbd95SGleb Smirnoff #define NG_DEFLATE_CONFIG_INFO { \ 5181ccbd95SGleb Smirnoff { "enable", &ng_parse_uint8_type }, \ 5281ccbd95SGleb Smirnoff { "windowBits", &ng_parse_uint8_type }, \ 5381ccbd95SGleb Smirnoff { NULL } \ 5481ccbd95SGleb Smirnoff } 5581ccbd95SGleb Smirnoff 5681ccbd95SGleb Smirnoff /* Statistics structure for one direction. */ 5781ccbd95SGleb Smirnoff struct ng_deflate_stats { 5881ccbd95SGleb Smirnoff uint64_t FramesPlain; 5981ccbd95SGleb Smirnoff uint64_t FramesComp; 6081ccbd95SGleb Smirnoff uint64_t FramesUncomp; 6181ccbd95SGleb Smirnoff uint64_t InOctets; 6281ccbd95SGleb Smirnoff uint64_t OutOctets; 6381ccbd95SGleb Smirnoff uint64_t Errors; 6481ccbd95SGleb Smirnoff }; 6581ccbd95SGleb Smirnoff 6681ccbd95SGleb Smirnoff /* Keep this in sync with the above structure definition. */ 6781ccbd95SGleb Smirnoff #define NG_DEFLATE_STATS_INFO { \ 6881ccbd95SGleb Smirnoff { "FramesPlain",&ng_parse_uint64_type }, \ 6981ccbd95SGleb Smirnoff { "FramesComp", &ng_parse_uint64_type }, \ 7081ccbd95SGleb Smirnoff { "FramesUncomp", &ng_parse_uint64_type }, \ 7181ccbd95SGleb Smirnoff { "InOctets", &ng_parse_uint64_type }, \ 7281ccbd95SGleb Smirnoff { "OutOctets", &ng_parse_uint64_type }, \ 7381ccbd95SGleb Smirnoff { "Errors", &ng_parse_uint64_type }, \ 7481ccbd95SGleb Smirnoff { NULL } \ 7581ccbd95SGleb Smirnoff } 7681ccbd95SGleb Smirnoff 7781ccbd95SGleb Smirnoff /* Netgraph commands */ 7881ccbd95SGleb Smirnoff enum { 7981ccbd95SGleb Smirnoff NGM_DEFLATE_CONFIG = 1, 8081ccbd95SGleb Smirnoff NGM_DEFLATE_RESETREQ, /* sent either way! */ 8181ccbd95SGleb Smirnoff NGM_DEFLATE_GET_STATS, 8281ccbd95SGleb Smirnoff NGM_DEFLATE_CLR_STATS, 8381ccbd95SGleb Smirnoff NGM_DEFLATE_GETCLR_STATS, 8481ccbd95SGleb Smirnoff }; 8581ccbd95SGleb Smirnoff 8681ccbd95SGleb Smirnoff #endif /* _NETGRAPH_NG_DEFLATE_H_ */ 8781ccbd95SGleb Smirnoff 88