Max has uploaded this change for review. ( https://gerrit.osmocom.org/11746


Change subject: Store subscriber's cell identity
......................................................................

Store subscriber's cell identity

It's defined similar to LAC and could be potentially useful for
constructing GCR for LCLS.

Change-Id: I8544c30ea800ce8356a227b03a8b21bf3252be7e
Related: OS#2487
---
M include/osmocom/msc/gsm_data.h
M include/osmocom/msc/osmo_msc.h
M src/libmsc/a_iface_bssap.c
M src/libmsc/iucs.c
M src/libmsc/subscr_conn.c
M tests/msc_vlr/msc_vlr_test_rest.c
M tests/msc_vlr/msc_vlr_tests.c
7 files changed, 18 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/46/11746/1

diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 085248c..213ee02 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -127,7 +127,8 @@
        /* connected via 2G or 3G? */
        enum ran_type via_ran;

-       uint16_t lac;
+       uint16_t lac; /* 3GPP TS 24.008 §10.5.1.3 */
+       uint16_t ci;  /* 3GPP TS 24.008 §10.5.1.1 */
        struct gsm_encr encr;

        /* "Temporary" storage for the case the VLR asked for Cipher Mode 
Command, but the MSC still
diff --git a/include/osmocom/msc/osmo_msc.h b/include/osmocom/msc/osmo_msc.h
index 3ffb65c..e0b4f46 100644
--- a/include/osmocom/msc/osmo_msc.h
+++ b/include/osmocom/msc/osmo_msc.h
@@ -48,7 +48,7 @@
 };

 struct gsm_subscriber_connection *msc_subscr_conn_alloc(struct gsm_network 
*network,
-                                                       enum ran_type via_ran, 
uint16_t lac);
+                                                       enum ran_type via_ran, 
uint16_t lac, uint16_t ci);

 void msc_subscr_conn_update_id(struct gsm_subscriber_connection *conn,
                               enum complete_layer3_type from, const char *id);
diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index 282fd73..5e7db63 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -48,13 +48,14 @@
 /* Allocate a new subscriber connection */
 static struct gsm_subscriber_connection *subscr_conn_allocate_a(const struct 
a_conn_info *a_conn_info,
                                                                struct 
gsm_network *network,
-                                                               uint16_t lac, 
struct osmo_sccp_user *scu, int conn_id)
+                                                               uint16_t lac, 
uint16_t ci,
+                                                               struct 
osmo_sccp_user *scu, int conn_id)
 {
        struct gsm_subscriber_connection *conn;

-       LOGP(DMSC, LOGL_DEBUG, "Allocating A-Interface subscriber conn: lac %i, 
conn_id %i\n", lac, conn_id);
+       LOGP(DMSC, LOGL_DEBUG, "Allocating A-Interface subscriber conn: lac %i, 
ci %i, conn_id %i\n", lac, ci, conn_id);

-       conn = msc_subscr_conn_alloc(network, RAN_GERAN_A, lac);
+       conn = msc_subscr_conn_alloc(network, RAN_GERAN_A, lac, ci);
        if (!conn)
                return NULL;

@@ -257,7 +258,7 @@
                              struct msgb *msg, struct tlv_parsed *tp)
 {
        struct gsm0808_cell_id_list2 cil;
-       uint16_t lac = 0;
+       uint16_t lac = 0, ci = 0;
        uint8_t data_length;
        const uint8_t *data;
        int rc;
@@ -296,11 +297,13 @@
                        return -EINVAL;
                }
                lac = id->lai.lac;
+               ci = id->cell_identity;
                break;
        }
        case CELL_IDENT_LAC_AND_CI: {
                const struct osmo_lac_and_ci_id *id = 
&cil.id_list[0].lac_and_ci;
                lac = id->lac;
+               ci = id->ci;
                break;
        }
        case CELL_IDENT_LAI_AND_LAC: {
@@ -317,7 +320,8 @@
                lac = cil.id_list[0].lac;
                break;

-       case CELL_IDENT_CI:
+       case CELL_IDENT_CI: /* FIXME: why LAC is mandatory is we have CI? */
+               ci = cil.id_list[0].ci;
        case CELL_IDENT_NO_CELL:
        case CELL_IDENT_BSS:
                LOGP(DBSSAP, LOGL_ERROR,
@@ -342,7 +346,7 @@
        }

        /* Create new subscriber context */
-       conn = subscr_conn_allocate_a(a_conn_info, network, lac, scu, 
a_conn_info->conn_id);
+       conn = subscr_conn_allocate_a(a_conn_info, network, lac, ci, scu, 
a_conn_info->conn_id);

        /* Handover location update to the MSC code */
        rc = msc_compl_l3(conn, msg, 0);
diff --git a/src/libmsc/iucs.c b/src/libmsc/iucs.c
index a3092f8..0fe7e78 100644
--- a/src/libmsc/iucs.c
+++ b/src/libmsc/iucs.c
@@ -57,7 +57,7 @@
        DEBUGP(DIUCS, "Allocating IuCS subscriber conn: lac %d, conn_id %" 
PRIx32 "\n",
               lac, ue->conn_id);

-       conn = msc_subscr_conn_alloc(network, RAN_UTRAN_IU, lac);
+       conn = msc_subscr_conn_alloc(network, RAN_UTRAN_IU, lac, 0); /* FIXME: 
is there equivalent for CI? */
        if (!conn)
                return NULL;

diff --git a/src/libmsc/subscr_conn.c b/src/libmsc/subscr_conn.c
index e6fa7e1..6bbbeed 100644
--- a/src/libmsc/subscr_conn.c
+++ b/src/libmsc/subscr_conn.c
@@ -628,7 +628,7 @@
  * conn. As long as the FSM is waiting for responses from the subscriber, it 
will itself hold a use count
  * on the conn. */
 struct gsm_subscriber_connection *msc_subscr_conn_alloc(struct gsm_network 
*network,
-                                                       enum ran_type via_ran, 
uint16_t lac)
+                                                       enum ran_type via_ran, 
uint16_t lac, uint16_t ci)
 {
        struct gsm_subscriber_connection *conn;
        struct osmo_fsm_inst *fi;
@@ -649,6 +649,7 @@
                .network = network,
                .via_ran = via_ran,
                .lac = lac,
+               .ci = ci,
                .fi = fi,
        };

diff --git a/tests/msc_vlr/msc_vlr_test_rest.c 
b/tests/msc_vlr/msc_vlr_test_rest.c
index 247e7ae..5a50420 100644
--- a/tests/msc_vlr/msc_vlr_test_rest.c
+++ b/tests/msc_vlr/msc_vlr_test_rest.c
@@ -31,7 +31,7 @@
        EXPECT_ACCEPTED(false);

        btw("freshly allocated conn");
-       g_conn = msc_subscr_conn_alloc(net, RAN_GERAN_A, 123);
+       g_conn = msc_subscr_conn_alloc(net, RAN_GERAN_A, 123, 0);
        EXPECT_ACCEPTED(false);

        btw("conn_fsm present, in state NEW");
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index 1192cf2..f887837 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -191,7 +191,7 @@
 struct gsm_subscriber_connection *conn_new(void)
 {
        struct gsm_subscriber_connection *conn;
-       conn = msc_subscr_conn_alloc(net, rx_from_ran, 23);
+       conn = msc_subscr_conn_alloc(net, rx_from_ran, 23, 0);
        if (conn->via_ran == RAN_UTRAN_IU) {
                struct ranap_ue_conn_ctx *ue_ctx = talloc_zero(conn, struct 
ranap_ue_conn_ctx);
                *ue_ctx = (struct ranap_ue_conn_ctx){

--
To view, visit https://gerrit.osmocom.org/11746
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8544c30ea800ce8356a227b03a8b21bf3252be7e
Gerrit-Change-Number: 11746
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msur...@sysmocom.de>

Reply via email to