152907Sjulian/* 252907Sjulian * netgraph.h 3139823Simp */ 4139823Simp 5139823Simp/*- 652907Sjulian * Copyright (c) 1996-1999 Whistle Communications, Inc. 752907Sjulian * All rights reserved. 852907Sjulian * 952907Sjulian * Subject to the following obligations and disclaimer of warranty, use and 1052907Sjulian * redistribution of this software, in source or object code forms, with or 1152907Sjulian * without modifications are expressly permitted by Whistle Communications; 1252907Sjulian * provided, however, that: 1352907Sjulian * 1. Any and all reproductions of the source or object code must include the 1452907Sjulian * copyright notice above and the following disclaimer of warranties; and 1552907Sjulian * 2. No rights are granted, in any manner or form, to use Whistle 1652907Sjulian * Communications, Inc. trademarks, including the mark "WHISTLE 1752907Sjulian * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 1852907Sjulian * such appears in the above copyright notice or in the software. 1952907Sjulian * 2052907Sjulian * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 2152907Sjulian * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 2252907Sjulian * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 2352907Sjulian * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 2452907Sjulian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 2552907Sjulian * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 2652907Sjulian * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 2752907Sjulian * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 2852907Sjulian * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 2952907Sjulian * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 3052907Sjulian * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 3152907Sjulian * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 3252907Sjulian * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 3352907Sjulian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3452907Sjulian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3552907Sjulian * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 3652907Sjulian * OF SUCH DAMAGE. 3752907Sjulian * 3867506Sjulian * Author: Julian Elischer <julian@freebsd.org> 3952907Sjulian * 4052907Sjulian * $FreeBSD$ 4152907Sjulian * $Whistle: ng_socketvar.h,v 1.1 1999/01/20 21:35:39 archie Exp $ 4252907Sjulian */ 4352907Sjulian 4452907Sjulian#ifndef _NETGRAPH_NG_SOCKETVAR_H_ 45122481Sru#define _NETGRAPH_NG_SOCKETVAR_H_ 4652907Sjulian 4752907Sjulian/* Netgraph protocol control block for each socket */ 4852907Sjulianstruct ngpcb { 4952907Sjulian struct socket *ng_socket; /* the socket */ 5052907Sjulian struct ngsock *sockdata; /* netgraph info */ 5160938Sjake LIST_ENTRY(ngpcb) socks; /* linked list of sockets */ 5252907Sjulian int type; /* NG_CONTROL or NG_DATA */ 5352907Sjulian}; 5452907Sjulian 55231587Sglebius#ifdef _KERNEL 56231587Sglebiusstruct hookpriv { 57231587Sglebius LIST_ENTRY(hookpriv) next; 58231587Sglebius hook_p hook; 59231587Sglebius}; 60231587SglebiusLIST_HEAD(ngshash, hookpriv); 61231587Sglebius#endif 62231587Sglebius 6352907Sjulian/* Per-node private data */ 6452907Sjulianstruct ngsock { 6552907Sjulian struct ng_node *node; /* the associated netgraph node */ 6652907Sjulian struct ngpcb *datasock; /* optional data socket */ 6752907Sjulian struct ngpcb *ctlsock; /* optional control socket */ 6852919Sjulian int flags; 6952907Sjulian int refs; 70147774Sglebius struct mtx mtx; /* mtx to wait on */ 71147774Sglebius int error; /* place to store error */ 72205083Sglebius ng_ID_t node_id; /* a hint for netstat(1) to find the node */ 73231587Sglebius#ifdef _KERNEL 74231587Sglebius struct ngshash *hash; /* hash for hook names */ 75231587Sglebius u_long hmask; /* hash mask */ 76231587Sglebius#endif 7752907Sjulian}; 7852919Sjulian#define NGS_FLAG_NOLINGER 1 /* close with last hook */ 7952907Sjulian 8052907Sjulian#endif /* _NETGRAPH_NG_SOCKETVAR_H_ */ 8152907Sjulian 82