move ranap_*.h,iu_helpers.h to include/osmocom/ranap/

A bit hacky: the ranap_ies_defs.h is generated together with the
ranap_encoder.c and ranap_decoder.c. See comments in src/Makefile.am and
include/osmocom/ranap/Makefile.am.
diff --git a/include/osmocom/ranap/Makefile.am b/include/osmocom/ranap/Makefile.am
index 873cadc..b4e1e29 100644
--- a/include/osmocom/ranap/Makefile.am
+++ b/include/osmocom/ranap/Makefile.am
@@ -1,4 +1,16 @@
+# Ugly: ranap_ies_defs.h is generated from asn1tostruct.py at the same time as
+# the ranap_*.c files in src/, but the ranap_ies_defs.h should live here. If
+# the build process wants this header file, it should first build
+# src/ranap_encoder.c and src/ranap_decoder.c.
+# This rule sucks:
+ranap_ies_defs.h: $(top_builddir)/src/ranap_encoder.c
+	make -C $(top_builddir)/src/ ranap_encoder.c
+
 ranap_HEADERS = \
+	ranap_ies_defs.h \
+	ranap_common.h \
+	ranap_msg_factory.h \
+	iu_helpers.h \
 	RANAP_AccuracyFulfilmentIndicator.h \
 	RANAP_AllocationOrRetentionPriority.h \
 	RANAP_AlternativeRABConfigurationRequest.h \
diff --git a/src/iu_helpers.h b/include/osmocom/ranap/iu_helpers.h
similarity index 100%
rename from src/iu_helpers.h
rename to include/osmocom/ranap/iu_helpers.h
diff --git a/src/ranap_common.h b/include/osmocom/ranap/ranap_common.h
similarity index 100%
rename from src/ranap_common.h
rename to include/osmocom/ranap/ranap_common.h
diff --git a/src/ranap_msg_factory.h b/include/osmocom/ranap/ranap_msg_factory.h
similarity index 100%
rename from src/ranap_msg_factory.h
rename to include/osmocom/ranap/ranap_msg_factory.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 1fc76a4..aeb75b2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,9 +11,13 @@
 rua_encoder.c rua_decoder.c rua_ies_defs.h: $(ASN1_ROOT)/rua/RUA-PDU-Contents.asn $(ASN1TOSTRUCT)
 	$(ASN1TOSTRUCT) -p RUA_ -f $<
 
-ranap_encoder.c ranap_decoder.c ranap_ies_defs.h: $(ASN1_ROOT)/ranap/RANAP-PDU-Contents.asn $(ASN1TOSTRUCT)
+ranap_encoder.c ranap_decoder.c: $(ASN1_ROOT)/ranap/RANAP-PDU-Contents.asn $(ASN1TOSTRUCT)
 	$(ASN1TOSTRUCT) -p RANAP_ -f $<
-
+	mv ranap_ies_defs.h $(includedir)/osmocom/ranap/
+#	this is ugly ^. ranap_ies_defs.h is generated from asn1tostruct.py here, but
+#	it should live in include/osmocom/ranap/.
+#	We also need to replace the include in the newly generated .c files:
+	sed -i 's,^#include "ranap_ies_defs.h",#include <osmocom/ranap/ranap_ies_defs.h>,' ranap_encoder.c ranap_decoder.c
 
 AM_CFLAGS = $(OSMOCORE_CFLAGS) $(OSMOVTY_CFLAGS) $(OSMOGSM_CFLAGS) $(OSMONETIF_CFLAGS) $(ASN1C_CFLAGS) $(OSMOSIGTRAN_CFLAGS) -I../include
 COMMON_LDADD = -lsctp
@@ -26,10 +30,6 @@
 libosmo_ranap_la_LIBADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(ASN1C_LIBS) $(COMMON_LDADD) ranap/libosmo-asn1-ranap.la
 libosmo_ranap_la_SOURCES = ranap_common.c ranap_encoder.c ranap_decoder.c ranap_msg_factory.c iu_helpers.c
 
-osmoranap_HEADERS = ranap_common.h ranap_ies_defs.h ranap_msg_factory.h iu_helpers.h
-osmoranapdir = $(includedir)/osmocom/ranap
-
-
 # build the actual HomeNodeB gateway
 #
 bin_PROGRAMS = osmo-hnbgw
diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c
index c1e9d1c..18661ea 100644
--- a/src/hnbgw_cn.c
+++ b/src/hnbgw_cn.c
@@ -28,8 +28,8 @@
 
 #include "hnbgw.h"
 #include "hnbgw_rua.h"
-#include "ranap_ies_defs.h"
-#include "ranap_msg_factory.h"
+#include <osmocom/ranap/ranap_ies_defs.h>
+#include <osmocom/ranap/ranap_msg_factory.h>
 #include "context_map.h"
 #include "sccp_helpers.h"
 
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c
index 7790bfd..4d7870e 100644
--- a/src/hnbgw_hnbap.c
+++ b/src/hnbgw_hnbap.c
@@ -28,7 +28,7 @@
 #include <string.h>
 
 #include "asn1helpers.h"
-#include "iu_helpers.h"
+#include <osmocom/ranap/iu_helpers.h>
 
 #include "hnbgw.h"
 #include "hnbap_common.h"
diff --git a/src/hnbgw_ranap.c b/src/hnbgw_ranap.c
index 5d9168b..3f7c2bf 100644
--- a/src/hnbgw_ranap.c
+++ b/src/hnbgw_ranap.c
@@ -31,8 +31,8 @@
 
 #include "hnbgw.h"
 #include "hnbgw_rua.h"
