laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-cbc/+/28705 )
Change subject: cbc_vty: Use value_string to define proto names used in vty
......................................................................
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(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, approved
laforge: Looks good to me, approved
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
https://gerrit.osmocom.org/c/osmo-cbc/+/28705
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I125c7e5ca1f86c2ef390a85975465330c3ae1eb0
Gerrit-Change-Number: 28705
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged