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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/11411 Change subject: gsm23003: Add MME domain name related helper functions ...................................................................... gsm23003: Add MME domain name related helper functions osmo_gen_mme_group_domain(), osmo_gen_mme_group_domain() and osmo_gen_home_network_domain() Change-Id: Ia882d9db05ec0037e593aeebea21bc31adb680bb --- M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_23_003.h M src/gsm/gsm23003.c M src/gsm/libosmogsm.map 4 files changed, 61 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/11/11411/1 diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h index fd4f369..0539fc7 100644 --- a/include/osmocom/gsm/gsm23003.h +++ b/include/osmocom/gsm/gsm23003.h @@ -120,3 +120,7 @@ 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_gen_home_network_domain(char *out, uint16_t mcc, uint16_t mnc); +int osmo_gen_mme_domain(char *out, uint8_t mmec, uint16_t mmegi, uint16_t mcc, uint16_t mnc); +int osmo_gen_mme_group_domain(char *out, uint16_t mmegi, uint16_t mcc, uint16_t mnc); diff --git a/include/osmocom/gsm/protocol/gsm_23_003.h b/include/osmocom/gsm/protocol/gsm_23_003.h index 0e66939..ee697ff 100644 --- a/include/osmocom/gsm/protocol/gsm_23_003.h +++ b/include/osmocom/gsm/protocol/gsm_23_003.h @@ -24,3 +24,9 @@ GSM23003_IMEI_SNR_NUM_DIGITS + 1) #define GSM23003_IMEISV_NUM_DIGITS (GSM23003_IMEI_TAC_NUM_DIGITS + \ GSM23003_IMEI_SNR_NUM_DIGITS + 2) + +/* Chapter 19.2 "epc.mnc000.mcc000.3gppnetwork.org" */ +#define GSM23003_HOME_NETWORK_DOMAIN_LEN 33 + +/* Chapter 19.4.2.4: "mmec00.mmegi0000.mme.epc.mnc000.mcc000.3gppnetwork.org" */ +#define GSM23003_MME_DOMAIN_LEN 55 diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c index 2c3b21e..bb73364 100644 --- a/src/gsm/gsm23003.c +++ b/src/gsm/gsm23003.c @@ -297,3 +297,51 @@ return 1; return osmo_mnc_cmp(a->mnc, a->mnc_3_digits, b->mnc, b->mnc_3_digits); } + +/*! 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 mcc[in] Mobile Country Code + * \param mnc[in] Mobile Network Code + * \returns number of characters printed (excluding NUL); negative on error */ +int osmo_gen_home_network_domain(char *out, uint16_t mcc, uint16_t mnc) +{ + if (mcc > 999) + return -EINVAL; + if (mnc > 999) + return -EINVAL; + return sprintf(out, "epc.mnc%03u.mcc%03u.3gppnetwork.org", mcc, mnc); +} + +/*! Generate TS 23.003 Section 19.4.2.4 MME Domain (text form) + * \param out[out] caller-provided output buffer, at least 56 bytes long + * \param mmec[in] MME Code + * \param mmegi[in] MME Group Identifier + * \param mcc[in] Mobile Country Code + * \param mnc[in] Mobile Network Code + * \returns number of characters printed (excluding NUL); negative on error */ +int osmo_gen_mme_domain(char *out, uint8_t mmec, uint16_t mmegi, uint16_t mcc, uint16_t mnc) +{ + char domain[GSM23003_HOME_NETWORK_DOMAIN_LEN+1]; + int rc; + rc = osmo_gen_home_network_domain(domain, mcc, mnc); + if (rc < 0) + return rc; + return sprintf(out, "mmec%02x.mmegi%04x.mme.%s", mmec, mmegi, domain); +} + +/*! Generate TS 23.003 Section 19.4.2.4 MME Group Domain (text form) + * \param out[out] caller-provided output buffer, at least 56 bytes long + * \param mmec[in] MME Code + * \param mmegi[in] MME Group Identifier + * \param mcc[in] Mobile Country Code + * \param mnc[in] Mobile Network Code + * \returns number of characters printed (excluding NUL); negative on error */ +int osmo_gen_mme_group_domain(char *out, uint16_t mmegi, uint16_t mcc, uint16_t mnc) +{ + char domain[GSM23003_HOME_NETWORK_DOMAIN_LEN+1]; + int rc; + rc = osmo_gen_home_network_domain(domain, mcc, mnc); + if (rc < 0) + return rc; + return sprintf(out, "mmegi%04x.mme.%s", mmegi, domain); +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index dcc491d..103334b 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -318,6 +318,9 @@ osmo_mnc_from_str; osmo_mnc_cmp; osmo_plmn_cmp; +osmo_gen_home_network_domain; +osmo_gen_mme_domain; +osmo_gen_mme_group_domain; gsm48_chan_mode_names; gsm_chan_t_names; gsm48_pdisc_names; -- To view, visit https://gerrit.osmocom.org/11411 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ia882d9db05ec0037e593aeebea21bc31adb680bb Gerrit-Change-Number: 11411 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte <laforge at gnumonks.org> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181021/1c0dd9f0/attachment.htm>