aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Kluchnikov <kluchnikovi@gmail.com>2017-09-13 13:55:23 +0300
committerIvan Kluchnikov <kluchnikovi@gmail.com>2017-11-24 15:47:23 +0300
commit0ca2faafe03fd80baedd380d8b627fd59c1565ce (patch)
tree7a5ca5f6f9ad53439dcc14927b290d1d6cbcf4c6
parent131376c76fff758e4140cf91fe708090049278a8 (diff)
transaction: Add new function trans_find_by_lchan
-rw-r--r--openbsc/include/openbsc/transaction.h1
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c15
-rw-r--r--openbsc/src/libmsc/transaction.c18
3 files changed, 22 insertions, 12 deletions
diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h
index 9a87d04e4..624db7418 100644
--- a/openbsc/include/openbsc/transaction.h
+++ b/openbsc/include/openbsc/transaction.h
@@ -65,6 +65,7 @@ struct gsm_trans *trans_find_by_id(struct gsm_subscriber_connection *conn,
uint8_t proto, uint8_t trans_id);
struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
uint32_t callref);
+struct gsm_trans *trans_find_by_lchan(struct gsm_lchan *lchan);
struct gsm_trans *trans_alloc(struct gsm_network *net,
struct gsm_subscriber *subscr,
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 10d5fdcf3..d34f64e4d 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -3397,19 +3397,10 @@ static int tch_rtp_connect(struct gsm_network *net, void *arg)
static int tch_rtp_signal(struct gsm_lchan *lchan, int signal)
{
- struct gsm_network *net;
- struct gsm_trans *tmp, *trans = NULL;
-
- net = lchan->ts->trx->bts->network;
- llist_for_each_entry(tmp, &net->trans_list, entry) {
- if (!tmp->conn)
- continue;
- if (tmp->conn->lchan != lchan && tmp->conn->ho_lchan != lchan)
- continue;
- trans = tmp;
- break;
- }
+ struct gsm_network *net = lchan->ts->trx->bts->network;
+ struct gsm_trans *trans;
+ trans = trans_find_by_lchan(lchan);
if (!trans) {
LOGP(DMNCC, LOGL_ERROR, "%s IPA abis signal but no transaction.\n",
gsm_lchan_name(lchan));
diff --git a/openbsc/src/libmsc/transaction.c b/openbsc/src/libmsc/transaction.c
index 4b46e22ae..053716dcd 100644
--- a/openbsc/src/libmsc/transaction.c
+++ b/openbsc/src/libmsc/transaction.c
@@ -61,6 +61,24 @@ struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
return NULL;
}
+struct gsm_trans *trans_find_by_lchan(struct gsm_lchan *lchan)
+{
+ struct gsm_trans *tmp;
+ struct gsm_trans *trans = NULL;
+ struct gsm_network *net = lchan->ts->trx->bts->network;
+
+ llist_for_each_entry(tmp, &net->trans_list, entry) {
+ if (!tmp->conn)
+ continue;
+ if (tmp->conn->lchan != lchan && tmp->conn->ho_lchan != lchan)
+ continue;
+ trans = tmp;
+ break;
+ }
+
+ return trans;
+}
+
struct gsm_trans *trans_alloc(struct gsm_network *net,
struct gsm_subscriber *subscr,
uint8_t protocol, uint8_t trans_id,