SNMPpp
v0.0.3-20-7eeb228
Classes, methods, and functions to use net-snmp from C++
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Varlist.hpp
Go to the documentation of this file.
1
// SNMPpp: https://sourceforge.net/p/snmppp/
2
// SNMPpp project uses the MIT license. See LICENSE for details.
3
// @copyright Copyright (C) 2013 Stephane Charette <stephanecharette@gmail.com>
4
5
#pragma once
6
7
#include <
SNMPpp/net-snmppp.hpp
>
8
#include <
SNMPpp/OID.hpp
>
9
10
11
namespace
SNMPpp
12
{
22
class
Varlist
23
{
24
public
:
25
38
virtual
~Varlist
(
void
);
39
41
Varlist
(
void
);
42
47
Varlist
( netsnmp_variable_list *vl );
48
50
virtual
void
free
(
void
);
51
61
virtual
void
clear
(
void
) {
varlist
= NULL; }
62
64
virtual
operator
netsnmp_variable_list* ( void ) {
return
varlist
; }
65
67
virtual
operator
netsnmp_variable_list**( void ) {
return
&
varlist
; }
68
73
virtual
size_t
size
(
void
)
const
{
return
count_varbinds(
varlist
); }
74
79
virtual
bool
empty
(
void
)
const
{
return
varlist
== NULL; }
80
86
virtual
const
Varlist
&
getOids
(
SNMPpp::VecOID
&v )
const
;
87
93
virtual
const
Varlist
&
getOids
(
SNMPpp::SetOID
&s )
const
;
94
96
virtual
MapOidVarList
getMap
(
void
)
const
;
97
99
virtual
bool
contains
(
const
SNMPpp::OID
&o )
const
;
100
106
virtual
Varlist
&
addNullVar
(
const
SNMPpp::OID
&o );
107
112
virtual
Varlist
&
addNullVars
(
const
SNMPpp::SetOID
&s );
113
118
virtual
Varlist
&
addNullVars
(
const
SNMPpp::VecOID
&v );
119
128
virtual
const
netsnmp_variable_list *
at
(
const
SNMPpp::OID
&o )
const
;
129
131
virtual
netsnmp_variable_list *
operator[]
(
const
size_t
idx );
132
134
virtual
SNMPpp::OID
firstOID
(
void
)
const
;
135
136
// The next few methods help extract information from Varlists
137
// when there happens to be multiple objects in the linked list.
138
160
virtual
int
asnType
(
const
SNMPpp::OID
&o )
const
{
return
at
(o)->type; }
161
169
virtual
const
netsnmp_vardata &
valueAt
(
const
SNMPpp::OID
&o )
const
{
return
at
(o)->val; }
170
175
virtual
bool
getBool
(
const
SNMPpp::OID
&o )
const
;
176
181
virtual
long
getLong
(
const
SNMPpp::OID
&o )
const
;
182
186
virtual
std::string
getString
(
const
SNMPpp::OID
&o )
const
;
187
192
virtual
SNMPpp::OID
getOID
(
const
SNMPpp::OID
&o )
const
;
193
199
virtual
std::string
asString
(
const
SNMPpp::OID
&o )
const
;
200
201
// The next few methods help extract information from Varlists
202
// when there happens to be a single object in the linked list.
203
210
virtual
int
asnType
(
void
)
const
{
return
asnType
(
firstOID
() ); }
211
218
virtual
const
netsnmp_vardata &
value
(
void
)
const
{
return
valueAt
(
firstOID
() ); }
219
226
virtual
bool
getBool
(
void
)
const
{
return
getBool
(
firstOID
() ); }
227
234
virtual
long
getLong
(
void
)
const
{
return
getLong
(
firstOID
() ); }
235
241
virtual
std::string
getString
(
void
)
const
{
return
getString
(
firstOID
() ); }
242
249
virtual
SNMPpp::OID
getOID
(
void
)
const
{
return
getOID
(
firstOID
() ); }
250
256
virtual
std::string
asString
(
void
)
const
{
return
asString
(
firstOID
() ); }
257
258
protected
:
259
261
netsnmp_variable_list *
varlist
;
262
};
263
};
264
265
269
std::ostream &
operator<<
( std::ostream &os,
const
SNMPpp::Varlist
&varlist );
include
SNMPpp
Varlist.hpp
Generated on Sun Feb 2 2014 11:02:31 for SNMPpp by
1.8.4