subscr: Dump the pending requests to help with debugging state.

This commit is contained in:
Holger Hans Peter Freyther 2010-12-29 11:07:22 +01:00
parent 68c3bf6de8
commit 763b42a92a
5 changed files with 42 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -104,3 +104,4 @@ int main() {
/* stubs */
void input_event(void) {}
void nm_state_event(void) {}
void vty_out() {}