subscr: Show the number of pending requests on this subscriber.
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h
index 1318ae8..0f44a10 100644
--- a/openbsc/include/openbsc/gsm_subscriber.h
+++ b/openbsc/include/openbsc/gsm_subscriber.h
@@ -88,6 +88,8 @@
struct gsm_subscriber *subscr_active_by_imsi(struct gsm_network *net,
const char *imsi);
+int subscr_pending_requests(struct gsm_subscriber *subscr);
+
char *subscr_name(struct gsm_subscriber *subscr);
int subscr_purge_inactive(struct gsm_network *net);
diff --git a/openbsc/src/gsm_subscriber.c b/openbsc/src/gsm_subscriber.c
index 1326021..f42c688 100644
--- a/openbsc/src/gsm_subscriber.c
+++ b/openbsc/src/gsm_subscriber.c
@@ -345,3 +345,14 @@
{
db_subscriber_update(sub);
}
+
+int subscr_pending_requests(struct gsm_subscriber *sub)
+{
+ struct subscr_request *req;
+ int pending = 0;
+
+ llist_for_each_entry(req, &sub->requests, entry)
+ pending += 1;
+
+ return pending;
+}
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index a26f2e3..4cba8c2 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -49,7 +49,7 @@
extern struct gsm_network *gsmnet_from_vty(struct vty *v);
-static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr)
+static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr, int pending)
{
int rc;
struct gsm_auth_info ainfo;
@@ -95,6 +95,9 @@
hexdump(atuple.kc, sizeof(atuple.kc)),
VTY_NEWLINE);
}
+ if (pending)
+ vty_out(vty, " Pending: %d%s",
+ subscr_pending_requests(subscr), VTY_NEWLINE);
vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
}
@@ -110,7 +113,7 @@
llist_for_each_entry(subscr, &active_subscribers, entry) {
vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
- subscr_dump_full_vty(vty, subscr);
+ subscr_dump_full_vty(vty, subscr, 0);
}
return CMD_SUCCESS;
@@ -220,7 +223,7 @@
return CMD_WARNING;
}
- subscr_dump_full_vty(vty, subscr);
+ subscr_dump_full_vty(vty, subscr, 1);
subscr_put(subscr);