aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Whyte <keith@rhizomatica.org>2022-10-15 01:08:53 +0100
committerKeith Whyte <keith@rhizomatica.org>2023-11-23 22:05:41 +0000
commit19c3532f21e0dc05215601edb7d852824c56992c (patch)
treeb2b9e4c022f7d84d2e3baa414216347ab1697183
parent12c63f584e7919803f492e4d72c8f858e1305c9f (diff)
LCLS: Add function trans_find_by_same_gcr()
-rw-r--r--include/osmocom/msc/transaction.h2
-rw-r--r--src/libmsc/transaction.c23
2 files changed, 25 insertions, 0 deletions
diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h
index aa529e494..9ac7d7c41 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -185,6 +185,8 @@ struct gsm_trans *trans_find_by_callref(const struct gsm_network *net, enum tran
struct gsm_trans *trans_find_by_sm_rp_mr(const struct gsm_network *net,
const struct vlr_subscr *vsub,
uint8_t sm_rp_mr);
+struct gsm_trans *trans_find_by_same_gcr(const struct gsm_network *net,
+ const struct gsm_trans *trans);
struct osmo_lcls *trans_lcls_compose(const struct gsm_trans *trans, bool use_lac);
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index 5ccb847fc..5fee4b4c8 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -112,6 +112,29 @@ struct gsm_trans *trans_find_by_sm_rp_mr(const struct gsm_network *net,
return NULL;
}
+/*! Find a transaction by global call reference
+ * \param[in] net Network in which we should search
+ * \param[in] trans Transaction containing GCR to search for
+ * \returns Matching transaction, if any
+ */
+struct gsm_trans *trans_find_by_same_gcr(const struct gsm_network *net,
+ const struct gsm_trans *trans)
+{
+ struct gsm_trans *trans_other;
+
+ llist_for_each_entry(trans_other, &net->trans_list, entry) {
+ /* don't report back the same transaction */
+ if (trans_other == trans)
+ continue;
+ /* don't consider any trans where GCR is not available */
+ if (trans_other->cc.lcls == NULL || trans_other->cc.lcls->gcr_available == false)
+ continue;
+ if (!memcmp(&trans_other->cc.lcls->gcr, &trans->cc.lcls->gcr, sizeof(trans->cc.lcls->gcr)))
+ return trans_other;
+ }
+ return NULL;
+}
+
struct osmo_lcls *trans_lcls_compose(const struct gsm_trans *trans, bool use_lac)
{
if (!trans) {