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

The class snmpEngineID implements the textual convention SnmpEngineID. More...

#include <snmp_textual_conventions.h>

Inheritance diagram for SnmpEngineID:
MibLeaf MibEntry ThreadManager Synchronized

Public Member Functions

 SnmpEngineID (const Oidx &, mib_access, NS_SNMP OctetStr *)
 Construct a SnmpEngineID with initial value.
 
 SnmpEngineID (const Oidx &, mib_access, NS_SNMP OctetStr *, int)
 Construct a SnmpEngineID with initial value.
 
virtual ~SnmpEngineID ()
 Destructor.
 
virtual MibEntryPtr clone ()
 Clone the receiver object.
 
virtual int prepare_set_request (Request *, int &)
 Let the receiver prepare a SNMP SET subrequest.
 
- Public Member Functions inherited from MibLeaf
 MibLeaf ()
 Default constructor.
 
 MibLeaf (const Oidx &, mib_access, NS_SNMP SmiUINT32)
 Construct a MibLeaf object.
 
 MibLeaf (const Oidx &, mib_access, NS_SNMP SnmpSyntax *)
 Construct a MibLeaf object.
 
 MibLeaf (const Oidx &, mib_access, NS_SNMP SnmpSyntax *, int)
 Construct a MibLeaf object.
 
 MibLeaf (const MibLeaf &)
 Copy Constructor.
 
virtual ~MibLeaf ()
 Destructor.
 
virtual void init (NS_SNMP SnmpSyntax *, int)
 Initialize a MibLeaf object.
 
virtual mib_type type () const
 Return the type of the receiver.
 
virtual bool serialize (char *&, int &)
 Serialize the value of the receiver.
 
virtual bool deserialize (char *, int &)
 Read the value of the receiver from a byte stream.
 
virtual NS_SNMP SmiUINT32 get_syntax () const
 Get the syntax of the receiver's value.
 
virtual Vbx get_value () const
 Get the value of the receiver.
 
virtual int get_value (NS_SNMP SnmpSyntax &s) const
 Get the value of the receiver.
 
virtual int get_value (int &i) const
 Get the value of the receiver.
 
virtual int get_value (long &i) const
 Get the value of the receiver.
 
virtual int get_value (unsigned long &i) const
 Get the value of the receiver.
 
virtual int get_value (char *c) const
 Get the value of the receiver.
 
virtual void set_value (const NS_SNMP SnmpSyntax &)
 Set the value of the receiver by value.
 
virtual void set_value (const unsigned long)
 Set the unsigned integer value of the receiver.
 
virtual int set_value (const Vbx &)
 Set the value of the receiver from a variable binding and checks for validity of the variable binding and compatible syntax and oid.
 
virtual void replace_value (NS_SNMP SnmpSyntax *s)
 Set the value of the receiver by reference.
 
virtual OidxPtr max_key ()
 Return the immediate successor of the greatest object identifier within the receiver's scope.
 
virtual void get_request (Request *, int)
 Interface methods dispatch table <-> instrumentation.
 
virtual void get_next_request (Request *, int)
 Let the receiver process a SNMP GETNEXT subrequest.
 
virtual int commit_set_request (Request *, int)
 Let the receiver commit a SNMP SET subrequest.
 
virtual int undo_set_request (Request *, int &)
 Let the receiver undo a SNMP SET subrequest.
 
virtual void cleanup_set_request (Request *, int &)
 Clean up resources used for performing (or undoing) set requests.
 
virtual bool value_ok (const Vbx &)
 Check whether the receiver's value may be set to the given new value.
 
virtual int set (const Vbx &vb)
 Set the receiver's value and backup its old value for a later undo.
 
virtual int unset ()
 Undo a previous set.
 
MibTableget_reference_to_table ()
 Return a pointer to the table the receiver belongs to.
 
MibTableRowget_reference_to_row ()
 Return a pointer to the row the receiver belongs to.
 
int valid ()
 Gets the flags (bits) that determine the type/stage of validity of the leaf's value.
 
bool has_default ()
 Return whether the receiver has a default value.
 
bool is_locked ()
 Return whether the receiver has a default value.
 
void set_reference_to_table (MibTable *t)
 Set the receiver's reference to its table.
 
void set_reference_to_row (MibTableRow *r)
 Set the receiver's reference to its row.
 
void set_access (mib_access a)
 Set the maximum access rights of the receiver.
 
Oidx get_oid () const
 Get the instance OID of the MibLeaf object.
 
