AGENT++  4.0.3
agent++.h
Go to the documentation of this file.
1 /*_############################################################################
2  _##
3  _## AGENT++ 4.0 - agent++.h.in
4  _##
5  _## Copyright (C) 2000-2013 Frank Fock and Jochen Katz (agentpp.com)
6  _##
7  _## Licensed under the Apache License, Version 2.0 (the "License");
8  _## you may not use this file except in compliance with the License.
9  _## You may obtain a copy of the License at
10  _##
11  _## http://www.apache.org/licenses/LICENSE-2.0
12  _##
13  _## Unless required by applicable law or agreed to in writing, software
14  _## distributed under the License is distributed on an "AS IS" BASIS,
15  _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  _## See the License for the specific language governing permissions and
17  _## limitations under the License.
18  _##
19  _##########################################################################*/
20 
21 #ifndef _agentpp_h_
22 #define _agentpp_h_
23 
24 #define AGENTPP_VERSION_STRING "4.0.3"
25 #define AGENTPP_VERSION 4
26 #define AGENTPP_RELEASE 0
27 #define AGENTPP_PATCHLEVEL 3
28 
29 // Defines the absolute upper limit for GETBULK repetitions an agent
30 // will process. 0 or less disables an upper limit.
31 // Setting a limit can improve the responsiveness of an agent if
32 // there are slow instrumented objects or AgentX subrequests involved.
33 // If that is the case, the upper limit should be 25 or less.
34 #define AGENTPP_MAX_GETBULK_REPETITIONS 0
35 
36 #include <libagent.h>
37 
38 // system dependend witches
39 #ifndef NO_NANOSLEEP
40 #define nanosleep nanosleep
41 #endif
42 
43 // Agent++ configuration options
44 //
45 // (Note that Agent++ and SNMP++ should be built with the same settings!)
46 
47 // define _NO_LOGGING in snmp++/include/config_snmp_pp.h if you do not
48 // want any logging output (increases performance drastically and
49 // minimizes memory consumption)
50 
51 // define _NO_THREADS in snmp++/include/config_snmp_pp.h if you do not
52 // want thread support
53 
54 // define _NO_SNMPv3 in snmp++/include/config_snmp_pp.h if you do not
55 // want v3 support
56 
57 // snmp_pp.h includes config_snmp_pp.h, which checks whether _SNMPv3 and
58 // thread support are defined
59 #include <snmp_pp/snmp_pp.h>
60 
61 
62 #if 1
63 #define _USE_PROXY
64 #else
65 #undef _USE_PROXY
66 #endif
67 
68 // define _PROXY_FORWARDER for v1/v2c/v3 proxy agents
69 #if 1
70 #define _PROXY_FORWARDER
71 #else
72 #undef _PROXY_FORWARDER
73 #endif
74 
75 #ifndef AGENTPP_OPAQUE_PTHREAD_T
76 #define AGENTPP_OPAQUE_PTHREAD_T int
77 #endif
78 
79 #include <snmp_pp/smi.h>
80 
81 #ifndef GENERIC_CLASS_SUCCESS
82 #define GENERIC_CLASS_SUCCESS 0
83 #endif
84 #ifndef GENERIC_CLASS_ERROR
85 #define GENERIC_CLASS_ERROR 1
86 #endif
87 
88 #ifndef GENERIC_CLASS_TYPE_MISMATCH
89 #define GENERIC_CLASS_TYPE_MISMATCH -1
90 #endif
91 
92 #ifndef TRUE
93 #define TRUE 1
94 #endif
95 
96 #ifndef FALSE
97 #define FALSE 0
98 #endif
99 
100 #if 0
101 #ifdef bool
102 #undef bool
103 #endif
104 #define bool int
105 #ifdef true
106 #undef true
107 #endif
108 #define true TRUE
109 #ifdef false
110 #undef false
111 #endif
112 #define false FALSE
113 #endif
114 
115 #if 1
116 #define AGENTPP_NAMESPACE
117 #else
118 #undef AGENTPP_NAMESPACE
119 #endif
120 
121 // internal "snmp" pdu types, used for internal mib updates
122 // update: update one or more managed objects
123 // NOTE: if the target object is a table object and
124 // if the target object does not exist an new row is created
125 // remove: remove one or more managed objects
126 // NOTE: if the target object is a table object
127 // the complete row is removed
128 
129 #define MIB_UPDATE (aSN_UNIVERSAL | aSN_CONSTRUCTOR | 0x0A )
130 #define MIB_REMOVE (aSN_UNIVERSAL | aSN_CONSTRUCTOR | 0x0B )
131 
132 typedef enum { READING, WRITING } access_types;
133 
134 #ifndef AGENTPP_DECL
135  #if defined (WIN32) && defined (AGENT_PP_DLL)
136  #ifdef AGENT_PP_EXPORTS
137  #define AGENTPP_DECL __declspec(dllexport)
138  #define AGENTPP_DECL_TEMPL
139  #pragma warning (disable : 4018) // signed/unsigned mismatch when exporting templates
140  #else
141  #define AGENTPP_DECL __declspec(dllimport)
142  #define AGENTPP_DECL_TEMPL extern
143  #pragma warning (disable : 4231) // disable warnings on extern before template instantiation
144  #endif
145  #else
146  #define AGENTPP_DECL
147 // Seems that a eplicit extern declaration is needed on some
148 // systems. If you encounter linking problems you may uncomment
149 // the following:
150 //#ifdef WIN32
151  #define AGENTPP_DECL_TEMPL
152 //#else
153 // #define AGENTPP_DECL_TEMPL extern
154 //#endif
155  #endif
156 #endif
157 
158 #ifdef WIN32
159 #define WIN32_LEAN_AND_MEAN
160 // already included by config_snmp_pp.h: #include <winsock.h>
161 #include <time.h>
162 #include <process.h>
163 #endif
164 
165 // Options about program code alternatives
166 
167 // undef this if you want to use OrderedList instead OrderedArray
168 #define USE_ARRAY_TEMPLATE
169 
170 // Define STATIC_REQUEST_LIST if you need a static RequestList in
171 // Mib.
172 #if defined(_USE_PROXY) && !defined(_PROXY_FORWARDER)
173 // Old proxy implementation requires STATIC_REQUEST_LIST
174 #define STATIC_REQUEST_LIST
175 #endif
176 
177 // ThreadPool may not work on any system so disable it if you encounter
178 // problems
179 #ifdef _THREADS
180 #define AGENTPP_USE_THREAD_POOL
181 
182 // Use NO_FAST_MUTEXES on systems that do not allow a thread to unlock
183 // a mutex it does not own. This setting affects set requests only.
184 // This has to be defined on WIN32 systems!
185 #ifdef WIN32
186 #define NO_FAST_MUTEXES
187 #endif
188 // The Single UNIX ® Specification, Version 2 says:
189 // If a thread attempts to unlock a mutex that it has not locked or [...], undefined behaviour results.
190 #ifdef HAVE_PTHREAD
191 #define NO_FAST_MUTEXES
192 #endif
193 #endif //_THREADS
194 
195 // SnmpRequest and SnmpRequestV3 use temporary Snmpx objects for sending
196 // traps, informs and requests. The default is to create these objects
197 // with listen address 0.0.0.0. If you define this, they are created
198 // using the listen address of the RequestList.
199 #define USE_LISTEN_ADDRESS_FOR_SENDING_TRAPS
200 
201 #ifdef AGENTPP_NAMESPACE
202 #define NS_AGENT Agentpp::
203 #else
204 #define NS_AGENT
205 #endif
206 
207 #ifndef MAXUINT32
208 #define MAXUINT32 4294967295u
209 #endif
210 
211 #define DEFAULT_ENGINE_BOOTS_FILE "snmpv3_boot_counter"
212 
213 #if defined(__APPLE__) || defined(__clang__)
214 // g++ 4.0.1 of MacOS X 10.5.6 does not like the template declarations
215 #define AGENTPP_DECL_TEMPL_OIDLIST_MIBSTATICENTRY
216 #define AGENTPP_DECL_TEMPL_LIST_MIBENTRY
217 #define AGENTPP_DECL_TEMPL_OIDLIST_MIBENTRY
218 #define AGENTPP_DECL_TEMPL_OIDLIST_MIBGROUP
219 #define AGENTPP_DECL_TEMPL_LIST_MIBENTRY
220 #define AGENTPP_DECL_TEMPL_LIST_MIBLEAF
221 #define AGENTPP_DECL_TEMPL_ORDEREDLIST_MIBLEAF
222 #define AGENTPP_DECL_TEMPL_ORDEREDARRAY_MIBLEAF
223 #define AGENTPP_DECL_TEMPL_LIST_MIBTABLE
224 #define AGENTPP_DECL_TEMPL_LIST_MIBTABLEROW
225 #define AGENTPP_DECL_TEMPL_LIST_MIBTABLEVOTER
226 #define AGENTPP_DECL_TEMPL_OIDLIST_MIBTABLEROW
227 #define AGENTPP_DECL_TEMPL_ORDEREDLIST_MIBTABLEROW
228 #define AGENTPP_DECL_TEMPL_ARRAY_MIBCONFIGFORMAT
229 #define AGENTPP_DECL_TEMPL_OIDLIST_MIBCONTEXT
230 #define AGENTPP_DECL_TEMPL_OIDLIST_PROXYFORWARDER
231 #define AGENTPP_DECL_TEMPL_ARRAY_MIBENTRY
232 #define AGENTPP_DECL_TEMPL_ARRAY_THREAD
233 #define AGENTPP_DECL_TEMPL_ARRAY_TASKMANAGER
234 #define AGENTPP_DECL_TEMPL_LIST_RUNNABLE
235 #define AGENTPP_DECL_TEMPL_LIST_LOCKREQUEST
236 #define AGENTPP_DECL_TEMPL_LIST_VIEWNAMEINDEX
237 #endif
238 
239 #endif // _agentpp_h_