SNMP++  3.3.4
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 #define SNMP_PP_VERSION_STRING "3.3.4"
32 #define SNMP_PP_VERSION 3
33 #define SNMP_PP_RELEASE 3
34 #define SNMP_PP_PATCHLEVEL 4
35 
36 //! The maximum size of a message that can be sent or received.
37 #define MAX_SNMP_PACKET 4096
38 
39 #ifndef DLLOPT
40 #if defined (WIN32) && defined (SNMP_PP_DLL)
41 #ifdef SNMP_PP_EXPORTS
42 #define DLLOPT __declspec(dllexport)
43 #define DLLOPT_TEMPL
44 #else
45 #define DLLOPT __declspec(dllimport)
46 #define DLLOPT_TEMPL extern
47 #endif
48 #else
49 #define DLLOPT
50 #define DLLOPT_TEMPL
51 #endif
52 #endif
53 
54 /*
55  * some permanent parts from autoconf process
56  */
57 #if 1
58 #define _SNMPv3 1
59 #else
60 #define _NO_SNMPv3 1
61 #endif
62 #if 1
63 #define SNMP_PP_IPv6 1
64 #endif
65 #if 1
66 #define ENABLE_THREADS 1
67 #else
68 #define _NO_THREADS
69 #endif
70 #if 1
71 #define HAVE_LIBSSL 1
72 #endif
73 #if 0
74 #define HAVE_LIBTOMCRYPT 1
75 #endif
76 #if 0
77 #define HAVE_LIBDES 1
78 #endif
79 #if 1
80 #define HAVE_PTHREAD 1
81 #endif
82 
83 // define SNMP_PP_NAMESPACE to enclose all library names in Snmp_pp namespace
84 #if 1
85 #define SNMP_PP_NAMESPACE
86 #else
87 #undef SNMP_PP_NAMESPACE
88 #endif
89 
90 // If you do not use SNMP++ for commercial purposes or if you
91 // have licensed IDEA (read README.v3) you may define the following
92 // to enable IDEA support. (note this is not defined by a rfc)
93 // #define _USE_IDEA
94 
95 #if defined(_SNMPv3) || !defined(_NO_SNMPv3)
96 # if defined(HAVE_LIBSSL)
97 # define _USE_OPENSSL 1
98 # elif defined(HAVE_LIBTOMCRYPT)
99 # define _USE_LIBTOMCRYPT 1
100 # elif HAVE_LIBDES
101 # define _USE_3DES_EDE 1
102 # else
103 # warn No crypto library found - disable SNMPv3
104 # undef _SNMPv3
105 # define _NO_SNMPv3 1
106 # endif
107 #endif
108 
109 // define _NO_LOGGING if you do not want any logging output
110 // (increases performance drastically and minimizes memory consumption)
111 #if 1
112 #undef _NO_LOGGING
113 #else
114 #define _NO_LOGGING
115 #endif
116 
117 #if 1
118 #ifndef WITHOUT_LOG_PROFILES
119 #define WITH_LOG_PROFILES 1
120 #endif
121 #else
122 #undef WITH_LOG_PROFILES
123 #endif
124 
125 // define _IPX_ADDRESS and/or _MAC_ADDRESS if you want to use the
126 // classess IpxAddress/IpxSockAddress and/or MacAddress
127 #if 0
128 #define _MAC_ADDRESS
129 #else
130 #undef _MAC_ADDRESS
131 #endif
132 #if 0
133 #define _IPX_ADDRESS
134 #else
135 #undef _IPX_ADDRESS
136 #endif
137 
138 // define this if you want to send out broadcasts
139 #define SNMP_BROADCAST
140 
141 // Some socket types
142 #if !(defined (CPU) && CPU == PPC603) && (defined __GNUC__ || defined __FreeBSD__ || defined _AIX) && ! defined __MINGW32__
143  typedef socklen_t SocketLengthType;
144 #else
145  typedef int SocketLengthType;
146 #endif
147 
148 #ifdef SNMP_PP_IPv6
149  typedef struct sockaddr_storage SocketAddrType;
150 #else
151  typedef struct sockaddr_in SocketAddrType;
152 #endif
153 
154 // Not fully tested!
155 //#define HAVE_POLL_SYSCALL
156 
157 // Some older(?) compilers need a special declaration of
158 // template classes
159 // #define _OLD_TEMPLATE_COLLECTION
160 
161 // can we use the reentrant version of these functions or
162 // are the standard functions thread safe
163 #ifdef __CYGWIN32__
164 #define HAVE_REENTRANT_LOCALTIME
165 #define HAVE_REENTRANT_GETHOSTBYADDR
166 #define HAVE_REENTRANT_GETHOSTBYNAME
167 #elif __MINGW32__
168 //FIXME: snmp++/src/address.cpp:865: error: `inet_ntop' was not declared in this scope
169 //FIXME: snmp++/src/address.cpp:988: error: `inet_pton' was not declared in this scope
170 //FIXME: snmp++/src/notifyqueue.cpp:538: error: `inet_pton' was not declared in this scope
171 #define HAVE_REENTRANT_GETHOSTBYNAME
172 #define HAVE_REENTRANT_LOCALTIME
173 #define HAVE_REENTRANT_GETHOSTBYADDR
174 #elif __DECCXX
175 #define HAVE_REENTRANT_GETHOSTBYNAME
176 #define HAVE_REENTRANT_GETHOSTBYADDR
177 #elif __HP_aCC
178 #define HAVE_REENTRANT_GETHOSTBYNAME
179 #define HAVE_REENTRANT_GETHOSTBYADDR
180 #elif _MSC_VER
181 #define HAVE_REENTRANT_GETHOSTBYNAME
182 #define HAVE_REENTRANT_LOCALTIME
183 #define HAVE_REENTRANT_GETHOSTBYADDR
184 #elif _AIX
185 #define HAVE_REENTRANT_GETHOSTBYNAME
186 #define HAVE_REENTRANT_GETHOSTBYADDR
187 #endif
188 
189 // Define a unsigned 64 bit integer:
190 #ifdef WIN32
191 #include <windows.h>
192 #if defined(HAVE_WINSOCK2_H)
193 #include <winsock2.h>
194 #elif defined(HAVE_WINSOCK_H)
195 #include <winsock.h>
196 #endif
197 #ifdef HAVE_WSTCPIP_H
198 #include <ws2tcpip.h>
199 #endif
200 #ifdef HAVE_WSPIAPI_H
201 #include <wspiapi.h>
202 #endif
203 #ifdef __BCPLUSPLUS__
204 typedef unsigned __int64 pp_uint64;
205 #else
206 typedef ULONGLONG pp_uint64;
207 #endif
208 #else // not WIN32
209 typedef unsigned long long pp_uint64;
210 #endif
211 
212 // Define a type used for sockets
213 #ifdef _MSC_VER
214  typedef SOCKET SnmpSocket;
215 #else
216  typedef int SnmpSocket;
217 #endif
218 
219 #ifdef HAVE_POLL_SYSCALL
220 #include <poll.h>
221 #endif
222 
223 #define SNMP_PP_DEFAULT_SNMP_PORT 161 // standard port # for SNMP
224 #define SNMP_PP_DEFAULT_SNMP_TRAP_PORT 162 // standard port # for SNMP traps
225 
226 ///////////////////////////////////////////////////////////////////////
227 // Changes below this line should not be necessary
228 ///////////////////////////////////////////////////////////////////////
229 
230 
231 // Make use of mutable keyword
232 //#define SNMP_PP_MUTABLE mutable
233 #define SNMP_PP_MUTABLE
234 
235 #define SAFE_INT_CAST(expr) ((int)(expr))
236 #define SAFE_UINT_CAST(expr) ((unsigned int)(expr))
237 
238 // Safe until 32 bit second counter wraps to zero (time functions)
239 #define SAFE_LONG_CAST(expr) ((long)(expr))
240 #define SAFE_ULONG_CAST(expr) ((unsigned long)(expr))
241 
242 #ifdef ENABLE_THREADS
243 #ifdef WIN32
244 
245 #ifndef _THREADS
246 #define _WIN32THREADS
247 #define VC_EXTRALEAN
248 #define _THREADS
249 #endif
250 
251 #else // !WIN32
252 
253 #ifndef _THREADS
254 #define _THREADS
255 #endif
256 
257 #ifdef __APPLE__
258 #ifndef __unix
259 #define __unix
260 #endif
261 #endif
262 
263 #ifndef POSIX_THREADS
264 #ifdef HAVE_PTHREAD
265 #define POSIX_THREADS
266 #endif
267 #endif
268 
269 #endif // WIN32
270 #endif // ENABLE_THREADS
271 
272 #endif // _CONFIG_SNMP_PP_H_
struct sockaddr_storage SocketAddrType
int SocketLengthType
unsigned long long pp_uint64
int SnmpSocket