lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-iuh/+/38947?usp=email )

 (

10 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: iu_client: add a new event NEW_AREA
......................................................................

iu_client: add a new event NEW_AREA

When the IU client learns a new LAC/RAC or
the LAC/RAC has moved from one RNC to another RNC,
inform the user via an event.

Allows the SGSN to track RACs which uses Iu.

Change-Id: I8b1b8c58bf72b00e2705ca87a89a91481bac3470
---
M TODO-RELEASE
M include/osmocom/ranap/iu_client.h
M src/iu_client.c
3 files changed, 39 insertions(+), 2 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  Jenkins Builder: Verified




diff --git a/TODO-RELEASE b/TODO-RELEASE
index ac52f44..b583f7e 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -10,3 +10,4 @@
 libosmo-ranap add API         ranap_ran_rx_co_decode2()
 libosmo-ranap deprecate API   ranap_ran_rx_co_decode()
 libosmo-ranap  add API                 iu_client.h: add 
ranap_iu_page_cs2/ranap_iu_page_ps2
+libosmo-ranap  new event               RANAP_IU_EVENT_NEW_AREA
diff --git a/include/osmocom/ranap/iu_client.h 
b/include/osmocom/ranap/iu_client.h
index 86ae874..465a17d 100644
--- a/include/osmocom/ranap/iu_client.h
+++ b/include/osmocom/ranap/iu_client.h
@@ -38,11 +38,26 @@
        struct osmo_timer_list release_timeout;
 };

+enum ranap_iu_event_new_area_type {
+       RANAP_IU_NEW_LAC,
+       RANAP_IU_NEW_RAC,
+};
+
+struct ranap_iu_event_new_area {
+       const struct osmo_rnc_id *rnc_id;
+       enum ranap_iu_event_new_area_type cell_type;
+       union {
+               const struct osmo_location_area_id *lai;
+               const struct osmo_routing_area_id *rai;
+       } u;
+};
+
 enum ranap_iu_event_type {
        RANAP_IU_EVENT_RAB_ASSIGN,
        RANAP_IU_EVENT_SECURITY_MODE_COMPLETE,
        RANAP_IU_EVENT_IU_RELEASE, /* An actual Iu Release message was received 
*/
        RANAP_IU_EVENT_LINK_INVALIDATED, /* A SUA link was lost or closed down 
*/
+       RANAP_IU_EVENT_NEW_AREA, /* Either a new LAC/RAC has been detected */
 };
 
 extern const struct value_string ranap_iu_event_type_names[];
diff --git a/src/iu_client.c b/src/iu_client.c
index ce3030e..90fd1dc 100644
--- a/src/iu_client.c
+++ b/src/iu_client.c
@@ -116,6 +116,7 @@
        OSMO_VALUE_STRING(RANAP_IU_EVENT_SECURITY_MODE_COMPLETE),
        OSMO_VALUE_STRING(RANAP_IU_EVENT_IU_RELEASE),
        OSMO_VALUE_STRING(RANAP_IU_EVENT_LINK_INVALIDATED),
+       OSMO_VALUE_STRING(RANAP_IU_EVENT_NEW_AREA),
        { 0, NULL }
 };

@@ -126,7 +127,7 @@
        if (!global_iu_event_cb)
                return 0;

-       if (!ue_ctx->notification)
+       if (ue_ctx && !ue_ctx->notification)
                return 0;

        LOGPIU(LOGL_DEBUG, "Submit Iu event to upper layer: %s\n", 
ranap_iu_event_type_str(type));
@@ -134,6 +135,25 @@
        return global_iu_event_cb(ue_ctx, type, data);
 }

+static void global_iu_event_new_area(const struct osmo_rnc_id *rnc_id, const 
struct osmo_routing_area_id *rai)
+{
+       struct ranap_iu_event_new_area new_area = (struct 
ranap_iu_event_new_area) {
+           .rnc_id = rnc_id,
+           .cell_type = RANAP_IU_NEW_RAC
+       };
+
+       if (rai->rac == OSMO_RESERVED_RAC) {
+               new_area.cell_type = RANAP_IU_NEW_LAC;
+               new_area.u.lai = &rai->lac;
+       } else {
+               new_area.cell_type = RANAP_IU_NEW_RAC;
+               new_area.u.rai = rai;
+       }
+
+       global_iu_event(NULL, RANAP_IU_EVENT_NEW_AREA, &new_area);
+}
+
+
 static void ue_conn_ctx_release_timeout_cb(void *ctx_)
 {
        struct ranap_ue_conn_ctx *ctx = (struct ranap_ue_conn_ctx *)ctx_;
@@ -330,12 +350,14 @@

                llist_del(&lre->entry);
                llist_add(&lre->entry, &rnc->lac_rac_list);
+               global_iu_event_new_area(rnc_id, rai);
        } else if (!old_rnc) {
                /* LAC, RAC not recorded yet */
                LOGPIU(LOGL_NOTICE, "RNC %s: new LAC/RAC %s\n", 
osmo_rnc_id_name(rnc_id), osmo_rai_name2(rai));
                lre = talloc_zero(rnc, struct iu_lac_rac_entry);
                lre->rai = *rai;
                llist_add(&lre->entry, &rnc->lac_rac_list);
+               global_iu_event_new_area(rnc_id, rai);
        }
        /* else, LAC,RAC already recorded with the current RNC. */

@@ -959,7 +981,6 @@
        return paged;
 }

-
 /***********************************************************************
  *
  ***********************************************************************/

--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/38947?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I8b1b8c58bf72b00e2705ca87a89a91481bac3470
Gerrit-Change-Number: 38947
Gerrit-PatchSet: 20
Gerrit-Owner: lynxis lazus <lyn...@fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lyn...@fe80.eu>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>

Reply via email to