diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-21 18:00:36 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-21 19:40:49 +0100 |
commit | eab20964b2f059898fc804584e55a157c021afc0 (patch) | |
tree | e6dfcce7b7d40d761a2bfb13200794ba42006a89 /include | |
parent | 4da421da6fed6135f7c01eeb6769fb2a82d476cb (diff) |
udp: Make the SNMP code asynchronouson-waves/multiple-links
Do not block the application when doing a SNMP request. Work
with the results coming back from the callback. Right now a
link can only be taken down and up.
Diffstat (limited to 'include')
-rw-r--r-- | include/bsc_data.h | 2 | ||||
-rw-r--r-- | include/snmp_mtp.h | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h index 3311d53..1092d6e 100644 --- a/include/bsc_data.h +++ b/include/bsc_data.h @@ -141,7 +141,7 @@ void update_con_state(struct mtp_link_set *link, int rc, struct sccp_parse_resul unsigned int sls_for_src_ref(struct sccp_source_reference *ref); /* udp init */ -int link_global_init(struct mtp_udp_data *data, int src_port); +int link_global_init(struct mtp_udp_data *data, char *dest_ip, int src_port); int link_udp_init(struct mtp_udp_link *data, const char *dest_ip, int port); int link_init(struct bsc_data *bsc); int link_shutdown_all(struct mtp_link_set *); diff --git a/include/snmp_mtp.h b/include/snmp_mtp.h index 045e90f..8c15df7 100644 --- a/include/snmp_mtp.h +++ b/include/snmp_mtp.h @@ -26,6 +26,27 @@ 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(char *host); @@ -33,4 +54,7 @@ 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 |