diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-02-18 22:20:46 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-03-08 01:01:43 +0100 |
commit | 6d804b1a7e375213cb4b3e437c2b9b8c68872164 (patch) | |
tree | 226c66c67e1d2181e545cb21f83234b90b051a99 /openbsc/src/libcommon | |
parent | abf53d87b6648f2d42562c5699e9035afd92e608 (diff) |
add struct bsc_subscr, separating libbsc from gsm_subscriber
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will
not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC
subscriber: struct bsc_subscr.
Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no
longer have a backpointer to gsm_network (used to be via subscr->group).
Create a separate logging filter for the new BSC subscriber. The implementation
of adjusting the filter context is added in libbsc to not introduce
bsc_subscr_get/_put() dependencies to libcommon.
During Paging Response, fetch a bsc_subscr from the mobile identity, like we do
for the gsm_subscriber. It looks like a duplication now, but will make sense
for the VLR as well as for future MSC split patches.
Naming: it was requested to not name the new struct bsc_sub, because 'sub' is
too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function
prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to
match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast
to type, relatively short, unambiguous, and the naming is consistent.
Add bsc_subscr unit test.
Related: OS#1592, OS#1594
Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
Diffstat (limited to 'openbsc/src/libcommon')
-rw-r--r-- | openbsc/src/libcommon/debug.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/openbsc/src/libcommon/debug.c b/openbsc/src/libcommon/debug.c index 4d7bfed68..0f8221198 100644 --- a/openbsc/src/libcommon/debug.c +++ b/openbsc/src/libcommon/debug.c @@ -180,6 +180,7 @@ static const struct log_info_cat default_categories[] = { static int filter_fn(const struct log_context *ctx, struct log_target *tar) { const struct gsm_subscriber *subscr = ctx->ctx[LOG_CTX_VLR_SUBSCR]; + const struct bsc_subscr *bsub = ctx->ctx[LOG_CTX_BSC_SUBSCR]; const struct gprs_nsvc *nsvc = ctx->ctx[LOG_CTX_GB_NSVC]; const struct gprs_nsvc *bvc = ctx->ctx[LOG_CTX_GB_BVC]; @@ -187,6 +188,10 @@ static int filter_fn(const struct log_context *ctx, struct log_target *tar) && subscr && subscr == tar->filter_data[LOG_FLT_VLR_SUBSCR]) return 1; + if ((tar->filter_map & (1 << LOG_FLT_BSC_SUBSCR)) != 0 + && bsub && bsub == tar->filter_data[LOG_FLT_BSC_SUBSCR]) + return 1; + /* Filter on the NS Virtual Connection */ if ((tar->filter_map & (1 << LOG_FLT_GB_NSVC)) != 0 && nsvc && (nsvc == tar->filter_data[LOG_FLT_GB_NSVC])) @@ -206,7 +211,8 @@ const struct log_info log_info = { .num_cat = ARRAY_SIZE(default_categories), }; -void log_set_imsi_filter(struct log_target *target, struct gsm_subscriber *subscr) +void log_set_filter_vlr_subscr(struct log_target *target, + struct gsm_subscriber *vlr_subscr) { struct gsm_subscriber **fsub = (void*)&target->filter_data[LOG_FLT_VLR_SUBSCR]; @@ -216,9 +222,9 @@ void log_set_imsi_filter(struct log_target *target, struct gsm_subscriber *subsc *fsub = NULL; } - if (subscr) { + if (vlr_subscr) { target->filter_map |= (1 << LOG_FLT_VLR_SUBSCR); - *fsub = subscr_get(subscr); + *fsub = subscr_get(vlr_subscr); } else target->filter_map &= ~(1 << LOG_FLT_VLR_SUBSCR); } |