56 #ifndef _SNMP_TARGET_H_ 57 #define _SNMP_TARGET_H_ 67 #ifdef SNMP_PP_NAMESPACE 112 : validity(false), timeout(default_timeout), retries(default_retries),
113 version(
version1), ttype(type_base) {};
119 : validity(false), timeout(default_timeout), retries(default_retries),
120 version(
version1), ttype(type_base), my_address(address)
121 {
if (my_address.valid()) validity =
true; };
143 bool valid()
const {
return validity;};
185 { default_timeout = t; };
231 virtual bool set_address(
const Address &address);
261 virtual void clear();
268 static const char* version_to_string(
const snmp_version version);
304 const char *read_community_name,
305 const char *write_community_name);
315 const OctetStr &read_community_name,
316 const OctetStr &write_community_name);
356 {
return (
const char *) read_community.get_printable(); };
385 {
return (
const char *) write_community.get_printable(); };
421 int operator==(
const CTarget &rhs)
const;
435 bool resolve_to_C(
OctetStr& read_comm,
440 unsigned char &v)
const;
456 #define INITIAL_USER "initial" 458 #define INITIAL_USER "public" 484 const char *sec_name,
485 const int sec_model);
496 const int sec_model);
518 if (coexistence_security_name) {
519 delete coexistence_security_name;
545 bool set_address(
const Address &address);
622 if (coexistence_security_name) {
623 delete coexistence_security_name;
625 coexistence_security_name =
new OctetStr(security_name);
635 if (coexistence_security_name) {
636 security_name = *coexistence_security_name;
637 delete coexistence_security_name;
638 coexistence_security_name =
nullptr;
671 virtual int operator==(
const UTarget &rhs)
const;
685 bool resolve_to_U(
OctetStr& sec_name,
690 unsigned char &v)
const;
706 #ifdef SNMP_PP_NAMESPACE 710 #endif // _SNMP_TARGET_H_
int retries
number of retries
GenAddress my_address
Address object.
void set_engine_id(const char *str)
Set the engine id.
bool valid() const
Returns the validity of the target object.
void get_readcommunity(OctetStr &oct) const
Get the read community name.
target_type ttype
Type of the target.
SnmpTarget(const Address &address)
Create a SnmpTarget object with the given Address.
target_type
Enum to identify a target object through SnmpTarget::get_type() method.
SnmpTarget * clone() const
Clone operator.
unsigned long get_timeout() const
Get the timeout.
void set_writecommunity(const OctetStr &oct)
Set the write community name.
void set_security_name(const char *str)
Set the security name.
void set_version(const snmp_version v)
Set the SNMP version of this target.
bool validity
Validity of the object.
static void set_default_retries(const int r)
Change the default retries vlaue.
void set_timeout(const unsigned long t)
Set the timeout for requests.
void set_coexistence_security_name(const OctetStr &oct)
Set the security name and store the previously set security name as coexistence_security_name that ca...
void set_engine_id(const OctetStr &oct)
Set the engine id.
const char * get_writecommunity() const
Get the write community name.
SnmpTarget()
Create a SnmpTarget object with default values.
Community based target object.
const OctetStr & get_security_name() const
Get the security name.
static int default_retries
default retries for new objects
void get_security_name(OctetStr &oct) const
Get the security name.
static unsigned long default_timeout
default timeout for new objects
It is a SnmpTarget object.
void set_security_name(const OctetStr &oct)
Set the security name.
snmp_version get_version() const
Get the SNMP version for this target.
Base class of all Address classes.
~UTarget()
Destructor, that deletes coexistence security name if present.
void set_readcommunity(const char *str)
Set the read community name.
void set_retry(const int r)
Set the retry value.
snmp_version
The SNMP version to use is passed with this enum.
snmp_version version
SNMP version to use.
int get_retry() const
Get the retry value.
~CTarget()
Destructor, that has nothing to do.
void set_writecommunity(const char *str)
Set the write community name.
target_type get_type() const
Return the type of the target object.
virtual ~SnmpTarget()
Destructor that has nothing to do.
void set_security_model(int sec_model)
Set the security_model.
unsigned long timeout
xmit timeout in 10 milli secs
void get_engine_id(OctetStr &oct) const
Get the engine id.
void unset_coexistence_security_name()
Set the security_name to the previously saved coexistence_security_name (if present) and delete that ...
int get_security_model() const
Get the security_model.
OctetStr * coexistence_security_name
void set_readcommunity(const OctetStr &oct)
Set the read community name.
const OctetStr & get_engine_id() const
Get the engine id.
const GenAddress & get_address() const
Get the address object.
SnmpCollection< SnmpTarget > TargetCollection
const char * get_readcommunity() const
Get the read community name.
Abstract class used to provide a virtual interface into Targets.
static void set_default_timeout(const unsigned long t)
Change the default timeout.
SnmpTarget * clone() const
Clone operator.
void get_writecommunity(OctetStr &oct) const
Get the write community name.