aboutsummaryrefslogtreecommitdiffstats
path: root/include/snmp_mtp.h
blob: bff550711b6a9ad610fd459eed84d9889ea03841 (plain)
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
/*
 * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
 * (C) 2010 by On-Waves
 * All Rights Reserved
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
#ifndef snmp_mtp_h
#define snmp_mtp_h

#include <stdlib.h>

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/utilities.h>
#include <net-snmp/net-snmp-includes.h>

struct snmp_mtp_session {
	netsnmp_session session, *ss;
	void *data;

	/*
	 * The callbacks will be called multiple times. Even if
	 * we only toggle one object. Remember which request we
	 * are handling here and then we will claim success on the
	 * first of a series of PDUs. This is the easies to manage
	 * and if a link fails to come up the SLTM will catch it.
	 */
	int last_up_req;
	int last_do_req;
};

enum {
	SNMP_LINK_UP,
	SNMP_LINK_DOWN,
};

enum {
	SNMP_STATUS_OK,
	SNMP_STATUS_TIMEOUT,
};

struct snmp_mtp_session *snmp_mtp_session_create(void);
int snmp_mtp_peer_name(struct snmp_mtp_session *, char *name);
void snmp_mtp_deactivate(struct snmp_mtp_session *, int link_id);
void snmp_mtp_activate(struct snmp_mtp_session *, int link_id);
void snmp_mtp_poll();

/* to be implemented by the handler */
void snmp_mtp_callback(struct snmp_mtp_session *, int area, int res, int link_id);

#endif