diff options
-rw-r--r-- | openbsc/src/gprs_bssgp.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/openbsc/src/gprs_bssgp.c b/openbsc/src/gprs_bssgp.c index 44e0a35c..4b582134 100644 --- a/openbsc/src/gprs_bssgp.c +++ b/openbsc/src/gprs_bssgp.c @@ -43,40 +43,41 @@ struct gprs_ns_inst *bssgp_nsi; void *bssgp_tall_ctx = NULL; +/* BSSGP Protocol specific, not implementation specific */ +/* FIXME: This needs to go into libosmocore after finished */ + /* Chapter 11.3.9 / Table 11.10: Cause coding */ -static const char *bssgp_cause_strings[] = { - [BSSGP_CAUSE_PROC_OVERLOAD] = "Processor overload", - [BSSGP_CAUSE_EQUIP_FAIL] = "Equipment Failure", - [BSSGP_CAUSE_TRASIT_NET_FAIL] = "Transit netowkr service failure", - [BSSGP_CAUSE_CAPA_GREATER_0KPBS]= "Transmission capacity modified", - [BSSGP_CAUSE_UNKNOWN_MS] = "Unknown MS", - [BSSGP_CAUSE_UNKNOWN_BVCI] = "Unknown BVCI", - [BSSGP_CAUSE_CELL_TRAF_CONG] = "Cell traffic congestion", - [BSSGP_CAUSE_SGSN_CONG] = "SGSN congestion", - [BSSGP_CAUSE_OML_INTERV] = "O&M intervention", - [BSSGP_CAUSE_BVCI_BLOCKED] = "BVCI blocked", - [BSSGP_CAUSE_PFC_CREATE_FAIL] = "PFC create failure", - [BSSGP_CAUSE_SEM_INCORR_PDU] = "Semantically incorrect PDU", - [BSSGP_CAUSE_INV_MAND_INF] = "Invalid mandatory information", - [BSSGP_CAUSE_MISSING_MAND_IE] = "Missing mandatory IE", - [BSSGP_CAUSE_MISSING_COND_IE] = "Missing conditional IE", - [BSSGP_CAUSE_UNEXP_COND_IE] = "Unexpected conditional IE", - [BSSGP_CAUSE_COND_IE_ERR] = "Conditional IE error", - [BSSGP_CAUSE_PDU_INCOMP_STATE] = "PDU incompatible with protocol state", - [BSSGP_CAUSE_PROTO_ERR_UNSPEC] = "Protocol error - unspecified", - [BSSGP_CAUSE_PDU_INCOMP_FEAT] = "PDU not compatible with feature set", +static const struct value_string bssgp_cause_strings[] = { + { BSSGP_CAUSE_PROC_OVERLOAD, "Processor overload" }, + { BSSGP_CAUSE_EQUIP_FAIL, "Equipment Failure" }, + { BSSGP_CAUSE_TRASIT_NET_FAIL, "Transit netowkr service failure" }, + { BSSGP_CAUSE_CAPA_GREATER_0KPBS,"Transmission capacity modified" }, + { BSSGP_CAUSE_UNKNOWN_MS, "Unknown MS" }, + { BSSGP_CAUSE_UNKNOWN_BVCI, "Unknown BVCI" }, + { BSSGP_CAUSE_CELL_TRAF_CONG, "Cell traffic congestion" }, + { BSSGP_CAUSE_SGSN_CONG, "SGSN congestion" }, + { BSSGP_CAUSE_OML_INTERV, "O&M intervention" }, + { BSSGP_CAUSE_BVCI_BLOCKED, "BVCI blocked" }, + { BSSGP_CAUSE_PFC_CREATE_FAIL, "PFC create failure" }, + { BSSGP_CAUSE_SEM_INCORR_PDU, "Semantically incorrect PDU" }, + { BSSGP_CAUSE_INV_MAND_INF, "Invalid mandatory information" }, + { BSSGP_CAUSE_MISSING_MAND_IE, "Missing mandatory IE" }, + { BSSGP_CAUSE_MISSING_COND_IE, "Missing conditional IE" }, + { BSSGP_CAUSE_UNEXP_COND_IE, "Unexpected conditional IE" }, + { BSSGP_CAUSE_COND_IE_ERR, "Conditional IE error" }, + { BSSGP_CAUSE_PDU_INCOMP_STATE, "PDU incompatible with protocol state" }, + { BSSGP_CAUSE_PROTO_ERR_UNSPEC, "Protocol error - unspecified" }, + { BSSGP_CAUSE_PDU_INCOMP_FEAT, "PDU not compatible with feature set" }, + { 0, NULL }, }; -static const char *bssgp_cause_str(enum gprs_bssgp_cause cause) +const char *bssgp_cause_str(enum gprs_bssgp_cause cause) { - if (cause >= ARRAY_SIZE(bssgp_cause_strings)) - return "undefined"; + return get_value_string(bssgp_cause_strings, cause); +} - if (bssgp_cause_strings[cause]) - return bssgp_cause_strings[cause]; - return "undefined"; -} +/* Our actual implementation */ #define BVC_F_BLOCKED 0x0001 |