1*0147868eSNuno Antunes 2*0147868eSNuno Antunes /* 3*0147868eSNuno Antunes * internal.h 4*0147868eSNuno Antunes * 5*0147868eSNuno Antunes * Copyright (c) 1996-1999 Whistle Communications, Inc. 6*0147868eSNuno Antunes * All rights reserved. 7*0147868eSNuno Antunes * 8*0147868eSNuno Antunes * Subject to the following obligations and disclaimer of warranty, use and 9*0147868eSNuno Antunes * redistribution of this software, in source or object code forms, with or 10*0147868eSNuno Antunes * without modifications are expressly permitted by Whistle Communications; 11*0147868eSNuno Antunes * provided, however, that: 12*0147868eSNuno Antunes * 1. Any and all reproductions of the source or object code must include the 13*0147868eSNuno Antunes * copyright notice above and the following disclaimer of warranties; and 14*0147868eSNuno Antunes * 2. No rights are granted, in any manner or form, to use Whistle 15*0147868eSNuno Antunes * Communications, Inc. trademarks, including the mark "WHISTLE 16*0147868eSNuno Antunes * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 17*0147868eSNuno Antunes * such appears in the above copyright notice or in the software. 18*0147868eSNuno Antunes * 19*0147868eSNuno Antunes * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 20*0147868eSNuno Antunes * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 21*0147868eSNuno Antunes * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 22*0147868eSNuno Antunes * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 23*0147868eSNuno Antunes * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 24*0147868eSNuno Antunes * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 25*0147868eSNuno Antunes * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 26*0147868eSNuno Antunes * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 27*0147868eSNuno Antunes * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 28*0147868eSNuno Antunes * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 29*0147868eSNuno Antunes * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 30*0147868eSNuno Antunes * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 31*0147868eSNuno Antunes * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 32*0147868eSNuno Antunes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33*0147868eSNuno Antunes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34*0147868eSNuno Antunes * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 35*0147868eSNuno Antunes * OF SUCH DAMAGE. 36*0147868eSNuno Antunes * 37*0147868eSNuno Antunes * Author: Archie Cobbs <archie@whistle.com> 38*0147868eSNuno Antunes * 39*0147868eSNuno Antunes * $FreeBSD: src/lib/libnetgraph/internal.h,v 1.5 2007/05/14 14:18:41 mav Exp $ 40*0147868eSNuno Antunes * $DragonFly: src/lib/libnetgraph/internal.h,v 1.2 2003/06/17 04:26:50 dillon Exp $ 41*0147868eSNuno Antunes * $Whistle: internal.h,v 1.5 1999/01/20 00:57:22 archie Exp $ 42*0147868eSNuno Antunes */ 43*0147868eSNuno Antunes 44*0147868eSNuno Antunes #include <sys/types.h> 45*0147868eSNuno Antunes #include <sys/param.h> 46*0147868eSNuno Antunes #include <sys/time.h> 47*0147868eSNuno Antunes #include <sys/socket.h> 48*0147868eSNuno Antunes #include <poll.h> 49*0147868eSNuno Antunes #include <sys/linker.h> 50*0147868eSNuno Antunes #include <stddef.h> 51*0147868eSNuno Antunes 52*0147868eSNuno Antunes #include <stdlib.h> 53*0147868eSNuno Antunes #include <stdio.h> 54*0147868eSNuno Antunes #include <string.h> 55*0147868eSNuno Antunes #include <unistd.h> 56*0147868eSNuno Antunes #include <errno.h> 57*0147868eSNuno Antunes #include <ctype.h> 58*0147868eSNuno Antunes #include <err.h> 59*0147868eSNuno Antunes 60*0147868eSNuno Antunes /* the 'sockaddr overhead' for a netgraph address. This is everything before 61*0147868eSNuno Antunes * the string that constitutes the address. */ 62*0147868eSNuno Antunes #define NGSA_OVERHEAD (offsetof(struct sockaddr_ng, sg_data)) 63*0147868eSNuno Antunes 64*0147868eSNuno Antunes extern int _gNgDebugLevel; 65*0147868eSNuno Antunes 66*0147868eSNuno Antunes extern void (*_NgLog)(const char *fmt, ...); 67*0147868eSNuno Antunes extern void (*_NgLogx)(const char *fmt, ...); 68*0147868eSNuno Antunes 69*0147868eSNuno Antunes #define NGLOG (*_NgLog) 70*0147868eSNuno Antunes #define NGLOGX (*_NgLogx) 71*0147868eSNuno Antunes 72*0147868eSNuno Antunes extern void _NgDebugSockaddr(const struct sockaddr_ng *sg); 73*0147868eSNuno Antunes extern void _NgDebugMsg(const struct ng_mesg *msg, const char *path); 74*0147868eSNuno Antunes extern void _NgDebugBytes(const u_char *ptr, int size); 75*0147868eSNuno Antunes 76