blob: 91eed96be966f04c0ab85e788ffeeda7f44437ca [file] [log] [blame]
Neels Hofmeyr9bc42ec2016-08-29 13:02:12 +02001/* OpenBSC Iu related interface to quagga VTY */
2/* (C) 2016 by sysmocom s.m.f.c. GmbH <info@sysmocom.de>
3 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#include <stdlib.h>
21
22#include <osmocom/vty/command.h>
23#include <osmocom/vty/logging.h>
24
25/* Pointer to the actual asn_debug value as passed from main scopes. */
26static int *g_asn_debug_p = NULL;
27
28DEFUN(logging_asn_debug,
29 logging_asn_debug_cmd,
30 "logging asn1-debug (1|0)",
31 LOGGING_STR
32 "Log human readable representations of all ASN.1 messages to stderr\n"
33 "Log decoded ASN.1 messages to stderr\n"
34 "Do not log decoded ASN.1 messages to stderr\n")
35{
36 if (!g_asn_debug_p) {
37 vty_out(vty, "%%ASN.1 debugging not available%s", VTY_NEWLINE);
38 return CMD_WARNING;
39 }
40
41 *g_asn_debug_p = atoi(argv[0]);
42 return CMD_SUCCESS;
43}
44
45void iu_vty_init(int *asn_debug_p)
46{
47 g_asn_debug_p = asn_debug_p;
48
49 install_element(CFG_LOG_NODE, &logging_asn_debug_cmd);
50}