diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-15 23:52:02 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-15 23:52:02 +0200 |
commit | 8be8c8fec9be1a117d47b5af462c0f4b47c3e062 (patch) | |
tree | 79f2b14fcc7d6108c91921c7eacd67859b7dcb10 /openbsc/src/debug.c | |
parent | 3bac9a84ceeb17edd71a11e9b1b9a30bd409f827 (diff) |
[GPRS] NS: Allow filtering of log messages by NSVC / NSEI
Diffstat (limited to 'openbsc/src/debug.c')
-rw-r--r-- | openbsc/src/debug.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/openbsc/src/debug.c b/openbsc/src/debug.c index 1ef5c733f..31694f37f 100644 --- a/openbsc/src/debug.c +++ b/openbsc/src/debug.c @@ -176,17 +176,24 @@ static const struct log_info_cat default_categories[] = { enum log_filter { _FLT_ALL = LOG_FILTER_ALL, /* libosmocore */ FLT_IMSI = 1, + FLT_NSVC = 1, }; static int filter_fn(const struct log_context *ctx, struct log_target *tar) { struct gsm_subscriber *subscr = ctx->ctx[BSC_CTX_SUBSCR]; + const struct gprs_nsvc *nsvc = ctx->ctx[BSC_CTX_NSVC]; if ((tar->filter_map & (1 << FLT_IMSI)) != 0 && subscr && strcmp(subscr->imsi, tar->filter_data[FLT_IMSI]) == 0) return 1; + /* Filter on the NS Virtual Connection */ + if ((tar->filter_map & (1 << FLT_NSVC)) != 0 + && nsvc && (nsvc == tar->filter_data[FLT_NSVC])) + return 1; + return 0; } @@ -207,3 +214,15 @@ void log_set_imsi_filter(struct log_target *target, const char *imsi) target->filter_data[FLT_IMSI] = NULL; } } + +void log_set_nsvc_filter(struct log_target *target, + const struct gprs_nsvc *nsvc) +{ + if (nsvc) { + target->filter_map |= (1 << FLT_NSVC); + target->filter_data[FLT_NSVC] = nsvc; + } else if (target->filter_data[FLT_NSVC]) { + target->filter_map = ~(1 << FLT_NSVC); + target->filter_data[FLT_NSVC] = NULL; + } +} |