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 @@ AC_CONFIG_FILES([Makefile 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 @@ AM_CFLAGS = \ -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 #include +#include +#include + #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 #include #include +#include #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 #include -#include "../gtp/gtp.h" -#include "../gtp/pdp.h" +#include +#include #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 -#include "../gtp/pdp.h" +#include /* 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 #include -#include "../gtp/pdp.h" +#include 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 @@ LIBVERSION=9:1:3 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 ISO C99 types */ -#include "pdp.h" -#include "gtp.h" -#include "gtpie.h" +#include +#include +#include + #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 ISO C99 types */ -#include "pdp.h" -#include "gtp.h" -#include "gtpie.h" +#include +#include +#include + #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 #include -#include "gtpie.h" +#include /*! 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 #include #include -#include "pdp.h" -#include "gtp.h" + +#include +#include + #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 #include #include -#include "pdp.h" -#include "gtp.h" + +#include +#include + #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 -#include "gtp.h" +#include #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 @@ AM_CFLAGS = \ -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 +#include +#include + #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 #include -#include "checksum.h" -#include "../gtp/gtp.h" -#include "../gtp/pdp.h" +#include +#include + +#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 #include -#include "../gtp/gtp.h" -#include "../gtp/pdp.h" +#include +#include #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 #include 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 #include -#include "../gtp/pdp.h" +#include /* 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 /* 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 #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 @@ Name: OsmoGGSN GTP Library Description: C Utility Library Version: @VERSION@ Libs: -L${libdir} -lgtp -Cflags: -I${includedir}/ +# Add two include paths to support: +# * #include (like other Osmocom headers) +# * #include (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 @@ AM_CFLAGS = \ -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 +#include + #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 #include +#include + #include "../../lib/syserr.h" -#include "../../gtp/gtpie.h" static const uint8_t in[] = { 1,2,3,4,5,6 }; static uint8_t buf[256];