diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-10-12 01:29:33 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-03-09 17:12:23 +0100 |
commit | 79e3cbe537dc3b407b4d6b00bd65189b251ea5b5 (patch) | |
tree | a2914feb1583e97a5cc18af97787dab22c7241c6 /openbsc/src/libiu/iu_vty.c | |
parent | 1b5e85a28970e6bff445d57d4f91489632b3b060 (diff) |
iu: sort out confusion around asn_debug and asn1_xer_print
Before, I confused asn_debug with asn1_xer_print. Have two distinct VTY
commands and fix documentation.
Put the asn_debug and asn1_xer_print implementations in iu.c.
Since they are globally defined, don't pass a pointer to iu_vty_init()
but just use it directly. Might be considered less clean, but is also less
bloat.
Change-Id: Iccbadfe1585ba224f74cdfb5273b5ce29b6d78f0
Diffstat (limited to 'openbsc/src/libiu/iu_vty.c')
-rw-r--r-- | openbsc/src/libiu/iu_vty.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/openbsc/src/libiu/iu_vty.c b/openbsc/src/libiu/iu_vty.c index 91eed96be..cfa02ea6c 100644 --- a/openbsc/src/libiu/iu_vty.c +++ b/openbsc/src/libiu/iu_vty.c @@ -22,29 +22,34 @@ #include <osmocom/vty/command.h> #include <osmocom/vty/logging.h> -/* Pointer to the actual asn_debug value as passed from main scopes. */ -static int *g_asn_debug_p = NULL; +#include <openbsc/iu.h> DEFUN(logging_asn_debug, logging_asn_debug_cmd, "logging asn1-debug (1|0)", LOGGING_STR + "Log ASN.1 debug messages to stderr\n" + "Log ASN.1 debug messages to stderr\n" + "Do not log ASN.1 debug messages to stderr\n") +{ + asn_debug = atoi(argv[0]); + return CMD_SUCCESS; +} + +DEFUN(logging_asn_xer_print, + logging_asn_xer_print_cmd, + "logging asn1-xer-print (1|0)", + LOGGING_STR "Log human readable representations of all ASN.1 messages to stderr\n" "Log decoded ASN.1 messages to stderr\n" "Do not log decoded ASN.1 messages to stderr\n") { - if (!g_asn_debug_p) { - vty_out(vty, "%%ASN.1 debugging not available%s", VTY_NEWLINE); - return CMD_WARNING; - } - - *g_asn_debug_p = atoi(argv[0]); + asn1_xer_print = atoi(argv[0]); return CMD_SUCCESS; } -void iu_vty_init(int *asn_debug_p) +void iu_vty_init(void) { - g_asn_debug_p = asn_debug_p; - install_element(CFG_LOG_NODE, &logging_asn_debug_cmd); + install_element(CFG_LOG_NODE, &logging_asn_xer_print_cmd); } |