SNMP++  3.3.4
CTarget Class Reference

Community based target object. More...

#include <target.h>

Inheritance diagram for CTarget:
Collaboration diagram for CTarget:

Public Member Functions

 CTarget ()
 Constructor with no args. More...
 
 CTarget (const Address &address, const char *read_community_name, const char *write_community_name)
 Constructor with all args. More...
 
 CTarget (const Address &address, const OctetStr &read_community_name, const OctetStr &write_community_name)
 Constructor with all args. More...
 
 CTarget (const Address &address)
 Constructor with only address. More...
 
 CTarget (const CTarget &target)
 Constructor from existing CTarget. More...
 
 ~CTarget ()
 Destructor, that has nothing to do. More...
 
SnmpTargetclone () const
 Clone operator. More...
 
const char * get_readcommunity () const
 Get the read community name. More...
 
void get_readcommunity (OctetStr &oct) const
 Get the read community name. More...
 
void set_readcommunity (const char *str)
 Set the read community name. More...
 
void set_readcommunity (const OctetStr &oct)
 Set the read community name. More...
 
const char * get_writecommunity () const
 Get the write community name. More...
 
void get_writecommunity (OctetStr &oct) const
 Get the write community name. More...
 
void set_writecommunity (const char *str)
 Set the write community name. More...
 
void set_writecommunity (const OctetStr &oct)
 Set the write community name. More...
 
CTargetoperator= (const CTarget &target)
 Overloaded assignment operator. More...
 
int operator== (const CTarget &rhs) const
 Overloeaded compare operator. More...
 
bool resolve_to_C (OctetStr &read_comm, OctetStr &write_comm, GenAddress &address, unsigned long &t, int &r, unsigned char &v) const
 Get all values of a CTarget 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...
 
virtual bool set_address (const Address &address)
 Set 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 read_community
 
OctetStr write_community
 
- 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

Community based target object.

This target can be used for SNMPv1 and SNMPv2c messages.

Definition at line 279 of file target.h.

Constructor & Destructor Documentation

CTarget::CTarget ( )

Constructor with no args.

The validity of the target will be false.

CTarget::CTarget ( const Address address,
const char *  read_community_name,
const char *  write_community_name 
)

Constructor with all args.

Parameters
address- Address of the target host (cann be any address object)
read_community_name- Community for get requests
write_community_name- Community for set requests
CTarget::CTarget ( const Address address,
const OctetStr read_community_name,
const OctetStr write_community_name 
)

Constructor with all args.

Parameters
address- Address of the target host (cann be any address object)
read_community_name- Community for get requests
write_community_name- Community for set requests
CTarget::CTarget ( const Address address)

Constructor with only address.

The read and write community names will be set to "public".

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

Constructor from existing CTarget.

CTarget::~CTarget ( )
inline

Destructor, that has nothing to do.

Definition at line 327 of file target.h.

Member Function Documentation

void CTarget::clear ( )
virtual

Reset the object.

Reimplemented from SnmpTarget.

SnmpTarget* CTarget::clone ( ) const
inlinevirtual

Clone operator.

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

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 340 of file target.h.

const char* CTarget::get_readcommunity ( ) const
inline

Get the read community name.

Returns
C string of the read community.

Definition at line 347 of file target.h.

void CTarget::get_readcommunity ( OctetStr oct) const
inline

Get the read community name.

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

Definition at line 355 of file target.h.

const char* CTarget::get_writecommunity ( ) const
inline

Get the write community name.

Returns
C string of the write community.

Definition at line 376 of file target.h.

void CTarget::get_writecommunity ( OctetStr oct) const
inline

Get the write community name.

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

Definition at line 384 of file target.h.

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

Overloaded assignment operator.

int CTarget::operator== ( const CTarget rhs) const

Overloeaded compare operator.

Two CTarget objects are considered equal, if all member variables and the base classes are equal.

Returns
1 if targets are equal, 0 if not.
bool CTarget::resolve_to_C ( OctetStr read_comm,
OctetStr write_comm,
GenAddress address,
unsigned long &  t,
int &  r,
unsigned char &  v 
) const

Get all values of a CTarget object.

Parameters
read_comm- Read community name
write_comm- Write community name
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.
void CTarget::set_readcommunity ( const char *  str)
inline

Set the read community name.

Parameters
str- The new read community name

Definition at line 362 of file target.h.

void CTarget::set_readcommunity ( const OctetStr oct)
inline

Set the read community name.

Parameters
oct- The new read community name

Definition at line 369 of file target.h.

void CTarget::set_writecommunity ( const char *  str)
inline

Set the write community name.

Parameters
str- The new write community name

Definition at line 391 of file target.h.

void CTarget::set_writecommunity ( const OctetStr oct)
inline

Set the write community name.

Parameters
oct- The new write community name

Definition at line 398 of file target.h.

Member Data Documentation

OctetStr CTarget::read_community
protected

Definition at line 440 of file target.h.

OctetStr CTarget::write_community
protected

Definition at line 441 of file target.h.


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