AGENT++  4.0.3
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Request Class Reference

#include <request.h>

Inheritance diagram for Request:
Synchronized

Public Types

typedef NS_SNMP CTarget TargetType
 target type when SNMPv3 must not be supported
 
- Public Types inherited from Synchronized
enum  TryLockResult { LOCKED = 1, BUSY = 0, OWNED = -1 }
 

Public Member Functions

 Request (const Pdux &, const TargetType &)
 Construct a Request.
 
 Request (const Request &)
 Copy constructor.
 
virtual ~Request ()
 Destructor.
 
virtual bool contains (const Vbx &)
 Check whether the receiver contains a specified variable binding.
 
virtual int position (const Vbx &)
 Return the position of a specified variable binding in the receiver request.
 
virtual bool finished () const
 Check whether the receiver request is finished (all variable bindings have been processed).
 
virtual bool is_done (int) const
 Check whether a specified variable binding (sub-request) has been processed.
 
virtual void finish (int, const Vbx &)
 Finish a sub-request by setting the receivers variable binding at the given sub-request index to a specified value and marking the sub-request as done.
 
virtual void finish (int)
 Mark a subrequest as done, without changing its value.
 
virtual void set_ready (int)
 Set a sub-request ready for commit.
 
virtual void unset_ready (int)
 Set a sub-request not-ready for commit.
 
virtual bool is_ready (int) const
 Check whether a specified variable binding (sub-request) is ready to commit (applies only for SET-Requests).
 
virtual int first_pending () const
 Return the index of the first pending (done == FALSE) subrequest.
 
virtual void error (int, int)
 Set the error status of the receiver request.
 
virtual Vbx get_value (int)
 Return the variable binding of the specified sub-request.
 
Vbxsearch_value (const Oidx &) const
 Get the value for a given OID if the request contains such an instance.
 
Vbx get_original_value (unsigned int i)
 Gets the original variable binding of the specified sub-request.
 
virtual NS_SNMP SnmpInt32 get_syntax (int)
 Return the syntax of the specified sub-request (variable binding).
 
virtual Oidx get_oid (int)
 Return the object identifier of the specified sub-request.
 
virtual void set_oid (const Oidx &, int)
 Set the object identifier of a specified sub-request.
 
unsigned short get_type ()
 Return the request type.
 
unsigned long get_request_id ()
 Return the request id of the receiver.
 
unsigned long get_transaction_id ()
 Return the agent wide unique transaction id of the receiver.
 
int get_error_status ()
 Return the error status of the receiver request.
 
int get_error_index ()
 Return the index of the sub-request that failed with an error condition.
 
void set_error_status (int s)
 Set the error status of the receiver request.
 
void set_error_index (int i)
 Set the error index of the receiver request.
 
void set_transaction_id (unsigned long id)
 Set the transaction id of the receiver sub-request.
 
int subrequests ()
 Return the count of sub-requests in the receiver request.
 
int get_non_rep ()
 Return the count of non repetition variable bindings of a GETBULK request.
 
int get_rep ()
 Return the count of repetition variable bindings of a GETBULK request.
 
int get_max_rep ()
 Return the maximum repetition of repetition variable bindings of a GETBULK request.
 
virtual bool add_rep_row ()
 Add a repetition row to the GETBULK request PDU.
 
virtual bool init_rep_row (int)
 Initialize a repetition row of a GETBULK request PDU.
 
virtual void trim_request (int)
 Trim the request's variable bindings to a given number of elements.
 
void inc_outstanding ()
 Increment the number of variable bindings to be processed by one.
 
void dec_outstanding ()
 Decrement the number of variable bindings to be processed by one.
 
void no_outstanding ()
 Set the number of variable bindings to be processed to 0.
 
Pduxget_pdu ()
 Return a pointer to the receiver's PDU.
 
NS_SNMP CTarget * get_address ()
 Return a pointer to the request's originator address.
 
NS_SNMP snmp_version get_snmp_version ()
 Get the request's version.
 
MibEntryget_locked (int)
 Get a pointer to the MibEntry object that has been locked for the given subrequest.
 
void set_locked (int, MibEntry *)
 Set the locked MibEntry for the given subrequest id.
 
void set_unlocked (int)
 Set the given subrequest as unlocked.
 
int lock_index (MibEntry *)
 Determine the lock index of a MibEntry.
 
void trim_bulk_response ()
 Trim BULK response PDU to N+M*R variables and set OIDs of variables with END OF MIB VIEW syntax to either the corresponding request OID (R == 0) or to the last successor found.
 
- 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.
 

Public Attributes

u_char phase
 

Protected Member Functions

 Request ()
 
virtual void init_from_pdu ()
 
void check_exception (int, Vbx &)
 
int get_max_response_length ()
 

Protected Attributes

