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
This commit is contained in:
Oliver Smith
2024-02-22 14:11:49 +01:00
parent 3372625ad9
commit 1dd16fa12f
34 changed files with 70 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = \
include \
lib \
gtp \
ggsn \

View File

@@ -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

View File

@@ -7,6 +7,7 @@ AM_CFLAGS = \
-fno-builtin \
-Wall \
-DSBINDIR='"$(sbindir)"' \
-I$(top_srcdir)/include \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOCTRL_CFLAGS) \
$(LIBOSMOVTY_CFLAGS) \

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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)

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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

View File

@@ -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"

View File

@@ -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 */

View File

@@ -19,7 +19,7 @@
#include <osmocom/core/linuxlist.h>
#include "gtp.h"
#include <osmocom/gtp/gtp.h>
#define QUEUE_DEBUG 0 /* Print debug information */

3
include/Makefile.am Normal file
View File

@@ -0,0 +1,3 @@
SUBDIRS = \
osmocom \
$(NULL)

View File

@@ -0,0 +1,3 @@
SUBDIRS = \
gtp \
$(NULL)

View File

@@ -0,0 +1,8 @@
libgtp_HEADERS = \
gsn.h \
gtp.h \
gtpie.h \
pdp.h \
$(NULL)
libgtpdir = $(includedir)/osmocom/gtp

View File

@@ -19,6 +19,7 @@ AM_CFLAGS = \
-fno-builtin \
-Wall \
-DSBINDIR='"$(sbindir)"' \
-I$(top_srcdir)/include \
$(LIBOSMOCORE_CFLAGS) \
$(NULL)

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -10,7 +10,7 @@
*/
#include "../lib/in46_addr.h"
#include "../gtp/pdp.h"
#include <osmocom/gtp/pdp.h>
#include <osmocom/core/utils.h>

View File

@@ -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 */

View File

@@ -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.

View File

@@ -9,7 +9,7 @@
*
*/
#include "../gtp/pdp.h"
#include <osmocom/gtp/pdp.h>
#include "ippool.h"
#include "in46_addr.h"

View File

@@ -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 <osmocom/gtp/gtp.h> (like other Osmocom headers)
# * #include <gtp.h> (legacy compat)
Cflags: -I${includedir}/osmocom/gtp/ -I${includedir}/

View File

@@ -7,6 +7,7 @@ AM_CFLAGS = \
-fno-builtin \
-Wall \
-DSBINDIR='"$(sbindir)"' \
-I$(top_srcdir)/include \
$(LIBOSMOCORE_CFLAGS) \
$(NULL)

View File

@@ -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 */

View File

@@ -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];