summaryrefslogtreecommitdiffstats
path: root/openbsc
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
commit290671d6835079a08ee2a1cdc85406f8291da517 (patch)
tree0cfa980f81c6e2379e9aa85397a89eb930c6c236 /openbsc
parent6752fa43b6cdcc2cb33d04b5e6cf3c87c609de68 (diff)
[gprs] BSSGP: convert cause strings to value_string
Diffstat (limited to 'openbsc')
-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 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