AGENT++  4.0.3
Public Member Functions | Static Public Member Functions | List of all members
Oidx Class Reference

The Oidx class is a sub class of Oid that provides additional methods for manipulating OID values. More...

#include <snmp_pp_ext.h>

Inheritance diagram for Oidx:

Public Member Functions

 Oidx ()
 Construct an empty Object Identifier.
 
 Oidx (const char *s)
 Construct an Object Identifier from a string.
 
 Oidx (const unsigned long *data, int length)
 Construct an Object Identifier from a long array.
 
 Oidx (const Oid &oid)
 Copy constructor.
 
virtual ~Oidx ()
 Destructor.
 
Oidx cut_left (const unsigned int index) const
 Return a copy of the receiver oid without the n leftmost subidentifiers.
 
Oidx cut_right (const unsigned int index) const
 Return a copy of the receiver oid without the n rightmost subidentifiers.
 
Oidxmask (const NS_SNMP OctetStr &mask)
 Mask the receiver, i.e.
 
unsigned long last () const
 Return the last subidentifier of the receiver.
 
virtual Oidxoperator= (unsigned long l)
 
Oidxoperator+= (NS_SNMP IpAddress const &ip)
 
bool in_subtree_of (const Oidx &o) const
 Check if the receiver is in the subtree of a given oid.
 
bool is_root_of (const Oidx &o) const
 Check if the receiver is root of a given oid.
 
int compare (const Oidx &, const NS_SNMP OctetStr &) const
 Compare the receiver with another object identifier using a mask which defines to subidentifiers to be compared.
 
int compare (const Oidx &, u_int) const
 Compare the receiver with another object identifier using a wildcard at the given subidentifier.
 
NS_SNMP OctetStr as_string (bool withoutLength=false) const
 Return the receiver as an OctetStr.
 
Oidx successor () const
 Return the immediate lexicographic successor of the receiver.
 
Oidx predecessor () const
 Return the immediate lexicographic predecessor of the receiver.
 
Oidx next_peer () const
 Return the next peer of the receiver.
 

Static Public Member Functions

static Oidx cut_left (const Oidx &oid, const unsigned int index)
 Return a copy of the given oid without the n leftmost subidentifiers.
 
static Oidx cut_right (const Oidx &oid, const unsigned int index)
 Return a copy of the given oid without the n rightmost subidentifiers.
 
static Oidx from_string (const NS_SNMP OctetStr &str, bool withLength=TRUE)
 Return an object identifier from a string.
 

Detailed Description

The Oidx class is a sub class of Oid that provides additional methods for manipulating OID values.

AGENT++ uses Oidx instead of Oid.

Version
3.4
Author
Frank Fock

Constructor & Destructor Documentation

Oidx::Oidx ( )
inline

Construct an empty Object Identifier.

Oidx::Oidx ( const char *  s)
inline

Construct an Object Identifier from a string.

Parameters
s- A oid string (e.g., ".x.y.z" or "x.y.z")
Oidx::Oidx ( const unsigned long *  data,
int  length 
)
inline

Construct an Object Identifier from a long array.

Parameters
data- An array of long values.
length- The length of the array.
Oidx::Oidx ( const Oid &  oid)
inline

Copy constructor.

Parameters
oid- Another object identifier.
virtual Oidx::~Oidx ( )
inlinevirtual

Destructor.

Member Function Documentation

NS_SNMP OctetStr Oidx::as_string ( bool  withoutLength = false) const
inline

Return the receiver as an OctetStr.

Every subidentifier is interpreted as one char. Thus, all subidentifiers must be between 0 and 255.

Parameters
withoutLengthif TRUE there will be no preceeding subid containing the length of the string
Returns
An OctetStr.
int Oidx::compare ( const Oidx ,
const NS_SNMP OctetStr &   
) const

Compare the receiver with another object identifier using a mask which defines to subidentifiers to be compared.

The mask is used like defined in RFC2273 for the snmpNotifyFilterMask.

