#include <stdarg.h>
#include <libsnmp.h>
#include "snmp_pp/config_snmp_pp.h"
Go to the source code of this file.
|
DLLOPT void | debug_set_level (const int db_level) |
| Set the amount of log messages you want to get. More...
|
|
DLLOPT void | debugprintf (int db_level, const char *format,...) |
| SNMP++ logging function. More...
|
|
DLLOPT void | debughexcprintf (int db_level, const char *comment, const unsigned char *data, const unsigned int len) |
| SNMP++ logging function for hex strings. More...
|
|
DLLOPT int | unsignedCharCompare (const unsigned char *str1, const long int ptr1len, const unsigned char *str2, const long int ptr2len) |
| Compare two strings. More...
|
|
DLLOPT unsigned char * | v3strcpy (const unsigned char *src, const int srclen) |
| String copy function. More...
|
|
DLLOPT void | encodeString (const unsigned char *in, const int in_length, char *out) |
| Encode the given string into the output buffer. More...
|
|
DLLOPT void | decodeString (const unsigned char *in, const int in_length, char *out) |
| Decode the given encoded string into the output buffer. More...
|
|
DLLOPT int | getBootCounter (const char *fileName, const OctetStr &engineId, unsigned int &boot) |
| Read the bootCounter of the given engineID stored in the given file. More...
|
|
DLLOPT int | saveBootCounter (const char *fileName, const OctetStr &engineId, const unsigned int boot) |
| Store the bootCounter of the given engineID in the given file. More...
|
|
◆ debughexprintf
#define debughexprintf |
( |
|
db_level, |
|
|
|
data, |
|
|
|
len |
|
) |
| debughexcprintf(db_level, NULL, data, len); |
◆ MAXLENGTH_CONTEXT_NAME
#define MAXLENGTH_CONTEXT_NAME 32 |
Definition at line 111 of file v3.h.
◆ MAXLENGTH_ENGINEID
#define MAXLENGTH_ENGINEID 32 |
Definition at line 110 of file v3.h.
◆ MAXLENGTH_FILENAME
#define MAXLENGTH_FILENAME 255 |
Definition at line 112 of file v3.h.
◆ MAXLENGTH_GLOBALDATA
#define MAXLENGTH_GLOBALDATA 42 |
Definition at line 113 of file v3.h.
◆ oidSnmpUnavailableContexts
#define oidSnmpUnavailableContexts "1.3.6.1.6.3.12.1.4.0" |
Definition at line 123 of file v3.h.
◆ oidSnmpUnknownContexts
#define oidSnmpUnknownContexts "1.3.6.1.6.3.12.1.5.0" |
Definition at line 124 of file v3.h.
◆ oidV3SnmpEngine
#define oidV3SnmpEngine "1.3.6.1.6.3.10.2.1" |
Definition at line 115 of file v3.h.
◆ oidV3SnmpEngineBoots
#define oidV3SnmpEngineBoots "1.3.6.1.6.3.10.2.1.2.0" |
Definition at line 117 of file v3.h.
◆ oidV3SnmpEngineID
#define oidV3SnmpEngineID "1.3.6.1.6.3.10.2.1.1.0" |
Definition at line 116 of file v3.h.
◆ oidV3SnmpEngineMaxMessageSize
#define oidV3SnmpEngineMaxMessageSize "1.3.6.1.6.3.10.2.1.4.0" |
Definition at line 119 of file v3.h.
◆ oidV3SnmpEngineTime
#define oidV3SnmpEngineTime "1.3.6.1.6.3.10.2.1.3.0" |
Definition at line 118 of file v3.h.
◆ SecurityModel_any
Definition at line 264 of file v3.h.
◆ SecurityModel_USM
Definition at line 267 of file v3.h.
◆ SecurityModel_v1
Definition at line 265 of file v3.h.
◆ SecurityModel_v2
Definition at line 266 of file v3.h.
◆ SNMP_SECURITY_MODEL_ANY
#define SNMP_SECURITY_MODEL_ANY 0 |
Not used in SNMP++.
Definition at line 46 of file v3.h.
◆ SNMP_SECURITY_MODEL_USM
#define SNMP_SECURITY_MODEL_USM 3 |
Can be used for SNMPv3 only.
Definition at line 49 of file v3.h.
◆ SNMP_SECURITY_MODEL_V1
#define SNMP_SECURITY_MODEL_V1 1 |
Can be used for SNMPv1 only.
Definition at line 47 of file v3.h.
◆ SNMP_SECURITY_MODEL_V2
#define SNMP_SECURITY_MODEL_V2 2 |
Can be used for SNMPv2 only.
Definition at line 48 of file v3.h.
◆ SNMPv3_FILE_ERROR
#define SNMPv3_FILE_ERROR -4 |
The given file contains a wrong line.
Definition at line 136 of file v3.h.
◆ SNMPv3_FILECREATE_ERROR
#define SNMPv3_FILECREATE_ERROR -5 |
The File could not be created.
Definition at line 137 of file v3.h.
◆ SNMPv3_FILEOPEN_ERROR
#define SNMPv3_FILEOPEN_ERROR -2 |
Unable to open file.
Definition at line 134 of file v3.h.
◆ SNMPv3_FILERENAME_ERROR
#define SNMPv3_FILERENAME_ERROR -6 |
Error renaming the temporary file.
Definition at line 138 of file v3.h.
◆ SNMPv3_NO_ENTRY_ERROR
#define SNMPv3_NO_ENTRY_ERROR -1 |
No line for the engine id found.
Definition at line 133 of file v3.h.
◆ SNMPv3_OK
No error.
Definition at line 132 of file v3.h.
◆ SNMPv3_TOO_LONG_ERROR
#define SNMPv3_TOO_LONG_ERROR -3 |
The given engineID is too long.
Definition at line 135 of file v3.h.
◆ debug_set_level()
DLLOPT void debug_set_level |
( |
const int |
db_level | ) |
|
Set the amount of log messages you want to get.
To disable all messages, set the level to -1
- Parameters
-
◆ debughexcprintf()
DLLOPT void debughexcprintf |
( |
int |
db_level, |
|
|
const char * |
comment, |
|
|
const unsigned char * |
data, |
|
|
const unsigned int |
len |
|
) |
| |
SNMP++ logging function for hex strings.
- Parameters
-
db_level | - Priority of the message (0 = high) |
comment | - Comment printed before the hex dump (may be 0) |
data | - pointer to the hex data |
len | - length of the hex data |
◆ debugprintf()
DLLOPT void debugprintf |
( |
int |
db_level, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
SNMP++ logging function.
The default is to log all messages with a level < 19. To change that either edit v3.cpp or use a "extern unsigned int debug_level" to change the level.
- Parameters
-
db_level | - Priority of the message (0 = high) |
format | - Just like printf |
◆ decodeString()
DLLOPT void decodeString |
( |
const unsigned char * |
in, |
|
|
const int |
in_length, |
|
|
char * |
out |
|
) |
| |
Decode the given encoded string into the output buffer.
- Parameters
-
in | - The encoded string |
in_length | - The length of the encoded string |
out | - Buffer for the decoded string (half size of input string). The String will be null terminated. |
◆ encodeString()
DLLOPT void encodeString |
( |
const unsigned char * |
in, |
|
|
const int |
in_length, |
|
|
char * |
out |
|
) |
| |
Encode the given string into the output buffer.
For each byte of the string two bytes in the output buffer are used. The output buffer will contain chars from 0x64 to 0x79.
- Parameters
-
in | - The string (for example engine id) to encode |
in_length | - The length of the engineID |
out | - The output buffer for the encoded string, must have lenth 2 * in_length |
◆ getBootCounter()
DLLOPT int getBootCounter |
( |
const char * |
fileName, |
|
|
const OctetStr & |
engineId, |
|
|
unsigned int & |
boot |
|
) |
| |
Read the bootCounter of the given engineID stored in the given file.
- Parameters
-
fileName | - The name of the file |
engineId | - Read the bootCounter for this enigneID |
boot | - OUT: the bootCounter that was read |
- Returns
- One of SNMPv3_OK, SNMPv3_TOO_LONG_ERROR, SNMPv3_FILE_ERROR, SNMPv3_NO_ENTRY_ERROR, SNMPv3_FILEOPEN_ERROR
◆ saveBootCounter()
DLLOPT int saveBootCounter |
( |
const char * |
fileName, |
|
|
const OctetStr & |
engineId, |
|
|
const unsigned int |
boot |
|
) |
| |
Store the bootCounter of the given engineID in the given file.
- Parameters
-
fileName | - The name of the file |
engineId | - Store the bootCounter for this enigneID |
boot | - The bootCounter |
- Returns
- One of SNMPv3_OK, SNMPv3_FILEOPEN_ERROR, SNMPv3_FILECREATE_ERROR, SNMPv3_FILERENAME_ERROR.
◆ unsignedCharCompare()
DLLOPT int unsignedCharCompare |
( |
const unsigned char * |
str1, |
|
|
const long int |
ptr1len, |
|
|
const unsigned char * |
str2, |
|
|
const long int |
ptr2len |
|
) |
| |
Compare two strings.
- Parameters
-
str1 | - The first byte array |
ptr1len | - Length of first array |
str2 | - The second byte array |
ptr2len | - Length of second array |
- Returns
- 1 if the strings are identical, 0 if not.
◆ v3strcpy()
DLLOPT unsigned char* v3strcpy |
( |
const unsigned char * |
src, |
|
|
const int |
srclen |
|
) |
| |
String copy function.
- Note
- The returned string has to be deleted with "delete []".
- Parameters
-
src | - Source string |
srclen | - Length of source string |
- Returns
- Pointer to a null terminated copy of src (or 0 on error).