SNMP++
3.3.11
|
The Object Identifier Class. More...
#include <oid.h>
Public Member Functions | |
Oid () | |
Construct an invalid Oid. More... | |
Oid (const char *oid_string, const bool is_dotted_oid_string=true) | |
Construct an Oid from a string. More... | |
Oid (const Oid &oid) | |
Constructor using another oid object (copy constructor). More... | |
Oid (const unsigned long *raw_oid, int oid_len) | |
Constructor from array. More... | |
virtual | ~Oid () |
Destructor. More... | |
SmiUINT32 | get_syntax () const |
Return the current syntax. More... | |
virtual Oid & | operator= (const char *dotted_oid_string) |
Assignment from a string. More... | |
virtual Oid & | operator= (const Oid &oid) |
Assign one Oid to another. More... | |
int | get_asn1_length () const |
Return the space needed for serialization. More... | |
bool | operator== (const Oid &rhs) const |
Overloaded equal operator. More... | |
bool | operator!= (const Oid &rhs) const |
Overloaded not equal operator. More... | |
bool | operator< (const Oid &rhs) const |
Overloaded less than < operator. More... | |
bool | operator<= (const Oid &rhs) const |
Overloaded less than <= operator. More... | |
bool | operator> (const Oid &rhs) const |
Overloaded greater than > operator. More... | |
bool | operator>= (const Oid &rhs) const |
Overloaded greater than >= operator. More... | |
Oid & | operator+= (const char *a) |
Append operator, appends the dotted oid string. More... | |
Oid & | operator+= (const unsigned long i) |
Appends an int. More... | |
Oid & | operator+= (const Oid &o) |
Appends an Oid. More... | |
unsigned long & | operator[] (const unsigned int index) |
Allows element access as an array. More... | |
unsigned long | operator[] (const unsigned int index) const |
Allows element access as an array for const objects. More... | |
SmiLPOID | oidval () |
Get the WinSnmp oid part. More... | |
void | set_data (const unsigned long *raw_oid, const unsigned int oid_len) |
Set the data from raw form. More... | |
void | set_data (const char *str, const unsigned int str_len) |
Set the data from raw form. More... | |
unsigned long | len () const |
Get the length of the oid. More... | |
void | trim (const unsigned long n=1) |
Trim off the rightmost values of an oid. More... | |
int | nCompare (const unsigned long n, const Oid &o) const |
Compare two Oids from the left in direction left-to-right. More... | |
int | nCompare (const Oid &o) const |
Compare two Oids from the left in direction left-to-right. More... | |
bool | valid () const |
Return validity of the object. More... | |
const char * | get_printable () const |
Get a printable ASCII string of the whole value. More... | |
const char * | get_printable (const unsigned long n) const |
Get a printable ASCII string of the right part of the value. More... | |
const char * | get_printable (const unsigned long start, const unsigned long n, char *&buffer) const |
Get a printable ASCII string of a part of the value. More... | |
const char * | get_printable (const unsigned long start, const unsigned long n) const |
Get a printable ASCII string of a part of the value. More... | |
SnmpSyntax * | clone () const |
Clone this object. More... | |
SnmpSyntax & | operator= (const SnmpSyntax &val) |
Map other SnmpSyntax objects to Oid. More... | |
void | clear () |
Clear the Oid. More... | |
![]() | |
virtual | ~SnmpSyntax () |
Virtual destructor to ensure deletion of derived classes... More... | |
Protected Member Functions | |
virtual int | StrToOid (const char *string, SmiLPOID dstOid) const |
Convert a string to an smi oid. More... | |
virtual int | OidCopy (SmiLPOID srcOid, SmiLPOID dstOid) const |
Clone an smi oid. More... | |
virtual int | OidToStr (const SmiOID *srcOid, SmiUINT32 size, char *string) const |
Convert an smi oid to its string representation. More... | |
void | delete_oid_ptr () |
Free the internal oid pointer and set the pointer and the length to zero. More... | |
![]() | |
SnmpSyntax () | |
Protected Attributes | |
SNMP_PP_MUTABLE char * | iv_str |
SNMP_PP_MUTABLE char * | iv_part_str |
SNMP_PP_MUTABLE bool | m_changed |
![]() | |
SmiVALUE | smival |
Friends | |
DLLOPT friend Oid | operator+ (const Oid &lhs, const Oid &rhs) |
Overloaded operator +, Concatenate two Oids. More... | |
The Object Identifier Class.
The Object Identification (Oid) class is the encapsulation of an SMI object identifier. The SMI object is a data identifier for a data element found in a Management Information Base (MIB), as defined by a MIB definition. The SMI Oid, its related structures and functions, are a natural fit for object orientation. In fact, the Oid class shares many common features to the C++ String class. For those of you familiar with the C++ String class or Microsoft's Foundation Classes (MFC) CString class, the Oid class will be familiar and easy to use. The Oid class is designed to be efficient and fast. The Oid class allows definition and manipulation of object identifiers.
|
inline |
Oid::Oid | ( | const char * | oid_string, |
const bool | is_dotted_oid_string = true |
||
) |
Construct an Oid from a string.
Depending on the second param, the oid_string can either be
oid_string | - for example "1.3.1.6.1.10" |
is_dotted_oid_string | - Select format within oid_string |
|
inline |
Constructor using another oid object (copy constructor).
oid | - Source Oid |
Definition at line 128 of file oid.h.
References sNMP_SYNTAX_OID.
|
inline |
Constructor from array.
raw_oid | - array of oid values |
oid_len | - length of array |
Definition at line 151 of file oid.h.
References sNMP_SYNTAX_OID.
|
inlinevirtual |
|
inlinevirtual |
Clone this object.
Implements SnmpSyntax.
|
inlineprotected |
|
virtual |
Return the space needed for serialization.
Implements SnmpSyntax.
|
inlinevirtual |
Get a printable ASCII string of the whole value.
Implements SnmpSyntax.
|
inline |
const char* Oid::get_printable | ( | const unsigned long | start, |
const unsigned long | n, | ||
char *& | buffer | ||
) | const |
Get a printable ASCII string of a part of the value.
start | - First position to print, starting with 1 (not zero!) |
n | - positions to print. |
buffer | - pointer to the returned buffer |
|
inline |
|
inlinevirtual |
Return the current syntax.
Implements SnmpSyntax.
Definition at line 185 of file oid.h.
References sNMP_SYNTAX_OID.
|
inline |
Get the length of the oid.
Definition at line 387 of file oid.h.
Referenced by Pdu::get_notify_enterprise(), operator<(), operator==(), and Pdu::set_notify_enterprise().
|
inline |
Compare two Oids from the left in direction left-to-right.
n | - Subvalues to compare |
o | - The Oid to compare with |
Definition at line 414 of file oid.h.
References SmiOID::len, SmiVALUE::oid, SmiOID::ptr, SnmpSyntax::smival, and SmiVALUE::value.
|
inline |
Compare two Oids from the left in direction left-to-right.
o | - The Oid to compare with |
Definition at line 463 of file oid.h.
References SmiOID::len, SmiVALUE::oid, SmiOID::ptr, SnmpSyntax::smival, and SmiVALUE::value.
Clone an smi oid.
srcOid | - source oid |
dstOid | - destination oid |
Definition at line 587 of file oid.h.
References SmiOID::len, MEMCPY, and SmiOID::ptr.
|
protectedvirtual |
Convert an smi oid to its string representation.
srcOid | - source oid |
size | - size of string |
string | - pointer to string |
|
inline |
|
inline |
Oid& Oid::operator+= | ( | const char * | a | ) |
Append operator, appends the dotted oid string.
a | - dotted oid string, for example "5.192.14.6" |
|
inline |
Appends an Oid.
o | - Oid to add at the end |
Definition at line 299 of file oid.h.
References SmiOID::len, MEMCPY, SmiVALUE::oid, SmiOID::ptr, SnmpSyntax::smival, and SmiVALUE::value.
|
inline |
|
inline |
|
virtual |
Assignment from a string.
dotted_oid_string | - New value (for example "1.3.6.1.6.0"); |
|
virtual |
Map other SnmpSyntax objects to Oid.
Implements SnmpSyntax.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Oid::set_data | ( | const unsigned long * | raw_oid, |
const unsigned int | oid_len | ||
) |
Set the data from raw form.
raw_oid | - Array of new values |
oid_len | - Length of the array raw_oid |
void Oid::set_data | ( | const char * | str, |
const unsigned int | str_len | ||
) |
Set the data from raw form.
str | - Array of new values (a string) |
str_len | - Length of the array raw_oid |
|
protectedvirtual |
Convert a string to an smi oid.
string | - input string |
dstOid | - destination oid |
|
inline |
|
inlinevirtual |
|
protected |
|
protected |
|
protected |