diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-12-20 17:35:41 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-01 14:22:28 +0100 |
commit | c3dcfa79b90f6f43d651329046846c8a0189b98f (patch) | |
tree | 461cde03288750cc15b7907ee6cead9b4cf6935c | |
parent | 67b8c875e7207a927a83fa5dfba1d6fe594fa892 (diff) |
linkset: Prepare the UDP support to support multiple links.
-rw-r--r-- | include/bsc_data.h | 1 | ||||
-rw-r--r-- | include/snmp_mtp.h | 4 | ||||
-rw-r--r-- | src/link_udp.c | 6 | ||||
-rw-r--r-- | src/links.c | 4 | ||||
-rw-r--r-- | src/snmp_mtp.c | 8 |
5 files changed, 13 insertions, 10 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h index 518f193..7906130 100644 --- a/include/bsc_data.h +++ b/include/bsc_data.h @@ -55,6 +55,7 @@ struct link_data { struct write_queue write_queue; struct sockaddr_in remote; struct snmp_mtp_session *session; + int link_index; int reset_timeout; } udp; }; diff --git a/include/snmp_mtp.h b/include/snmp_mtp.h index 6a70a5c..4beff60 100644 --- a/include/snmp_mtp.h +++ b/include/snmp_mtp.h @@ -33,7 +33,7 @@ void snmp_mtp_start_c7_datalink(struct snmp_mtp_session *, int link_id); void snmp_mtp_stop_c7_datalink(struct snmp_mtp_session *, int link_id); struct snmp_mtp_session *snmp_mtp_session_create(char *host); -void snmp_mtp_deactivate(struct snmp_mtp_session *); -void snmp_mtp_activate(struct snmp_mtp_session *); +void snmp_mtp_deactivate(struct snmp_mtp_session *, int link_id); +void snmp_mtp_activate(struct snmp_mtp_session *, int link_id); #endif diff --git a/src/link_udp.c b/src/link_udp.c index f0532ac..405c7f7 100644 --- a/src/link_udp.c +++ b/src/link_udp.c @@ -132,7 +132,7 @@ static void do_start(void *_data) struct link_data *link = (struct link_data *) _data; link->forced_down = 0; - snmp_mtp_activate(link->udp.session); + snmp_mtp_activate(link->udp.session, link->udp.link_index); bsc_link_up(link); } @@ -140,7 +140,7 @@ static int udp_link_reset(struct link_data *link) { LOGP(DINP, LOGL_NOTICE, "Will restart SLTM transmission in %d seconds.\n", link->udp.reset_timeout); - snmp_mtp_deactivate(link->udp.session); + snmp_mtp_deactivate(link->udp.session, link->udp.link_index); bsc_link_down(link); /* restart the link in 90 seconds... to force a timeout on the BSC */ @@ -157,7 +157,7 @@ static int udp_link_write(struct link_data *link, struct msgb *msg) hdr = (struct udp_data_hdr *) msgb_push(msg, sizeof(*hdr)); hdr->format_type = UDP_FORMAT_SIMPLE_UDP; hdr->data_type = UDP_DATA_MSU_PRIO_0; - hdr->data_link_index = htons(1); + hdr->data_link_index = htons(link->udp.link_index); hdr->user_context = 0; hdr->data_length = htonl(msgb_l2len(msg)); diff --git a/src/links.c b/src/links.c index e56c475..e9bd5f6 100644 --- a/src/links.c +++ b/src/links.c @@ -99,6 +99,7 @@ int link_setup_start(struct bsc_data *bsc) bsc->first_link.bsc = bsc; bsc->first_link.pcap_fd = bsc->pcap_fd; bsc->first_link.udp.reset_timeout = bsc->udp_reset_timeout; + bsc->first_link.udp.link_index = 1; llist_add(&bsc->first_link.entry, &bsc->links); @@ -120,7 +121,8 @@ int link_setup_start(struct bsc_data *bsc) * SLTM and it begins a reset. Then we will take it up * again and do the usual business. */ - snmp_mtp_deactivate(bsc->first_link.udp.session); + snmp_mtp_deactivate(bsc->first_link.udp.session, + bsc->first_link.udp.link_index); bsc->start_timer.cb = start_rest; bsc->start_timer.data = bsc; bsc_schedule_timer(&bsc->start_timer, bsc->udp_reset_timeout, 0); diff --git a/src/snmp_mtp.c b/src/snmp_mtp.c index 3e69a64..f7ee225 100644 --- a/src/snmp_mtp.c +++ b/src/snmp_mtp.c @@ -101,12 +101,12 @@ struct snmp_mtp_session *snmp_mtp_session_create(char *host) return session; } -void snmp_mtp_deactivate(struct snmp_mtp_session *session) +void snmp_mtp_deactivate(struct snmp_mtp_session *session, int index) { - snmp_mtp_stop_c7_datalink(session, 1); + snmp_mtp_stop_c7_datalink(session, index); } -void snmp_mtp_activate(struct snmp_mtp_session *session) +void snmp_mtp_activate(struct snmp_mtp_session *session, int index) { - snmp_mtp_start_c7_datalink(session, 1); + snmp_mtp_start_c7_datalink(session, index); } |