Pduxpdu
 
VbxoriginalVbs
 
int originalSize
 
NS_SNMP UdpAddress from
 
bool * done
 
bool * ready
 
int outstanding
 
int size
 
int non_rep
 
int max_rep
 
int repeater
 
NS_SNMP snmp_version version
 
unsigned long transaction_id
 
Array< MibEntrylocks
 
TargetType target
 

Friends

class RequestList
 
class Mib
 

Member Typedef Documentation

typedef NS_SNMP CTarget Request::TargetType

target type when SNMPv3 must not be supported

Constructor & Destructor Documentation

Request::Request ( const Pdux ,
const TargetType  
)

Construct a Request.

Parameters
pdua Pdux instance.
fromAddressthe Target containing the originator's address.
Request::Request ( const Request )

Copy constructor.

Parameters
otheranother Request instance.
virtual Request::~Request ( )
virtual

Destructor.

Request::Request ( )
protected

Member Function Documentation

virtual bool Request::add_rep_row ( )
virtual

Add a repetition row to the GETBULK request PDU.

Returns
TRUE if there was enough room in the response PDU for another repetition, FALSE otherwise.
void Request::check_exception ( int  ,
Vbx  
)
protected
virtual bool Request::contains ( const Vbx )
virtual

Check whether the receiver contains a specified variable binding.

Note
Two variable bindings are supposed to be the same, if their oids are equal.
Parameters
vb- A variable binding.
void Request::dec_outstanding ( )

Decrement the number of variable bindings to be processed by one.

virtual void Request::error ( int  ,
int   
)
virtual

Set the error status of the receiver request.

Parameters
index- The index of the sub-request that failed.
error- An error code describing the error condition.
virtual void Request::finish ( int  ,
const Vbx  
)
virtual

Finish a sub-request by setting the receivers variable binding at the given sub-request index to a specified value and marking the sub-request as done.

Parameters
i- The index of the sub-request to finish.
vb- A variable binding.
virtual void Request::finish ( int  )
virtual

Mark a subrequest as done, without changing its value.

Parameters
indexthe index of the sub-request to finish.
virtual bool Request::finished ( ) const
virtual

Check whether the receiver request is finished (all variable bindings have been processed).

Returns
TRUE if the request is complete, FALSE otherwise.
virtual int Request::first_pending ( ) const
virtual

Return the index of the first pending (done == FALSE) subrequest.

Returns
the index of the first non ready subrequest or -1 if request is finished.
NS_SNMP CTarget* Request::get_address ( )
inline

Return a pointer to the request's originator address.

(only available without _SNMPv3)

Returns
a pointer to a CTarget instance.
int Request::get_error_index ( )
inline

Return the index of the sub-request that failed with an error condition.

Returns
The index of the failed sub-request (starting from 1).
int Request::get_error_status ( )
inline

Return the error status of the receiver request.

Returns
A SNMP error status.
MibEntry* Request::get_locked ( int  )

Get a pointer to the MibEntry object that has been locked for the given subrequest.

Parameters
inda subrequest index.
Returns
0 if such an object has not been locked or has been already released, otherwise a pointer to a MibEntry instance is returned that has been locked for the current request.
int Request::get_max_rep ( )
inline

Return the maximum repetition of repetition variable bindings of a GETBULK request.

Returns
The number of non-repetition variable bindings.
int Request::get_max_response_length ( )
protected
int Request::get_non_rep ( )
inline

Return the count of non repetition variable bindings of a GETBULK request.

Returns
The number of non-repetition variable bindings.
virtual Oidx Request::get_oid ( int  )
virtual

Return the object identifier of the specified sub-request.

Parameters
index- An index of a sub-request (starting from 0).
Returns
An object identifier.
Vbx Request::get_original_value ( unsigned int  i)
inline

Gets the original variable binding of the specified sub-request.

Parameters
indexthe zero-based index of the sub-request.
Returns
a variable binding.
Pdux* Request::get_pdu ( )
inline

Return a pointer to the receiver's PDU.

Returns
a pointer to a Pdux instance.
int Request::get_rep ( )
inline

Return the count of repetition variable bindings of a GETBULK request.

Returns
The number of non-repetition variable bindings.
unsigned long Request::get_request_id ( )
inline

Return the request id of the receiver.

Returns
A request id.
NS_SNMP snmp_version Request::get_snmp_version ( )
inline

Get the request's version.

Returns
the SNMP version of the request.
virtual NS_SNMP SnmpInt32 Request::get_syntax ( int  )
virtual

Return the syntax of the specified sub-request (variable binding).

Parameters
index- An index of a sub-request (starting from 0).
Returns
A SMI syntax.
unsigned long Request::get_transaction_id ( )
inline

Return the agent wide unique transaction id of the receiver.

