Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

v3.h File Reference

#include <stdio.h>
#include <stdarg.h>
#include "snmp_pp/config_snmp_pp.h"

Go to the source code of this file.

SNMPv3 Security Model values

#define SNMP_SECURITY_MODEL_ANY   0
 Not used in SNMP++.

#define SNMP_SECURITY_MODEL_V1   1
 Can be used for SNMPv1 only.

#define SNMP_SECURITY_MODEL_V2   2
 Can be used for SNMPv2 only.

#define SNMP_SECURITY_MODEL_USM   3
 Can be used for SNMPv3 only.


Error codes (storing engineBoots)

These values are returned by getBootCounter() and saveBootCounter().

#define SNMPv3_OK   0
 No error.

#define SNMPv3_NO_ENTRY_ERROR   -1
 No line for the engine id found.

#define SNMPv3_FILEOPEN_ERROR   -2
 Unable to open file.

#define SNMPv3_TOO_LONG_ERROR   -3
 The given engineID is too long.

#define SNMPv3_FILE_ERROR   -4
 The given file contains a wrong line.

#define SNMPv3_FILECREATE_ERROR   -5
 The File could not be created.

#define SNMPv3_FILERENAME_ERROR   -6
 Error renaming the temporary file.


Defines

#define TRUE   1
#define FALSE   0
#define debughexprintf(db_level, data, len)   debughexcprintf(db_level, NULL, data, len);
 Wrapper for debughexcprintf() without comment.

#define V3MAXMESSAGESIZE   SNMP_MSG_LENGTH
#define MAXLENGTH_ENGINEID   32
#define MAXLENGTH_CONTEXT_NAME   32
#define MAXLENGTH_FILENAME   255
#define MAXLENGTH_GLOBALDATA   42
#define oidV3SnmpEngine   "1.3.6.1.6.3.10.2.1"
#define oidV3SnmpEngineID   "1.3.6.1.6.3.10.2.1.1.0"
#define oidV3SnmpEngineBoots   "1.3.6.1.6.3.10.2.1.2.0"
#define oidV3SnmpEngineTime   "1.3.6.1.6.3.10.2.1.3.0"
#define oidV3SnmpEngineMaxMessageSize   "1.3.6.1.6.3.10.2.1.4.0"
#define oidSnmpUnavailableContexts   "1.3.6.1.6.3.12.1.4.0"
#define oidSnmpUnknownContexts   "1.3.6.1.6.3.12.1.5.0"
#define SecurityModel_any   SNMP_SECURITY_MODEL_ANY
#define SecurityModel_v1   SNMP_SECURITY_MODEL_V1
#define SecurityModel_v2   SNMP_SECURITY_MODEL_V2
#define SecurityModel_USM   SNMP_SECURITY_MODEL_USM

Functions

DLLOPT void debug_set_logfile (const char *filename)
 Set the logfile for logging output.

DLLOPT void debug_set_level (const int db_level)
 Set the amount of log messages you want to get.

DLLOPT void debugprintf (int db_level, const char *format,...)
 SNMP++ logging function.

DLLOPT void debughexcprintf (int db_level, const char *comment, const unsigned char *data, const unsigned int len)
 SNMP++ logging function for hex strings.

DLLOPT int unsignedCharCompare (const unsigned char *str1, const long int ptr1len, const unsigned char *str2, const long int ptr2len)
 Compare two strings.

DLLOPT unsigned char * v3strcpy (const unsigned char *src, const int srclen)
 String copy function.

DLLOPT void encodeString (const unsigned char *in, const int in_length, char *out)
 Encode the given string into the output buffer.

DLLOPT void decodeString (const unsigned char *in, const int in_length, char *out)
 Decode the given encoded string into the output buffer.

DLLOPT int getBootCounter (const char *fileName, const OctetStr &engineId, unsigned int &boot)
 Read the bootCounter of the given engineID stored in the given file.

DLLOPT int saveBootCounter (const char *fileName, const OctetStr &engineId, const unsigned int boot)
 Store the bootCounter of the given engineID in the given file.


Define Documentation

#define debughexprintf db_level,
data,
len   )     debughexcprintf(db_level, NULL, data, len);
 