- Public Member Functions inherited from MibEntry
 MibEntry ()
 Default constructor.
 
 MibEntry (const Oidx &, mib_access)
 Construct a MibEntry instance with a given object identifier and maximum access rights.
 
 MibEntry (const MibEntry &)
 Copy constructor.
 
virtual ~MibEntry ()
 Destructor.
 
virtual Oidx find_succ (const Oidx &, Request *req=0)
 Return the successor of a given object identifier within the receiver's scope and the context of a given Request.
 
virtual void load_from_file (const char *)
 Load the value(s) of the receiver node from a file.
 
virtual void save_to_file (const char *)
 Save the value(s) of the receiver node to a file.
 
virtual bool is_empty ()
 Check whether the receiver node contains any instance of a managed object.
 
virtual void notify_change (const Oidx &, mib_change)
 Notify all registered nodes of changes to an object managed by the receiver node.
 
virtual void register_for_notifications (MibEntry *)
 Register an MibEntry object to receive notifications about changes of the receiver node.
 
virtual void add_change_notification (MibEntry *e)
 Wrapper function for register_for_notifications.
 
virtual void change_notification (const Oidx &, mib_change)
 Receive a notification about changes to a managed object.
 
OidxPtr key ()
 Return a pointer to the key (object identifier) of the receiver.
 
virtual mib_access get_access ()
 Return the maximum access rights for the managed object represented by the receiver node.
 
virtual bool is_volatile ()
 Check whether the entry is volatile or not.
 
virtual void reset ()
 Resets (clears) the content of this entry.
 
int operator< (const MibEntry &) const
 
int operator> (const MibEntry &) const
 
int operator== (const MibEntry &) const
 
int operator< (const Oidx &) const
 
int operator> (const Oidx &) const
 
int operator<= (const Oidx &) const
 
int operator>= (const Oidx &) const
 
int operator== (const Oidx &) const
 
- Public Member Functions inherited from ThreadManager
 ThreadManager ()
 Default constructor.
 
virtual ~ThreadManager ()
 Destructor.
 
void start_synch ()
 Start synchronized execution.
 
void end_synch ()
 End synchronized execution.
 
- Public Member Functions inherited from Synchronized
 Synchronized ()
 
 ~Synchronized ()
 
void wait ()
 Causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.
 
bool wait (unsigned long timeout)
 Causes current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed.
 
void notify ()
 Wakes up a single thread that is waiting on this object's monitor.
 
void notify_all ()
 Wakes up all threads that are waiting on this object's monitor.
 
bool lock ()
 Enter a critical section.
 
TryLockResult trylock ()
 Try to enter a critical section.
 
bool unlock ()
 Leave a critical section.
 

Static Public Member Functions

static NS_SNMP OctetStr create_engine_id (const NS_SNMP OctetStr &userText)
 Create a default SnmpEngineID of the form <AGENT++ enterpriseID>+<userText>
 
static NS_SNMP OctetStr create_engine_id (unsigned short port)
 Create a default SnmpEngineID of the form <AGENT++ enterpriseID>+<hostname>+<port>
 

Additional Inherited Members

- Public Types inherited from Synchronized
enum  TryLockResult { LOCKED = 1, BUSY = 0, OWNED = -1 }
 
- Protected Member Functions inherited from MibLeaf
int get_value_mode ()
 Return the value handle mode.
 
void set_validity (int flags)
 Sets the flags (bits) that determine the type/stage of validity of the leaf's value.
 
void set_syntax (NS_SNMP SmiUINT32)
 Set the syntax of the receiver's value and delete the old value.
 
void free_value ()
 Frees the receiver's value and sets it to NULL.
 
- Protected Attributes inherited from MibLeaf
NS_SNMP SnmpSyntax * value
 
NS_SNMP SnmpSyntax * undo
 
int value_mode
 
int validity
 Set of flags (bits) that determine the type/stage of validity of the leaf's value.
 
MibTablemy_table
 
MibTableRowmy_row
 

Detailed Description

The class snmpEngineID implements the textual convention SnmpEngineID.

Description from SNMP-FRAMEWORK-MIB:

An SNMP engine's administratively-unique identifier. Objects of this type are for identification, not for addressing, even though it is possible that an address may have been used in the generation of a specific value.

The value for this object may not be all zeros or all 'ff'H or the empty (zero length) string.

The initial value for this object may be configured via an operator console entry or via an algorithmic function. In the latter case, the following example algorithm is recommended.

In cases where there are multiple engines on the same system, the use of this algorithm is NOT appropriate, as it would result in all of those engines ending up with the same ID value.

