ng_async.h revision 53913
152419Sjulian 252419Sjulian/* 352419Sjulian * ng_async.h 452419Sjulian * 552419Sjulian * Copyright (c) 1996-1999 Whistle Communications, Inc. 652419Sjulian * All rights reserved. 752419Sjulian * 852419Sjulian * Subject to the following obligations and disclaimer of warranty, use and 952419Sjulian * redistribution of this software, in source or object code forms, with or 1052419Sjulian * without modifications are expressly permitted by Whistle Communications; 1152419Sjulian * provided, however, that: 1252419Sjulian * 1. Any and all reproductions of the source or object code must include the 1352419Sjulian * copyright notice above and the following disclaimer of warranties; and 1452419Sjulian * 2. No rights are granted, in any manner or form, to use Whistle 1552419Sjulian * Communications, Inc. trademarks, including the mark "WHISTLE 1652419Sjulian * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 1752419Sjulian * such appears in the above copyright notice or in the software. 1852419Sjulian * 1952419Sjulian * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 2052419Sjulian * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 2152419Sjulian * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 2252419Sjulian * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 2352419Sjulian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 2452419Sjulian * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 2552419Sjulian * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 2652419Sjulian * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 2752419Sjulian * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 2852419Sjulian * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 2952419Sjulian * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 3052419Sjulian * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 3152419Sjulian * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 3252419Sjulian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3352419Sjulian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3452419Sjulian * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 3552419Sjulian * OF SUCH DAMAGE. 3652419Sjulian * 3752419Sjulian * Author: Archie Cobbs <archie@whistle.com> 3852419Sjulian * 3952419Sjulian * $FreeBSD: head/sys/netgraph/ng_async.h 53913 1999-11-30 02:45:32Z archie $ 4052419Sjulian * $Whistle: ng_async.h,v 1.5 1999/01/25 01:17:14 archie Exp $ 4152419Sjulian */ 4252419Sjulian 4352419Sjulian#ifndef _NETGRAPH_ASYNC_H_ 4452419Sjulian#define _NETGRAPH_ASYNC_H_ 4552419Sjulian 4652419Sjulian/* Type name and cookie */ 4752419Sjulian#define NG_ASYNC_NODE_TYPE "async" 4853913Sarchie#define NGM_ASYNC_COOKIE 886473717 4952419Sjulian 5052419Sjulian/* Hook names */ 5152976Sarchie#define NG_ASYNC_HOOK_SYNC "sync" /* Sync frames */ 5252976Sarchie#define NG_ASYNC_HOOK_ASYNC "async" /* Async-encoded frames */ 5352419Sjulian 5452419Sjulian/* Maximum receive size bounds (for both sync and async sides) */ 5552419Sjulian#define NG_ASYNC_MIN_MRU 1 5652419Sjulian#define NG_ASYNC_MAX_MRU 8192 5752419Sjulian#define NG_ASYNC_DEFAULT_MRU 1600 5852419Sjulian 5952419Sjulian/* Frame statistics */ 6052419Sjulianstruct ng_async_stat { 6152419Sjulian u_int32_t syncOctets; 6252419Sjulian u_int32_t syncFrames; 6352419Sjulian u_int32_t syncOverflows; 6452419Sjulian u_int32_t asyncOctets; 6552419Sjulian u_int32_t asyncFrames; 6652419Sjulian u_int32_t asyncRunts; 6752419Sjulian u_int32_t asyncOverflows; 6852419Sjulian u_int32_t asyncBadCheckSums; 6952419Sjulian}; 7052419Sjulian 7153913Sarchie/* Keep this in sync with the above structure definition */ 7253913Sarchie#define NG_ASYNC_STATS_TYPE_INFO { \ 7353913Sarchie { \ 7453913Sarchie { "syncOctets", &ng_parse_int32_type }, \ 7553913Sarchie { "syncFrames", &ng_parse_int32_type }, \ 7653913Sarchie { "syncOverflows", &ng_parse_int32_type }, \ 7753913Sarchie { "asyncOctets", &ng_parse_int32_type }, \ 7853913Sarchie { "asyncFrames", &ng_parse_int32_type }, \ 7953913Sarchie { "asyncRunts", &ng_parse_int32_type }, \ 8053913Sarchie { "asyncOverflows", &ng_parse_int32_type }, \ 8153913Sarchie { "asyncBadCheckSums",&ng_parse_int32_type }, \ 8253913Sarchie { NULL }, \ 8353913Sarchie } \ 8453913Sarchie} 8553913Sarchie 8652419Sjulian/* Configuration for this node */ 8752419Sjulianstruct ng_async_cfg { 8852419Sjulian u_char enabled; /* Turn encoding on/off */ 8952419Sjulian u_int16_t amru; /* Max receive async frame length */ 9052419Sjulian u_int16_t smru; /* Max receive sync frame length */ 9152419Sjulian u_int32_t accm; /* ACCM encoding */ 9252419Sjulian}; 9352419Sjulian 9453913Sarchie/* Keep this in sync with the above structure definition */ 9553913Sarchie#define NG_ASYNC_CONFIG_TYPE_INFO { \ 9653913Sarchie { \ 9753913Sarchie { "enabled", &ng_parse_int8_type }, \ 9853913Sarchie { "amru", &ng_parse_int16_type }, \ 9953913Sarchie { "smru", &ng_parse_int16_type }, \ 10053913Sarchie { "accm", &ng_parse_int32_type }, \ 10153913Sarchie { NULL }, \ 10253913Sarchie } \ 10353913Sarchie} 10453913Sarchie 10552419Sjulian/* Commands */ 10652419Sjulianenum { 10752419Sjulian NGM_ASYNC_CMD_GET_STATS = 1, /* returns struct ng_async_stat */ 10852419Sjulian NGM_ASYNC_CMD_CLR_STATS, 10952419Sjulian NGM_ASYNC_CMD_SET_CONFIG, /* takes struct ng_async_cfg */ 11052419Sjulian NGM_ASYNC_CMD_GET_CONFIG, /* returns struct ng_async_cfg */ 11152419Sjulian}; 11252419Sjulian 11352419Sjulian#endif /* _NETGRAPH_ASYNC_H_ */ 114