SNMP++  3.3.11
config_snmp_pp.h
Go to the documentation of this file.
1 /*_############################################################################
2  _##
3  _## config_snmp_pp.h.in
4  _##
5  _## SNMP++ v3.3
6  _## -----------------------------------------------
7  _## Copyright (c) 2001-2013 Jochen Katz, Frank Fock
8  _##
9  _## This software is based on SNMP++2.6 from Hewlett Packard:
10  _##
11  _## Copyright (c) 1996
12  _## Hewlett-Packard Company
13  _##
14  _## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
15  _## Permission to use, copy, modify, distribute and/or sell this software
16  _## and/or its documentation is hereby granted without fee. User agrees
17  _## to display the above copyright notice and this license notice in all
18  _## copies of the software and any documentation of the software. User
19  _## agrees to assume all liability for the use of the software;
20  _## Hewlett-Packard and Jochen Katz make no representations about the
21  _## suitability of this software for any purpose. It is provided
22  _## "AS-IS" without warranty of any kind, either express or implied. User
23  _## hereby grants a royalty-free license to any and all derivatives based
24  _## upon this software code base.
25  _##
26  _##########################################################################*/
27 
28 #ifndef _CONFIG_SNMP_PP_H_
29 #define _CONFIG_SNMP_PP_H_
30 
31 #ifndef __LIBSNMP_H_INCLUDED__
32 #include <libsnmp.h>
33 #endif
34 
35 #define SNMP_PP_VERSION_STRING "3.3.10"
36 #define SNMP_PP_VERSION 3
37 #define SNMP_PP_RELEASE 3
38 #define SNMP_PP_PATCHLEVEL 10
39 
40 //! The maximum size of a message that can be sent or received.
41 #define MAX_SNMP_PACKET 4096
42 
43 #ifndef DLLOPT
44 #if defined (WIN32) && defined (SNMP_PP_DLL)
45 #ifdef SNMP_PP_EXPORTS
46 #define DLLOPT __declspec(dllexport)
47 #define DLLOPT_TEMPL
48 #else
49 #define DLLOPT __declspec(dllimport)
50 #define DLLOPT_TEMPL extern
51 #endif
52 #else
53 #define DLLOPT
54 #define DLLOPT_TEMPL
55 #endif
56 #endif
57 
58 /*
59  * some permanent parts from autoconf process
60  */
61 #if 1
62 #define _SNMPv3 1
63 #else
64 #define _NO_SNMPv3 1
65 #endif
66 #if 1
67 #define SNMP_PP_IPv6 1
68 #endif
69 #if 1
70 #define ENABLE_THREADS 1
71 #else
72 #define _NO_THREADS
73 #endif
74 #if 1
75 #define HAVE_LIBSSL 1
76 #endif
77 #if 0
78 #define HAVE_LIBTOMCRYPT 1
79 #endif
80 #if 0
81 #define HAVE_LIBDES 1
82 #endif
83 #if 1
84 #define HAVE_PTHREAD 1
85 #endif
86 
87 // define SNMP_PP_NAMESPACE to enclose all library names in Snmp_pp namespace
88 #if 1
89 #define SNMP_PP_NAMESPACE
90 #else
91 #undef SNMP_PP_NAMESPACE
92 #endif
93 
94 // If you do not use SNMP++ for commercial purposes or if you
95 // have licensed IDEA (read README.v3) you may define the following
96 // to enable IDEA support. (note this is not defined by a rfc)
97 // #define _USE_IDEA
98 
99 #if defined(_SNMPv3) || !defined(_NO_SNMPv3)
100 # if defined(HAVE_LIBSSL)
101 # define _USE_OPENSSL
102 # elif defined(HAVE_LIBTOMCRYPT)
103 # define _USE_LIBTOMCRYPT
104 # elif HAVE_LIBDES
105 # define _USE_3DES_EDE
106 # else
107 # warn No crypto library found - disable SNMPv3
108 # undef _SNMPv3
109 # define _NO_SNMPv3
110 # endif
111 #endif
112 
113 // define _NO_LOGGING if you do not want any logging output
114 // (increases performance drastically and minimizes memory consumption)
115 #if 1
116 #undef _NO_LOGGING
117 #else
118 #define _NO_LOGGING
119 #endif
120 
121 #if 1
122 #ifndef WITHOUT_LOG_PROFILES
123 #define WITH_LOG_PROFILES 1
124 #endif
125 #else
126 #undef WITH_LOG_PROFILES
127 #endif
128 
129 // define _IPX_ADDRESS and/or _MAC_ADDRESS if you want to use the
130 // classess IpxAddress/IpxSockAddress and/or MacAddress
131 #if 0
132 #define _MAC_ADDRESS
133 #else
134 #undef _MAC_ADDRESS
135 #endif
136 #if 0
137 #define _IPX_ADDRESS
138 #else
139 #undef _IPX_ADDRESS
140 #endif
141 
142 // define this if you want to send out broadcasts
143 #define SNMP_BROADCAST
144 
145 // Some socket types
146 #if !(defined (CPU) && CPU == PPC603) && (defined __GNUC__ || defined __FreeBSD__ || defined _AIX) && ! defined __MINGW32__
147  typedef socklen_t SocketLengthType;
148 #else
149  typedef int SocketLengthType;
150 #endif
151 
152 #ifdef SNMP_PP_IPv6
153  typedef struct sockaddr_storage SocketAddrType;
154 #else
155  typedef struct sockaddr_in SocketAddrType;
156 #endif
157 
158 // Not fully tested!
159 //#define HAVE_POLL_SYSCALL
160 
161 // Some older(?) compilers need a special declaration of
162 // template classes
163 // #define _OLD_TEMPLATE_COLLECTION
164 
165 // can we use the reentrant version of these functions or
166 // are the standard functions thread safe
167 #ifdef __CYGWIN32__
168 #define HAVE_REENTRANT_LOCALTIME
169 #define HAVE_REENTRANT_GETHOSTBYADDR
170 #define HAVE_REENTRANT_GETHOSTBYNAME
171 #elif __MINGW32__
172 //FIXME: snmp++/src/address.cpp:865: error: `inet_ntop' was not declared in this scope
173 //FIXME: snmp++/src/address.cpp:988: error: `inet_pton' was not declared in this scope
174 //FIXME: snmp++/src/notifyqueue.cpp:538: error: `inet_pton' was not declared in this scope
175 #define HAVE_REENTRANT_GETHOSTBYNAME
176 #define HAVE_REENTRANT_LOCALTIME
177 #define HAVE_REENTRANT_GETHOSTBYADDR
178 #elif __DECCXX
179 #define HAVE_REENTRANT_GETHOSTBYNAME
180 #define HAVE_REENTRANT_GETHOSTBYADDR
181 #elif __HP_aCC
182 #define HAVE_REENTRANT_GETHOSTBYNAME
183 #define HAVE_REENTRANT_GETHOSTBYADDR
184 #elif _MSC_VER
185 #define HAVE_REENTRANT_GETHOSTBYNAME
186 #define HAVE_REENTRANT_LOCALTIME
187 #define HAVE_REENTRANT_GETHOSTBYADDR
188 #elif _AIX
189 #define HAVE_REENTRANT_GETHOSTBYNAME
190 #define HAVE_REENTRANT_GETHOSTBYADDR
191 #endif
192 
193 // Define a unsigned 64 bit integer:
194 #ifdef WIN32
195 #include <windows.h>
196 #if defined(HAVE_WINSOCK2_H)
197 #include <winsock2.h>
198 #elif defined(HAVE_WINSOCK_H)
199 #include <winsock.h>
200 #endif
201 #ifdef HAVE_WSTCPIP_H
202 #include <ws2tcpip.h>
203 #endif
204 #ifdef HAVE_WSPIAPI_H
205 #include <wspiapi.h>
206 #endif
207 #ifdef __BCPLUSPLUS__
208 typedef unsigned __int64 pp_uint64;
209 typedef __int64 pp_int64;
210 #else
211 typedef ULONGLONG pp_uint64;
212 typedef LONGLONG pp_int64;
213 #endif
214 #else // not WIN32
215 typedef unsigned long long pp_uint64;
216 typedef long long pp_int64;
217 #endif
218 
219 // Define a type used for sockets
220 #ifdef _MSC_VER
221  typedef SOCKET SnmpSocket;
222 #else
223  typedef int SnmpSocket;
224 #endif
225 
226 #ifdef HAVE_POLL_SYSCALL
227 #include <poll.h>
228 #endif
229 
230 #define SNMP_PP_DEFAULT_SNMP_PORT 161 // standard port # for SNMP
231 #define SNMP_PP_DEFAULT_SNMP_TRAP_PORT 162 // standard port # for SNMP traps
232 
233 ///////////////////////////////////////////////////////////////////////
234 // Changes below this line should not be necessary
235 ///////////////////////////////////////////////////////////////////////
236 
237 
238 // Make use of mutable keyword
239 //#define SNMP_PP_MUTABLE mutable
240 #define SNMP_PP_MUTABLE
241 
242 #define SAFE_INT_CAST(expr) ((int)(expr))
243 #define SAFE_UINT_CAST(expr) ((unsigned int)(expr))
244 
245 // Safe until 32 bit second counter wraps to zero (time functions)
246 #define SAFE_LONG_CAST(expr) ((long)(expr))
247 #define SAFE_ULONG_CAST(expr) ((unsigned long)(expr))
248 
249 #ifdef ENABLE_THREADS
250 #ifdef WIN32
251 
252 #ifndef _THREADS
253 #define _WIN32THREADS
254 #define VC_EXTRALEAN
255 #define _THREADS
256 #endif
257 
258 #else // !WIN32
259 
260 #ifndef _THREADS
261 #define _THREADS
262 #endif
263 
264 #ifdef __APPLE__
265 #ifndef __unix
266 #define __unix
267 #endif
268 #endif
269 
270 #ifndef POSIX_THREADS
271 #ifdef HAVE_PTHREAD
272 #define POSIX_THREADS
273 // Use error checking by default since AGENT++ 4.0.8, define
274 // AGENTPP_PTHREAD_RECURSIVE here to get behavior of AGENT++ 4.0.7 and before:
275 // #define AGENTPP_PTHREAD_RECURSIVE
276 #endif
277 #endif
278 
279 #endif // WIN32
280 #endif // ENABLE_THREADS
281 
282 #ifdef _THREADS
283 #ifndef _WIN32THREADS
284 #include <pthread.h>
285 #endif
286 #endif
287 
288 
289 #endif // _CONFIG_SNMP_PP_H_
struct sockaddr_storage SocketAddrType
long long pp_int64
int SocketLengthType
unsigned long long pp_uint64
int SnmpSocket