Port gbproxy to NS2

Since NS2 has a different abstraction we mock up the prim send/recv
functions and don't test NS like the old tests did.

Related: SYS#4998
Change-Id: Iecfd0408a35a11638d254c1db3c1d477b1a11524
diff --git a/src/gbproxy/gb_proxy_vty.c b/src/gbproxy/gb_proxy_vty.c
index 355b23f..236d5d3 100644
--- a/src/gbproxy/gb_proxy_vty.c
+++ b/src/gbproxy/gb_proxy_vty.c
@@ -26,10 +26,11 @@
 #include <inttypes.h>
 
 #include <osmocom/core/talloc.h>
+#include <osmocom/core/timer.h>
 #include <osmocom/core/rate_ctr.h>
 #include <osmocom/gsm/gsm48.h>
 
-#include <osmocom/gprs/gprs_ns.h>
+#include <osmocom/gprs/gprs_ns2.h>
 #include <osmocom/gsm/apn.h>
 
 #include <osmocom/sgsn/debug.h>
@@ -666,27 +667,21 @@
 	}
 
 	if (delete_nsvc) {
-		struct gprs_ns_inst *nsi = g_cfg->nsi;
-		struct gprs_nsvc *nsvc, *nsvc2;
+		struct gprs_ns2_inst *nsi = g_cfg->nsi;
+		struct gprs_ns2_nse *nse;
 
-		counter = 0;
-		llist_for_each_entry_safe(nsvc, nsvc2, &nsi->gprs_nsvcs, list) {
-			if (nsvc->nsei != nsei)
-				continue;
-			if (nsvc->persistent)
-				continue;
-
-			if (!dry_run)
-				gprs_nsvc_delete(nsvc);
-			else
-				vty_out(vty, "NS-VC: NSEI %5u, NS-VCI %5u, "
-					"remote %s%s",
-					nsvc->nsei, nsvc->nsvci,
-					gprs_ns_ll_str(nsvc), VTY_NEWLINE);
-			counter += 1;
+		nse = gprs_ns2_nse_by_nsei(nsi, nsei);
+		if (!nse) {
+			vty_out(vty, "NSEI not found%s", VTY_NEWLINE);
+			return CMD_WARNING;
 		}
-		vty_out(vty, "%sDeleted %d NS-VC%s",
-			dry_run ? "Not " : "", counter, VTY_NEWLINE);
+
+		/* TODO: We should NOT delete a persistent NSEI/NSVC as soon as we can check for these */
+		if (!dry_run)
+			gprs_ns2_free_nse(nse);
+
+		vty_out(vty, "%sDeleted NS-VCs for NSEI %d%s",
+			dry_run ? "Not " : "", nsei, VTY_NEWLINE);
 	}
 
 	return CMD_SUCCESS;