40 #ifdef SNMP_PP_NAMESPACE
47 #define MAX_HOST_NAME_LENGTH 128
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"
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
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
125 unsigned int engine_boots,
int &construct_status);
142 {
return own_engine_id_oct; };
172 {
return engine_id_table.add_entry(engine_id, host, port); };
183 {
return engine_id_table.delete_entry(host, port); };
193 {
return engine_id_table.delete_entry(engine_id); };
207 {
return engine_id_table.get_entry(engine_id, hostport); };
220 const OctetStr &host,
int port)
const
221 {
return engine_id_table.get_entry(engineID, host, port); };
230 {
return engine_id_table.reset(); };
240 int remove_engine_id(
const OctetStr &engine_id);
250 {
return snmpUnknownSecurityModels; };
258 {
return snmpInvalidMsgs; };
266 {
return snmpUnknownPDUHandlers; };
272 { snmpUnknownSecurityModels++; };
310 unsigned char *inBuf,
317 long &msgSecurityModel,
333 static bool is_v3_msg(
unsigned char *buffer,
int length);
353 unsigned char *packet,
357 int securityModel,
int securityLevel,
371 const bool local_request =
true)
372 { cache.delete_entry(requestID, local_request); };
386 unsigned long messageID,
387 const bool local_request)
388 { cache.delete_entry(requestID, messageID, local_request); };
408 int send_report(
unsigned char* scopedPDU,
int scopedPDULength,
409 struct snmp_pdu *pdu,
int errorCode,
int sLevel,
437 int add_entry(
const OctetStr &engine_id,
480 int delete_entry(
const OctetStr &engine_id);
491 int delete_entry(
const OctetStr &host,
int port);
494 bool initialize_table(
const int size);
552 int add_entry(
int msg_id,
unsigned long req_id,
559 struct SecurityStateReference *sec_state_ref,
560 int error_code,
bool local_request);
573 int get_entry(
int msg_id,
bool local_request,
int *error_code,
574 struct SecurityStateReference **sec_state_ref);
583 void delete_entry(
unsigned long req_id,
bool local_request);
591 void delete_entry(
unsigned long req_id,
int msg_id,
604 int get_entry(
int searchedID,
bool local_request,
642 #ifdef SNMP_PP_NAMESPACE
SNMP_PP_MUTABLE SnmpSynchronized lock
int entries
the current amount of entries
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.
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.
void inc_stats_invalid_msgs()
Increment the value of the status counter snmpInvalidMsgs.
Holds cache entries for currently processed requests.
void inc_stats_unknown_pdu_handlers()
Increment the value of the status counter snmpUnknownPDUHandlers.
OctetStr context_engine_id
unsigned int snmpUnknownPDUHandlers
USM * get_usm()
Get a pointer to the USM object that is used by the v3MP.
unsigned int cur_msg_id
msgID to use for next message
void set_usm(USM *usm_to_use)
OctetStr own_engine_id_oct
int add_to_engine_id_table(const OctetStr &engine_id, const OctetStr &host, int port)
Add an entry to the engine id table.
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.
USM * usm
the USM object used
struct Entry_T * table
whole table
int reset_engine_id_table()
Remove all entries from the engine id table.
The SNMPv3 Message Processing Model (v3MP).
int remove_from_engine_id_table(const OctetStr &engine_id)
Remove an entry from the engine id table.
unsigned char * own_engine_id
snmp_version
The SNMP version to use is passed with this enum.
EngineIdTable engine_id_table
unsigned long get_stats_unknown_security_models() const
Get the value of the status counter snmpUnknownSecurityModels.
The engine id table is used to store known engine ids with corresponding hostadress and port...
unsigned int snmpInvalidMsgs
int max_entries
the maximum number of entries
unsigned long get_stats_unknown_pdu_handlers() const
Get the value of the status counter snmpUnknownPDUHandlers.
void delete_from_cache(unsigned long requestID, const bool local_request=true)
Delete the entry with the given request id from the cache.
void get_local_engine_id(OctetStr &id)
Get the engine id of this SNMP entity.
int remove_from_engine_id_table(const OctetStr &host, int port)
Remove an entry from the engine id table.
This is the class for the User Based Security Model.
int max_entries
the maximum number of entries
unsigned long get_stats_invalid_msgs() const
Get the value of the status counter snmpInvalidMsgs.
struct SecurityStateReference * sec_state_ref
void inc_stats_unknown_security_models()
Increment the value of the status counter snmpUnknownSecurityModels.
const OctetStr & get_local_engine_id() const
Get the engine id of this SNMP entity as a OctetStr reference.
DLLOPT int snmp_parse(struct snmp_pdu *pdu, unsigned char *data, int data_length, unsigned char *community_name, int &community_len, snmp_version &version)
SNMP_PP_MUTABLE SnmpSynchronized cur_msg_id_lock
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
int entries
the current amount of entries