lynxis lazus has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-iuh/+/38944?usp=email )
Change subject: iu_client: use new struct osmo_rnc_id
......................................................................
iu_client: use new struct osmo_rnc_id
The osmo_rnc_id is a libosmocore type which can be used across
different libraries.
In preparation to notify the SGSN when a new RAC/LAC is learned.
Change-Id: Id8db70bd3d63b0533b637402a91757eb677c38b7
---
M src/iu_client.c
1 file changed, 18 insertions(+), 18 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/44/38944/1
diff --git a/src/iu_client.c b/src/iu_client.c
index ea5ebe8..3fc29bd 100644
--- a/src/iu_client.c
+++ b/src/iu_client.c
@@ -73,7 +73,7 @@
struct ranap_iu_rnc {
struct llist_head entry;
- uint16_t rnc_id;
+ struct osmo_rnc_id rnc_id;
struct osmo_sccp_addr sccp_addr;
/* A list of struct iu_lac_rac_entry */
@@ -209,18 +209,18 @@
}
}
-static struct ranap_iu_rnc *iu_rnc_alloc(uint16_t rnc_id, struct osmo_sccp_addr *addr)
+static struct ranap_iu_rnc *iu_rnc_alloc(const struct osmo_rnc_id *rnc_id, struct
osmo_sccp_addr *addr)
{
struct ranap_iu_rnc *rnc = talloc_zero(talloc_iu_ctx, struct ranap_iu_rnc);
OSMO_ASSERT(rnc);
INIT_LLIST_HEAD(&rnc->lac_rac_list);
- rnc->rnc_id = rnc_id;
+ rnc->rnc_id = *rnc_id;
rnc->sccp_addr = *addr;
llist_add(&rnc->entry, &rnc_list);
- LOGPIU(LOGL_NOTICE, "New RNC %d at %s\n", rnc->rnc_id,
osmo_sccp_addr_dump(addr));
+ LOGPIU(LOGL_NOTICE, "New RNC %s at %s\n",
osmo_rnc_id_name(&rnc->rnc_id), osmo_sccp_addr_dump(addr));
return rnc;
}
@@ -253,11 +253,11 @@
return false;
}
-static struct ranap_iu_rnc *iu_rnc_id_find(uint16_t rnc_id)
+static struct ranap_iu_rnc *iu_rnc_id_find(struct osmo_rnc_id *rnc_id)
{
struct ranap_iu_rnc *rnc;
llist_for_each_entry(rnc, &rnc_list, entry) {
- if (rnc->rnc_id == rnc_id)
+ if (!osmo_rnc_id_cmp(&rnc->rnc_id, rnc_id))
return rnc;
}
return NULL;
@@ -270,7 +270,7 @@
return !strcmp(buf, osmo_sccp_addr_dump(b));
}
-static struct ranap_iu_rnc *iu_rnc_register(uint16_t rnc_id, uint16_t lac,
+static struct ranap_iu_rnc *iu_rnc_register(struct osmo_rnc_id *rnc_id, uint16_t lac,
uint8_t rac, struct osmo_sccp_addr *addr)
{
struct ranap_iu_rnc *rnc;
@@ -282,8 +282,8 @@
if (rnc) {
if (!same_sccp_addr(&rnc->sccp_addr, addr)) {
- LOGPIU(LOGL_NOTICE, "RNC %u changed its SCCP addr to %s (LAC=%u RAC=%u)\n",
- rnc_id, osmo_sccp_addr_dump(addr), lac, rac);
+ LOGPIU(LOGL_NOTICE, "RNC %s changed its SCCP addr to %s (LAC=%u RAC=%u)\n",
+ osmo_rnc_id_name(rnc_id), osmo_sccp_addr_dump(addr), lac, rac);
rnc->sccp_addr = *addr;
}
} else
@@ -294,16 +294,16 @@
if (old_rnc && old_rnc != rnc) {
/* LAC,RAC already exists in a different RNC */
- LOGPIU(LOGL_NOTICE, "LAC %u RAC %u moved from RNC %u %s",
- lac, rac, old_rnc->rnc_id, osmo_sccp_addr_dump(&old_rnc->sccp_addr));
- LOGPIUC(LOGL_NOTICE, " to RNC %u %s\n",
- rnc->rnc_id, osmo_sccp_addr_dump(&rnc->sccp_addr));
+ LOGPIU(LOGL_NOTICE, "LAC %u RAC %u moved from RNC %s %s",
+ lac, rac, osmo_rnc_id_name(&old_rnc->rnc_id),
osmo_sccp_addr_dump(&old_rnc->sccp_addr));
+ LOGPIUC(LOGL_NOTICE, " to RNC %s %s\n",
+ osmo_rnc_id_name(&rnc->rnc_id), osmo_sccp_addr_dump(&rnc->sccp_addr));
llist_del(&lre->entry);
llist_add(&lre->entry, &rnc->lac_rac_list);
} else if (!old_rnc) {
/* LAC,RAC not recorded yet */
- LOGPIU(LOGL_NOTICE, "RNC %u: new LAC %u RAC %u\n", rnc_id, lac, rac);
+ LOGPIU(LOGL_NOTICE, "RNC %s: new LAC %u RAC %u\n", osmo_rnc_id_name(rnc_id),
lac, rac);
lre = talloc_zero(rnc, struct iu_lac_rac_entry);
lre->lac = lac;
lre->rac = rac;
@@ -376,7 +376,7 @@
return osmo_sccp_user_sap_down(g_scu, &prim->oph);
}
-static int iu_grnc_id_parse(struct iu_grnc_id *dst, struct RANAP_GlobalRNC_ID *src)
+static int iu_grnc_id_parse(struct osmo_rnc_id *dst, struct RANAP_GlobalRNC_ID *src)
{
/* The size is coming from arbitrary sender, check it gracefully */
if (src->pLMNidentity.size != 3) {
@@ -411,7 +411,7 @@
{
struct new_ue_conn_ctx *new_ctx = ctx;
struct gprs_ra_id ra_id;
- struct iu_grnc_id grnc_id;
+ struct osmo_rnc_id rnc_id = {};
uint16_t sai;
struct ranap_ue_conn_ctx *ue;
struct msgb *msg = msgb_alloc(256, "RANAP->NAS");
@@ -426,7 +426,7 @@
ra_id.rac = asn1str_to_u8(&ies->rac);
}
- if (iu_grnc_id_parse(&grnc_id, &ies->globalRNC_ID) != 0) {
+ if (iu_grnc_id_parse(&rnc_id, &ies->globalRNC_ID) != 0) {
LOGPIU(LOGL_ERROR,
"Failed to parse RANAP Global-RNC-ID IE\n");
return -1;
@@ -437,7 +437,7 @@
memcpy(msgb_gmmh(msg), ies->nas_pdu.buf, ies->nas_pdu.size);
/* Make sure we know the RNC Id and LAC+RAC coming in on this connection. */
- rnc = iu_rnc_register(grnc_id.rnc_id, ra_id.lac, ra_id.rac,
&new_ctx->sccp_addr);
+ rnc = iu_rnc_register(&rnc_id, ra_id.lac, ra_id.rac, &new_ctx->sccp_addr);
ue = ue_conn_ctx_alloc(rnc, new_ctx->conn_id);
OSMO_ASSERT(ue);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-iuh/+/38944?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: Id8db70bd3d63b0533b637402a91757eb677c38b7
Gerrit-Change-Number: 38944
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>