1) The very first bit is used to indicate how the rest of the data is composed.

0 - as defined by enterprise using former methods that existed before SNMPv3. See item 2 below.

1 - as defined by this architecture, see item 3 below.

Note that this allows existing uses of the engineID (also known as AgentID [RFC1910]) to co-exist with any new uses.

2) The snmpEngineID has a length of 12 octets.

The first four octets are set to the binary equivalent of the agent's SNMP management private enterprise number as assigned by the Internet Assigned Numbers Authority (IANA). For example, if Acme Networks has been assigned { enterprises 696 }, the first four octets would be assigned '000002b8'H.

The remaining eight octets are determined via one or more enterprise-specific methods. Such methods must be designed so as to maximize the possibility that the value of this object will be unique in the agent's administrative domain. For example, it may be the IP address of the SNMP entity, or the MAC address of one of the interfaces, with each address suitably padded with random octets. If multiple methods are defined, then it is recommended that the first octet indicate the method being used and the remaining octets be a function of the method.

3) The length of the octet strings varies.

The first four octets are set to the binary equivalent of the agent's SNMP management private enterprise number as assigned by the Internet Assigned Numbers Authority (IANA). For example, if Acme Networks has been assigned { enterprises 696 }, the first four octets would be assigned '000002b8'H.

The very first bit is set to 1. For example, the above value for Acme Networks now changes to be '800002b8'H.

The fifth octet indicates how the rest (6th and following octets) are formatted. The values for the fifth octet are:

0 - reserved, unused.

1 - IPv4 address (4 octets) lowest non-special IP address

2 - IPv6 address (16 octets) lowest non-special IP address

3 - MAC address (6 octets) lowest IEEE MAC address, canonical order

4 - Text, administratively assigned Maximum remaining length 27

5 - Octets, administratively assigned Maximum remaining length 27

6-127 - reserved, unused

127-255 - as defined by the enterprise Maximum remaining length 27

Author
Frank Fock
Version
3.3

Constructor & Destructor Documentation

SnmpEngineID::SnmpEngineID ( const Oidx ,
mib_access  ,
NS_SNMP OctetStr *   
)

Construct a SnmpEngineID with initial value.

Parameters
oidthe oid of the leaf or the column of the columnar object.
accessthe max-access rights for the object.
octetstra pointer to an OctetStr containing the initial value for the object.
SnmpEngineID::SnmpEngineID ( const Oidx ,
mib_access  ,
NS_SNMP OctetStr *  ,
int   
)

Construct a SnmpEngineID with initial value.

Parameters
oidthe oid of the leaf or the column of the columnar object.
accessthe max-access rights for the object.
octetstra pointer to an OctetStr containing the initial value for the object.
valueModecontains an ored value of one or more of the following modes: VMODE_DEFAULT: the value of the object pointed by value will be used as default value, otherwise the managed object has no default value. VMODE_LOCKED: value is locked (cannot be modified) while the row status of the receiver's row is active(1). This mode has no effect, if the the leaf is a scalar or otherwise if the receiver's row has no snmpRowStatus.
virtual SnmpEngineID::~SnmpEngineID ( )
virtual

Destructor.

Member Function Documentation

virtual MibEntryPtr SnmpEngineID::clone ( )
virtual

Clone the receiver object.

Returns
A pointer to the clone.

Reimplemented from MibLeaf.

static NS_SNMP OctetStr SnmpEngineID::create_engine_id ( const NS_SNMP OctetStr &  userText)
static

Create a default SnmpEngineID of the form <AGENT++ enterpriseID>+<userText>

Parameters
userTextan OcetStr
Returns
a SnmpEngineID OctetStr.
static NS_SNMP OctetStr SnmpEngineID::create_engine_id ( unsigned short  port)
static

Create a default SnmpEngineID of the form <AGENT++ enterpriseID>+<hostname>+<port>

Parameters
portthe UDP port the SNMP engine listens on.
Returns
a SnmpEngineID OctetStr.
virtual int SnmpEngineID::prepare_set_request ( Request ,
int &   
)
virtual

Let the receiver prepare a SNMP SET subrequest.

Parameters
req- A pointer to the whole SNMP SET request.
ind- The index of the subrequest to be processed.
Returns
SNMP_ERROR_SUCCESS on success and SNMP_ERROR_WRONG_VALUE, SNMP_ERROR_WRONG_TYPE, or SNMP_ERROR_NOT_WRITEABLE on failure.

Reimplemented from MibLeaf.


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