SNMP++
3.3.11
|
#include <pdu.h>
Public Member Functions | |
Pdu () | |
Constructor no args. More... | |
Pdu (Vb *pvbs, const int pvb_count) | |
Constructor with vbs. More... | |
Pdu (const Pdu &pdu) | |
Constructor with another Pdu instance. More... | |
virtual | ~Pdu () |
Destructor. More... | |
Pdu & | operator= (const Pdu &pdu) |
Overloaded assignment operator. More... | |
Pdu & | operator+= (const Vb &vb) |
Append a vb to the pdu. More... | |
Pdu * | clone () const |
Clone a Pdu object. More... | |
int | get_vblist (Vb *pvbs, const int pvb_count) const |
Get Pointers to all Vbs from Pdu. More... | |
int | set_vblist (Vb const *pvbs, const int pvb_count) |
Deposit all Vbs to Pdu. More... | |
int | get_vb (Vb &vb, const int index) const |
Get a particular Vb. More... | |
const Vb & | get_vb (const int index) const |
Return a reference to a particular Vb. More... | |
int | set_vb (Vb const &vb, const int index) |
Set a particular vb. More... | |
int | get_vb_count () const |
Get the number of vbs. More... | |
Vb & | operator[] (const int i) |
Get a Vb. More... | |
int | get_error_status () const |
Get the error status. More... | |
void | set_error_status (const int err) |
Set the error status. More... | |
void | clear_error_status () |
Clear the error status. More... | |
int | get_error_index () const |
Get the error index. More... | |
void | set_error_index (const int index) |
Set the error index. More... | |
void | clear_error_index () |
Clear the error index. More... | |
void | clear_error () |
Clear error status and error index. More... | |
unsigned long | get_request_id () const |
Get the request id. More... | |
void | set_request_id (const unsigned long rid) |
Set the request id. More... | |
unsigned short | get_type () const |
Get the pdu type. More... | |
void | set_type (unsigned short type) |
Set the pdu type. More... | |
bool | valid () const |
Returns validity of Pdu instance. More... | |
int | trim (const int count=1) |
Trim off vbs. More... | |
int | delete_vb (const int position) |
Delete a Vb anywhere within the Pdu. More... | |
void | set_notify_timestamp (const TimeTicks &ts) |
Set notify timestamp. More... | |
void | get_notify_timestamp (TimeTicks &ts) const |
Get notify timestamp. More... | |
bool | set_notify_id (const Oid &id) |
Set the notify id. More... | |
bool | get_notify_id (Oid &id) const |
Get the notify id. More... | |
bool | set_notify_enterprise (const Oid &e) |
Set the notify enterprise. More... | |
bool | get_notify_enterprise (Oid &e) const |
Get the notify enterprise. More... | |
void | set_security_level (const int level) |
Set the security level that should be used when this Pdu is sent. More... | |
int | get_security_level () const |
Return the security level of the Pdu. More... | |
bool | set_context_name (const OctetStr &name) |
Set the context name of the Pdu. More... | |
bool | set_context_name (const char *name) |
Set the context name of the Pdu. More... | |
bool | get_context_name (OctetStr &name) const |
Get the context name of the Pdu. More... | |
const OctetStr & | get_context_name () const |
Get the context name of the Pdu. More... | |
bool | set_context_engine_id (const OctetStr &id) |
Set the context engine id of the Pdu. More... | |
bool | set_context_engine_id (const char *id) |
Set the context engine id of the Pdu. More... | |
bool | get_context_engine_id (OctetStr &id) const |
Get the context engine id of the Pdu. More... | |
const OctetStr & | get_context_engine_id () const |
Get the context engine id of the Pdu. More... | |
void | set_message_id (const unsigned long msg_id) |
Set the SNMPv3 message id (msgID) More... | |
unsigned long | get_message_id () const |
Get the SNMPv3 message id (msgID) More... | |
void | set_maxsize_scopedpdu (unsigned long l) |
Set the maximum size of the scoped pdu to be included in a possible response message. More... | |
unsigned long | get_maxsize_scopedpdu () const |
Get the maximum size of the scoped pdu to be included in a possible response message. More... | |
int | get_v1_trap_address (GenAddress &address) const |
Get the SNMPv1 trap address. More... | |
int | set_v1_trap_address (const Address &address) |
Set the SNMPv1 trap address. More... | |
int | get_asn1_length () const |
Return the length of the encoded vbs with pdu header. More... | |
void | clear () |
Clear the Pdu contents (destruct and construct in one go) More... | |
Static Public Member Functions | |
static bool | match_type (const int request, const int response) |
Does the type of response match the type of request. More... | |
Protected Member Functions | |
bool | extend_vbs () |
Extend the vbs array. More... | |
Protected Attributes | |
Vb ** | vbs |
int | vbs_size |
int | vb_count |
int | error_status |
int | error_index |
bool | validity |
unsigned long | request_id |
unsigned short | pdu_type |
TimeTicks | notify_timestamp |
Oid | notify_id |
Oid | notify_enterprise |
GenAddress | v1_trap_address |
int | v1_trap_address_set |
int | security_level |
unsigned long | message_id |
unsigned long | maxsize_scopedpdu |
OctetStr | context_name |
OctetStr | context_engine_id |
Pdu::Pdu | ( | ) |
Constructor no args.
This constructor creates a valid empty Pdu object.
Pdu::Pdu | ( | Vb * | pvbs, |
const int | pvb_count | ||
) |
|
inline |
|
virtual |
Destructor.
void Pdu::clear | ( | ) |
Clear the Pdu contents (destruct and construct in one go)
|
inline |
|
inline |
|
inline |
int Pdu::delete_vb | ( | const int | position | ) |
|
protected |
Extend the vbs array.
int Pdu::get_asn1_length | ( | ) | const |
Return the length of the encoded vbs with pdu header.
|
inline |
|
inline |
|
inline |
Get the context name of the Pdu.
name | - Object fot the context name |
Definition at line 386 of file pdu.h.
References OctetStr::valid().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the notify enterprise.
Definition at line 344 of file pdu.h.
References Oid::len().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int Pdu::get_v1_trap_address | ( | GenAddress & | address | ) | const |
Get the SNMPv1 trap address.
int Pdu::get_vb | ( | Vb & | vb, |
const int | index | ||
) | const |
Get a particular Vb.
vb | - Object to store the vb |
index | - The vb to get (zero is the first vb) |
|
inline |
|
inline |
int Pdu::get_vblist | ( | Vb * | pvbs, |
const int | pvb_count | ||
) | const |
Get Pointers to all Vbs from Pdu.
The caller has to allocate the array. The returned pointers point to the Vb objects that are internally used by the pdu. So any changes to the returned Vb objects will change the pdu. If the pdu is modified (e.g. through Pdu::trim()) afterwards, the returned array will contain invalid pointers.
pvbs | - Array of empty pointers of size pvb_count |
pvb_count | - Amount of Vb pointers to get |
|
static |
Does the type of response match the type of request.
Append a vb to the pdu.
vb | - The Vb that should be added (as last vb) to the pdu |
Overloaded assignment operator.
pdu | - Pdu that should be assigned to this object |
|
inline |
|
inline |
|
inline |
|
inline |
Set the context name of the Pdu.
name | - The context name |
Definition at line 370 of file pdu.h.
References OctetStr::valid().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set the notify enterprise.
Definition at line 336 of file pdu.h.
References Oid::len().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int Pdu::set_v1_trap_address | ( | const Address & | address | ) |
Set the SNMPv1 trap address.
int Pdu::set_vb | ( | Vb const & | vb, |
const int | index | ||
) |
Set a particular vb.
If this method returns FALSE, the pdu has not been modified.
vb | - Source vb |
index | - The vb to set (zero is the first vb) |
int Pdu::set_vblist | ( | Vb const * | pvbs, |
const int | pvb_count | ||
) |
Deposit all Vbs to Pdu.
The vb objects of the pdu will be freed and the objects from the array will be cloned and added to the pdu. If this method returns FALSE, the pdu will not conatin any Vb objects.
pvbs | - Array of valid pointers of size pvb_count |
pvb_count | - Amount of Vb pointers i the array |
int Pdu::trim | ( | const int | count = 1 | ) |
Trim off vbs.
count | - number of vbs to trim of, starting with the last |
|
inline |
|
protected |