Parameters
otheranother object identifier to compare the receiver with.
maskan octet string containing a mask.
Returns
0 if both (masked) object identifiers are equal, return 1 if the given object identifier is in the subtree of the receiver, and return -1 otherwise.
int Oidx::compare ( const Oidx ,
u_int   
) const

Compare the receiver with another object identifier using a wildcard at the given subidentifier.

Parameters
otheranother object identifier to compare the receiver with.
wildcard_subidthe subidentifier position (>=0) that is not compared
Returns
0 if both (masked) object identifiers are equal, return 1 if the given object identifier is in the subtree of the receiver, and return -1 otherwise.
Oidx Oidx::cut_left ( const unsigned int  index) const
inline

Return a copy of the receiver oid without the n leftmost subidentifiers.

Parameters
n- The number of subidentifiers to cut of from left side.
Returns
An Oidx object identifier.
static Oidx Oidx::cut_left ( const Oidx oid,
const unsigned int  index 
)
inlinestatic

Return a copy of the given oid without the n leftmost subidentifiers.

Parameters
o- An Oidx object identifier.
n- The number of subidentifiers to cut of from left side.
Returns
An Oidx object identifier.
Oidx Oidx::cut_right ( const unsigned int  index) const
inline

Return a copy of the receiver oid without the n rightmost subidentifiers.

Parameters
n- The number of subidentifiers to cut of from right side.
Returns
An Oidx object identifier.
static Oidx Oidx::cut_right ( const Oidx oid,
const unsigned int  index 
)
inlinestatic

Return a copy of the given oid without the n rightmost subidentifiers.

Parameters
o- An Oidx object identifier.
n- The number of subidentifiers to cut of from right side.
Returns
An Oidx object identifier.
static Oidx Oidx::from_string ( const NS_SNMP OctetStr &  str,
bool  withLength = TRUE 
)
inlinestatic

Return an object identifier from a string.

The first subidentifier will contain the length of the string, each following subidentifier represents one character.

Parameters
withExplicitLengthif FALSE there will be no preceeding subid containing the length of the string will be generated.
Returns
An Oidx.
bool Oidx::in_subtree_of ( const Oidx o) const
inline

Check if the receiver is in the subtree of a given oid.

Parameters
o- An Oidx object identifier.
Returns
TRUE if the receiver is in the subtree of o, FALSE otherwise.
bool Oidx::is_root_of ( const Oidx o) const
inline

Check if the receiver is root of a given oid.

Parameters
o- An Oidx object identifier.
Returns
TRUE if the receiver is root of o, FALSE otherwise.
unsigned long Oidx::last ( ) const
inline

Return the last subidentifier of the receiver.

Returns
A subidentifier or 0 if it does not exist.
Oidx& Oidx::mask ( const NS_SNMP OctetStr &  mask)
inline

Mask the receiver, i.e.

zero those sub-identifiers for which a bit in the mask is set. Each bit of the bit mask corresponds to a sub-identifier, with to most significant bit of the i-th octet of the octet string value corresponding to the (8*i - 7)-th sub-identifier, and the least significant bit of the i-th octet corresponding to the (8*i)-th sub-identifier.

Parameters
maskan octet string.
Returns
a reference to the receiver.
Oidx Oidx::next_peer ( ) const
inline

Return the next peer of the receiver.

Thus, add one to the last sub-identifier. Note: If the receiver's last sub-identifier is 0xFFFFFFFFul the returned object ID may not be valid.

Returns
an Oidx instance.
Oidx& Oidx::operator+= ( NS_SNMP IpAddress const &  ip)
inline
virtual Oidx& Oidx::operator= ( unsigned long  l)
inlinevirtual
Oidx Oidx::predecessor ( ) const
inline

Return the immediate lexicographic predecessor of the receiver.

Returns
an Oidx instance immediate preceding the receiver.
Oidx Oidx::successor ( ) const
inline

Return the immediate lexicographic successor of the receiver.

Returns
an Oidx instance (receiver.0)

The documentation for this class was generated from the following file: