SNMP++  3.6.3
config_snmp_pp.h
Go to the documentation of this file.
1 /*_############################################################################
2  _##
3  _## config_snmp_pp.h.in
4  _##
5  _## SNMP++ v3.4
6  _## -----------------------------------------------
7  _## Copyright (c) 2001-2021 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, Frank Fock, and Jochen Katz make no representations
21  _## about the 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.6.3"
36 #define SNMP_PP_VERSION 3
37 #define SNMP_PP_RELEASE 6
38 #define SNMP_PP_PATCHLEVEL 3
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 # define _USE_3DES_EDE
103 # elif defined(HAVE_LIBTOMCRYPT)
104 # define _USE_LIBTOMCRYPT
105 # elif HAVE_LIBDES
106 # define _USE_3DES_EDE
107 # else
108 # warning No crypto library found - disable SNMPv3
109 # undef _SNMPv3
110 # define _NO_SNMPv3
111 # endif
112 #endif
113 
114 // define _NO_LOGGING if you do not want any logging output
115 // (increases performance drastically and minimizes memory consumption)
116 #if 1
117 #undef _NO_LOGGING
118 #else
119 #define _NO_LOGGING
120 #endif
121 
122 #if 1
123 #ifndef WITHOUT_LOG_PROFILES
124 #define WITH_LOG_PROFILES 1
125 #endif
126 #else
127 #undef WITH_LOG_PROFILES
128 #endif
129 
130 // define _IPX_ADDRESS and/or _MAC_ADDRESS if you want to use the
131 // classess IpxAddress/IpxSockAddress and/or MacAddress
132 #if 0
133 #define _MAC_ADDRESS
134 #else
135 #undef _MAC_ADDRESS
136 #endif
137 #if 0
138 #define _IPX_ADDRESS
139 #else
140 #undef _IPX_ADDRESS
141 #endif
142 
143 // define _USER_DEFINED_EVENTS or _USER_DEFINED_TMEOUTS
144 // if you want to use user defined events/timeouts
145 //#define _USER_DEFINED_EVENTS
146 //#define _USER_DEFINED_TMEOUTS
147 
148 // define this if you want to send out broadcasts
149 #define SNMP_BROADCAST
150 
151 // Some socket types
152 #if !(defined (CPU) && CPU == PPC603) && (defined __GNUC__ || defined __FreeBSD__ || defined _AIX) && ! defined __MINGW32__
153  typedef socklen_t SocketLengthType;
154 #else
155  typedef int SocketLengthType;
156 #endif
157 
158 #ifdef SNMP_PP_IPv6
159  typedef struct sockaddr_storage SocketAddrType;
160 #else
161  typedef struct sockaddr_in SocketAddrType;
162 #endif
163 
164 // Not fully tested!
165 //#define HAVE_POLL_SYSCALL
166 
167 // Some older(?) compilers need a special declaration of
168 // template classes
169 // #define _OLD_TEMPLATE_COLLECTION
170 
171 // can we use the reentrant version of these functions or
172 // are the standard functions thread safe
173 #ifdef __CYGWIN32__
174 #define HAVE_REENTRANT_LOCALTIME
175 #define HAVE_REENTRANT_GETHOSTBYADDR
176 #define HAVE_REENTRANT_GETHOSTBYNAME
177 #elif __MINGW32__
178 //FIXME: snmp++/src/address.cpp:865: error: `inet_ntop' was not declared in this scope
179 //FIXME: snmp++/src/address.cpp:988: error: `inet_pton' was not declared in this scope
180 //FIXME: snmp++/src/notifyqueue.cpp:538: error: `inet_pton' was not declared in this scope
181 #define HAVE_REENTRANT_GETHOSTBYNAME
182 #define HAVE_REENTRANT_LOCALTIME
183 #define HAVE_REENTRANT_GETHOSTBYADDR
184 #elif __DECCXX
185 #define HAVE_REENTRANT_GETHOSTBYNAME
186 #define HAVE_REENTRANT_GETHOSTBYADDR
187 #elif __HP_aCC
188 #define HAVE_REENTRANT_GETHOSTBYNAME
189 #define HAVE_REENTRANT_GETHOSTBYADDR
190 #elif _MSC_VER
191 #define HAVE_REENTRANT_GETHOSTBYNAME
192 #define HAVE_REENTRANT_LOCALTIME
193 #define HAVE_REENTRANT_GETHOSTBYADDR
194 #elif _AIX
195 #define HAVE_REENTRANT_GETHOSTBYNAME
196 #define HAVE_REENTRANT_GETHOSTBYADDR
197 #endif
198 
199 // Define a unsigned 64 bit integer:
200 #ifdef WIN32
201 #if defined(HAVE_WINSOCK2_H)
202 #include <winsock2.h>
203 #elif defined(HAVE_WINSOCK_H)
204 #include <winsock.h>
205 #endif
206 #include <windows.h>
207 #ifdef HAVE_WSTCPIP_H
208 #include <ws2tcpip.h>
209 #endif
210 #ifdef HAVE_WSPIAPI_H
211 #include <wspiapi.h>
212 #endif
213 #ifdef __BCPLUSPLUS__
214 typedef unsigned __int64 pp_uint64;
215 typedef __int64 pp_int64;
216 #else
217 typedef ULONGLONG pp_uint64;
218 typedef LONGLONG pp_int64;
219 #endif
220 #else // not WIN32
221 typedef unsigned long long pp_uint64;
222 typedef long long pp_int64;
223 #endif
224 
225 // Define a type used for sockets
226 #ifdef _MSC_VER
227  typedef SOCKET SnmpSocket;
228 #else
229  typedef int SnmpSocket;
230 #endif
231 
232 #ifdef HAVE_POLL_SYSCALL
233 #include <poll.h>
234 #endif
235 
236 #define SNMP_PP_DEFAULT_SNMP_PORT 161 // standard port # for SNMP
237 #define SNMP_PP_DEFAULT_SNMP_TRAP_PORT 162 // standard port # for SNMP traps
238 
239 ///////////////////////////////////////////////////////////////////////
240 // Changes below this line should not be necessary
241 ///////////////////////////////////////////////////////////////////////
242 
243 
244 // Make use of mutable keyword
245 //#define SNMP_PP_MUTABLE mutable
246 #define SNMP_PP_MUTABLE
247 
248 #define SAFE_INT_CAST(expr) ((int)(expr))
249 #define SAFE_UINT_CAST(expr) ((unsigned int)(expr))
250 
251 // Safe until 32 bit second counter wraps to zero (time functions)
252 #define SAFE_LONG_CAST(expr) ((long)(expr))
253 #define SAFE_ULONG_CAST(expr) ((unsigned long)(expr))
254 
255 #ifdef ENABLE_THREADS
256 #ifdef WIN32
257 
258 #ifndef _THREADS
259 #define _WIN32THREADS
260 #define VC_EXTRALEAN
261 #define _THREADS
262 #endif
263 
264 #else // !WIN32
265 
266 #ifndef _THREADS
267 #define _THREADS
268 #endif
269 
270 #ifdef __APPLE__
271 #ifndef __unix
272 #define __unix
273 #endif
274 #endif
275 
276 #ifndef POSIX_THREADS
277 #ifdef HAVE_PTHREAD
278 #define POSIX_THREADS
279 // Use error checking by default since AGENT++ 4.0.8, define
280 // AGENTPP_PTHREAD_RECURSIVE here to get behavior of AGENT++ 4.0.7 and before:
281 // #define AGENTPP_PTHREAD_RECURSIVE
282 #endif
283 #endif
284 
285 #endif // WIN32
286 #endif // ENABLE_THREADS
287 
288 #ifdef _THREADS
289 #ifndef _WIN32THREADS
290 #include <pthread.h>
291 #endif
292 #endif
293 
294 
295 #endif // _CONFIG_SNMP_PP_H_
struct sockaddr_storage SocketAddrType
long long pp_int64
int SocketLengthType
unsigned long long pp_uint64
int SnmpSocket