SNMP++  3.3.4
UTarget Class Reference

User based Target. More...

#include <target.h>

Inheritance diagram for UTarget:
Collaboration diagram for UTarget:

Public Member Functions

 UTarget ()
 Constructor with no args. More...
 
 UTarget (const Address &address, const char *sec_name, const int sec_model)
 Constructor with all args. More...
 
 UTarget (const Address &address, const OctetStr &sec_name, const int sec_model)
 Constructor with all args. More...
 
 UTarget (const Address &address)
 Constructor with only address. More...
 
 UTarget (const UTarget &target)
 Constructor from existing UTarget. More...
 
 ~UTarget ()
 Destructor, that has nothing to do. More...
 
SnmpTargetclone () const
 Clone operator. More...
 
bool set_address (const Address &address)
 Set the address object. More...
 
const OctetStrget_security_name () const
 Get the security name. More...
 
void get_security_name (OctetStr &oct) const
 Get the security name. More...
 
void set_security_name (const char *str)
 Set the security name. More...
 
void set_security_name (const OctetStr &oct)
 Set the security name. More...
 
void set_engine_id (const char *str)
 Set the engine id. More...
 
void set_engine_id (const OctetStr &oct)
 Set the engine id. More...
 
const OctetStrget_engine_id () const
 Get the engine id. More...
 
void get_engine_id (OctetStr &oct) const
 Get the engine id. More...
 
int get_security_model () const
 Get the security_model. More...
 
void set_security_model (int sec_model)
 Set the security_model. More...
 
UTargetoperator= (const UTarget &target)
 Overloaded assignment operator. More...
 
virtual int operator== (const UTarget &rhs) const
 Overloeaded compare operator. More...
 
bool resolve_to_U (OctetStr &sec_name, int &sec_model, GenAddress &address, unsigned long &t, int &r, unsigned char &v) const
 Get all values of a UTarget object. More...
 
void clear ()
 Reset the object. More...
 
- Public Member Functions inherited from SnmpTarget
 SnmpTarget ()
 Create a SnmpTarget object with default values. More...
 
 SnmpTarget (const Address &address)
 Create a SnmpTarget object with the given Address. More...
 
virtual ~SnmpTarget ()
 Destructor that has nothing to do. More...
 
target_type get_type () const
 Return the type of the target object. More...
 
bool valid () const
 Returns the validity of the target object. More...
 
void set_retry (const int r)
 Set the retry value. More...
 
int get_retry () const
 Get the retry value. More...
 
void set_timeout (const unsigned long t)
 Set the timeout for requests. More...
 
unsigned long get_timeout () const
 Get the timeout. More...
 
bool get_address (GenAddress &address) const
 Get the address object. More...
 
const GenAddressget_address () const
 Get the address object. More...
 
snmp_version get_version () const
 Get the SNMP version for this target. More...
 
void set_version (const snmp_version v)
 Set the SNMP version of this target. More...
 
int operator== (const SnmpTarget &rhs) const
 Overloeaded compare operator. More...
 

Protected Attributes

OctetStr security_name
 
int security_model
 
OctetStr engine_id
 
- Protected Attributes inherited from SnmpTarget
bool validity
 Validity of the object. More...
 
unsigned long timeout
 xmit timeout in 10 milli secs More...
 
int retries
 number of retries More...
 
snmp_version version
 SNMP version to use. More...
 
target_type ttype
 Type of the target. More...
 
GenAddress my_address
 Address object. More...
 

Additional Inherited Members

- Public Types inherited from SnmpTarget
enum  target_type { type_base, type_ctarget, type_utarget }
 Enum to identify a target object through SnmpTarget::get_type() method. More...
 
- Static Public Member Functions inherited from SnmpTarget
static void set_default_timeout (const unsigned long t)
 Change the default timeout. More...
 
static void set_default_retries (const int r)
 Change the default retries vlaue. More...
 
- Static Protected Attributes inherited from SnmpTarget
static unsigned long default_timeout
 default timeout for new objects More...
 
static int default_retries
 default retries for new objects More...
 

Detailed Description

User based Target.

This class is used for SNMPv3 targets.

Definition at line 459 of file target.h.

Constructor & Destructor Documentation

UTarget::UTarget ( )

Constructor with no args.

The validity of the target will be false.

UTarget::UTarget ( const Address address,
const char *  sec_name,
const int  sec_model 
)

Constructor with all args.

