[gprs] BSSGP: convert cause strings to value_string

This commit is contained in:
Harald Welte 2010-05-02 09:34:20 +02:00
parent 6752fa43b6
commit 290671d683
1 changed files with 30 additions and 29 deletions

View File

@ -43,41 +43,42 @@ 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";
if (bssgp_cause_strings[cause])
return bssgp_cause_strings[cause];
return "undefined";
return get_value_string(bssgp_cause_strings, cause);
}
/* Our actual implementation */
#define BVC_F_BLOCKED 0x0001
/* The per-BTS context that we keep on the SGSN side of the BSSGP link */