SNMP++  3.3.4
v3MP::Cache Class Reference

Holds cache entries for currently processed requests. More...

Collaboration diagram for v3MP::Cache:

Classes

struct  Entry_T
 

Public Member Functions

 Cache ()
 
 ~Cache ()
 
int add_entry (int msg_id, unsigned long req_id, const OctetStr &sec_engine_id, int sec_model, const OctetStr &sec_name, int sec_level, const OctetStr &context_engine_id, const OctetStr &context_name, struct SecurityStateReference *sec_state_ref, int error_code, bool local_request)
 Add an entry to the cache. More...
 
int get_entry (int msg_id, bool local_request, int *error_code, struct SecurityStateReference **sec_state_ref)
 Search the cache for a message id, return the error code and the sec_state_ref and delete the entry from the cache. More...
 
void delete_entry (unsigned long req_id, bool local_request)
 Delete the entry with the given request id from the cache. More...
 
void delete_entry (unsigned long req_id, int msg_id, bool local_request)
 Delete the entry with the given request and message id from the cache. More...
 
int get_entry (int searchedID, bool local_request, struct Cache::Entry_T *res)
 Search the cache for a message id, return the whole entry and delete the entry from the cache. More...
 
void delete_content (struct Cache::Entry_T &ce)
 
void set_usm (USM *usm_to_use)
 

Private Attributes

SNMP_PP_MUTABLE SnmpSynchronized lock
 
struct Entry_T * table
 whole table More...
 
int max_entries
 the maximum number of entries More...
 
int entries
 the current amount of entries More...
 
USM * usm
 

Detailed Description

Holds cache entries for currently processed requests.

Definition at line 513 of file mp_v3.h.

Constructor & Destructor Documentation

v3MP::Cache::Cache ( )
v3MP::Cache::~Cache ( )

Member Function Documentation

int v3MP::Cache::add_entry ( int  msg_id,
unsigned long  req_id,
const OctetStr &  sec_engine_id,
int  sec_model,
const OctetStr &  sec_name,
int  sec_level,
const OctetStr &  context_engine_id,
const OctetStr &  context_name,
struct SecurityStateReference *  sec_state_ref,
int  error_code,
bool  local_request 
)

Add an entry to the cache.

Parameters
msg_id- The message id of the message
req_id- The request id of the message
sec_engine_id- The authoritative engineID
sec_model- The security model used for this message
sec_name- The name of the user
sec_level- The security level used for this message
context_engine_id- The context_engine_id
context_name- The context_name
sec_state_ref- The reference of the USM
error_code- The code of the error that occured while parsing the received message
Returns
- SNMPv3_MP_OK, SNMPv3_MP_ERROR or SNMPv3_DOUBLED_MESSAGE (an entry with the given values is already in the cache)
void v3MP::Cache::delete_content ( struct Cache::Entry_T &  ce)
void v3MP::Cache::delete_entry ( unsigned long  req_id,
bool  local_request 
)

Delete the entry with the given request id from the cache.

This function is used in eventlist.cpp when a request has timed out.

Parameters
req_id- The request id.
void v3MP::Cache::delete_entry ( unsigned long  req_id,
int  msg_id,
bool  local_request 
)

Delete the entry with the given request and message id from the cache.

Parameters
req_id- The request id.
msg_id- The message id.
int v3MP::Cache::get_entry ( int  msg_id,
bool  local_request,
int *  error_code,
struct SecurityStateReference **  sec_state_ref 
)

Search the cache for a message id, return the error code and the sec_state_ref and delete the entry from the cache.

Parameters
msg_id- Search for this message id
error_code- OUT: The error code of the received message
sec_state_ref- IN: Pointer to a pointer of the structure OUT: The structure as received by the USM when the message was parsed.
Returns
- SNMPv3_MP_ERROR, SNMPv3_MP_OK
int v3MP::Cache::get_entry ( int  searchedID,
bool  local_request,
struct Cache::Entry_T *  res 
)

Search the cache for a message id, return the whole entry and delete the entry from the cache.

Parameters
searchedID- Search for this message id
res- IN: Pointer to an empy structure OUT: The filled structure
Returns
- SNMPv3_MP_ERROR, SNMPv3_MP_OK
void v3MP::Cache::set_usm ( USM *  usm_to_use)
inline

Definition at line 609 of file mp_v3.h.

Member Data Documentation

int v3MP::Cache::entries
private

the current amount of entries

Definition at line 617 of file mp_v3.h.

SNMP_PP_MUTABLE SnmpSynchronized v3MP::Cache::lock
private

Definition at line 609 of file mp_v3.h.

int v3MP::Cache::max_entries
private

the maximum number of entries

Definition at line 616 of file mp_v3.h.

struct Entry_T* v3MP::Cache::table
private

whole table

Definition at line 615 of file mp_v3.h.

USM* v3MP::Cache::usm
private

Definition at line 618 of file mp_v3.h.


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