SNMP++  3.3.11
v3MP::EngineIdTable Class Reference

The engine id table is used to store known engine ids with corresponding hostadress and port. More...

Collaboration diagram for v3MP::EngineIdTable:

Classes

struct  Entry_T
 

Public Member Functions

 EngineIdTable (int initial_size=10)
 
 ~EngineIdTable ()
 
int add_entry (const OctetStr &engine_id, const OctetStr &host, int port)
 Add an entry to the table. More...
 
int get_entry (OctetStr &engine_id, const OctetStr &hostport) const
 Get the engine_id of the SNMP entity at the given host/port. More...
 
int get_entry (OctetStr &engine_id, const OctetStr &host, int port) const
 Get the engineID of the SNMP entity at the given host/port. More...
 
int reset ()
 Remove all entries from the engine id table. More...
 
int delete_entry (const OctetStr &engine_id)
 Remove the given engine id from the table. More...
 
int delete_entry (const OctetStr &host, int port)
 Remove the entry for the given address/port from the table. More...
 
int get_cache_size_limit ()
 Get the upper limit of the number of entries in this engine ID cache. More...
 
void set_cache_size_limit (int size_upper_limit)
 Set the upper limit of the number of entries in this engine ID cache. More...
 

Private Member Functions

bool initialize_table (const int size)
 

Private Attributes

struct Entry_Ttable
 
int max_entries
 the maximum number of entries More...
 
int upper_limit_entries
 the upper most number of entries to keep More...
 
int entries
 the current amount of entries More...
 
SNMP_PP_MUTABLE SnmpSynchronized lock
 

Detailed Description

The engine id table is used to store known engine ids with corresponding hostadress and port.

Definition at line 425 of file mp_v3.h.

Constructor & Destructor Documentation

◆ EngineIdTable()

v3MP::EngineIdTable::EngineIdTable ( int  initial_size = 10)

◆ ~EngineIdTable()

v3MP::EngineIdTable::~EngineIdTable ( )

Member Function Documentation

◆ add_entry()

int v3MP::EngineIdTable::add_entry ( const OctetStr engine_id,
const OctetStr host,
int  port 
)

Add an entry to the table.

Parameters
engine_id- The engineID
host- The numerical IP address
port- The port
Returns
- SNMPv3_MP_ERROR, SNMPv3_MP_OK

◆ delete_entry() [1/2]

int v3MP::EngineIdTable::delete_entry ( const OctetStr engine_id)

Remove the given engine id from the table.

Parameters
engine_id- The engine id to remove
Returns
- SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR, SNMPv3_MP_OK

◆ delete_entry() [2/2]

int v3MP::EngineIdTable::delete_entry ( const OctetStr host,
int  port 
)

Remove the entry for the given address/port from the table.

Parameters
host- Numeric IP address
port- listen port of the snmp entity
Returns
- SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR, SNMPv3_MP_OK

◆ get_cache_size_limit()

int v3MP::EngineIdTable::get_cache_size_limit ( )
inline

Get the upper limit of the number of entries in this engine ID cache.

Returns
- the cache size upper limit (50.000 by default).

Definition at line 501 of file mp_v3.h.

◆ get_entry() [1/2]

int v3MP::EngineIdTable::get_entry ( OctetStr engine_id,
const OctetStr hostport 
) const

Get the engine_id of the SNMP entity at the given host/port.

Parameters
engine_id- OUT: The engineID
hostport- The numerical IP address and port (syntax: a.b.c.d/port)
Returns
- SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR, SNMPv3_MP_OK

◆ get_entry() [2/2]

int v3MP::EngineIdTable::get_entry ( OctetStr engine_id,
const OctetStr host,
int  port 
) const

Get the engineID of the SNMP entity at the given host/port.

Parameters
engine_id- OUT: The engineID
host- The numerical IP address
port- The port
Returns
- SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR, SNMPv3_MP_OK

◆ initialize_table()

bool v3MP::EngineIdTable::initialize_table ( const int  size)
private

◆ reset()

int v3MP::EngineIdTable::reset ( )

Remove all entries from the engine id table.

Returns
- SNMPv3_MP_NOT_INITIALIZED, SNMPv3_MP_ERROR, SNMPv3_MP_OK

◆ set_cache_size_limit()

void v3MP::EngineIdTable::set_cache_size_limit ( int  size_upper_limit)
inline

Set the upper limit of the number of entries in this engine ID cache.

Calls of this method with a cache size of 0 or less are ignored.

Parameters
size_upper_limitthe upper limit of the engine ID cache size (50.000 by default).

Definition at line 509 of file mp_v3.h.

Member Data Documentation

◆ entries

int v3MP::EngineIdTable::entries
private

the current amount of entries

Definition at line 525 of file mp_v3.h.

◆ lock

SNMP_PP_MUTABLE SnmpSynchronized v3MP::EngineIdTable::lock
private

Definition at line 526 of file mp_v3.h.

◆ max_entries

int v3MP::EngineIdTable::max_entries
private

the maximum number of entries

Definition at line 523 of file mp_v3.h.

◆ table

struct Entry_T* v3MP::EngineIdTable::table
private

Definition at line 522 of file mp_v3.h.

◆ upper_limit_entries

int v3MP::EngineIdTable::upper_limit_entries
private

the upper most number of entries to keep

Definition at line 524 of file mp_v3.h.


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