aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-02 09:34:20 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-04 07:20:43 +0200
commitdbab1c79e7cb8e2c5141f20b6b9ef4a52f33ab40 (patch)
tree9b2e5aa9fcf047dbe2a21df6b2bcd994e50b2c03
parenta26655426d11b8ff619510f52bd5234304520d4c (diff)
[gprs] BSSGP: convert cause strings to value_string
-rw-r--r--openbsc/src/gprs_bssgp.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/openbsc/src/gprs_bssgp.c b/openbsc/src/gprs_bssgp.c
index 44e0a35c0..4b5821343 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