sms: Provide some simple vty command for the state of the SMS queue

This commit is contained in:
Holger Hans Peter Freyther 2010-12-25 14:08:00 +01:00
parent 17164061a6
commit 81c0e2582f
3 changed files with 33 additions and 0 deletions

View File

@ -3,8 +3,12 @@
struct gsm_network;
struct gsm_sms_queue;
struct vty;
int sms_queue_start(struct gsm_network *, int in_flight);
int sms_queue_trigger(struct gsm_sms_queue *);
/* vty helper functions */
int sms_queue_stats(struct gsm_sms_queue *, struct vty* vty);
#endif

View File

@ -40,6 +40,8 @@
#include <osmocore/talloc.h>
#include <osmocom/vty/vty.h>
/*
* One pending SMS that we wait for.
*/
@ -391,3 +393,17 @@ static int sms_sms_cb(unsigned int subsys, unsigned int signal,
return 0;
}
/* VTY helper functions */
int sms_queue_stats(struct gsm_sms_queue *smsq, struct vty *vty)
{
struct gsm_sms_pending *pending;
vty_out(vty, "SMSqueue with max_pending: %d pending: %d%s",
smsq->max_pending, smsq->pending, VTY_NEWLINE);
llist_for_each_entry(pending, &smsq->pending_sms, entry)
vty_out(vty, " SMS Pending for Subscriber: %llu%s\n",
pending->subscr->id, VTY_NEWLINE);
return 0;
}

View File

@ -46,6 +46,7 @@
#include <openbsc/vty.h>
#include <openbsc/gsm_04_80.h>
#include <openbsc/chan_alloc.h>
#include <openbsc/sms_queue.h>
extern struct gsm_network *gsmnet_from_vty(struct vty *v);
@ -633,6 +634,17 @@ DEFUN(show_stats,
return CMD_SUCCESS;
}
DEFUN(show_smsqueue,
show_smsqueue_cmd,
"show sms-queue",
SHOW_STR "Display SMSqueue statistics\n")
{
struct gsm_network *net = gsmnet_from_vty(vty);
sms_queue_stats(net->sms_queue, vty);
return CMD_SUCCESS;
}
int bsc_vty_init_extra(void)
{
@ -650,6 +662,7 @@ int bsc_vty_init_extra(void)
install_element_ve(&subscriber_ussd_notify_cmd);
install_element_ve(&subscriber_update_cmd);
install_element_ve(&show_stats_cmd);
install_element_ve(&show_smsqueue_cmd);
install_element(ENABLE_NODE, &ena_subscr_name_cmd);
install_element(ENABLE_NODE, &ena_subscr_extension_cmd);