osmith has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ggsn/+/36066?usp=email )
Change subject: libgtp: move includes to osmocom/include/gtp
......................................................................
libgtp: move includes to osmocom/include/gtp
Move all includes from /usr/include/….h to
/usr/include/osmocom/gtp/….h to be more consistent with other Osmocom
projects, and to not "pollute" the top include directory if we add more
header files.
Also the new directory structure makes more obvious, which headers are
public and which ones aren't.
Adjust libgtp.pc.in so both #include <gtp.h> (legacy)
and #include <osmocom/gtp/gtp.h> can be used.
Related: OS#6373
Change-Id: If7e01c61168819bf7120667344e40c857da5490b
---
M Makefile.am
M configure.ac
M ggsn/Makefile.am
M ggsn/ggsn.c
M ggsn/ggsn.h
M ggsn/ggsn_vty.c
M ggsn/pco.h
M ggsn/sgsn.h
M gtp/Makefile.am
M gtp/gsn.c
M gtp/gtp.c
M gtp/gtpie.c
M gtp/pdp.c
M gtp/queue.c
M gtp/queue.h
A include/Makefile.am
A include/osmocom/Makefile.am
A include/osmocom/gtp/Makefile.am
R include/osmocom/gtp/gsn.h
R include/osmocom/gtp/gtp.h
R include/osmocom/gtp/gtpie.h
R include/osmocom/gtp/pdp.h
M lib/Makefile.am
M lib/gtp-kernel.c
M lib/icmpv6.c
M lib/icmpv6.h
M lib/in46_addr.c
M lib/in46_addr.h
M lib/ippool.h
M lib/util.c
M libgtp.pc.in
M sgsnemu/Makefile.am
M sgsnemu/sgsnemu.c
M tests/gtp/gtpie_test.c
34 files changed, 91 insertions(+), 40 deletions(-)
Approvals:
osmith: Looks good to me, approved
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
diff --git a/Makefile.am b/Makefile.am
index 4d59c53..ccd1e31 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = \
+ include \
lib \
gtp \
ggsn \
diff --git a/configure.ac b/configure.ac
index b73c5db..07b8b81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -265,6 +265,9 @@
tests/Makefile
tests/lib/Makefile
tests/gtp/Makefile
+ include/Makefile
+ include/osmocom/Makefile
+ include/osmocom/gtp/Makefile
libgtp.pc])
AC_OUTPUT
diff --git a/ggsn/Makefile.am b/ggsn/Makefile.am
index 0c6f334..ad6b2b2 100644
--- a/ggsn/Makefile.am
+++ b/ggsn/Makefile.am
@@ -7,6 +7,7 @@
-fno-builtin \
-Wall \
-DSBINDIR='"$(sbindir)"' \
+ -I$(top_srcdir)/include \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOCTRL_CFLAGS) \
$(LIBOSMOVTY_CFLAGS) \
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 0603773..2e9010e 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -46,14 +46,15 @@
#include <osmocom/ctrl/control_if.h>
#include <osmocom/gsm/apn.h>
+#include <osmocom/gtp/pdp.h>
+#include <osmocom/gtp/gtp.h>
+
#include "../lib/tun.h"
#include "../lib/ippool.h"
#include "../lib/syserr.h"
#include "../lib/in46_addr.h"
#include "../lib/gtp-kernel.h"
#include "../lib/util.h"
-#include "../gtp/pdp.h"
-#include "../gtp/gtp.h"
#include "../lib/icmpv6.h"
#include "pco.h"
#include "ggsn.h"
diff --git a/ggsn/ggsn.h b/ggsn/ggsn.h
index 1abbc9a..7a3204f 100644
--- a/ggsn/ggsn.h
+++ b/ggsn/ggsn.h
@@ -8,12 +8,12 @@
#include <osmocom/core/timer.h>
#include <osmocom/core/tdef.h>
#include <osmocom/ctrl/control_if.h>
+#include <osmocom/gtp/gtp.h>
#include "../lib/tun.h"
#include "../lib/ippool.h"
#include "../lib/syserr.h"
#include "../lib/in46_addr.h"
-#include "../gtp/gtp.h"
#include "sgsn.h"
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index 7414b6a..a661869 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -35,8 +35,8 @@
#include <osmocom/vty/misc.h>
#include <osmocom/vty/tdef_vty.h>
-#include "../gtp/gtp.h"
-#include "../gtp/pdp.h"
+#include <osmocom/gtp/gtp.h>
+#include <osmocom/gtp/pdp.h>
#include "../lib/util.h"
diff --git a/ggsn/pco.h b/ggsn/pco.h
index 2f95d09..bedfa8a 100644
--- a/ggsn/pco.h
+++ b/ggsn/pco.h
@@ -2,7 +2,7 @@
#include <stdint.h>
-#include "../gtp/pdp.h"
+#include <osmocom/gtp/pdp.h>
/* 3GPP TS 24.008 10.5.6.3 */
enum pco_protocols {
diff --git a/ggsn/sgsn.h b/ggsn/sgsn.h
index d2c3c0c..3bc94e3 100644
--- a/ggsn/sgsn.h
+++ b/ggsn/sgsn.h
@@ -8,7 +8,7 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
-#include "../gtp/pdp.h"
+#include <osmocom/gtp/pdp.h>
struct ggsn_ctx;
struct pdp_priv_t;
diff --git a/gtp/Makefile.am b/gtp/Makefile.am
index 666befe..f0c7555 100644
--- a/gtp/Makefile.am
+++ b/gtp/Makefile.am
@@ -6,26 +6,21 @@
lib_LTLIBRARIES = libgtp.la
-include_HEADERS = gtp.h gsn.h pdp.h gtpie.h
-
AM_CFLAGS = \
-fno-builtin \
-Wall \
-DSBINDIR='"$(sbindir)"' \
+ -I$(top_srcdir)/include \
$(LIBOSMOCORE_CFLAGS) \
$(NULL)
libgtp_la_SOURCES = \
gsn.c \
- gsn.h \
gtp.c \
- gtp.h \
gtpie.c \
- gtpie.h \
lookupa.c \
lookupa.h \
pdp.c \
- pdp.h \
queue.c \
queue.h \
$(NULL)
diff --git a/gtp/gsn.c b/gtp/gsn.c
index e66dc99..e326f80 100644
--- a/gtp/gsn.c
+++ b/gtp/gsn.c
@@ -57,9 +57,10 @@
/* #include <stdint.h> ISO C99 types */
-#include "pdp.h"
-#include "gtp.h"
-#include "gtpie.h"
+#include <osmocom/gtp/pdp.h>
+#include <osmocom/gtp/gtp.h>
+#include <osmocom/gtp/gtpie.h>
+
#include "queue.h"
/* Error reporting functions */
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 43e56b5..8921802 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -55,9 +55,10 @@
/* #include <stdint.h> ISO C99 types */
-#include "pdp.h"
-#include "gtp.h"
-#include "gtpie.h"
+#include <osmocom/gtp/pdp.h>
+#include <osmocom/gtp/gtp.h>
+#include <osmocom/gtp/gtpie.h>
+
#include "queue.h"
/* Error reporting functions */
diff --git a/gtp/gtpie.c b/gtp/gtpie.c
index e413d11..3212a8a 100644
--- a/gtp/gtpie.c
+++ b/gtp/gtpie.c
@@ -37,7 +37,7 @@
#include <netinet/in.h>
#include <string.h>
-#include "gtpie.h"
+#include <osmocom/gtp/gtpie.h>
/*! Encode a TLV type Information Element.
* \param[inout] p Pointer to output packet to which IE is appended
diff --git a/gtp/pdp.c b/gtp/pdp.c
index 2be2dd3..9626ce8 100644
--- a/gtp/pdp.c
+++ b/gtp/pdp.c
@@ -28,8 +28,10 @@
#include <netinet/in.h>
#include <string.h>
#include <inttypes.h>
-#include "pdp.h"
-#include "gtp.h"
+
+#include <osmocom/gtp/pdp.h>
+#include <osmocom/gtp/gtp.h>
+
#include "lookupa.h"
#include "queue.h"
diff --git a/gtp/queue.c b/gtp/queue.c
index 4c25913..157c226 100644
--- a/gtp/queue.c
+++ b/gtp/queue.c
@@ -27,8 +27,10 @@
#include <sys/time.h>
#include <netinet/in.h>
#include <string.h>
-#include "pdp.h"
-#include "gtp.h"
+
+#include <osmocom/gtp/pdp.h>
+#include <osmocom/gtp/gtp.h>
+
#include "queue.h"
/*! \brief dump a queue_t to stdout */
diff --git a/gtp/queue.h b/gtp/queue.h
index 9f62482..7fde079 100644
--- a/gtp/queue.h
+++ b/gtp/queue.h
@@ -19,7 +19,7 @@
#include <osmocom/core/linuxlist.h>
-#include "gtp.h"
+#include <osmocom/gtp/gtp.h>
#define QUEUE_DEBUG 0 /* Print debug information */
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..9d963a0
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = \
+ osmocom \
+ $(NULL)
diff --git a/include/osmocom/Makefile.am b/include/osmocom/Makefile.am
new file mode 100644
index 0000000..2a96bba
--- /dev/null
+++ b/include/osmocom/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = \
+ gtp \
+ $(NULL)
diff --git a/include/osmocom/gtp/Makefile.am b/include/osmocom/gtp/Makefile.am
new file mode 100644
index 0000000..db696e5
--- /dev/null
+++ b/include/osmocom/gtp/Makefile.am
@@ -0,0 +1,8 @@
+libgtp_HEADERS = \
+ gsn.h \
+ gtp.h \
+ gtpie.h \
+ pdp.h \
+ $(NULL)
+
+libgtpdir = $(includedir)/osmocom/gtp
diff --git a/gtp/gsn.h b/include/osmocom/gtp/gsn.h
similarity index 100%
rename from gtp/gsn.h
rename to include/osmocom/gtp/gsn.h
diff --git a/gtp/gtp.h b/include/osmocom/gtp/gtp.h
similarity index 100%
rename from gtp/gtp.h
rename to include/osmocom/gtp/gtp.h
diff --git a/gtp/gtpie.h b/include/osmocom/gtp/gtpie.h
similarity index 100%
rename from gtp/gtpie.h
rename to include/osmocom/gtp/gtpie.h
diff --git a/gtp/pdp.h b/include/osmocom/gtp/pdp.h
similarity index 100%
rename from gtp/pdp.h
rename to include/osmocom/gtp/pdp.h
diff --git a/lib/Makefile.am b/lib/Makefile.am
index bef8962..1fdc93f 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -19,6 +19,7 @@
-fno-builtin \
-Wall \
-DSBINDIR='"$(sbindir)"' \
+ -I$(top_srcdir)/include \
$(LIBOSMOCORE_CFLAGS) \
$(NULL)
diff --git a/lib/gtp-kernel.c b/lib/gtp-kernel.c
index 6a14d78..4c8c3ac 100644
--- a/lib/gtp-kernel.c
+++ b/lib/gtp-kernel.c
@@ -23,12 +23,13 @@
#include <time.h>
+#include <osmocom/gtp/pdp.h>
+#include <osmocom/gtp/gtp.h>
+
#include "../lib/tun.h"
#include "../lib/syserr.h"
#include "../lib/util.h"
#include "../lib/ippool.h"
-#include "../gtp/pdp.h"
-#include "../gtp/gtp.h"
#include "gtp-kernel.h"
diff --git a/lib/icmpv6.c b/lib/icmpv6.c
index ac1474d..b6994cd 100644
--- a/lib/icmpv6.c
+++ b/lib/icmpv6.c
@@ -21,10 +21,11 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/utils.h>
-#include "checksum.h"
-#include "../gtp/gtp.h"
-#include "../gtp/pdp.h"
+#include <osmocom/gtp/gtp.h>
+#include <osmocom/gtp/pdp.h>
+
+#include "checksum.h"
#include "ippool.h"
#include "syserr.h"
#include "icmpv6.h"
diff --git a/lib/icmpv6.h b/lib/icmpv6.h
index ee5ef29..5bed5c6 100644
--- a/lib/icmpv6.h
+++ b/lib/icmpv6.h
@@ -5,8 +5,8 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/endian.h>
-#include "../gtp/gtp.h"
-#include "../gtp/pdp.h"
+#include <osmocom/gtp/gtp.h>
+#include <osmocom/gtp/pdp.h>
#define ICMPv6_OPT_TYPE_PREFIX_INFO 0x03
diff --git a/lib/in46_addr.c b/lib/in46_addr.c
index 648fe7e..c5157be 100644
--- a/lib/in46_addr.c
+++ b/lib/in46_addr.c
@@ -10,7 +10,7 @@
*/
#include "../lib/in46_addr.h"
-#include "../gtp/pdp.h"
+#include <osmocom/gtp/pdp.h>
#include <osmocom/core/utils.h>
diff --git a/lib/in46_addr.h b/lib/in46_addr.h
index 5589f94..89e1e22 100644
--- a/lib/in46_addr.h
+++ b/lib/in46_addr.h
@@ -2,7 +2,7 @@
#include <stdint.h>
#include <netinet/in.h>
-#include "../gtp/pdp.h"
+#include <osmocom/gtp/pdp.h>
/* a simple wrapper around an in6_addr to also contain the length of the address,
* thereby implicitly indicating the address family of the address */
diff --git a/lib/ippool.h b/lib/ippool.h
index efb274b..406938e 100644
--- a/lib/ippool.h
+++ b/lib/ippool.h
@@ -13,7 +13,7 @@
#define _IPPOOL_H
#include "../lib/in46_addr.h"
-#include "../gtp/gtp.h"
+#include <osmocom/gtp/gtp.h>
/* Assuming that the address space is fragmented we need a hash table
in order to return the addresses.
diff --git a/lib/util.c b/lib/util.c
index 6bb0d85..f29884a 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -9,7 +9,7 @@
*
*/
-#include "../gtp/pdp.h"
+#include <osmocom/gtp/pdp.h>
#include "ippool.h"
#include "in46_addr.h"
diff --git a/libgtp.pc.in b/libgtp.pc.in
index e6048e9..b6b0652 100644
--- a/libgtp.pc.in
+++ b/libgtp.pc.in
@@ -7,5 +7,8 @@
Description: C Utility Library
Version: @VERSION@
Libs: -L${libdir} -lgtp
-Cflags: -I${includedir}/
+# Add two include paths to support:
+# * #include <osmocom/gtp/gtp.h> (like other Osmocom headers)
+# * #include <gtp.h> (legacy compat)
+Cflags: -I${includedir}/osmocom/gtp/ -I${includedir}/
diff --git a/sgsnemu/Makefile.am b/sgsnemu/Makefile.am
index 7e7fdbb..5d88c7f 100644
--- a/sgsnemu/Makefile.am
+++ b/sgsnemu/Makefile.am
@@ -7,6 +7,7 @@
-fno-builtin \
-Wall \
-DSBINDIR='"$(sbindir)"' \
+ -I$(top_srcdir)/include \
$(LIBOSMOCORE_CFLAGS) \
$(NULL)
diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 7893f4f..de7af4a 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -54,13 +54,14 @@
#endif // HAVE_IN6_ADDR_GEN_MODE_NONE
#endif
+#include <osmocom/gtp/pdp.h>
+#include <osmocom/gtp/gtp.h>
+
#include "../lib/tun.h"
#include "../lib/ippool.h"
#include "../lib/syserr.h"
#include "../lib/netns.h"
#include "../lib/icmpv6.h"
-#include "../gtp/pdp.h"
-#include "../gtp/gtp.h"
#include "cmdline.h"
#define IPADDRLEN 256 /* Character length of addresses */
diff --git a/tests/gtp/gtpie_test.c b/tests/gtp/gtpie_test.c
index ed1f26e..46c0a98 100644
--- a/tests/gtp/gtpie_test.c
+++ b/tests/gtp/gtpie_test.c
@@ -10,8 +10,9 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/bits.h>
+#include <osmocom/gtp/gtpie.h>
+
#include "../../lib/syserr.h"
-#include "../../gtp/gtpie.h"
static const uint8_t in[] = { 1,2,3,4,5,6 };
static uint8_t buf[256];
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ggsn/+/36066?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: If7e01c61168819bf7120667344e40c857da5490b
Gerrit-Change-Number: 36066
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged