osmith has uploaded this change for review.

View Change

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.

Leave stub files in /usr/include/….h that include the files from the new
paths, for backwards compatibility.

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
A include/Makefile.am
A include/gsn.h
A include/gtp.h
A include/gtpie.h
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
A include/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 sgsnemu/Makefile.am
M sgsnemu/sgsnemu.c
M tests/gtp/gtpie_test.c
33 files changed, 94 insertions(+), 29 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/66/36066/1
diff --git a/Makefile.am b/Makefile.am
index 5db4ac6..f5ec81c 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 ae93974..d190059 100644
--- a/configure.ac
+++ b/configure.ac
@@ -266,6 +266,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 0cd0feb..2644ac5 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..a2631dd 100644
--- a/gtp/Makefile.am
+++ b/gtp/Makefile.am
@@ -6,12 +6,11 @@

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)

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/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..d5db322
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,12 @@
+SUBDIRS = \
+ osmocom \
+ $(NULL)
+
+# Legacy headers files outside of osmocom/gtp dir. These files are stubs that
+# include the files from the proper paths.
+include_HEADERS = \
+ gsn.h \
+ gtp.h \
+ gtpie.h \
+ pdp.h \
+ $(NULL)
diff --git a/include/gsn.h b/include/gsn.h
new file mode 100644
index 0000000..ef8ba54
--- /dev/null
+++ b/include/gsn.h
@@ -0,0 +1,2 @@
+#pragma once
+#include <osmocom/gtp/gsn.h>
diff --git a/include/gtp.h b/include/gtp.h
new file mode 100644
index 0000000..8d07b57
--- /dev/null
+++ b/include/gtp.h
@@ -0,0 +1,2 @@
+#pragma once
+#include <osmocom/gtp/gtp.h>
diff --git a/include/gtpie.h b/include/gtpie.h
new file mode 100644
index 0000000..e69d3fd
--- /dev/null
+++ b/include/gtpie.h
@@ -0,0 +1,2 @@
+#pragma once
+#include <osmocom/gtp/gtpie.h>
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/include/pdp.h b/include/pdp.h
new file mode 100644
index 0000000..304dee5
--- /dev/null
+++ b/include/pdp.h
@@ -0,0 +1,2 @@
+#pragma once
+#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 9bfb380..9f2ad65 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/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 change 36066. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: If7e01c61168819bf7120667344e40c857da5490b
Gerrit-Change-Number: 36066
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-MessageType: newchange