summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-02 09:37:45 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-04 07:20:43 +0200
commit2577d415269085d71fff62aead723c7d28522645 (patch)
tree7a5f0214cd602e7f299240576addda380d61d3bf /openbsc
parent290671d6835079a08ee2a1cdc85406f8291da517 (diff)
[gprs] convert ns_cause_str to value_string
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/gprs_ns.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/openbsc/src/gprs_ns.c b/openbsc/src/gprs_ns.c
index 18d189f5..7f94b97b 100644
--- a/openbsc/src/gprs_ns.c
+++ b/openbsc/src/gprs_ns.c
@@ -124,29 +124,24 @@ static struct gprs_nsvc *nsvc_create(struct gprs_ns_inst *nsi, u_int16_t nsvci)
}
/* Section 10.3.2, Table 13 */
-static const char *ns_cause_str[] = {
- [NS_CAUSE_TRANSIT_FAIL] = "Transit network failure",
- [NS_CAUSE_OM_INTERVENTION] = "O&M intervention",
- [NS_CAUSE_EQUIP_FAIL] = "Equipment failure",
- [NS_CAUSE_NSVC_BLOCKED] = "NS-VC blocked",
- [NS_CAUSE_NSVC_UNKNOWN] = "NS-VC unknown",
- [NS_CAUSE_BVCI_UNKNOWN] = "BVCI unknown",
- [NS_CAUSE_SEM_INCORR_PDU] = "Semantically incorrect PDU",
- [NS_CAUSE_PDU_INCOMP_PSTATE] = "PDU not compatible with protocol state",
- [NS_CAUSE_PROTO_ERR_UNSPEC] = "Protocol error, unspecified",
- [NS_CAUSE_INVAL_ESSENT_IE] = "Invalid essential IE",
- [NS_CAUSE_MISSING_ESSENT_IE] = "Missing essential IE",
+static const struct value_string ns_cause_str[] = {
+ { NS_CAUSE_TRANSIT_FAIL, "Transit network failure" },
+ { NS_CAUSE_OM_INTERVENTION, "O&M intervention" },
+ { NS_CAUSE_EQUIP_FAIL, "Equipment failure" },
+ { NS_CAUSE_NSVC_BLOCKED, "NS-VC blocked" },
+ { NS_CAUSE_NSVC_UNKNOWN, "NS-VC unknown" },
+ { NS_CAUSE_BVCI_UNKNOWN, "BVCI unknown" },
+ { NS_CAUSE_SEM_INCORR_PDU, "Semantically incorrect PDU" },
+ { NS_CAUSE_PDU_INCOMP_PSTATE, "PDU not compatible with protocol state" },
+ { NS_CAUSE_PROTO_ERR_UNSPEC, "Protocol error }, unspecified" },
+ { NS_CAUSE_INVAL_ESSENT_IE, "Invalid essential IE" },
+ { NS_CAUSE_MISSING_ESSENT_IE, "Missing essential IE" },
+ { 0, NULL }
};
-static const char *gprs_ns_cause_str(enum ns_cause cause)
+const char *gprs_ns_cause_str(enum ns_cause cause)
{
- if (cause >= ARRAY_SIZE(ns_cause_str))
- return "undefined";
-
- if (ns_cause_str[cause])
- return ns_cause_str[cause];
-
- return "undefined";
+ return get_value_string(ns_cause_str, cause);
}
static int nsip_sendmsg(struct gprs_nsvc *nsvc, struct msgb *msg);