1cb3c7a5dSArchie Cobbs 2cb3c7a5dSArchie Cobbs /* 3cb3c7a5dSArchie Cobbs * ng_ksocket.h 4cb3c7a5dSArchie Cobbs * 5cb3c7a5dSArchie Cobbs * Copyright (c) 1996-1999 Whistle Communications, Inc. 6cb3c7a5dSArchie Cobbs * All rights reserved. 7cb3c7a5dSArchie Cobbs * 8cb3c7a5dSArchie Cobbs * Subject to the following obligations and disclaimer of warranty, use and 9cb3c7a5dSArchie Cobbs * redistribution of this software, in source or object code forms, with or 10cb3c7a5dSArchie Cobbs * without modifications are expressly permitted by Whistle Communications; 11cb3c7a5dSArchie Cobbs * provided, however, that: 12cb3c7a5dSArchie Cobbs * 1. Any and all reproductions of the source or object code must include the 13cb3c7a5dSArchie Cobbs * copyright notice above and the following disclaimer of warranties; and 14cb3c7a5dSArchie Cobbs * 2. No rights are granted, in any manner or form, to use Whistle 15cb3c7a5dSArchie Cobbs * Communications, Inc. trademarks, including the mark "WHISTLE 16cb3c7a5dSArchie Cobbs * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 17cb3c7a5dSArchie Cobbs * such appears in the above copyright notice or in the software. 18cb3c7a5dSArchie Cobbs * 19cb3c7a5dSArchie Cobbs * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 20cb3c7a5dSArchie Cobbs * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 21cb3c7a5dSArchie Cobbs * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 22cb3c7a5dSArchie Cobbs * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 23cb3c7a5dSArchie Cobbs * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 24cb3c7a5dSArchie Cobbs * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 25cb3c7a5dSArchie Cobbs * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 26cb3c7a5dSArchie Cobbs * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 27cb3c7a5dSArchie Cobbs * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 28cb3c7a5dSArchie Cobbs * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 29cb3c7a5dSArchie Cobbs * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 30cb3c7a5dSArchie Cobbs * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 31cb3c7a5dSArchie Cobbs * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 32cb3c7a5dSArchie Cobbs * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33cb3c7a5dSArchie Cobbs * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34cb3c7a5dSArchie Cobbs * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 35cb3c7a5dSArchie Cobbs * OF SUCH DAMAGE. 36cb3c7a5dSArchie Cobbs * 37cc3bbd68SJulian Elischer * Author: Archie Cobbs <archie@freebsd.org> 38cb3c7a5dSArchie Cobbs * 39cb3c7a5dSArchie Cobbs * $FreeBSD$ 40cb3c7a5dSArchie Cobbs * $Whistle: ng_ksocket.h,v 1.1 1999/11/16 20:04:40 archie Exp $ 41cb3c7a5dSArchie Cobbs */ 42cb3c7a5dSArchie Cobbs 43cb3c7a5dSArchie Cobbs #ifndef _NETGRAPH_KSOCKET_H_ 44cb3c7a5dSArchie Cobbs #define _NETGRAPH_KSOCKET_H_ 45cb3c7a5dSArchie Cobbs 46cb3c7a5dSArchie Cobbs /* Node type name and magic cookie */ 47cb3c7a5dSArchie Cobbs #define NG_KSOCKET_NODE_TYPE "ksocket" 48cb3c7a5dSArchie Cobbs #define NGM_KSOCKET_COOKIE 942710669 49cb3c7a5dSArchie Cobbs 50f8307e12SArchie Cobbs /* For NGM_KSOCKET_SETOPT and NGM_KSOCKET_GETOPT control messages */ 51f8307e12SArchie Cobbs struct ng_ksocket_sockopt { 52cac2a7deSArchie Cobbs int32_t level; /* second arg of [gs]etsockopt() */ 53cac2a7deSArchie Cobbs int32_t name; /* third arg of [gs]etsockopt() */ 54f8307e12SArchie Cobbs u_char value[0]; /* fourth arg of [gs]etsockopt() */ 55f8307e12SArchie Cobbs }; 56f8307e12SArchie Cobbs 57f8307e12SArchie Cobbs /* Max length socket option we can return via NGM_KSOCKET_GETOPT 58f8307e12SArchie Cobbs XXX This should not be necessary, we should dynamically size 59f8307e12SArchie Cobbs XXX the response. Until then.. */ 60f8307e12SArchie Cobbs #define NG_KSOCKET_MAX_OPTLEN 1024 61f8307e12SArchie Cobbs 62f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */ 63f8307e12SArchie Cobbs #define NG_KSOCKET_SOCKOPT_INFO(svtype) { \ 64f8307e12SArchie Cobbs { \ 65f8307e12SArchie Cobbs { "level", &ng_parse_int32_type }, \ 66f8307e12SArchie Cobbs { "name", &ng_parse_int32_type }, \ 67f8307e12SArchie Cobbs { "value", (svtype) }, \ 68f8307e12SArchie Cobbs { NULL }, \ 69f8307e12SArchie Cobbs } \ 70f8307e12SArchie Cobbs } 71f8307e12SArchie Cobbs 72cb3c7a5dSArchie Cobbs /* Netgraph commands */ 73cb3c7a5dSArchie Cobbs enum { 74cb3c7a5dSArchie Cobbs NGM_KSOCKET_BIND = 1, 75cb3c7a5dSArchie Cobbs NGM_KSOCKET_LISTEN, 76cb3c7a5dSArchie Cobbs NGM_KSOCKET_ACCEPT, 77cb3c7a5dSArchie Cobbs NGM_KSOCKET_CONNECT, 78cb3c7a5dSArchie Cobbs NGM_KSOCKET_GETNAME, 79cb3c7a5dSArchie Cobbs NGM_KSOCKET_GETPEERNAME, 80cb3c7a5dSArchie Cobbs NGM_KSOCKET_SETOPT, 81cb3c7a5dSArchie Cobbs NGM_KSOCKET_GETOPT, 82cb3c7a5dSArchie Cobbs }; 83cb3c7a5dSArchie Cobbs 84cb3c7a5dSArchie Cobbs #endif /* _NETGRAPH_KSOCKET_H_ */ 85