GPRS: Modularize the NS implementation

* move UDP listener code for NSIP from input/ipaccess.c and into gprs_ns.c
* add PDU type, IE and CAUSE values for later IP based 3GPP TS 48.016
* support multiple NS-VCs and their lookup based on NSVC and sockaddr_in
* maintain the remote_state (blocked/alive) for each NSVC
* introduce the concept of GPRS_NS instances, move all global vars to instance
* remove hardcoded calls to gprs_bssgp_rcvmsg() and replace it by callback

WARNING: This is not finished code.  While it will compile, it will not work
yet, as BSSGP needs to be converted to properly indicate the NSVC to which it
needs to send data.
diff --git a/openbsc/src/gprs_sgsn.c b/openbsc/src/gprs_sgsn.c
index 477e448..3f7f61e 100644
--- a/openbsc/src/gprs_sgsn.c
+++ b/openbsc/src/gprs_sgsn.c
@@ -26,7 +26,10 @@
 #include <osmocore/talloc.h>
 #include <osmocore/timer.h>
 #include <openbsc/gsm_subscriber.h>
+#include <openbsc/debug.h>
 #include <openbsc/gprs_sgsn.h>
+#include <openbsc/gprs_ns.h>
+#include <openbsc/gprs_bssgp.h>
 
 static LLIST_HEAD(sgsn_mm_ctxts);
 
@@ -91,3 +94,35 @@
 
 	return ctx;
 }
+
+/* call-back function for the NS protocol */
+static int gprs_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,
+		      struct msgb *msg, u_int16_t bvci)
+{
+	int rc = 0;
+
+	switch (event) {
+	case GPRS_NS_EVT_UNIT_DATA:
+		/* hand the message into the BSSGP implementation */
+		rc = gprs_bssgp_rcvmsg(msg, bvci);
+		break;
+	default:
+		LOGP(DGPRS, LOGL_ERROR, "SGSN: Unknown event %u from NS\n", event);
+		if (msg)
+			talloc_free(msg);
+		rc = -EIO;
+		break;
+	}
+	return rc;
+}
+
+int sgsn_init(void)
+{
+	struct gprs_ns_inst *nsi;
+
+	nsi = gprs_ns_instantiate(&gprs_ns_cb);
+	if (!nsi)
+		return -EIO;
+
+	return nsip_listen(nsi, 23000);
+}