aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/bsc_sccp.h12
-rw-r--r--src/Makefile.am2
-rw-r--r--src/bsc_sccp.c70
-rw-r--r--src/main.c41
4 files changed, 83 insertions, 42 deletions
diff --git a/include/bsc_sccp.h b/include/bsc_sccp.h
index c8d7a90..72bfa47 100644
--- a/include/bsc_sccp.h
+++ b/include/bsc_sccp.h
@@ -22,8 +22,15 @@
#ifndef bsc_sccp_h
#define bsc_sccp_h
+#include <inttypes.h>
+
+#include <osmocore/linuxlist.h>
+#include <osmocore/timer.h>
+
#include <osmocore/protocol/gsm_08_08.h>
+#include <osmocom/sccp/sccp.h>
+
/*
* One SCCP connection.
* Use for connection tracking and fixups...
@@ -51,4 +58,9 @@ struct active_sccp_con {
int sls;
};
+struct active_sccp_con *find_con_by_src_ref(struct sccp_source_reference *src_ref);
+struct active_sccp_con *find_con_by_src_dest_ref(struct sccp_source_reference *src_ref,
+ struct sccp_source_reference *dst_ref);
+unsigned int sls_for_src_ref(struct sccp_source_reference *ref);
+
#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index a694623..186c97e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,7 +10,7 @@ mgcp_mgw_LDADD = $(LAFORGE_LIBS) $(NEXUSWARE_C7_LIBS) $(NEXUSWARE_UNIPORTE_LIBS)
$(LIBOSMOVTY_LIBS) $(LIBOSMOCORE_LIBS) -lpthread
cellmgr_ng_SOURCES = main.c mtp_layer3.c thread.c input/ipaccess.c pcap.c \
- bss_patch.c bssap_sccp.c \
+ bss_patch.c bssap_sccp.c bsc_sccp.c \
msc_conn.c link_udp.c snmp_mtp.c debug.c vty_interface.c
cellmgr_ng_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) $(NEXUSWARE_C7_LIBS) \
-lpthread -lnetsnmp -lcrypto
diff --git a/src/bsc_sccp.c b/src/bsc_sccp.c
new file mode 100644
index 0000000..a10a4b6
--- /dev/null
+++ b/src/bsc_sccp.c
@@ -0,0 +1,70 @@
+/* routines to track connections */
+/*
+ * (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 General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include "bsc_sccp.h"
+#include "bsc_data.h"
+
+#include <string.h>
+
+extern struct bsc_data bsc;
+
+struct active_sccp_con *find_con_by_src_ref(struct sccp_source_reference *src_ref)
+{
+ struct active_sccp_con *con;
+
+ /* it is quite normal to not find this one */
+ if (!src_ref)
+ return NULL;
+
+ llist_for_each_entry(con, &bsc.sccp_connections, entry) {
+ if (memcmp(&con->src_ref, src_ref, sizeof(*src_ref)) == 0)
+ return con;
+ }
+
+ return NULL;
+}
+
+struct active_sccp_con *find_con_by_src_dest_ref(struct sccp_source_reference *src_ref,
+ struct sccp_source_reference *dst_ref)
+{
+ struct active_sccp_con *con;
+
+ llist_for_each_entry(con, &bsc.sccp_connections, entry) {
+ if (memcmp(src_ref, &con->src_ref, sizeof(*src_ref)) == 0 &&
+ memcmp(dst_ref, &con->dst_ref, sizeof(*dst_ref)) == 0) {
+ return con;
+ }
+ }
+
+ return NULL;
+}
+
+unsigned int sls_for_src_ref(struct sccp_source_reference *ref)
+{
+ struct active_sccp_con *con;
+
+ con = find_con_by_src_ref(ref);
+ if (!con)
+ return 13;
+ return con->sls;
+}
+
diff --git a/src/main.c b/src/main.c
index 948d71b..4e97aec 100644
--- a/src/main.c
+++ b/src/main.c
@@ -382,47 +382,6 @@ static struct active_sccp_con *find_con_by_dest_ref(struct sccp_source_reference
return NULL;
}
-static struct active_sccp_con *find_con_by_src_ref(struct sccp_source_reference *src_ref)
-{
- struct active_sccp_con *con;
-
- /* it is quite normal to not find this one */
- if (!src_ref)
- return NULL;
-
- llist_for_each_entry(con, &bsc.sccp_connections, entry) {
- if (memcmp(&con->src_ref, src_ref, sizeof(*src_ref)) == 0)
- return con;
- }
-
- return NULL;
-}
-
-static struct active_sccp_con *find_con_by_src_dest_ref(struct sccp_source_reference *src_ref,
- struct sccp_source_reference *dst_ref)
-{
- struct active_sccp_con *con;
-
- llist_for_each_entry(con, &bsc.sccp_connections, entry) {
- if (memcmp(src_ref, &con->src_ref, sizeof(*src_ref)) == 0 &&
- memcmp(dst_ref, &con->dst_ref, sizeof(*dst_ref)) == 0) {
- return con;
- }
- }
-
- return NULL;
-}
-
-unsigned int sls_for_src_ref(struct sccp_source_reference *ref)
-{
- struct active_sccp_con *con;
-
- con = find_con_by_src_ref(ref);
- if (!con)
- return 13;
- return con->sls;
-}
-
static void send_rlc_to_bsc(unsigned int sls, struct sccp_source_reference *src, struct sccp_source_reference *dst)
{
struct msgb *msg;