1adf284a2SGleb Smirnoff /*- 2adf284a2SGleb Smirnoff * ng_tcpmss.h 3adf284a2SGleb Smirnoff * 4*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 5fe267a55SPedro F. Giffuni * 6adf284a2SGleb Smirnoff * Copyright (c) 2004, Alexey Popov <lollypop@flexuser.ru> 7adf284a2SGleb Smirnoff * All rights reserved. 8adf284a2SGleb Smirnoff * 9adf284a2SGleb Smirnoff * Redistribution and use in source and binary forms, with or without 10adf284a2SGleb Smirnoff * modification, are permitted provided that the following conditions 11adf284a2SGleb Smirnoff * are met: 12adf284a2SGleb Smirnoff * 1. Redistributions of source code must retain the above copyright 13adf284a2SGleb Smirnoff * notice unmodified, this list of conditions, and the following 14adf284a2SGleb Smirnoff * disclaimer. 15adf284a2SGleb Smirnoff * 2. Redistributions in binary form must reproduce the above copyright 16adf284a2SGleb Smirnoff * notice, this list of conditions and the following disclaimer in the 17adf284a2SGleb Smirnoff * documentation and/or other materials provided with the distribution. 18adf284a2SGleb Smirnoff * 19adf284a2SGleb Smirnoff * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20adf284a2SGleb Smirnoff * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21adf284a2SGleb Smirnoff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22adf284a2SGleb Smirnoff * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23adf284a2SGleb Smirnoff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24adf284a2SGleb Smirnoff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25adf284a2SGleb Smirnoff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26adf284a2SGleb Smirnoff * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27adf284a2SGleb Smirnoff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28adf284a2SGleb Smirnoff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29adf284a2SGleb Smirnoff * SUCH DAMAGE. 30adf284a2SGleb Smirnoff */ 31adf284a2SGleb Smirnoff 32adf284a2SGleb Smirnoff #ifndef _NETGRAPH_TCPMSS_H_ 33adf284a2SGleb Smirnoff #define _NETGRAPH_TCPMSS_H_ 34adf284a2SGleb Smirnoff 35adf284a2SGleb Smirnoff /* Node type name and magic cookie */ 36adf284a2SGleb Smirnoff #define NG_TCPMSS_NODE_TYPE "tcpmss" 37adf284a2SGleb Smirnoff #define NGM_TCPMSS_COOKIE 1097623478 38adf284a2SGleb Smirnoff 39adf284a2SGleb Smirnoff /* Statistics structure for one hook. */ 40adf284a2SGleb Smirnoff struct ng_tcpmss_hookstat { 41adf284a2SGleb Smirnoff uint64_t Octets; 42adf284a2SGleb Smirnoff uint64_t Packets; 43adf284a2SGleb Smirnoff uint16_t maxMSS; 44adf284a2SGleb Smirnoff uint64_t SYNPkts; 45adf284a2SGleb Smirnoff uint64_t FixedPkts; 46adf284a2SGleb Smirnoff }; 47adf284a2SGleb Smirnoff 48adf284a2SGleb Smirnoff /* Keep this in sync with the above structure definition. */ 49adf284a2SGleb Smirnoff #define NG_TCPMSS_HOOKSTAT_INFO { \ 50adf284a2SGleb Smirnoff { "Octets", &ng_parse_uint64_type }, \ 51adf284a2SGleb Smirnoff { "Packets", &ng_parse_uint64_type }, \ 52adf284a2SGleb Smirnoff { "maxMSS", &ng_parse_uint16_type }, \ 53adf284a2SGleb Smirnoff { "SYNPkts", &ng_parse_uint64_type }, \ 54adf284a2SGleb Smirnoff { "FixedPkts", &ng_parse_uint64_type }, \ 55adf284a2SGleb Smirnoff { NULL } \ 56adf284a2SGleb Smirnoff } 57adf284a2SGleb Smirnoff 58adf284a2SGleb Smirnoff /* Structure for NGM_TCPMSS_CONFIG. */ 59adf284a2SGleb Smirnoff struct ng_tcpmss_config { 60adf284a2SGleb Smirnoff char inHook[NG_HOOKSIZ]; 61adf284a2SGleb Smirnoff char outHook[NG_HOOKSIZ]; 62adf284a2SGleb Smirnoff uint16_t maxMSS; 63adf284a2SGleb Smirnoff }; 64adf284a2SGleb Smirnoff 65adf284a2SGleb Smirnoff /* Keep this in sync with the above structure definition. */ 66adf284a2SGleb Smirnoff #define NG_TCPMSS_CONFIG_INFO { \ 67adf284a2SGleb Smirnoff { "inHook", &ng_parse_hookbuf_type }, \ 68adf284a2SGleb Smirnoff { "outHook", &ng_parse_hookbuf_type }, \ 69adf284a2SGleb Smirnoff { "maxMSS", &ng_parse_uint16_type }, \ 70adf284a2SGleb Smirnoff { NULL } \ 71adf284a2SGleb Smirnoff } 72adf284a2SGleb Smirnoff 73adf284a2SGleb Smirnoff /* Netgraph commands */ 74adf284a2SGleb Smirnoff enum { 75adf284a2SGleb Smirnoff NGM_TCPMSS_GET_STATS = 1, /* Get stats. */ 76adf284a2SGleb Smirnoff NGM_TCPMSS_CLR_STATS, /* Clear stats. */ 77adf284a2SGleb Smirnoff NGM_TCPMSS_GETCLR_STATS, /* "Atomically" get and clear stats. */ 78adf284a2SGleb Smirnoff NGM_TCPMSS_CONFIG /* Set configuration. */ 79adf284a2SGleb Smirnoff }; 80adf284a2SGleb Smirnoff 81adf284a2SGleb Smirnoff #endif /* _NETGRAPH_TCPMSS_H_ */ 82