aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_common.c
blob: b97394e926327f8fc2e4e58b041753def61e5452 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * osmo-pcap common code
 *
 * (C) 2011 by Holger Hans Peter Freyther <zecke@selfish.org>
 * (C) 2011 by On-Waves
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <osmo-pcap/common.h>

#include <osmocom/core/utils.h>

static const struct log_info_cat default_categories[] = {
	[DPCAP] = {
		.name = "DPCAP",
		.description = "PCAP related functionality",
		.color = "\033[1;31m",
		.enabled = 1, .loglevel = LOGL_NOTICE,
	},
	[DCLIENT] = {
		.name = "DCLIENT",
		.description = "Client related functionality",
		.color = "\033[1;32m",
		.enabled = 1, .loglevel = LOGL_NOTICE,
	},
	[DSERVER] = {
		.name = "DSERVER",
		.description = "Server related functionality",
		.color = "\033[1;33m",
		.enabled = 1, .loglevel = LOGL_NOTICE,
	},
	[DVTY] = {
		.name = "DVTY",
		.description = "VTY code",
		.color = "\033[1;34m",
		.enabled = 1, .loglevel = LOGL_NOTICE,
	},
};

const struct log_info log_info = {
	.cat = default_categories,
	.num_cat = ARRAY_SIZE(default_categories),
};

const char *osmopcap_copyright = 
	"Copyright (C) 2011 Holger Freyther\r\n"
	"License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
	"This is free software: you are free to change and redistribute it.\r\n"
	"There is NO WARRANTY, to the extent permitted by law.\r\n";


enum node_type  osmopcap_go_parent(struct vty *vty)
{
	switch (vty->node) {
	case CLIENT_NODE:
	case SERVER_NODE:
		vty->node = CONFIG_NODE;
		vty->index = NULL;
		break;
	default:
		vty->node = CONFIG_NODE;
		break;
	}

	return vty->node;	
}

int osmopcap_is_config_node(struct vty *vty, int node)
{
	switch (node) {
	case CONFIG_NODE:
		return 0;
	default:
		return 1;
	}
}