diff options
author | Max <msuraev@sysmocom.de> | 2018-11-07 13:16:54 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-11-18 20:14:06 +0000 |
commit | aa934630530af05a84b62b204ce4da7688c5e3ad (patch) | |
tree | 34eb73668b997ca14a5d81b286a6b6d23cda6e0c /src | |
parent | c0d1de36f3e378364b1c02e98a3870394e3d457e (diff) |
Update 3GPP TS 08.08 Cause handling
* add Class definitions
* add helper to check for extended bit
* add helper to get Cause's Class
* use enum in gsm0808_cause_name() and gsm0808_create_cipher_reject() to
avoid confusion between class and cause
* update gsm0808_create_cipher_reject() comments
Change-Id: I31b31dfc22eb4b6b07089e1255246ac458125340
Related: OS#3187
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/gsm0808.c | 30 | ||||
-rw-r--r-- | src/gsm/libosmogsm.map | 1 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index e5c3e30a..791ebc2c 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -265,18 +265,18 @@ struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id) } /*! Create BSSMAP Cipher Mode Reject message - * \param[in] cause TS 08.08 cause value + * \param[in] cause 3GPP TS 08.08 §3.2.2.5 cause value * \returns callee-allocated msgb with BSSMAP Cipher Mode Reject message */ -struct msgb *gsm0808_create_cipher_reject(uint8_t cause) +struct msgb *gsm0808_create_cipher_reject(enum gsm0808_cause cause) { struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, - "bssmap: clear complete"); + "bssmap: cipher mode reject"); if (!msg) return NULL; msgb_v_put(msg, BSS_MAP_MSG_CIPHER_MODE_REJECT); - /* FIXME: support 2-byte cause value as per 3GPP TS 08.08 §3.2.2.5 */ - msgb_tlv_put(msg, GSM0808_IE_CAUSE, 1, &cause); + + msgb_tlv_put(msg, GSM0808_IE_CAUSE, 1, (const uint8_t *)&cause); msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); @@ -1271,8 +1271,26 @@ static const struct value_string gsm0808_cause_names[] = { { 0, NULL } }; +static const struct value_string gsm0808_cause_class_names[] = { + { GSM0808_CAUSE_CLASS_NORM0, "Normal event" }, + { GSM0808_CAUSE_CLASS_NORM1, "Normal event" }, + { GSM0808_CAUSE_CLASS_RES_UNAVAIL, "Resource unavailable" }, + { GSM0808_CAUSE_CLASS_SRV_OPT_NA, "Service or option not available" }, + { GSM0808_CAUSE_CLASS_SRV_OPT_NIMPL, "Service or option not implemented" }, + { GSM0808_CAUSE_CLASS_INVAL, "Invalid message" }, + { GSM0808_CAUSE_CLASS_PERR, "Protocol error" }, + { GSM0808_CAUSE_CLASS_INTW, "Interworking" }, + { 0, NULL } +}; + +/*! Return string name of BSSMAP Cause Class name */ +const char *gsm0808_cause_class_name(enum gsm0808_cause_class class) +{ + return get_value_string(gsm0808_cause_class_names, class); +} + /*! Return string name of BSSMAP Cause name */ -const char *gsm0808_cause_name(uint8_t cause) +const char *gsm0808_cause_name(enum gsm0808_cause cause) { return get_value_string(gsm0808_cause_names, cause); } diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 6234d949..32e4ce95 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -148,6 +148,7 @@ gsm0808_att_tlvdef; gsm0808_bssap_name; gsm0808_bssmap_name; gsm0808_cause_name; +gsm0808_cause_class_name; gsm0808_create_ass; gsm0808_create_assignment_completed; gsm0808_create_ass_compl; |