From 8bb11c90fcb333de65f5bdbbe0787ba93a1c9a82 Mon Sep 17 00:00:00 2001 From: Ivan Kluchnikov Date: Mon, 21 Dec 2015 12:05:56 +0300 Subject: trans: Add new parameter message reference for SMS and function for finding transaction by this reference --- openbsc/include/openbsc/transaction.h | 5 +++++ openbsc/src/libmsc/transaction.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h index 6890f14ae..1cf0874f7 100644 --- a/openbsc/include/openbsc/transaction.h +++ b/openbsc/include/openbsc/transaction.h @@ -32,6 +32,9 @@ struct gsm_trans { /* reference from MNCC or other application */ uint32_t callref; + /* SMS RP message reference */ + uint8_t msg_ref; + /* if traffic channel receive was requested */ int tch_recv; @@ -70,6 +73,8 @@ 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_msgref(struct gsm_subscriber_connection *conn, + uint8_t msg_ref); 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 dba4bed17..3b10fd42a 100644 --- a/openbsc/src/libmsc/transaction.c +++ b/openbsc/src/libmsc/transaction.c @@ -61,6 +61,22 @@ struct gsm_trans *trans_find_by_callref(struct gsm_network *net, return NULL; } +struct gsm_trans *trans_find_by_msgref(struct gsm_subscriber_connection *conn, + uint8_t msg_ref) +{ + struct gsm_trans *trans; + struct gsm_network *net = conn->bts->network; + struct gsm_subscriber *subscr = conn->subscr; + + llist_for_each_entry(trans, &net->trans_list, entry) { + if (trans->subscr == subscr && + trans->protocol == GSM48_PDISC_SMS && + trans->msg_ref == msg_ref) + return trans; + } + return NULL; +} + struct gsm_trans *trans_alloc(struct gsm_network *net, struct gsm_subscriber *subscr, uint8_t protocol, uint8_t trans_id, -- cgit v1.2.3