1*0147868eSNuno Antunes /* 2*0147868eSNuno Antunes * ng_async.h 3*0147868eSNuno Antunes */ 4*0147868eSNuno Antunes 5*0147868eSNuno Antunes /*- 6*0147868eSNuno Antunes * Copyright (c) 1996-1999 Whistle Communications, Inc. 7*0147868eSNuno Antunes * All rights reserved. 8*0147868eSNuno Antunes * 9*0147868eSNuno Antunes * Subject to the following obligations and disclaimer of warranty, use and 10*0147868eSNuno Antunes * redistribution of this software, in source or object code forms, with or 11*0147868eSNuno Antunes * without modifications are expressly permitted by Whistle Communications; 12*0147868eSNuno Antunes * provided, however, that: 13*0147868eSNuno Antunes * 1. Any and all reproductions of the source or object code must include the 14*0147868eSNuno Antunes * copyright notice above and the following disclaimer of warranties; and 15*0147868eSNuno Antunes * 2. No rights are granted, in any manner or form, to use Whistle 16*0147868eSNuno Antunes * Communications, Inc. trademarks, including the mark "WHISTLE 17*0147868eSNuno Antunes * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 18*0147868eSNuno Antunes * such appears in the above copyright notice or in the software. 19*0147868eSNuno Antunes * 20*0147868eSNuno Antunes * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 21*0147868eSNuno Antunes * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 22*0147868eSNuno Antunes * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 23*0147868eSNuno Antunes * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 24*0147868eSNuno Antunes * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 25*0147868eSNuno Antunes * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 26*0147868eSNuno Antunes * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 27*0147868eSNuno Antunes * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 28*0147868eSNuno Antunes * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 29*0147868eSNuno Antunes * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 30*0147868eSNuno Antunes * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 31*0147868eSNuno Antunes * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 32*0147868eSNuno Antunes * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 33*0147868eSNuno Antunes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34*0147868eSNuno Antunes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 35*0147868eSNuno Antunes * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 36*0147868eSNuno Antunes * OF SUCH DAMAGE. 37*0147868eSNuno Antunes * 38*0147868eSNuno Antunes * Author: Archie Cobbs <archie@freebsd.org> 39*0147868eSNuno Antunes * 40*0147868eSNuno Antunes * $FreeBSD: src/sys/netgraph/ng_async.h,v 1.11 2005/01/07 01:45:39 imp Exp $ 41*0147868eSNuno Antunes * $DragonFly: src/sys/netgraph7/ng_async.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ 42*0147868eSNuno Antunes * $Whistle: ng_async.h,v 1.5 1999/01/25 01:17:14 archie Exp $ 43*0147868eSNuno Antunes */ 44*0147868eSNuno Antunes 45*0147868eSNuno Antunes #ifndef _NETGRAPH_NG_ASYNC_H_ 46*0147868eSNuno Antunes #define _NETGRAPH_NG_ASYNC_H_ 47*0147868eSNuno Antunes 48*0147868eSNuno Antunes /* Type name and cookie */ 49*0147868eSNuno Antunes #define NG_ASYNC_NODE_TYPE "async" 50*0147868eSNuno Antunes #define NGM_ASYNC_COOKIE 886473717 51*0147868eSNuno Antunes 52*0147868eSNuno Antunes /* Hook names */ 53*0147868eSNuno Antunes #define NG_ASYNC_HOOK_SYNC "sync" /* Sync frames */ 54*0147868eSNuno Antunes #define NG_ASYNC_HOOK_ASYNC "async" /* Async-encoded frames */ 55*0147868eSNuno Antunes 56*0147868eSNuno Antunes /* Maximum receive size bounds (for both sync and async sides) */ 57*0147868eSNuno Antunes #define NG_ASYNC_MIN_MRU 1 58*0147868eSNuno Antunes #define NG_ASYNC_MAX_MRU 8192 59*0147868eSNuno Antunes #define NG_ASYNC_DEFAULT_MRU 1600 60*0147868eSNuno Antunes 61*0147868eSNuno Antunes /* Frame statistics */ 62*0147868eSNuno Antunes struct ng_async_stat { 63*0147868eSNuno Antunes u_int32_t syncOctets; 64*0147868eSNuno Antunes u_int32_t syncFrames; 65*0147868eSNuno Antunes u_int32_t syncOverflows; 66*0147868eSNuno Antunes u_int32_t asyncOctets; 67*0147868eSNuno Antunes u_int32_t asyncFrames; 68*0147868eSNuno Antunes u_int32_t asyncRunts; 69*0147868eSNuno Antunes u_int32_t asyncOverflows; 70*0147868eSNuno Antunes u_int32_t asyncBadCheckSums; 71*0147868eSNuno Antunes }; 72*0147868eSNuno Antunes 73*0147868eSNuno Antunes /* Keep this in sync with the above structure definition */ 74*0147868eSNuno Antunes #define NG_ASYNC_STATS_TYPE_INFO { \ 75*0147868eSNuno Antunes { "syncOctets", &ng_parse_uint32_type }, \ 76*0147868eSNuno Antunes { "syncFrames", &ng_parse_uint32_type }, \ 77*0147868eSNuno Antunes { "syncOverflows", &ng_parse_uint32_type }, \ 78*0147868eSNuno Antunes { "asyncOctets", &ng_parse_uint32_type }, \ 79*0147868eSNuno Antunes { "asyncFrames", &ng_parse_uint32_type }, \ 80*0147868eSNuno Antunes { "asyncRunts", &ng_parse_uint32_type }, \ 81*0147868eSNuno Antunes { "asyncOverflows", &ng_parse_uint32_type }, \ 82*0147868eSNuno Antunes { "asyncBadCheckSums",&ng_parse_uint32_type }, \ 83*0147868eSNuno Antunes { NULL } \ 84*0147868eSNuno Antunes } 85*0147868eSNuno Antunes 86*0147868eSNuno Antunes /* Configuration for this node */ 87*0147868eSNuno Antunes struct ng_async_cfg { 88*0147868eSNuno Antunes u_char enabled; /* Turn encoding on/off */ 89*0147868eSNuno Antunes u_int16_t amru; /* Max receive async frame length */ 90*0147868eSNuno Antunes u_int16_t smru; /* Max receive sync frame length */ 91*0147868eSNuno Antunes u_int32_t accm; /* ACCM encoding */ 92*0147868eSNuno Antunes }; 93*0147868eSNuno Antunes 94*0147868eSNuno Antunes /* Keep this in sync with the above structure definition */ 95*0147868eSNuno Antunes #define NG_ASYNC_CONFIG_TYPE_INFO { \ 96*0147868eSNuno Antunes { "enabled", &ng_parse_int8_type }, \ 97*0147868eSNuno Antunes { "amru", &ng_parse_uint16_type }, \ 98*0147868eSNuno Antunes { "smru", &ng_parse_uint16_type }, \ 99*0147868eSNuno Antunes { "accm", &ng_parse_hint32_type }, \ 100*0147868eSNuno Antunes { NULL } \ 101*0147868eSNuno Antunes } 102*0147868eSNuno Antunes 103*0147868eSNuno Antunes /* Commands */ 104*0147868eSNuno Antunes enum { 105*0147868eSNuno Antunes NGM_ASYNC_CMD_GET_STATS = 1, /* returns struct ng_async_stat */ 106*0147868eSNuno Antunes NGM_ASYNC_CMD_CLR_STATS, 107*0147868eSNuno Antunes NGM_ASYNC_CMD_SET_CONFIG, /* takes struct ng_async_cfg */ 108*0147868eSNuno Antunes NGM_ASYNC_CMD_GET_CONFIG, /* returns struct ng_async_cfg */ 109*0147868eSNuno Antunes }; 110*0147868eSNuno Antunes 111*0147868eSNuno Antunes #endif /* _NETGRAPH_NG_ASYNC_H_ */ 112