sgsn/ctrl: Add ctrl interface, implement listing subscribers

Add the control interface with no hierachy right now and implement
the first command to list IMSI + Context Address of active sessions.
sgsn_cmd_handle could share more code with bsc variant.

Fixes: SYS#264, SYS#265
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index 9d42648..f5a66e6 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -50,6 +50,7 @@
 #include <openbsc/sgsn.h>
 #include <openbsc/gprs_llc.h>
 #include <openbsc/gprs_gmm.h>
+#include <openbsc/control_if.h>
 
 #include <gtp.h>
 
@@ -288,6 +289,7 @@
 
 int main(int argc, char **argv)
 {
+	struct ctrl_handle *ctrl;
 	struct gsm_network dummy_network;
 	int rc;
 
@@ -314,6 +316,17 @@
 	if (rc < 0)
 		exit(1);
 
+	ctrl = sgsn_controlif_setup(NULL, 4251);
+	if (!ctrl) {
+		LOGP(DGPRS, LOGL_ERROR, "Failed to create CTRL interface.\n");
+		exit(1);
+	}
+
+	if (sgsn_ctrl_cmds_install() != 0) {
+		LOGP(DGPRS, LOGL_ERROR, "Failed to install CTRL commands.\n");
+		exit(1);
+	}
+
 	gprs_ns_set_log_ss(DNS);
 	bssgp_set_log_ss(DBSSGP);