Returns
A transaction id.
unsigned short Request::get_type ( )
inline

Return the request type.

Returns
The PDU type of the receiver.
virtual Vbx Request::get_value ( int  )
virtual

Return the variable binding of the specified sub-request.

Parameters
index- An index of a sub-request (starting from 0).
Returns
A variable binding.
void Request::inc_outstanding ( )

Increment the number of variable bindings to be processed by one.

virtual void Request::init_from_pdu ( )
protectedvirtual
virtual bool Request::init_rep_row ( int  )
virtual

Initialize a repetition row of a GETBULK request PDU.

Parameters
rowthe repetition row to be initialized (counted from 1, row 0 is the non-repeated first row)
Returns
TRUE if such a row exists, FALSE otherwise.
virtual bool Request::is_done ( int  ) const
virtual

Check whether a specified variable binding (sub-request) has been processed.

Parameters
i- The index (starting from 0) of the variable binding to check.
Returns
TRUE if the sub-request is done, FALSE otherwise.
virtual bool Request::is_ready ( int  ) const
virtual

Check whether a specified variable binding (sub-request) is ready to commit (applies only for SET-Requests).

Parameters
i- The index (starting from 0) of the variable binding to check.
Returns
TRUE if the sub-request is ready, FALSE otherwise.
int Request::lock_index ( MibEntry )

Determine the lock index of a MibEntry.

The lock index is the index of the subrequest that acquired a lock for the given MibEntry.

Parameters
entrya pointer to a MibEntry object.
Returns
-1 if entry has not been locked by this request (or if such a lock has already been released). Otherwise, it returns the smallest subrequest index that locked entry.
void Request::no_outstanding ( )

Set the number of variable bindings to be processed to 0.

virtual int Request::position ( const Vbx )
virtual

Return the position of a specified variable binding in the receiver request.

Note
Two variable bindings are supposed to be the same, if their oids are equal.
Parameters
vb- A variable binding.
Vbx* Request::search_value ( const Oidx ) const

Get the value for a given OID if the request contains such an instance.

Parameters
oidan Oidx instance denoting the OID of the variable binding to return.
Returns
a pointer to a clone of the first Vbx instance in the request with the specified OID, or 0 if no such instance exists.
void Request::set_error_index ( int  i)
inline

Set the error index of the receiver request.

Parameters
s- The sub-request index of a failed sub-request.
Note
All error indexes starts at 1.
void Request::set_error_status ( int  s)
inline

Set the error status of the receiver request.

Parameters
s- An error status.
void Request::set_locked ( int  ,
MibEntry  
)

Set the locked MibEntry for the given subrequest id.

Parameters
inda subrequest index.
entrya pointer to a MibEntry instance or 0 to indicate that the specified subrequest no longer holds a lock.
virtual void Request::set_oid ( const Oidx ,
int   
)
virtual

Set the object identifier of a specified sub-request.

Parameters
oid- An object identifier.
index- An index of a sub-request (starting from 0).
virtual void Request::set_ready ( int  )
virtual

Set a sub-request ready for commit.

Parameters
i- The index of the sub-request to be set ready for commit.
void Request::set_transaction_id ( unsigned long  id)
inline

Set the transaction id of the receiver sub-request.

Parameters
id- An unique transaction id.
void Request::set_unlocked ( int  )

Set the given subrequest as unlocked.

Parameters
inda subrequest index.
int Request::subrequests ( )
inline

Return the count of sub-requests in the receiver request.

Returns
The request size.
void Request::trim_bulk_response ( )

Trim BULK response PDU to N+M*R variables and set OIDs of variables with END OF MIB VIEW syntax to either the corresponding request OID (R == 0) or to the last successor found.

N = nonrep, M = maxrep, R = rep.

This method does is a NOP when called on a request type other than GETBULK.

virtual void Request::trim_request ( int  )
virtual

Trim the request's variable bindings to a given number of elements.

Elements are removed starting from the end.

Parameters
countthe count of variable bindings that should remain.
virtual void Request::unset_ready ( int  )
virtual

Set a sub-request not-ready for commit.

Parameters
i- The index of the sub-request to be set not-ready for commit.

Friends And Related Function Documentation

friend class Mib
friend
friend class RequestList
friend

Member Data Documentation

bool* Request::done
protected
NS_SNMP UdpAddress Request::from
protected
Array<MibEntry> Request::locks
protected
int Request::max_rep
protected
int Request::non_rep
protected
int Request::originalSize
protected
Vbx* Request::originalVbs
protected
int Request::outstanding
protected
Pdux* Request::pdu
protected
u_char Request::phase
bool* Request::ready
protected
int Request::repeater
protected
int Request::size
protected
TargetType Request::target
protected
unsigned long Request::transaction_id
protected
NS_SNMP snmp_version Request::version
protected

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