From 35948551fd07441af1fa3a9d4985b08fdbdc7a33 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 30 Sep 2010 17:30:50 +0800 Subject: bsc: Move more sccp code into the bsc_sccp.c --- include/bsc_sccp.h | 2 ++ src/bsc_sccp.c | 33 +++++++++++++++++++++++++++++++++ src/main.c | 28 ---------------------------- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/include/bsc_sccp.h b/include/bsc_sccp.h index 72bfa47..aed5daa 100644 --- a/include/bsc_sccp.h +++ b/include/bsc_sccp.h @@ -58,6 +58,8 @@ struct active_sccp_con { int sls; }; +void free_con(struct active_sccp_con *con); +struct active_sccp_con *find_con_by_dest_ref(struct sccp_source_reference *ref); 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); diff --git a/src/bsc_sccp.c b/src/bsc_sccp.c index a10a4b6..c588029 100644 --- a/src/bsc_sccp.c +++ b/src/bsc_sccp.c @@ -23,10 +23,33 @@ #include "bsc_sccp.h" #include "bsc_data.h" +#include + +#include + #include extern struct bsc_data bsc; +struct active_sccp_con *find_con_by_dest_ref(struct sccp_source_reference *ref) +{ + struct active_sccp_con *con; + + if (!ref) { + LOGP(DINP, LOGL_ERROR, "Dest Reference is NULL. No connection found.\n"); + return NULL; + } + + llist_for_each_entry(con, &bsc.sccp_connections, entry) { + if (memcmp(&con->dst_ref, ref, sizeof(*ref)) == 0) + return con; + } + + LOGP(DINP, LOGL_ERROR, "No connection fond with: 0x%x as dest\n", sccp_src_ref_to_int(ref)); + return NULL; +} + + struct active_sccp_con *find_con_by_src_ref(struct sccp_source_reference *src_ref) { struct active_sccp_con *con; @@ -68,3 +91,13 @@ unsigned int sls_for_src_ref(struct sccp_source_reference *ref) return con->sls; } +/* + * remove data + */ +void free_con(struct active_sccp_con *con) +{ + llist_del(&con->entry); + bsc_del_timer(&con->rlc_timeout); + talloc_free(con); +} + diff --git a/src/main.c b/src/main.c index 4e97aec..8005666 100644 --- a/src/main.c +++ b/src/main.c @@ -214,16 +214,6 @@ static void handle_local_sccp(struct mtp_link *link, struct msgb *inpt, struct s return; } -/* - * remove data - */ -static void free_con(struct active_sccp_con *con) -{ - llist_del(&con->entry); - bsc_del_timer(&con->rlc_timeout); - talloc_free(con); -} - static void clear_connections(struct bsc_data *bsc) { struct active_sccp_con *tmp, *con; @@ -364,24 +354,6 @@ void bsc_link_up(struct link_data *data) /** * update the connection state and helpers below */ -static struct active_sccp_con *find_con_by_dest_ref(struct sccp_source_reference *ref) -{ - struct active_sccp_con *con; - - if (!ref) { - LOGP(DINP, LOGL_ERROR, "Dest Reference is NULL. No connection found.\n"); - return NULL; - } - - llist_for_each_entry(con, &bsc.sccp_connections, entry) { - if (memcmp(&con->dst_ref, ref, sizeof(*ref)) == 0) - return con; - } - - LOGP(DINP, LOGL_ERROR, "No connection fond with: 0x%x as dest\n", sccp_src_ref_to_int(ref)); - return NULL; -} - static void send_rlc_to_bsc(unsigned int sls, struct sccp_source_reference *src, struct sccp_source_reference *dst) { struct msgb *msg; -- cgit v1.2.3