Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 1 | /* |
| 2 | * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 3 | * (C) 2010 by On-Waves |
| 4 | * All Rights Reserved |
| 5 | * |
Holger Hans Peter Freyther | de56c22 | 2011-01-16 17:45:14 +0100 | [diff] [blame] | 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Affero General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Holger Hans Peter Freyther | de56c22 | 2011-01-16 17:45:14 +0100 | [diff] [blame] | 14 | * GNU Affero General Public License for more details. |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 15 | * |
Holger Hans Peter Freyther | de56c22 | 2011-01-16 17:45:14 +0100 | [diff] [blame] | 16 | * You should have received a copy of the GNU Affero General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 18 | * |
| 19 | */ |
| 20 | #ifndef snmp_mtp_h |
| 21 | #define snmp_mtp_h |
| 22 | |
| 23 | #include <net-snmp/net-snmp-config.h> |
| 24 | #include <net-snmp/utilities.h> |
| 25 | #include <net-snmp/net-snmp-includes.h> |
| 26 | |
| 27 | struct snmp_mtp_session { |
| 28 | netsnmp_session session, *ss; |
Holger Hans Peter Freyther | eab2096 | 2011-01-21 18:00:36 +0100 | [diff] [blame] | 29 | void *data; |
| 30 | |
| 31 | /* |
| 32 | * The callbacks will be called multiple times. Even if |
| 33 | * we only toggle one object. Remember which request we |
| 34 | * are handling here and then we will claim success on the |
| 35 | * first of a series of PDUs. This is the easies to manage |
| 36 | * and if a link fails to come up the SLTM will catch it. |
| 37 | */ |
| 38 | int last_up_req; |
| 39 | int last_do_req; |
| 40 | }; |
| 41 | |
| 42 | enum { |
| 43 | SNMP_LINK_UP, |
| 44 | SNMP_LINK_DOWN, |
| 45 | }; |
| 46 | |
| 47 | enum { |
| 48 | SNMP_STATUS_OK, |
| 49 | SNMP_STATUS_TIMEOUT, |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 50 | }; |
| 51 | |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 52 | struct snmp_mtp_session *snmp_mtp_session_create(char *host); |
Holger Hans Peter Freyther | b6edf97 | 2011-01-02 16:41:11 +0100 | [diff] [blame] | 53 | void snmp_mtp_deactivate(struct snmp_mtp_session *, int link_id); |
| 54 | void snmp_mtp_activate(struct snmp_mtp_session *, int link_id); |
Holger Hans Peter Freyther | 083a30b | 2011-01-21 12:57:12 +0100 | [diff] [blame] | 55 | void snmp_mtp_poll(); |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 56 | |
Holger Hans Peter Freyther | eab2096 | 2011-01-21 18:00:36 +0100 | [diff] [blame] | 57 | /* to be implemented by the handler */ |
| 58 | void snmp_mtp_callback(struct snmp_mtp_session *, int area, int res, int link_id); |
| 59 | |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 60 | #endif |