2 * Copyright (C) 2004-2005
6 * Author: Harti Brandt <harti@freebsd.org>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * $Begemot: bsnmp/lib/support.h,v 1.2 2005/10/06 07:14:59 brandt_h Exp $
31 * Functions that are missing on certain systems. This header file is not
34 #ifndef bsnmp_support_h_
35 #define bsnmp_support_h_
37 #include <sys/cdefs.h>
40 void err(int, const char *, ...) __printflike(2, 3) __dead2;
41 void errx(int, const char *, ...) __printflike(2, 3) __dead2;
43 void warn(const char *, ...) __printflike(1, 2);
44 void warnx(const char *, ...) __printflike(1, 2);
48 size_t strlcpy(char *, const char *, size_t);
51 #ifndef HAVE_GETADDRINFO
58 struct sockaddr *ai_addr;
60 struct addrinfo *ai_next;
62 #define AI_CANONNAME 0x0001
64 int getaddrinfo(const char *, const char *, const struct addrinfo *,
66 const char *gai_strerror(int);
67 void freeaddrinfo(struct addrinfo *);
72 * For systems with missing stdint.h or inttypes.h
74 #if !defined(INT32_MIN)
75 #define INT32_MIN (-0x7fffffff-1)
77 #if !defined(INT32_MAX)
78 #define INT32_MAX (0x7fffffff)
80 #if !defined(UINT32_MAX)
81 #define UINT32_MAX (0xffffffff)
85 * Systems missing SA_SIZE(). Taken from FreeBSD net/route.h:1.63
90 ( (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ? \
92 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) )