diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-12-29 11:07:22 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-06 14:52:52 +0100 |
commit | 763b42a92a7c60f931a9c7a3130f85c7080bee07 (patch) | |
tree | 4994783a1c4346316b9df36042d782e8ee1ce300 /openbsc | |
parent | 68c3bf6de887463eb5bbc94594f28b22ab2f349f (diff) |
subscr: Dump the pending requests to help with debugging state.
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/gsm_subscriber.h | 3 | ||||
-rw-r--r-- | openbsc/src/gsm_subscriber.c | 15 | ||||
-rw-r--r-- | openbsc/src/vty_interface_layer3.c | 22 | ||||
-rw-r--r-- | openbsc/tests/channel/channel_test.c | 1 | ||||
-rw-r--r-- | openbsc/tests/db/db_test.c | 1 |
5 files changed, 42 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h index 134dee4f3..6971bbf1f 100644 --- a/openbsc/include/openbsc/gsm_subscriber.h +++ b/openbsc/include/openbsc/gsm_subscriber.h @@ -16,6 +16,8 @@ #define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001 #define tmsi_from_string(str) strtoul(str, NULL, 10) +struct vty; + struct gsm_equipment { long long unsigned int id; char imei[GSM_IMEI_LENGTH]; @@ -90,6 +92,7 @@ struct gsm_subscriber *subscr_active_by_imsi(struct gsm_network *net, int subscr_pending_requests(struct gsm_subscriber *subscr); int subscr_pending_clear(struct gsm_subscriber *subscr); +int subscr_pending_dump(struct gsm_subscriber *subscr, struct vty *vty); char *subscr_name(struct gsm_subscriber *subscr); diff --git a/openbsc/src/gsm_subscriber.c b/openbsc/src/gsm_subscriber.c index 9b8adebaa..2f6cc3ca9 100644 --- a/openbsc/src/gsm_subscriber.c +++ b/openbsc/src/gsm_subscriber.c @@ -28,6 +28,8 @@ #include <osmocore/talloc.h> +#include <osmocom/vty/vty.h> + #include <openbsc/gsm_subscriber.h> #include <openbsc/gsm_04_08.h> #include <openbsc/debug.h> @@ -387,3 +389,16 @@ int subscr_pending_clear(struct gsm_subscriber *sub) return deleted; } + +int subscr_pending_dump(struct gsm_subscriber *sub, struct vty *vty) +{ + struct subscr_request *req; + + vty_out(vty, "Pending Requests for Subscriber %llu.%s", sub->id, VTY_NEWLINE); + llist_for_each_entry(req, &sub->requests, entry) { + vty_out(vty, "Channel type: %d State: %d Sub: %llu.%s", + req->channel_type, req->state, req->subscr->id, VTY_NEWLINE); + } + + return 0; +} diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c index 844ad3fc1..ccca79807 100644 --- a/openbsc/src/vty_interface_layer3.c +++ b/openbsc/src/vty_interface_layer3.c @@ -502,6 +502,27 @@ DEFUN(ena_subscr_clear, return CMD_SUCCESS; } +DEFUN(ena_subscr_pend, + ena_subscr_pend_cmd, + "subscriber " SUBSCR_TYPES " ID show-pending", + SUBSCR_HELP "Clear the paging requests for this subscriber\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + struct gsm_subscriber *subscr = + get_subscr_by_argv(gsmnet, argv[0], argv[1]); + + if (!subscr) { + vty_out(vty, "%% No subscriber found for %s %s%s", + argv[0], argv[1], VTY_NEWLINE); + return CMD_WARNING; + } + + subscr_pending_dump(subscr, vty); + subscr_put(subscr); + + return CMD_SUCCESS; +} + #define A3A8_ALG_TYPES "(none|xor|comp128v1)" #define A3A8_ALG_HELP \ "Use No A3A8 algorithm\n" \ @@ -742,6 +763,7 @@ int bsc_vty_init_extra(void) install_element(ENABLE_NODE, &ena_subscr_authorized_cmd); install_element(ENABLE_NODE, &ena_subscr_a3a8_cmd); install_element(ENABLE_NODE, &ena_subscr_clear_cmd); + install_element(ENABLE_NODE, &ena_subscr_pend_cmd); install_element(ENABLE_NODE, &subscriber_purge_cmd); install_element(ENABLE_NODE, &smsqueue_trigger_cmd); install_element(ENABLE_NODE, &smsqueue_max_cmd); diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index a63d8a56c..84039970d 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -78,6 +78,7 @@ void sms_alloc() {} void gsm_net_update_ctype(struct gsm_network *network) {} void gsm48_secure_channel() {} void paging_request_stop() {} +void vty_out() {} struct tlv_definition nm_att_tlvdef; diff --git a/openbsc/tests/db/db_test.c b/openbsc/tests/db/db_test.c index f126e9655..eba72dfdc 100644 --- a/openbsc/tests/db/db_test.c +++ b/openbsc/tests/db/db_test.c @@ -104,3 +104,4 @@ int main() { /* stubs */ void input_event(void) {} void nm_state_event(void) {} +void vty_out() {} |