move ip.access netowrk listen (NWL) to network_listen.c

Also, we now re-start the network listen test after it has finished,
so if you run a test from ipaccess-find, the test will get re-started
and re-started all the time.
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index 2ef1ba8..e55a83c 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -10,7 +10,7 @@
 		crc24.h gprs_bssgp.h gprs_llc.h gprs_ns.h gprs_gmm.h \
 		gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \
 		gprs_ns_frgre.h auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
-		osmo_bsc_rf.h osmo_bsc.h
+		osmo_bsc_rf.h osmo_bsc.h network_listen.h
 
 openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
 openbscdir = $(includedir)/openbsc
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h
index b3bf27e..13c0746 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -107,7 +107,7 @@
 int abis_nm_perform_test(struct gsm_bts *bts, u_int8_t obj_class,
 			 u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
 			 u_int8_t test_nr, u_int8_t auton_report,
-			 u_int8_t *phys_config, u_int16_t phys_config_len);
+			 const u_int8_t *phys_config, u_int16_t phys_config_len);
 
 int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan);
 
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 36591cf..5ec4441 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -379,6 +379,9 @@
 				struct gsm_nm_state nm_state;
 			} pa;
 		} bs11;
+		struct {
+			unsigned int test_state;
+		} ipaccess;
 	};
 	struct gsm_bts_trx_ts ts[TRX_NR_TS];
 };
diff --git a/openbsc/include/openbsc/network_listen.h b/openbsc/include/openbsc/network_listen.h
new file mode 100644
index 0000000..afd0049
--- /dev/null
+++ b/openbsc/include/openbsc/network_listen.h
@@ -0,0 +1,12 @@
+#ifndef _OPENBSC_NWL_H
+#define _OPENBSC_NWL_H
+
+#include <stdint.h>
+#include <openbsc/gsm_data.h>
+
+void ipac_nwl_init(void);
+
+/* Start a NWL test.  It will raise the S_IPAC_TEST_COMPLETE signal. */
+int ipac_nwl_test_start(struct gsm_bts_trx *trx, uint8_t testnr);
+
+#endif /* _OPENBSC_NWL_H */
diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h
index e614ee5..49ae374 100644
--- a/openbsc/include/openbsc/signal.h
+++ b/openbsc/include/openbsc/signal.h
@@ -43,6 +43,7 @@
 	SS_GLOBAL,
 	SS_CHALLOC,
 	SS_NS,
+	SS_IPAC_NWL,
 };
 
 /* SS_PAGING signals */
@@ -114,6 +115,11 @@
 	S_SCALL_DETACHED,
 };
 
+/* SS_IPAC_NWL signals */
+enum signal_ipaccess {
+	S_IPAC_NWL_COMPLETE,
+};
+
 enum signal_global {
 	S_GLOBAL_SHUTDOWN,
 };