pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/28258 )

Change subject: cbsp: Add enum and value string for Cause
......................................................................

cbsp: Add enum and value string for Cause

Change-Id: I35592bb4fff2e7b442d0e0cd537b66687862baf2
---
M TODO-RELEASE
M include/osmocom/gsm/cbsp.h
M src/gsm/cbsp.c
3 files changed, 47 insertions(+), 1 deletion(-)

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



diff --git a/TODO-RELEASE b/TODO-RELEASE
index 9f9f9d9..5f9d6e8 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -12,3 +12,4 @@
 libosmogb      ABI BREAKAGE            Add reset_ack_notification function 
pointer to struct bssgp_bvc_fsm_ops
 libosmogsm      add API                 Add rach_tx_integer_raw2val() in 
gsm_utils.h
 libosmogsm      add API                 iuup.h
+libosmogsm      add API                 cbsp.h enum osmo_cbsp_cause, 
osmo_cbsp_cause_name(s)
diff --git a/include/osmocom/gsm/cbsp.h b/include/osmocom/gsm/cbsp.h
index 30a0ec9..1e705e5 100644
--- a/include/osmocom/gsm/cbsp.h
+++ b/include/osmocom/gsm/cbsp.h
@@ -71,7 +71,7 @@
        struct llist_head list;         /* entry in a fail_list below */
        enum CELL_IDENT id_discr;
        union gsm0808_cell_id_u cell_id;
-       uint8_t cause;
+       uint8_t cause;                  /* enum osmo_cbsp_cause */
 };


@@ -241,6 +241,30 @@
        enum cbsp_channel_ind *channel_ind;
 };

+/* 8.2.13 Cause */
+enum osmo_cbsp_cause {
+       OSMO_CBSP_CAUSE_PARAM_NOT_RECOGNISED = 0,
+       OSMO_CBSP_CAUSE_PARAM_VALUE_INVALID,
+       OSMO_CBSP_CAUSE_MSG_REF_NOT_IDENTIFIED,
+       OSMO_CBSP_CAUSE_CELL_ID_NOT_VALID,
+       OSMO_CBSP_CAUSE_UNRECOGNISED_MESSAGE,
+       OSMO_CBSP_CAUSE_MISSING_MANDATORY_ELEMENT,
+       OSMO_CBSP_CAUSE_BSC_CAPACITY_EXCEEDED,
+       OSMO_CBSP_CAUSE_CELL_MEMORY_EXCEEDED,
+       OSMO_CBSP_CAUSE_BSC_MEMORY_EXCEEDED,
+       OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_SUPPORTED,
+       OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_OPERATIONAL,
+       OSMO_CBSP_CAUSE_INCOMPATIBLE_DRX_PARAM,
+       OSMO_CBSP_CAUSE_EXT_CHAN_NOT_SUPPORTED,
+       OSMO_CBSP_CAUSE_MSG_REF_ALREADY_USED,
+       OSMO_CBSP_CAUSE_UNSPECIFIED_ERROR,
+       OSMO_CBSP_CAUSE_LAI_OR_LAC_NOT_VALID,
+};
+extern const struct value_string osmo_cbsp_cause_names[];
+static inline const char *osmo_cbsp_cause_name(enum osmo_cbsp_cause cause)
+{
+       return get_value_string(osmo_cbsp_cause_names, cause);
+}

 /* decoded CBSP message */
 struct osmo_cbsp_decoded {
diff --git a/src/gsm/cbsp.c b/src/gsm/cbsp.c
index e340ebe..2095003 100644
--- a/src/gsm/cbsp.c
+++ b/src/gsm/cbsp.c
@@ -1477,4 +1477,25 @@
        return rc;
 }

+/*! value_string[] for enum osmo_cbsp_cause. */
+const struct value_string osmo_cbsp_cause_names[] = {
+       { OSMO_CBSP_CAUSE_PARAM_NOT_RECOGNISED, "Parameter-not-recognised" },
+       { OSMO_CBSP_CAUSE_PARAM_VALUE_INVALID, "Parameter-value-invalid" },
+       { OSMO_CBSP_CAUSE_MSG_REF_NOT_IDENTIFIED, 
"Message-reference-not-identified" },
+       { OSMO_CBSP_CAUSE_CELL_ID_NOT_VALID, "Cell-identity-not-valid" },
+       { OSMO_CBSP_CAUSE_UNRECOGNISED_MESSAGE, "Unrecognised-message" },
+       { OSMO_CBSP_CAUSE_MISSING_MANDATORY_ELEMENT, 
"Missing-mandatory-element" },
+       { OSMO_CBSP_CAUSE_BSC_CAPACITY_EXCEEDED, "BSC-capacity-exceeded" },
+       { OSMO_CBSP_CAUSE_CELL_MEMORY_EXCEEDED, "Cell-memory-exceeded" },
+       { OSMO_CBSP_CAUSE_BSC_MEMORY_EXCEEDED, "BSC-memory-exceeded" },
+       { OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_SUPPORTED, 
"Cell-broadcast-not-supported" },
+       { OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_OPERATIONAL, 
"Cell-broadcast-not-operational" },
+       { OSMO_CBSP_CAUSE_INCOMPATIBLE_DRX_PARAM, 
"Incompatible-DRX-parameter:"},
+       { OSMO_CBSP_CAUSE_EXT_CHAN_NOT_SUPPORTED, 
"Extended-channel-not-supported"},
+       { OSMO_CBSP_CAUSE_MSG_REF_ALREADY_USED, 
"Message-reference-already-used"},
+       { OSMO_CBSP_CAUSE_UNSPECIFIED_ERROR, "Unspecified-error"},
+       { OSMO_CBSP_CAUSE_LAI_OR_LAC_NOT_VALID, "LAI-or-LAC-not-valid"},
+       { 0, NULL }
+};
+
 #endif /* HAVE_SYS_SOCKET_H */

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28258
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I35592bb4fff2e7b442d0e0cd537b66687862baf2
Gerrit-Change-Number: 28258
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to