-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathsnmp.h
54 lines (41 loc) · 1.11 KB
/
snmp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef BCM2DUMP_SNMP_H
#define BCM2DUMP_SNMP_H
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include "interface.h"
#include "rwx.h"
namespace bcm2dump {
class snmp : public interface
{
public:
struct var
{
var(const std::string& str, u_char type = ASN_OCTET_STR)
: str(str), type(type)
{}
var(const void* data, size_t size, u_char type = ASN_OCTET_STR)
: str(static_cast<const char*>(data), size), type(type)
{}
var(long integer, u_char type)
: integer(integer), type(type)
{}
std::string str;
long integer;
u_char type;
};
snmp(std::string peer);
virtual std::string name() const override
{ return "snmp"; }
std::vector<var> get(const std::vector<std::string>& oids) const;
var get(const std::string& oid) const;
void set(const std::vector<std::pair<std::string, var>>& values);
void set(const std::string& oid, const var& value);
static interface::sp detect(const std::string& peer);
virtual rwx::sp create_rwx(const addrspace& space, bool safe) const;
protected:
virtual void initialize_impl() override;
private:
snmp_session* m_ss;
};
}
#endif