-#include "ranap_common.h"
-#include "ranap_ies_defs.h"
+#include <osmocom/ranap/ranap_common.h>
+#include <osmocom/ranap/ranap_ies_defs.h>
 
 static int ranap_tx_reset_ack(struct hnb_context *hnb,
 				RANAP_CN_DomainIndicator_t domain)
diff --git a/src/ranap_common.c b/src/ranap_common.c
index 47ee684..4bd088c 100644
--- a/src/ranap_common.c
+++ b/src/ranap_common.c
@@ -23,7 +23,7 @@
 #include <osmocom/core/msgb.h>
 #include <osmocom/gsm/gsm48.h>
 
-#include "ranap_common.h"
+#include <osmocom/ranap/ranap_common.h>
 
 extern int asn1_xer_print;
 int _ranap_DRANAP = 0;
diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c
index c62f268..e5d742f 100644
--- a/src/ranap_msg_factory.c
+++ b/src/ranap_msg_factory.c
@@ -22,11 +22,11 @@
 #include <osmocom/core/msgb.h>
 
 #include "asn1helpers.h"
-#include "iu_helpers.h"
+#include <osmocom/ranap/iu_helpers.h>
 
-#include "ranap_common.h"
-#include "ranap_ies_defs.h"
-#include "ranap_msg_factory.h"
+#include <osmocom/ranap/ranap_common.h>
+#include <osmocom/ranap/ranap_ies_defs.h>
+#include <osmocom/ranap/ranap_msg_factory.h>
 
 #define DRANAP _ranap_DRANAP
 
diff --git a/src/tests/dummy_cn_sua.c b/src/tests/dummy_cn_sua.c
index 4760b7b..c9acd9f 100644
--- a/src/tests/dummy_cn_sua.c
+++ b/src/tests/dummy_cn_sua.c
@@ -18,7 +18,7 @@
 
 #include "test_common.h"
 
-#include "ranap_ies_defs.h"
+#include <osmocom/ranap/ranap_ies_defs.h>
 #include "ranap_common_cn.h"
 #include "hnbgw.h"
 
diff --git a/src/tests/hnb-test.c b/src/tests/hnb-test.c
index b4a30f8..e2fa2ed 100644
--- a/src/tests/hnb-test.c
+++ b/src/tests/hnb-test.c
@@ -51,10 +51,10 @@
 #include "hnbap_ies_defs.h"
 #include "rua_msg_factory.h"
 #include "asn1helpers.h"
-#include "iu_helpers.h"
+#include <osmocom/ranap/iu_helpers.h>
 #include "test_common.h"
 
-#include "ranap_msg_factory.h"
+#include <osmocom/ranap/ranap_msg_factory.h>
 
 static void *tall_hnb_ctx;
 
diff --git a/src/tests/ranap_common_cn.c b/src/tests/ranap_common_cn.c
index f8b8e6e..799629e 100644
--- a/src/tests/ranap_common_cn.c
+++ b/src/tests/ranap_common_cn.c
@@ -25,8 +25,8 @@
 #include <osmocom/core/utils.h>
 #include <osmocom/core/logging.h>
 
-#include "ranap_common.h"
-#include "ranap_ies_defs.h"
+#include <osmocom/ranap/ranap_common.h>
+#include <osmocom/ranap/ranap_ies_defs.h>
 #include "ranap_common_cn.h"
 
 #include "hnbgw.h"
diff --git a/src/tests/ranap_common_cn.h b/src/tests/ranap_common_cn.h
index 38d2384..6eb16c2 100644
--- a/src/tests/ranap_common_cn.h
+++ b/src/tests/ranap_common_cn.h
@@ -2,8 +2,8 @@
 
 #include <stdint.h>
 
-#include "ranap_common.h"
-#include "ranap_ies_defs.h"
+#include <osmocom/ranap/ranap_common.h>
+#include <osmocom/ranap/ranap_ies_defs.h>
 
 /* call-back functions to be provided by actual core network node */
 int cn_ranap_handle_co(void *ctx, ranap_message *message);
diff --git a/src/tests/test-helpers.c b/src/tests/test-helpers.c
index b514d10..78bbe23 100644
--- a/src/tests/test-helpers.c
+++ b/src/tests/test-helpers.c
@@ -19,7 +19,7 @@
  */
 
 
-#include "iu_helpers.h"
+#include <osmocom/ranap/iu_helpers.h>
 #include "asn1helpers.h"
 
 #include <assert.h>
diff --git a/src/tests/test-hnbap.c b/src/tests/test-hnbap.c
index 5101ff4..463b4d4 100644
--- a/src/tests/test-hnbap.c
+++ b/src/tests/test-hnbap.c
@@ -19,7 +19,7 @@
  *
  */
 
-#include "iu_helpers.h"
+#include <osmocom/ranap/iu_helpers.h>
 #include "asn1helpers.h"
 
 #include "hnbap_common.h"
diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c
index 8364e7e..5566848 100644
--- a/src/tests/test-ranap.c
+++ b/src/tests/test-ranap.c
@@ -22,11 +22,11 @@
 #include <osmocom/vty/logging.h>
 
 #include "asn1helpers.h"
-#include "iu_helpers.h"
+#include <osmocom/ranap/iu_helpers.h>
 
-#include "ranap_common.h"
-#include "ranap_ies_defs.h"
-#include "ranap_msg_factory.h"
+#include <osmocom/ranap/ranap_common.h>
+#include <osmocom/ranap/ranap_ies_defs.h>
+#include <osmocom/ranap/ranap_msg_factory.h>
 
 #include "test_common.h"