aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_common.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-05-31 15:47:44 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-05-31 15:47:44 +0200
commit530ecc0879572a7281655693a53cc17b6920b118 (patch)
tree5999ca256591da285326239a2ce010eaf0725d84 /src/osmo_common.c
parent430366a2c5ffbb0af5d7e5213f7f54c5833d7c97 (diff)
osmo_pcap_client: Start with the framework for the pcap client
This is just the normal skeleton for the osmocom code.
Diffstat (limited to 'src/osmo_common.c')
-rw-r--r--src/osmo_common.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/osmo_common.c b/src/osmo_common.c
new file mode 100644
index 0000000..099cff2
--- /dev/null
+++ b/src/osmo_common.c
@@ -0,0 +1,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:
+ LOGP(DVTY, LOGL_ERROR, "Unhandled node %d\n", vty->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;
+ }
+}