152419Sjulian 252419Sjulian/* 352419Sjulian * internal.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: releng/10.3/lib/libnetgraph/internal.h 169551 2007-05-14 14:18:41Z mav $ 4052419Sjulian * $Whistle: internal.h,v 1.5 1999/01/20 00:57:22 archie Exp $ 4152419Sjulian */ 4252419Sjulian 4352419Sjulian#include <sys/types.h> 4456708Sarchie#include <sys/param.h> 4552419Sjulian#include <sys/time.h> 4652419Sjulian#include <sys/socket.h> 47169551Smav#include <poll.h> 4856708Sarchie#include <sys/linker.h> 49122649Sharti#include <stddef.h> 5052419Sjulian 5152419Sjulian#include <stdlib.h> 5252419Sjulian#include <stdio.h> 5352419Sjulian#include <string.h> 5452419Sjulian#include <unistd.h> 5552419Sjulian#include <errno.h> 5652419Sjulian#include <ctype.h> 5752419Sjulian#include <err.h> 5852419Sjulian 59122649Sharti/* the 'sockaddr overhead' for a netgraph address. This is everything before 60122649Sharti * the string that constitutes the address. */ 61122649Sharti#define NGSA_OVERHEAD (offsetof(struct sockaddr_ng, sg_data)) 62122649Sharti 6352419Sjulianextern int _gNgDebugLevel; 6452419Sjulian 6552419Sjulianextern void (*_NgLog)(const char *fmt, ...); 6652419Sjulianextern void (*_NgLogx)(const char *fmt, ...); 6752419Sjulian 6852419Sjulian#define NGLOG (*_NgLog) 6952419Sjulian#define NGLOGX (*_NgLogx) 7052419Sjulian 7153913Sarchieextern void _NgDebugSockaddr(const struct sockaddr_ng *sg); 7253913Sarchieextern void _NgDebugMsg(const struct ng_mesg *msg, const char *path); 7352419Sjulianextern void _NgDebugBytes(const u_char *ptr, int size); 7452419Sjulian 75