Request Class Reference

#include <request.h>

Inheritance diagram for Request:

Synchronized

List of all members.

Public Member Functions

 Request (const Pdux &, const NS_SNMP CTarget &)
 Construct a Request (only available without _SNMPv3).
 Request (const Request &)
 Copy constructor.
virtual ~Request ()
 Destructor.
virtual boolean 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 boolean finished () const
 Check whether the receiver request is finished (all variable bindings have been processed).
virtual boolean 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 receiverīs 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 boolean 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 boolean add_rep_row ()
 Add a repetition row to the GETBULK request PDU.
virtual boolean 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 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
boolean * done
boolean * ready
int outstanding
int size
int non_rep
int max_rep
int repeater
NS_SNMP snmp_version version
unsigned long transaction_id
Array< MibEntrylocks
NS_SNMP CTarget target

Friends

class RequestList
class Mib


Constructor & Destructor Documentation

Request::Request ( const Pdux ,
const NS_SNMP CTarget &   
)

Construct a Request (only available without _SNMPv3).

Parameters:
pdu a Pdux instance.
fromAddress the CTarget containg the originator's address.

Request::Request ( const Request  ) 

Copy constructor.

Parameters:
other another Request instance.

virtual Request::~Request (  )  [virtual]

Destructor.

Request::Request (  )  [protected]


Member Function Documentation

virtual boolean 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.

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.

virtual boolean 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 boolean 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 void Request::finish ( int  ,
const Vbx  
) [virtual]

Finish a sub-request by setting the receiverīs 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:
index the index of the sub-request to finish.

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.

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.

virtual boolean 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.

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.

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 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.

Vbx* Request::search_value ( const Oidx  )  const

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

Parameters:
oid an 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.

Vbx Request::get_original_value ( unsigned int  i  )  [inline]

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

Parameters:
index the zero-based index of the sub-request.
Returns:
a variable binding.

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.

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.

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).

unsigned short Request::get_type (  )  [inline]

Return the request type.

Returns:
The PDU type of the receiver.

unsigned long Request::get_request_id (  )  [inline]

Return the request id of the receiver.

Returns:
A request id.

unsigned long Request::get_transaction_id (  )  [inline]

Return the agent wide unique transaction id of the receiver.

Returns:
A transaction id.

int Request::get_error_status (  )  [inline]

Return the error status of the receiver request.

Returns:
A SNMP error status.

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).

void Request::set_error_status ( int  s  )  [inline]

Set the error status of the receiver request.

Parameters:
s - An error status.

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_transaction_id ( unsigned long  id  )  [inline]

Set the transaction id of the receiver sub-request.

Parameters:
id - An unique transaction id.

int Request::subrequests (  )  [inline]

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

Returns:
The request size.

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.

int Request::get_rep (  )  [inline]

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

Returns:
The number of non-repetition variable bindings.

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.

virtual boolean 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.

virtual boolean Request::init_rep_row ( int   )  [virtual]

Initialize a repetition row of a GETBULK request PDU.

Parameters:
row the 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 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:
count the count of variable bindings that should remain.

void Request::inc_outstanding (  ) 

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

void Request::dec_outstanding (  ) 

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

void Request::no_outstanding (  ) 

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

Pdux* Request::get_pdu (  )  [inline]

Return a pointer to the receiver's PDU.

Returns:
a pointer to a Pdux instance.

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.

NS_SNMP snmp_version Request::get_snmp_version (  )  [inline]

Get the request's version.

Returns:
the SNMP version of the request.

MibEntry* Request::get_locked ( int   ) 

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

Parameters:
ind a 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.

void Request::set_locked ( int  ,
MibEntry  
)

Set the locked MibEntry for the given subrequest id.

Parameters:
ind a subrequest index.
entry a pointer to a MibEntry instance or 0 to indicate that the specified subrequest no longer holds a lock.

void Request::set_unlocked ( int   ) 

Set the given subrequest as unlocked.

Parameters:
ind a subrequest index.

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:
entry a 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::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::init_from_pdu (  )  [protected, virtual]

void Request::check_exception ( int  ,
Vbx  
) [protected]

int Request::get_max_response_length (  )  [protected]


Friends And Related Function Documentation

friend class RequestList [friend]

friend class Mib [friend]


Member Data Documentation

Pdux* Request::pdu [protected]

Vbx* Request::originalVbs [protected]

int Request::originalSize [protected]

NS_SNMP UdpAddress Request::from [protected]

boolean* Request::done [protected]

boolean* Request::ready [protected]

int Request::outstanding [protected]

int Request::size [protected]

int Request::non_rep [protected]

int Request::max_rep [protected]

int Request::repeater [protected]

NS_SNMP snmp_version Request::version [protected]

unsigned long Request::transaction_id [protected]

NS_SNMP CTarget Request::target [protected]


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

Generated on Fri May 29 22:36:55 2009 for AGENT++ by  doxygen 1.5.6