diff options
-rw-r--r-- | openbsc/include/osmocom/gprs/gprs_msgb.h | 3 | ||||
-rw-r--r-- | openbsc/src/gprs/gb_proxy_main.c | 29 | ||||
-rw-r--r-- | openbsc/src/gprs/sgsn_main.c | 68 | ||||
-rw-r--r-- | openbsc/src/libgb/common_vty.c | 3 |
4 files changed, 98 insertions, 5 deletions
diff --git a/openbsc/include/osmocom/gprs/gprs_msgb.h b/openbsc/include/osmocom/gprs/gprs_msgb.h index 3567bb7f3..f4c855478 100644 --- a/openbsc/include/osmocom/gprs/gprs_msgb.h +++ b/openbsc/include/osmocom/gprs/gprs_msgb.h @@ -31,4 +31,7 @@ struct libgb_msgb_cb { #define GPRS_CTX_NSVC 0 #define GPRS_CTX_BVC 1 +#include <osmocom/core/logging.h> +int gprs_log_filter_fn(const struct log_context *ctx, + struct log_target *tar); #endif diff --git a/openbsc/src/gprs/gb_proxy_main.c b/openbsc/src/gprs/gb_proxy_main.c index 921b53f76..00a134fea 100644 --- a/openbsc/src/gprs/gb_proxy_main.c +++ b/openbsc/src/gprs/gb_proxy_main.c @@ -200,6 +200,31 @@ static struct vty_app_info vty_info = { .is_config_node = bsc_vty_is_config_node, }; +/* default categories */ +static struct log_info_cat gprs_categories[] = { + [DGPRS] = { + .name = "DGPRS", + .description = "GPRS Packet Service", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, + [DNS] = { + .name = "DNS", + .description = "GPRS Network Service (NS)", + .enabled = 1, .loglevel = LOGL_INFO, + }, + [DBSSGP] = { + .name = "DBSSGP", + .description = "GPRS BSS Gateway Protocol (BSSGP)", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, +}; + +static const struct log_info gprs_log_info = { + .filter_fn = gprs_log_filter_fn, + .cat = gprs_categories, + .num_cat = ARRAY_SIZE(gprs_categories), +}; + int main(int argc, char **argv) { struct gsm_network dummy_network; @@ -214,11 +239,11 @@ int main(int argc, char **argv) signal(SIGUSR2, &signal_handler); osmo_init_ignore_signals(); - osmo_init_logging(&log_info); + osmo_init_logging(&gprs_log_info); vty_info.copyright = openbsc_copyright; vty_init(&vty_info); - logging_vty_add_cmds(&log_info); + logging_vty_add_cmds(&gprs_log_info); gbproxy_vty_init(); handle_options(argc, argv); diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c index 55588797b..c3bc8d25d 100644 --- a/openbsc/src/gprs/sgsn_main.c +++ b/openbsc/src/gprs/sgsn_main.c @@ -227,6 +227,70 @@ static void handle_options(int argc, char **argv) } } +/* default categories */ +static struct log_info_cat gprs_categories[] = { + [DMM] = { + .name = "DMM", + .description = "Layer3 Mobility Management (MM)", + .color = "\033[1;33m", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, + [DSMS] = { + .name = "DSMS", + .description = "Layer3 Short Message Service (SMS)", + .color = "\033[1;37m", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, + [DPAG] = { + .name = "DPAG", + .description = "Paging Subsystem", + .color = "\033[1;38m", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, + [DMEAS] = { + .name = "DMEAS", + .description = "Radio Measurement Processing", + .enabled = 0, .loglevel = LOGL_NOTICE, + }, + [DREF] = { + .name = "DREF", + .description = "Reference Counting", + .enabled = 0, .loglevel = LOGL_NOTICE, + }, + [DGPRS] = { + .name = "DGPRS", + .description = "GPRS Packet Service", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, + [DNS] = { + .name = "DNS", + .description = "GPRS Network Service (NS)", + .enabled = 1, .loglevel = LOGL_INFO, + }, + [DBSSGP] = { + .name = "DBSSGP", + .description = "GPRS BSS Gateway Protocol (BSSGP)", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, + [DLLC] = { + .name = "DLLC", + .description = "GPRS Logical Link Control Protocol (LLC)", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, + [DSNDCP] = { + .name = "DSNDCP", + .description = "GPRS Sub-Network Dependent Control Protocol (SNDCP)", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, +}; + +static const struct log_info gprs_log_info = { + .filter_fn = gprs_log_filter_fn, + .cat = gprs_categories, + .num_cat = ARRAY_SIZE(gprs_categories), +}; + + int main(int argc, char **argv) { struct gsm_network dummy_network; @@ -241,11 +305,11 @@ int main(int argc, char **argv) signal(SIGUSR2, &signal_handler); osmo_init_ignore_signals(); - osmo_init_logging(&log_info); + osmo_init_logging(&gprs_log_info); vty_info.copyright = openbsc_copyright; vty_init(&vty_info); - logging_vty_add_cmds(&log_info); + logging_vty_add_cmds(&gprs_log_info); sgsn_vty_init(); handle_options(argc, argv); diff --git a/openbsc/src/libgb/common_vty.c b/openbsc/src/libgb/common_vty.c index 408dddf75..0bd0b6c37 100644 --- a/openbsc/src/libgb/common_vty.c +++ b/openbsc/src/libgb/common_vty.c @@ -22,6 +22,7 @@ #include <string.h> #include <osmocom/core/talloc.h> +#include <osmocom/core/logging.h> #include <osmocom/vty/telnet_interface.h> #include <osmocom/vty/command.h> @@ -70,7 +71,7 @@ int gprs_log_filter_fn(const struct log_context *ctx, struct log_target *tar) { const struct gprs_nsvc *nsvc = ctx->ctx[GPRS_CTX_NSVC]; - const struct gprs_nsvc *bvc = ctx->ctx[GPRS_CTX_BVC]; + const struct gprs_bvc *bvc = ctx->ctx[GPRS_CTX_BVC]; /* Filter on the NS Virtual Connection */ if ((tar->filter_map & (1 << FLT_NSVC)) != 0 |