-
Notifications
You must be signed in to change notification settings - Fork 34
/
oflops_snmp.h
75 lines (67 loc) · 1.67 KB
/
oflops_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef OFLOPS_SNMP_H
#define OFLOPS_SNMP_H
struct snmp_channel;
struct snmp_event;
#include "context.h"
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
/** Structure to hold SNMP reply.
*
* @date December, 2009
* @author ykk (Stanford University)
*/
typedef struct snmp_event
{
/** SNMP variable list
*/
struct variable_list* reply;
/** Pointer to SNMP reply
*/
struct snmp_pdu* pdu;
} snmp_event;
/** Structure to hold SNMP channel information.
*
* @date December 2009
* @author ykk (Stanford University)
*/
typedef struct snmp_channel
{
/** Hostname of SNMP agent.
*/
char* hostname;
/** SNMP community string.
*/
char* community_string;
/** Reference to session.
*/
struct snmp_session session;
/** Reference to packet
*/
struct snmp_pdu* req;
} snmp_channel;
/** Initialize SNMP channel.
* @param host IP address of SNPM agent
* @param community_string
* @return 0
*/
int snmp_channel_init(struct snmp_channel* channel,
char* host, char* community_string);
/** Setup SNMP session.
* @param ctx context (includes reference to SNMP session/setup)
*/
void setup_snmp_channel(struct oflops_context* ctx);
/** Callback function for SNMP
* @param operation type of SNMP operation
* @param sp pointer to SNMP session
* @param reqid required id
* @param pdu pointer to SNMP PDU
* @param magic magic object with request
* @return 0
*/
int snmp_response(int operation, struct snmp_session *sp, int reqid,
struct snmp_pdu *pdu, void *magic);
/** Teardown SNMP session.
* @param ctx context (includes reference to SNMP session/setup)
*/
void teardown_snmp_channel(struct oflops_context* ctx);
#endif