blob: b97394e926327f8fc2e4e58b041753def61e5452 [file] [log] [blame]
Holger Hans Peter Freyther530ecc02011-05-31 15:47:44 +02001/*
2 * osmo-pcap common code
3 *
4 * (C) 2011 by Holger Hans Peter Freyther <zecke@selfish.org>
5 * (C) 2011 by On-Waves
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#include <osmo-pcap/common.h>
24
25#include <osmocom/core/utils.h>
26
27static const struct log_info_cat default_categories[] = {
28 [DPCAP] = {
29 .name = "DPCAP",
30 .description = "PCAP related functionality",
31 .color = "\033[1;31m",
32 .enabled = 1, .loglevel = LOGL_NOTICE,
33 },
34 [DCLIENT] = {
35 .name = "DCLIENT",
36 .description = "Client related functionality",
37 .color = "\033[1;32m",
38 .enabled = 1, .loglevel = LOGL_NOTICE,
39 },
40 [DSERVER] = {
41 .name = "DSERVER",
42 .description = "Server related functionality",
43 .color = "\033[1;33m",
44 .enabled = 1, .loglevel = LOGL_NOTICE,
45 },
46 [DVTY] = {
47 .name = "DVTY",
48 .description = "VTY code",
49 .color = "\033[1;34m",
50 .enabled = 1, .loglevel = LOGL_NOTICE,
51 },
52};
53
54const struct log_info log_info = {
55 .cat = default_categories,
56 .num_cat = ARRAY_SIZE(default_categories),
57};
58
59const char *osmopcap_copyright =
60 "Copyright (C) 2011 Holger Freyther\r\n"
61 "License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
62 "This is free software: you are free to change and redistribute it.\r\n"
63 "There is NO WARRANTY, to the extent permitted by law.\r\n";
64
65
66enum node_type osmopcap_go_parent(struct vty *vty)
67{
68 switch (vty->node) {
69 case CLIENT_NODE:
70 case SERVER_NODE:
71 vty->node = CONFIG_NODE;
72 vty->index = NULL;
73 break;
74 default:
Holger Hans Peter Freyther47169ba2011-05-31 17:41:51 +020075 vty->node = CONFIG_NODE;
Holger Hans Peter Freyther530ecc02011-05-31 15:47:44 +020076 break;
77 }
78
79 return vty->node;
80}
81
82int osmopcap_is_config_node(struct vty *vty, int node)
83{
84 switch (node) {
85 case CONFIG_NODE:
86 return 0;
87 default:
88 return 1;
89 }
90}