summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Kluchnikov <kluchnikovi@gmail.com>2017-08-23 17:53:37 +0300
committerIvan Kluchnikov <kluchnikovi@gmail.com>2017-08-23 17:53:37 +0300
commit8623c372ccd739b073c405bf475be3c3f0aab5e3 (patch)
treee848a269ff549f2279d58c44d80d45e3ea49fdd3
parentee594b10352dee30458d48fdc6d661a9b9576f76 (diff)
transaction: Add new function trans_find_by_lchan
Function returns transaction for given lchan. In case of active call hold procedure it could be two transactions in a list with links to the same lchan: * transaction for call on hold * transaction for active call. In this case function ignores transaction which was put on hold and returns active call transaction. Change-Id: I41171d4e61abfa5f2b01d6fbf4a0ac98073d97a9
-rw-r--r--openbsc/include/openbsc/transaction.h1
-rw-r--r--openbsc/src/libmsc/transaction.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h
index 5b686d1ca..234541caa 100644
--- a/openbsc/include/openbsc/transaction.h
+++ b/openbsc/include/openbsc/transaction.h
@@ -77,6 +77,7 @@ struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
uint32_t callref);
struct gsm_trans *trans_find_by_msgref(struct gsm_subscriber_connection *conn,
uint8_t msg_ref);
+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/transaction.c b/openbsc/src/libmsc/transaction.c
index efe0d8251..0c1d08db1 100644
--- a/openbsc/src/libmsc/transaction.c
+++ b/openbsc/src/libmsc/transaction.c
@@ -77,6 +77,32 @@ struct gsm_trans *trans_find_by_msgref(struct gsm_subscriber_connection *conn,
return NULL;
}
+struct gsm_trans *trans_find_by_lchan(struct gsm_lchan *lchan)
+{
+ struct gsm_trans *temp;
+ struct gsm_trans *trans = NULL;
+ struct gsm_network *net = lchan->ts->trx->bts->network;
+
+ llist_for_each_entry(temp, &net->trans_list, entry) {
+ if (!temp->conn)
+ continue;
+ if (temp->conn->lchan != lchan && temp->conn->ho_lchan != lchan)
+ continue;
+ if (!trans) {
+ trans = temp;
+ if (trans->tch_recv)
+ break;
+ else
+ continue;
+ }
+ if (temp->tch_recv) {
+ trans = temp;
+ break;
+ }
+ }
+ return trans;
+}
+
struct gsm_trans *trans_alloc(struct gsm_network *net,
struct gsm_subscriber *subscr,
uint8_t protocol, uint8_t trans_id,