SNMP++  3.3.4
mp_v3.h
Go to the documentation of this file.
1 /*_############################################################################
2  _##
3  _## mp_v3.h
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 // $Id: mp_v3.h 2359 2013-05-09 20:07:01Z fock $
29 
30 #ifndef _MP_V3
31 #define _MP_V3
32 
33 #include "snmp_pp/config_snmp_pp.h"
34 
35 #ifdef _SNMPv3
36 
37 #include "snmp_pp/reentrant.h"
38 #include "snmp_pp/target.h"
39 
40 #ifdef SNMP_PP_NAMESPACE
41 namespace Snmp_pp {
42 #endif
43 
44 class Pdu;
45 class OctetStr;
46 
47 #define MAX_HOST_NAME_LENGTH 128
48 
49 #define oidMPDGroup "1.3.6.1.6.3.11.2.1"
50 #define oidSnmpUnknownSecurityModels "1.3.6.1.6.3.11.2.1.1.0"
51 #define oidSnmpInvalidMsgs "1.3.6.1.6.3.11.2.1.2.0"
52 #define oidSnmpUnknownPDUHandlers "1.3.6.1.6.3.11.2.1.3.0"
53 
54 /** @name Error codes of the v3MP */
55 //@{
56 #define SNMPv3_MP_ERROR -1400
57 #define SNMPv3_MP_OK -1401
58 #define SNMPv3_MP_UNSUPPORTED_SECURITY_MODEL -1402
59 #define SNMPv3_MP_NOT_IN_TIME_WINDOW -1403
60 #define SNMPv3_MP_DOUBLED_MESSAGE -1404
61 #define SNMPv3_MP_INVALID_MESSAGE -1405
62 #define SNMPv3_MP_INVALID_ENGINEID -1406
63 #define SNMPv3_MP_NOT_INITIALIZED -1407
64 #define SNMPv3_MP_PARSE_ERROR -1408
65 #define SNMPv3_MP_UNKNOWN_MSGID -1409
66 #define SNMPv3_MP_MATCH_ERROR -1410
67 #define SNMPv3_MP_COMMUNITY_ERROR -1411
68 #define SNMPv3_MP_WRONG_USER_NAME -1412
69 #define SNMPv3_MP_BUILD_ERROR -1413
70 #define SNMPv3_MP_USM_ERROR -1414
71 #define SNMPv3_MP_UNKNOWN_PDU_HANDLERS -1415
72 #define SNMPv3_MP_UNAVAILABLE_CONTEXT -1416
73 #define SNMPv3_MP_UNKNOWN_CONTEXT -1417
74 #define SNMPv3_MP_REPORT_SENT -1418
75 //@}
76 
77 /** @name Statistics on error codes. */
78 //@{
79 #define SNMPv3_MP_MAX_ERROR SNMPv3_MP_ERROR
80 #define SNMPv3_MP_MIN_ERROR SNMPv3_MP_REPORT_SENT
81 #define SNMPv3_MP_ERRORCOUNT SNMPv3_MP_MAX_ERROR - SNMPv3_MP_MIN_ERROR
82 //@}
83 
84 class Snmp;
85 class USM;
86 
87 /**
88  * The SNMPv3 Message Processing Model (v3MP).
89  *
90  * If SNMPv3 is used, the application needs to create _one_ object of
91  * this class. This object will automatically create an object of the
92  * USM class. A pointer to this object is returned from the get_usm()
93  * method. See the USM documentation for a description on how to create
94  * and delete users.
95  *
96  * The only thing that may be configured after creation of the v3MP is
97  * the engine id table of the v3MP. Entries for other SNMP entities
98  * can be added through add_to_engine_id_table(). It is only required
99  * to add entries to this table if you want to disable engine id
100  * discovery and/or you don't want the delay caused by the automatic
101  * engine id discovery of SNMPv3.
102  */
104 {
105  friend class SnmpMessage;
106  friend class CSNMPMessageQueue;
107  public:
108  /**
109  * Initialize the v3MP.
110  *
111  * Set the engineID of this SNMP entity and the Snmp object used to
112  * send reports. This function creates a new USM object that can
113  * be configured after getting a pointer to it through get_usm().
114  *
115  * The user is responsible to save and restore and increment the
116  * snmpEngineBoots counter (The functions getBootCounter() and
117  * saveBootCounter() can be used to do this.).
118  *
119  * @param engine_id - The locale engine id
120  * @param engine_boots - The new value for the snmpEngineBoots counter
121  * @param construct_status - OUT: SNMPv3_MP_OK or SNMPv3_MP_ERROR
122  *
123  */
124  v3MP(const OctetStr& engine_id,
125  unsigned int engine_boots, int &construct_status);
126 
127  /**
128  * Get the engine id of this SNMP entity.
129  *
130  * @param id - OUT: The engineID of this SNMP entity
131  *
132  * @return - SNMPv3_MP_OK or SNMPv3_MP_ERROR
133  */
134  void get_local_engine_id(OctetStr &id) { id = own_engine_id_oct; };
135 
136  /**
137  * Get the engine id of this SNMP entity as a OctetStr reference.
138  *
139  * @return Local engine id.
140  */
142  { return own_engine_id_oct; };
143 
144  /**
145  * Get a pointer to the USM object that is used by the v3MP.
146  */
147  USM *get_usm() { return usm; };
148 
149  /**
150  * Free all allocated ressources of the v3MP and leave it in an
151  * uninitialized state. After a call to this function, you can use
152  * mpInit() to reinitialize the v3MP.
153  *
154  */
155  ~v3MP();
156 
157  /**
158  * Add an entry to the engine id table.
159  *
160  * In this table all known engine ids are stored. If the discovery
161  * mode of the USM is enabled, snmp++ will add entries to this table
162  * whenever a new engine id is dicovered.
163  *
164  * @param engine_id - The engine id
165  * @param host - The numerical IP address
166  * @param port - The port
167  *
168  * @return - SNMPv3_MP_ERROR, SNMPv3_MP_OK
169  */
170  int add_to_engine_id_table(const OctetStr &engine_id,
171  const OctetStr &host, int port)
172  { return engine_id_table.add_entry(engine_id, host, port); };
173 
174  /**
175  * Remove an entry from the engine id table.
176  *
177  * @param host - The numerical IP address
178  * @param port - The port
179  *
180  * @return - SNMPv3_MP_ERROR, SNMPv3_MP_OK
181  */
182  int remove_from_engine_id_table(const OctetStr &host, int port)
183  { return engine_id_table.delete_entry(host, port); };
184 
185  /**
186  * Remove an entry from the engine id table.
187  *
188  * @param engine_id - The engine id
189  *
190  * @return - SNMPv3_MP_ERROR, SNMPv3_MP_OK
191  */
192  int remove_from_engine_id_table(const OctetStr &engine_id)
193  { return engine_id_table.delete_entry(engine_id); };
194 
195  /**
196  * Get the engine id of the SNMP entity at the given host/port.
197  *
198  * @param engine_id - OUT: The engine id
199  * @param hostport - The numerical IP address and port
200  * (syntax: a.b.c.d/port)
201  *
202  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
203  * SNMPv3_MP_OK
204  */
206  const OctetStr &hostport) const
207  { return engine_id_table.get_entry(engine_id, hostport); };
208 
209  /**
210  * Get the engineID of the SNMP entity at the given host/port.
211  *
212  * @param engineID - OUT: The engineID
213  * @param host - The numerical IP address
214  * @param port - The port
215  *
216  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
217  * SNMPv3_MP_OK
218  */
220  const OctetStr &host, int port) const
221  { return engine_id_table.get_entry(engineID, host, port); };
222 
223  /**
224  * Remove all entries from the engine id table.
225  *
226  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
227  * SNMPv3_MP_OK
228  */
230  { return engine_id_table.reset(); };
231 
232  /**
233  * Remove all occurences of this engine id from v3MP and USM.
234  *
235  * @param engine_id - The engine id to remove
236  *
237  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
238  * SNMPv3_MP_OK
239  */
240  int remove_engine_id(const OctetStr &engine_id);
241 
242  // ----------[ Access to status counters for agent++ ]--------------
243 
244  /**
245  * Get the value of the status counter snmpUnknownSecurityModels.
246  *
247  * @return - The status counter
248  */
249  unsigned long get_stats_unknown_security_models() const
250  { return snmpUnknownSecurityModels; };
251 
252  /**
253  * Get the value of the status counter snmpInvalidMsgs.
254  *
255  * @return - The status counter
256  */
257  unsigned long get_stats_invalid_msgs() const
258  { return snmpInvalidMsgs; };
259 
260  /**
261  * Get the value of the status counter snmpUnknownPDUHandlers.
262  *
263  * @return - The status counter
264  */
265  unsigned long get_stats_unknown_pdu_handlers() const
266  { return snmpUnknownPDUHandlers; };
267 
268  /**
269  * Increment the value of the status counter snmpUnknownSecurityModels.
270  */
272  { snmpUnknownSecurityModels++; };
273 
274  /**
275  * Increment the value of the status counter snmpInvalidMsgs.
276  */
277  void inc_stats_invalid_msgs() { snmpInvalidMsgs++; };
278 
279  /**
280  * Increment the value of the status counter snmpUnknownPDUHandlers.
281  */
282  void inc_stats_unknown_pdu_handlers() { snmpUnknownPDUHandlers++; };
283 
284  // temporary pointer will be removed...
285  static v3MP *I;
286 
287  protected:
288 
289  /**
290  * Parse the given buffer as a SNMPv3-Message.
291  *
292  * @param snmp_session - IN: The session used to receive the msg
293  * @param pdu - OUT: Parsed values are put into this struct
294  * @param inBuf - The buffer to parse
295  * @param inBufLength - The length of the buffer
296  * @param securityEngineID - OUT: The parsed securityEngineID
297  * @param securityName - OUT: The parsed securityName
298  * @param contextEngineID - OUT: The parsed contextEngineID
299  * @param contextName - OUT: The parsed contextName
300  * @param securityLevel - OUT: The parsed security level
301  * @param msgSecurityModel - OUT: The security model used
302  * @param spp_version - OUT: SNMP version (SNMPv3)
303  * @param from_address - Where the message came from (used to send
304  * a report if neccessary)
305  *
306  * @return - SNMPv3_MP_OK or any error listed in snmperr.h
307  */
308  int snmp_parse(Snmp *snmp_session,
309  struct snmp_pdu *pdu,
310  unsigned char *inBuf,
311  int inBufLength,
312  OctetStr &securityEngineID,
313  OctetStr &securityName,
314  OctetStr &contextEngineID,
315  OctetStr &contextName,
316  long &securityLevel,
317  long &msgSecurityModel,
318  snmp_version &spp_version,
319  UdpAddress from_address);
320 
321  /**
322  * Tests if the given buffer contains a SNMPv3-Message. The buffer is
323  * only parsed to extract the version of the message, no other checks
324  * are made.
325  *
326  * @param buffer - The message
327  * @param length - The length of the message
328  *
329  * @return - TRUE if the version could be extracted and it
330  * is a SNMPv3 message. On any error: FALSE.
331  *
332  */
333  static bool is_v3_msg( unsigned char *buffer, int length);
334 
335  /**
336  * Do the complete process of encoding the given values into the buffer
337  * ready to send to the target.
338  *
339  * @param pdu - The pdu structure
340  * @param packet - The buffer to store the serialized message
341  * @param out_length - IN: Length of the buffer,
342  * OUT: Length of the message
343  * @param securityEngineID - The securityEngineID
344  * @param securityNameIn - The securityName
345  * @param securityModel - Use this security model
346  * @param securityLevel - Use this security level
347  * @param contextEngineID - The contextEngineID
348  * @param contextName - The contextName
349  *
350  * @return - SNMPv3_MP_OK or any error listed in snmperr.h
351  */
352  int snmp_build(struct snmp_pdu *pdu,
353  unsigned char *packet,
354  int *out_length, // maximum Bytes in packet
355  const OctetStr &securityEngineID,
356  const OctetStr &securityNameIn,
357  int securityModel, int securityLevel,
358  const OctetStr &contextEngineID,
359  const OctetStr &contextName);
360 
361  /**
362  * Delete the entry with the given request id from the cache.
363  * This function is used in eventlist.cpp when a request
364  * has timed out.
365  *
366  * @param requestID - The request id.
367  * @param local_request - Does the request id belong to a local or to
368  * a remote request?
369  */
370  void delete_from_cache(unsigned long requestID,
371  const bool local_request = true)
372  { cache.delete_entry(requestID, local_request); };
373 
374  public:
375 
376  /**
377  * Delete the entry with the given request id from the cache.
378  * This function is used in agent++ RequestList.
379  *
380  * @param requestID - The request id.
381  * @param messageID - The message id.
382  * @param local_request - Does the request id belong to a local or to
383  * a remote request?
384  */
385  void delete_from_cache(unsigned long requestID,
386  unsigned long messageID,
387  const bool local_request)
388  { cache.delete_entry(requestID, messageID, local_request); };
389 
390  private:
391 
392  /**
393  * Send a report message.
394  *
395  * @param scopedPDU - The scopedPDU as received. If the pdu is not
396  * encrypted, the request id is extracted
397  * @param scopedPDULength - The lkength of the scopedPDU
398  * @param pdu - The pdu structure.
399  * @param errorCode - The code of the error that occured.
400  * @param sLevel - Send the report with this security level.
401  * @param sModel - Use this security model.
402  * @param sName - Use this security name
403  * @param destination - Send the report to this address.
404  * @param snmp_session - Snmp session to use for sending a report
405  *
406  * @return - SNMPv3_MP_ERROR, SNMPv3_MP_OK
407  */
408  int send_report(unsigned char* scopedPDU, int scopedPDULength,
409  struct snmp_pdu *pdu, int errorCode, int sLevel,
410  int sModel, OctetStr &sName,
411  UdpAddress &destination, Snmp *snmp_session);
412 
413 
414 
415  // =====================[ member classes ]==============================
416 
417  /**
418  * The engine id table is used to store known engine ids with
419  * corresponding hostadress and port.
420  */
422  {
423  public:
424 
425  EngineIdTable(int initial_size = 10);
426  ~EngineIdTable();
427 
428  /**
429  * Add an entry to the table.
430  *
431  * @param engine_id - The engineID
432  * @param host - The numerical IP address
433  * @param port - The port
434  *
435  * @return - SNMPv3_MP_ERROR, SNMPv3_MP_OK
436  */
437  int add_entry(const OctetStr &engine_id,
438  const OctetStr &host, int port);
439 
440  /**
441  * Get the engine_id of the SNMP entity at the given host/port.
442  *
443  * @param engine_id - OUT: The engineID
444  * @param hostport - The numerical IP address and port
445  * (syntax: a.b.c.d/port)
446  *
447  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
448  * SNMPv3_MP_OK
449  */
450  int get_entry(OctetStr &engine_id, const OctetStr &hostport) const;
451 
452  /**
453  * Get the engineID of the SNMP entity at the given host/port.
454  *
455  * @param engine_id - OUT: The engineID
456  * @param host - The numerical IP address
457  * @param port - The port
458  *
459  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
460  * SNMPv3_MP_OK
461  */
462  int get_entry(OctetStr &engine_id, const OctetStr &host, int port) const;
463 
464  /**
465  * Remove all entries from the engine id table.
466  *
467  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
468  * SNMPv3_MP_OK
469  */
470  int reset();
471 
472  /**
473  * Remove the given engine id from the table.
474  *
475  * @param engine_id - The engine id to remove
476  *
477  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
478  * SNMPv3_MP_OK
479  */
480  int delete_entry(const OctetStr &engine_id);
481 
482  /**
483  * Remove the entry for the given address/port from the table.
484  *
485  * @param host - Numeric IP address
486  * @param port - listen port of the snmp entity
487  *
488  * @return - SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR,
489  * SNMPv3_MP_OK
490  */
491  int delete_entry(const OctetStr &host, int port);
492 
493  private:
494  bool initialize_table(const int size);
495 
496  struct Entry_T
497  {
500  int port;
501  };
502 
503  struct Entry_T *table;
504  int max_entries; ///< the maximum number of entries
505  int entries; ///< the current amount of entries
507  };
508 
509 
510  /**
511  * Holds cache entries for currently processed requests.
512  */
513  class DLLOPT Cache
514  {
515  public:
516  Cache();
517  ~Cache();
518 
519  struct Entry_T
520  {
521  int msg_id;
522  unsigned long req_id;
529  struct SecurityStateReference *sec_state_ref;
532  };
533 
534  /**
535  * Add an entry to the cache.
536  *
537  * @param msg_id - The message id of the message
538  * @param req_id - The request id of the message
539  * @param sec_engine_id - The authoritative engineID
540  * @param sec_model - The security model used for this message
541  * @param sec_name - The name of the user
542  * @param sec_level - The security level used for this message
543  * @param context_engine_id - The context_engine_id
544  * @param context_name - The context_name
545  * @param sec_state_ref - The reference of the USM
546  * @param error_code - The code of the error that occured while
547  * parsing the received message
548  *
549  * @return - SNMPv3_MP_OK, SNMPv3_MP_ERROR or SNMPv3_DOUBLED_MESSAGE
550  * (an entry with the given values is already in the cache)
551  */
552  int add_entry(int msg_id, unsigned long req_id,
553  const OctetStr &sec_engine_id,
554  int sec_model,
555  const OctetStr &sec_name,
556  int sec_level,
557  const OctetStr &context_engine_id,
558  const OctetStr &context_name,
559  struct SecurityStateReference *sec_state_ref,
560  int error_code, bool local_request);
561  /**
562  * Search the cache for a message id, return the error code and
563  * the sec_state_ref and delete the entry from the cache.
564  *
565  * @param msg_id - Search for this message id
566  * @param error_code - OUT: The error code of the received message
567  * @param sec_state_ref - IN: Pointer to a pointer of the structure
568  * OUT: The structure as received by the USM when
569  * the message was parsed.
570  *
571  * @return - SNMPv3_MP_ERROR, SNMPv3_MP_OK
572  */
573  int get_entry(int msg_id, bool local_request, int *error_code,
574  struct SecurityStateReference **sec_state_ref);
575 
576  /**
577  * Delete the entry with the given request id from the cache.
578  * This function is used in eventlist.cpp when a request
579  * has timed out.
580  *
581  * @param req_id - The request id.
582  */
583  void delete_entry(unsigned long req_id, bool local_request);
584 
585  /**
586  * Delete the entry with the given request and message id from the cache.
587  *
588  * @param req_id - The request id.
589  * @param msg_id - The message id.
590  */
591  void delete_entry(unsigned long req_id, int msg_id,
592  bool local_request);
593 
594  /**
595  * Search the cache for a message id, return the whole entry and
596  * delete the entry from the cache.
597  *
598  * @param searchedID - Search for this message id
599  * @param res - IN: Pointer to an empy structure
600  * OUT: The filled structure
601  *
602  * @return - SNMPv3_MP_ERROR, SNMPv3_MP_OK
603  */
604  int get_entry(int searchedID, bool local_request,
605  struct Cache::Entry_T *res);
606 
607  void delete_content(struct Cache::Entry_T &ce);
608 
609  void set_usm(USM *usm_to_use) { usm = usm_to_use; };
610 
611  private:
612 #ifdef _THREADS
614 #endif
615  struct Entry_T *table; ///< whole table
616  int max_entries; ///< the maximum number of entries
617  int entries; ///< the current amount of entries
619  };
620 
621 
622  // =====================[ member variables ]==============================
625 
626  // the engineID of this SNMP entity
627  unsigned char *own_engine_id;
630 
631  unsigned int cur_msg_id; ///< msgID to use for next message
633 
634  USM *usm; ///< the USM object used
635 
636  // MIB Counters
638  unsigned int snmpInvalidMsgs;
640 };
641 
642 #ifdef SNMP_PP_NAMESPACE
643 } // end of namespace Snmp_pp
644 #endif
645 
646 #endif // _SNMPv3
647 
648 #endif
#define SNMP_PP_MUTABLE
Cache cache
Definition: mp_v3.h:624
SNMP_PP_MUTABLE SnmpSynchronized lock
Definition: mp_v3.h:506
int entries
the current amount of entries
Definition: mp_v3.h:617
int get_from_engine_id_table(OctetStr &engineID, const OctetStr &host, int port) const
Get the engineID of the SNMP entity at the given host/port.
Definition: mp_v3.h:219
void delete_from_cache(unsigned long requestID, unsigned long messageID, const bool local_request)
Delete the entry with the given request id from the cache.
Definition: mp_v3.h:385
void inc_stats_invalid_msgs()
Increment the value of the status counter snmpInvalidMsgs.
Definition: mp_v3.h:277
Holds cache entries for currently processed requests.
Definition: mp_v3.h:513
void inc_stats_unknown_pdu_handlers()
Increment the value of the status counter snmpUnknownPDUHandlers.
Definition: mp_v3.h:282
OctetStr context_engine_id
Definition: mp_v3.h:527
unsigned int snmpUnknownPDUHandlers
Definition: mp_v3.h:639
USM * get_usm()
Get a pointer to the USM object that is used by the v3MP.
Definition: mp_v3.h:147
unsigned int cur_msg_id
msgID to use for next message
Definition: mp_v3.h:631
int own_engine_id_len
Definition: mp_v3.h:628
void set_usm(USM *usm_to_use)
Definition: mp_v3.h:609
SNMP class defintion.
Definition: uxsnmp.h:99
USM * usm
Definition: mp_v3.h:618
OctetStr own_engine_id_oct
Definition: mp_v3.h:629
int add_to_engine_id_table(const OctetStr &engine_id, const OctetStr &host, int port)
Add an entry to the engine id table.
Definition: mp_v3.h:170
int get_from_engine_id_table(OctetStr &engine_id, const OctetStr &hostport) const
Get the engine id of the SNMP entity at the given host/port.
Definition: mp_v3.h:205
USM * usm
the USM object used
Definition: mp_v3.h:634
struct Entry_T * table
whole table
Definition: mp_v3.h:615
int reset_engine_id_table()
Remove all entries from the engine id table.
Definition: mp_v3.h:229
#define DLLOPT
struct Entry_T * table
Definition: mp_v3.h:503
The SNMPv3 Message Processing Model (v3MP).
Definition: mp_v3.h:103
int remove_from_engine_id_table(const OctetStr &engine_id)
Remove an entry from the engine id table.
Definition: mp_v3.h:192
unsigned char * own_engine_id
Definition: mp_v3.h:627
snmp_version
The SNMP version to use is passed with this enum.
Definition: target.h:75
EngineIdTable engine_id_table
Definition: mp_v3.h:623
unsigned long get_stats_unknown_security_models() const
Get the value of the status counter snmpUnknownSecurityModels.
Definition: mp_v3.h:249
The engine id table is used to store known engine ids with corresponding hostadress and port...
Definition: mp_v3.h:421
OctetStr sec_engine_id
Definition: mp_v3.h:523
unsigned int snmpInvalidMsgs
Definition: mp_v3.h:638
Definition: octet.h:67
OctetStr sec_name
Definition: mp_v3.h:525
int max_entries
the maximum number of entries
Definition: mp_v3.h:504
unsigned long get_stats_unknown_pdu_handlers() const
Get the value of the status counter snmpUnknownPDUHandlers.
Definition: mp_v3.h:265
void delete_from_cache(unsigned long requestID, const bool local_request=true)
Delete the entry with the given request id from the cache.
Definition: mp_v3.h:370
void get_local_engine_id(OctetStr &id)
Get the engine id of this SNMP entity.
Definition: mp_v3.h:134
int remove_from_engine_id_table(const OctetStr &host, int port)
Remove an entry from the engine id table.
Definition: mp_v3.h:182
This is the class for the User Based Security Model.
Definition: usm_v3.h:233
int max_entries
the maximum number of entries
Definition: mp_v3.h:616
unsigned long get_stats_invalid_msgs() const
Get the value of the status counter snmpInvalidMsgs.
Definition: mp_v3.h:257
struct SecurityStateReference * sec_state_ref
Definition: mp_v3.h:529
Definition: asn1.h:134
void inc_stats_unknown_security_models()
Increment the value of the status counter snmpUnknownSecurityModels.
Definition: mp_v3.h:271
const OctetStr & get_local_engine_id() const
Get the engine id of this SNMP entity as a OctetStr reference.
Definition: mp_v3.h:141
DLLOPT int snmp_parse(struct snmp_pdu *pdu, unsigned char *data, int data_length, unsigned char *community_name, int &community_len, snmp_version &version)
unsigned long req_id
Definition: mp_v3.h:522
OctetStr context_name
Definition: mp_v3.h:528
Pdu class...
Definition: pdu.h:81
SNMP_PP_MUTABLE SnmpSynchronized cur_msg_id_lock
Definition: mp_v3.h:632
DLLOPT int snmp_build(struct snmp_pdu *pdu, unsigned char *packet, int *out_length, const long version, const unsigned char *community, const int community_len)
unsigned int snmpUnknownSecurityModels
Definition: mp_v3.h:637
int entries
the current amount of entries
Definition: mp_v3.h:505