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>

List of all members.

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) const
 Return a copy of the receiver oid without the n leftmost subidentifiers.
Oidx cut_right (const unsigned int) const
 Return a copy of the receiver oid without the n rightmost subidentifiers.
Oidxmask (const NS_SNMP OctetStr &)
 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 &)
Oidxoperator+= (const char *)
Oidxoperator+= (const unsigned long i)
Oidxoperator+= (const Oid &)
int in_subtree_of (const Oidx &o) const
 Check if the receiver is in the subtree of a given oid.
int 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 () 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 &, const unsigned int)
 Return a copy of the given oid without the n leftmost subidentifiers.
static Oidx cut_right (const Oidx &, const unsigned int)
 Return a copy of the given oid without the n rightmost subidentifiers.
static Oidx from_string (const NS_SNMP OctetStr &, boolean 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 (  )  [inline, virtual]

Destructor.


Member Function Documentation

Oidx Oidx::cut_left ( const unsigned  int  )  const

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.

Oidx Oidx::cut_right ( const unsigned  int  )  const

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.

Oidx& Oidx::mask ( const NS_SNMP OctetStr &   ) 

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:
mask an octet string.
Returns:
a reference to the receiver.

static Oidx Oidx::cut_left ( const Oidx ,
const unsigned  int 
) [static]

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.

static Oidx Oidx::cut_right ( const Oidx ,
const unsigned  int 
) [static]

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.

unsigned long Oidx::last (  )  const

Return the last subidentifier of the receiver.

Returns:
A subidentifier.

virtual Oidx& Oidx::operator= ( unsigned long  l  )  [virtual]

Oidx& Oidx::operator+= ( NS_SNMP IpAddress &   ) 

Oidx& Oidx::operator+= ( const char *   ) 

Oidx& Oidx::operator+= ( const unsigned long  i  ) 

Oidx& Oidx::operator+= ( const Oid &   ) 

int Oidx::in_subtree_of ( const Oidx o  )  const

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.

int Oidx::is_root_of ( const Oidx o  )  const

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.

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:
other another object identifier to compare the receiver with.
mask an 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:
other another object identifier to compare the receiver with.
wildcard_subid the 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.

NS_SNMP OctetStr Oidx::as_string (  )  const

Return the receiver as an OctetStr.

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

Returns:
An OctetStr.

static Oidx Oidx::from_string ( const NS_SNMP OctetStr &  ,
boolean  withLength = TRUE 
) [static]

Return an object identifier from a string.

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

Parameters:
withExplicitLength if FALSE there will be no preceeding subid containing the length of the string will be generated.
Returns:
An Oidx.

Oidx Oidx::successor (  )  const

Return the immediate lexicographic successor of the receiver.

Returns:
an Oidx instance (receiver.0)

Oidx Oidx::predecessor (  )  const

Return the immediate lexicographic predecessor of the receiver.

Returns:
an Oidx instance immediate preceding the receiver.

Oidx Oidx::next_peer (  )  const

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.


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

Generated on Fri May 29 22:36:55 2009 for AGENT++ by  doxygen 1.5.6