Parameters
address- Address of the target host (cann be any address object)
sec_name- The security name
sec_model- The security model to use
UTarget::UTarget ( const Address address,
const OctetStr sec_name,
const int  sec_model 
)

Constructor with all args.

Parameters
address- Address of the target host (cann be any address object)
sec_name- The security name
sec_model- The security model to use
UTarget::UTarget ( const Address address)

Constructor with only address.

Assumes the following defaults: security_name: initial, version: SNMPv3, security_model: v3MP.

Parameters
address- Address of the target host (cann be any address object)
UTarget::UTarget ( const UTarget target)

Constructor from existing UTarget.

UTarget::~UTarget ( )
inline

Destructor, that has nothing to do.

Definition at line 508 of file target.h.

Member Function Documentation

void UTarget::clear ( )
virtual

Reset the object.

Reimplemented from SnmpTarget.

SnmpTarget* UTarget::clone ( ) const
inlinevirtual

Clone operator.

Clone operation for creating a new UTarget from an existing UTarget.

Note
The caller MUST use the delete operation on the return value when done.
Returns
A pointer to the new object on success, 0 on failure.

Reimplemented from SnmpTarget.

Definition at line 521 of file target.h.

const OctetStr& UTarget::get_engine_id ( ) const
inline

Get the engine id.

Returns
A const reference to the enigne id of this target.

Definition at line 591 of file target.h.

void UTarget::get_engine_id ( OctetStr oct) const
inline

Get the engine id.

Parameters
oct- OctetStr that will be filled with the engine id

Definition at line 598 of file target.h.

int UTarget::get_security_model ( ) const
inline

Get the security_model.

Returns
An integer representing the security_model of this target.

Definition at line 606 of file target.h.

const OctetStr& UTarget::get_security_name ( ) const
inline

Get the security name.

Returns
A const reference to the security name.

Definition at line 538 of file target.h.

void UTarget::get_security_name ( OctetStr oct) const
inline

Get the security name.

Parameters
oct- OctetStr that will be filled with the security name.

Definition at line 545 of file target.h.

UTarget& UTarget::operator= ( const UTarget target)

Overloaded assignment operator.

virtual int UTarget::operator== ( const UTarget rhs) const
virtual

Overloeaded compare operator.

Two UTarget objects are considered equal, if all member variables (beside the engine id) and the base classes are equal.

Returns
1 if targets are equal, 0 if not.
bool UTarget::resolve_to_U ( OctetStr sec_name,
int &  sec_model,
GenAddress address,
unsigned long &  t,
int &  r,
unsigned char &  v 
) const

Get all values of a UTarget object.

Parameters
sec_name- security name
sec_model- security model
address- Address of the target
t- Timeout value
r- Retries value
v- The SNMP version of this target
Returns
TRUE on success and FALSE on failure.
bool UTarget::set_address ( const Address address)
virtual

Set the address object.

This method is the same as in SnmpTarget, but it deletes engine_id.

Parameters
address- The address that this target should use.
Returns
true on success.

Reimplemented from SnmpTarget.

void UTarget::set_engine_id ( const char *  str)
inline

Set the engine id.

In most cases it is not necessary for the user to set the engine id as snmp++ performs engine id discovery. If the engine id is set by the user, no engine_id discovery is made, even if the engine id set by the user is wrong.

Parameters
str- The engine id to use

Definition at line 572 of file target.h.

void UTarget::set_engine_id ( const OctetStr oct)
inline

Set the engine id.

In most cases it is not necessary for the user to set the engine id as snmp++ performs engine id discovery. If the engine id is set by the user, no engine_id discovery is made, even if the engine id set by the user is wrong.

Parameters
oct- The engine id to use

Definition at line 584 of file target.h.

void UTarget::set_security_model ( int  sec_model)
inline

Set the security_model.

Parameters
sec_model- The security model to use.

Definition at line 613 of file target.h.

void UTarget::set_security_name ( const char *  str)
inline

Set the security name.

Parameters
str- The new security name

Definition at line 552 of file target.h.

void UTarget::set_security_name ( const OctetStr oct)
inline

Set the security name.

Parameters
oct- The new security name

Definition at line 559 of file target.h.

Member Data Documentation

OctetStr UTarget::engine_id
protected

Definition at line 658 of file target.h.

int UTarget::security_model
protected

Definition at line 656 of file target.h.

OctetStr UTarget::security_name
protected

Definition at line 655 of file target.h.


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