Wrapper for debughexcprintf() without comment.

Definition at line 105 of file v3.h.

#define FALSE   0
 

Definition at line 50 of file v3.h.

#define MAXLENGTH_CONTEXT_NAME   32
 

Definition at line 131 of file v3.h.

#define MAXLENGTH_ENGINEID   32
 

Definition at line 130 of file v3.h.

#define MAXLENGTH_FILENAME   255
 

Definition at line 132 of file v3.h.

#define MAXLENGTH_GLOBALDATA   42
 

Definition at line 133 of file v3.h.

#define oidSnmpUnavailableContexts   "1.3.6.1.6.3.12.1.4.0"
 

Definition at line 143 of file v3.h.

#define oidSnmpUnknownContexts   "1.3.6.1.6.3.12.1.5.0"
 

Definition at line 144 of file v3.h.

#define oidV3SnmpEngine   "1.3.6.1.6.3.10.2.1"
 

Definition at line 135 of file v3.h.

#define oidV3SnmpEngineBoots   "1.3.6.1.6.3.10.2.1.2.0"
 

Definition at line 137 of file v3.h.

#define oidV3SnmpEngineID   "1.3.6.1.6.3.10.2.1.1.0"
 

Definition at line 136 of file v3.h.

#define oidV3SnmpEngineMaxMessageSize   "1.3.6.1.6.3.10.2.1.4.0"
 

Definition at line 139 of file v3.h.

#define oidV3SnmpEngineTime   "1.3.6.1.6.3.10.2.1.3.0"
 

Definition at line 138 of file v3.h.

#define SecurityModel_any   SNMP_SECURITY_MODEL_ANY
 

Definition at line 244 of file v3.h.

#define SecurityModel_USM   SNMP_SECURITY_MODEL_USM
 

Definition at line 247 of file v3.h.

#define SecurityModel_v1   SNMP_SECURITY_MODEL_V1
 

Definition at line 245 of file v3.h.

#define SecurityModel_v2   SNMP_SECURITY_MODEL_V2
 

Definition at line 246 of file v3.h.

#define SNMP_SECURITY_MODEL_ANY   0
 

Not used in SNMP++.

Definition at line 56 of file v3.h.

#define SNMP_SECURITY_MODEL_USM   3
 

Can be used for SNMPv3 only.

Definition at line 59 of file v3.h.

#define SNMP_SECURITY_MODEL_V1   1
 

Can be used for SNMPv1 only.

Definition at line 57 of file v3.h.

#define SNMP_SECURITY_MODEL_V2   2
 

Can be used for SNMPv2 only.

Definition at line 58 of file v3.h.

#define SNMPv3_FILE_ERROR   -4
 

The given file contains a wrong line.

Definition at line 156 of file v3.h.

#define SNMPv3_FILECREATE_ERROR   -5
 

The File could not be created.

Definition at line 157 of file v3.h.

#define SNMPv3_FILEOPEN_ERROR   -2
 

Unable to open file.

Definition at line 154 of file v3.h.

#define SNMPv3_FILERENAME_ERROR   -6
 

Error renaming the temporary file.

Definition at line 158 of file v3.h.

#define SNMPv3_NO_ENTRY_ERROR   -1
 

No line for the engine id found.

Definition at line 153 of file v3.h.

#define SNMPv3_OK   0
 

No error.

Definition at line 152 of file v3.h.

#define SNMPv3_TOO_LONG_ERROR   -3
 

The given engineID is too long.

Definition at line 155 of file v3.h.

#define TRUE   1
 

Definition at line 46 of file v3.h.

#define V3MAXMESSAGESIZE   SNMP_MSG_LENGTH
 

Definition at line 129 of file v3.h.


Function Documentation

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:
db_level - New level

DLLOPT void debug_set_logfile const char *  filename  ) 
 

Set the logfile for logging output.

Parameters:
filename - Complete path and name of the logfile.
Note:
The string may not be deleted after the call.

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

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

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.

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

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

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.

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.

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).


Generated on Tue Jan 4 22:42:14 2005 for SNMP++ by doxygen 1.3.2