laforge submitted this change.
cbc_vty: Use value_string to define proto names used in vty
This will be used in other places in a follow up patch.
Change-Id: I125c7e5ca1f86c2ef390a85975465330c3ae1eb0
---
M src/cbc_vty.c
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/cbc_vty.c b/src/cbc_vty.c
index e27423e..7e70602 100644
--- a/src/cbc_vty.c
+++ b/src/cbc_vty.c
@@ -37,6 +37,13 @@
#include <osmocom/cbc/cbsp_link.h>
#include <osmocom/cbc/sbcap_link.h>
+static const struct value_string cbc_peer_proto_name_vty[] = {
+ { CBC_PEER_PROTO_CBSP, "cbsp" },
+ { CBC_PEER_PROTO_SABP, "sabp" },
+ { CBC_PEER_PROTO_SBcAP, "sbcap" },
+ { 0, NULL }
+};
+
static void dump_one_cbc_peer(struct vty *vty, const struct cbc_peer *peer)
{
const char *state = "<disconnected>";
@@ -544,10 +551,7 @@
"Cell Broadcast Service Protocol (GSM)\n")
{
struct cbc_peer *peer = (struct cbc_peer *) vty->index;
- if (strcmp(argv[0], "cbsp") == 0)
- peer->proto = CBC_PEER_PROTO_CBSP;
- else
- peer->proto = CBC_PEER_PROTO_SBcAP;
+ peer->proto = get_string_value(cbc_peer_proto_name_vty, argv[0]);
return CMD_SUCCESS;
}
To view, visit change 28705. To unsubscribe, or for help writing mail filters, visit settings.