aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libctrl/control_if.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/src/libctrl/control_if.c')
-rw-r--r--openbsc/src/libctrl/control_if.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c
index beb5b432a..45d7eb5f7 100644
--- a/openbsc/src/libctrl/control_if.c
+++ b/openbsc/src/libctrl/control_if.c
@@ -43,6 +43,8 @@
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/ipaccess.h>
+#include <openbsc/db.h>
+
#include <openbsc/socket.h>
#include <osmocom/abis/subchan_demux.h>
@@ -608,6 +610,31 @@ static int verify_rate_ctr(struct ctrl_cmd *cmd, const char *value, void *data)
return 0;
}
+/* active subscribers */
+CTRL_CMD_DEFINE(active_subscribers, "active_subscribers");
+static int get_active_subscribers(struct ctrl_cmd *cmd, void *data)
+{
+ cmd->reply = talloc_asprintf(cmd, "%d", db_get_active_subscribers());
+ if (!cmd->reply) {
+ cmd->reply = "OOM";
+ goto err;
+ }
+
+ return CTRL_CMD_REPLY;
+err:
+ return CTRL_CMD_ERROR;
+}
+
+static int verify_active_subscribers(struct ctrl_cmd *cmd, const char *value, void *data)
+{
+ return 0;
+}
+
+static int set_active_subscribers(struct ctrl_cmd *cmd, void *data)
+{
+ return 0;
+}
+
/* counter */
CTRL_CMD_DEFINE(counter, "counter *");
static int get_counter(struct ctrl_cmd *cmd, void *data)
@@ -695,6 +722,9 @@ struct ctrl_handle *controlif_setup(struct gsm_network *gsmnet, uint16_t port)
ret = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_counter);
if (ret)
goto err_vec;
+ ret = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_active_subscribers);
+ if (ret)
+ goto err_vec;
return ctrl;
err_vec: