blob: 16f3bbd8deb6353ce211f4992f90e267fde58f3c [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file common_vty.c
2 * OpenBSC VTY common helpers. */
3/*
4 * (C) 2009-2012 by Harald Welte <laforge@gnumonks.org>
Harald Welte4f5883b2012-06-16 16:54:06 +08005 * (C) 2009-2010 by Holger Hans Peter Freyther
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
Harald Welte7fa89c22014-10-26 20:33:09 +01009 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
Harald Welte4f5883b2012-06-16 16:54:06 +080011 * (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
Harald Welte7fa89c22014-10-26 20:33:09 +010016 * GNU General Public License for more details.
Harald Welte4f5883b2012-06-16 16:54:06 +080017 *
Harald Welte7fa89c22014-10-26 20:33:09 +010018 * You should have received a copy of the GNU General Public License
Harald Welte4f5883b2012-06-16 16:54:06 +080019 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#include <stdlib.h>
24#include <string.h>
25
26#include <osmocom/core/talloc.h>
Harald Welte8eda90d2012-06-17 12:58:46 +080027#include <osmocom/core/logging.h>
Harald Welte4f5883b2012-06-16 16:54:06 +080028
29#include <osmocom/vty/telnet_interface.h>
30#include <osmocom/vty/command.h>
31#include <osmocom/vty/buffer.h>
32#include <osmocom/vty/vty.h>
33
Harald Weltef5430362012-06-17 12:25:53 +080034#include <osmocom/gprs/gprs_msgb.h>
35
36#include "common_vty.h"
37
Harald Weltef5430362012-06-17 12:25:53 +080038int gprs_log_filter_fn(const struct log_context *ctx,
39 struct log_target *tar)
40{
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +010041 const struct gprs_nsvc *nsvc = ctx->ctx[LOG_CTX_GB_NSVC];
42 const struct gprs_bvc *bvc = ctx->ctx[LOG_CTX_GB_BVC];
Harald Weltef5430362012-06-17 12:25:53 +080043
44 /* Filter on the NS Virtual Connection */
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +010045 if ((tar->filter_map & (1 << LOG_FLT_GB_NSVC)) != 0
46 && nsvc && (nsvc == tar->filter_data[LOG_FLT_GB_NSVC]))
Harald Weltef5430362012-06-17 12:25:53 +080047 return 1;
48
49 /* Filter on the NS Virtual Connection */
Neels Hofmeyr8b86cd72017-02-23 18:03:28 +010050 if ((tar->filter_map & (1 << LOG_FLT_GB_BVC)) != 0
51 && bvc && (bvc == tar->filter_data[LOG_FLT_GB_BVC]))
Harald Weltef5430362012-06-17 12:25:53 +080052 return 1;
53
54 return 0;
55}
56
57
Harald Weltecca49632012-06-16 17:45:59 +080058int DNS, DBSSGP;