This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22382 ) Change subject: gsm: Introduce osmo_{rai,cgi_ps}_cmp() APIs ...................................................................... gsm: Introduce osmo_{rai,cgi_ps}_cmp() APIs Similar to what we already have for other data types, such as osmo_lai_cmp or osmo_cgi_cmp. Change-Id: I00e329bc5be8674b30267dec238e7656ddfc21db --- M TODO-RELEASE M include/osmocom/gsm/gsm23003.h M src/gsm/gsm23003.c M src/gsm/libosmogsm.map 4 files changed, 39 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/TODO-RELEASE b/TODO-RELEASE index 501f25b..e1b1507 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -13,3 +13,4 @@ libosmovty ABI change struct cmd_element: add a field for program specific attributes libosmovty ABI change struct vty_app_info: optional program specific attributes description libosmoctrl ABI change struct ctrl_handle changed size (new field "reply_cb" at the end) +libosmogsm new API osmo_rai_cmp(), osmo_cgi_ps_cmp() diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h index fbe0ca0..487379a 100644 --- a/include/osmocom/gsm/gsm23003.h +++ b/include/osmocom/gsm/gsm23003.h @@ -157,7 +157,9 @@ int osmo_mnc_cmp(uint16_t a_mnc, bool a_mnc_3_digits, uint16_t b_mnc, bool b_mnc_3_digits); int osmo_plmn_cmp(const struct osmo_plmn_id *a, const struct osmo_plmn_id *b); int osmo_lai_cmp(const struct osmo_location_area_id *a, const struct osmo_location_area_id *b); +int osmo_rai_cmp(const struct osmo_routing_area_id *a, const struct osmo_routing_area_id *b); int osmo_cgi_cmp(const struct osmo_cell_global_id *a, const struct osmo_cell_global_id *b); +int osmo_cgi_ps_cmp(const struct osmo_cell_global_id_ps *a, const struct osmo_cell_global_id_ps *b); int osmo_gen_home_network_domain(char *out, const struct osmo_plmn_id *plmn); int osmo_parse_home_network_domain(struct osmo_plmn_id *out, const char *in); diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c index ae498fa..c2b3de8 100644 --- a/src/gsm/gsm23003.c +++ b/src/gsm/gsm23003.c @@ -565,6 +565,23 @@ return 0; } +/* Compare two RAI. + * The order of comparison is MCC, MNC, LAC, RAC. See also osmo_lai_cmp(). + * \param a[in] "Left" side RAI. + * \param b[in] "Right" side RAI. + * \returns 0 if the RAI are equal, -1 if a < b, 1 if a > b. */ +int osmo_rai_cmp(const struct osmo_routing_area_id *a, const struct osmo_routing_area_id *b) +{ + int rc = osmo_lai_cmp(&a->lac, &b->lac); + if (rc) + return rc; + if (a->rac < b->rac) + return -1; + if (a->rac > b->rac) + return 1; + return 0; +} + /* Compare two CGI. * The order of comparison is MCC, MNC, LAC, CI. See also osmo_lai_cmp(). * \param a[in] "Left" side CGI. @@ -582,6 +599,23 @@ return 0; } +/* Compare two CGI-PS. + * The order of comparison is MCC, MNC, LAC, RAC, CI. See also osmo_rai_cmp(). + * \param a[in] "Left" side CGI-PS. + * \param b[in] "Right" side CGI-PS. + * \returns 0 if the CGI are equal, -1 if a < b, 1 if a > b. */ +int osmo_cgi_ps_cmp(const struct osmo_cell_global_id_ps *a, const struct osmo_cell_global_id_ps *b) +{ + int rc = osmo_rai_cmp(&a->rai, &b->rai); + if (rc) + return rc; + if (a->cell_identity < b->cell_identity) + return -1; + if (a->cell_identity > b->cell_identity) + return 1; + return 0; +} + /*! Generate TS 23.003 Section 19.2 Home Network Realm/Domain (text form) * \param out[out] caller-provided output buffer, at least 33 bytes long * \param plmn[in] Osmocom representation of PLMN ID (MCC + MNC) diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index de9a595..c314c20 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -410,6 +410,7 @@ osmo_lai_name; osmo_lai_name_buf; osmo_lai_name_c; +osmo_rai_cmp; osmo_rai_name; osmo_rai_name_buf; osmo_rai_name_c; @@ -421,6 +422,7 @@ osmo_cgi_name_buf; osmo_cgi_name_c; osmo_cgi_name2; +osmo_cgi_ps_cmp; osmo_cgi_ps_name; osmo_cgi_ps_name_buf; osmo_cgi_ps_name_c; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22382 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I00e329bc5be8674b30267dec238e7656ddfc21db Gerrit-Change-Number: 22382 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: osmith <osmith at sysmocom.de> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210122/873b17b5/attachment.htm>