Holger Hans Peter Freyther | 530ecc0 | 2011-05-31 15:47:44 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 27 | static 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 | }, |
Holger Hans Peter Freyther | c266796 | 2016-08-25 23:07:44 +0200 | [diff] [blame] | 52 | [DTLS] = { |
| 53 | .name = "DTLS", |
| 54 | .description = "TLS code", |
| 55 | .color = "\033[1;34m", |
| 56 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 57 | }, |
Holger Hans Peter Freyther | 530ecc0 | 2011-05-31 15:47:44 +0200 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | const struct log_info log_info = { |
| 61 | .cat = default_categories, |
| 62 | .num_cat = ARRAY_SIZE(default_categories), |
| 63 | }; |
| 64 | |
| 65 | const char *osmopcap_copyright = |
| 66 | "Copyright (C) 2011 Holger Freyther\r\n" |
| 67 | "License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n" |
| 68 | "This is free software: you are free to change and redistribute it.\r\n" |
| 69 | "There is NO WARRANTY, to the extent permitted by law.\r\n"; |
| 70 | |
| 71 | |
Holger Hans Peter Freyther | df92652 | 2016-08-12 10:29:46 +0200 | [diff] [blame] | 72 | int osmopcap_go_parent(struct vty *vty) |
Holger Hans Peter Freyther | 530ecc0 | 2011-05-31 15:47:44 +0200 | [diff] [blame] | 73 | { |
| 74 | switch (vty->node) { |
| 75 | case CLIENT_NODE: |
| 76 | case SERVER_NODE: |
| 77 | vty->node = CONFIG_NODE; |
| 78 | vty->index = NULL; |
| 79 | break; |
| 80 | default: |
Holger Hans Peter Freyther | 47169ba | 2011-05-31 17:41:51 +0200 | [diff] [blame] | 81 | vty->node = CONFIG_NODE; |
Holger Hans Peter Freyther | 530ecc0 | 2011-05-31 15:47:44 +0200 | [diff] [blame] | 82 | break; |
| 83 | } |
| 84 | |
| 85 | return vty->node; |
| 86 | } |
| 87 | |
| 88 | int osmopcap_is_config_node(struct vty *vty, int node) |
| 89 | { |
| 90 | switch (node) { |
| 91 | case CONFIG_NODE: |
| 92 | return 0; |
| 93 | default: |
| 94 | return 1; |
| 95 | } |
| 96 | } |