pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30903 )
Change subject: gtphub.h: Remove dependency on sgsn/gprs_sgsn.h ......................................................................
gtphub.h: Remove dependency on sgsn/gprs_sgsn.h
It is only really needed to import define GSM_APN_LENGTH, which is actually also available in libosmogsm. Hence simply use the one from libosmogsm.
Change-Id: I4c6110feeeaa1adfb6b1f0147eeb56dfe34636ec --- M include/osmocom/gtphub/gtphub.h M src/gtphub/gtphub.c M src/gtphub/gtphub_ares.c M src/gtphub/gtphub_sock.c M tests/gtphub/gtphub_test.c 5 files changed, 13 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/03/30903/1
diff --git a/include/osmocom/gtphub/gtphub.h b/include/osmocom/gtphub/gtphub.h index 6a439b5..dbf8469 100644 --- a/include/osmocom/gtphub/gtphub.h +++ b/include/osmocom/gtphub/gtphub.h @@ -27,9 +27,7 @@ #include <osmocom/core/select.h> #include <osmocom/core/timer.h> #include <osmocom/core/rate_ctr.h> - -#include <osmocom/sgsn/gprs_sgsn.h> - +#include <osmocom/gsm/apn.h>
/* support */
@@ -428,7 +426,7 @@
/* The APN OI, the Operator Identifier, is the combined address, * including parts of the IMSI and APN NI, and ending with ".gprs". */ - char apn_oi_str[GSM_APN_LENGTH]; + char apn_oi_str[APN_MAXLEN+1];
/* Which address and port we resolved that to. */ struct gtphub_peer_port *peer; diff --git a/src/gtphub/gtphub.c b/src/gtphub/gtphub.c index 2b00f59..937e6a4 100644 --- a/src/gtphub/gtphub.c +++ b/src/gtphub/gtphub.c @@ -475,7 +475,7 @@ * present but cannot be decoded. */ static int get_ie_apn_str(union gtpie_member *ie[], const char **apn_str) { - static char apn_buf[GSM_APN_LENGTH]; + static char apn_buf[APN_MAXLEN+1]; unsigned int len; if (gtpie_gettlv(ie, GTPIE_APN, 0, &len, apn_buf, sizeof(apn_buf)) != 0) diff --git a/src/gtphub/gtphub_ares.c b/src/gtphub/gtphub_ares.c index a2d8a4a..774563d 100644 --- a/src/gtphub/gtphub_ares.c +++ b/src/gtphub/gtphub_ares.c @@ -33,6 +33,7 @@
#include <osmocom/core/utils.h> #include <osmocom/gsm/apn.h> +#include <osmocom/gsm/protocol/gsm_23_003.h>
/* TODO split GRX ares from sgsn into a separate struct and allow use without * globals. */ @@ -56,8 +57,8 @@ struct gtphub *hub;
char imsi_str[GSM23003_IMSI_MAX_DIGITS+1]; - char apn_ni_str[GSM_APN_LENGTH]; - char apn_oi_str[GSM_APN_LENGTH]; + char apn_ni_str[APN_MAXLEN+1]; + char apn_oi_str[APN_MAXLEN+1]; int have_3dig_mnc; };
diff --git a/src/gtphub/gtphub_sock.c b/src/gtphub/gtphub_sock.c index 59a0d42..6f299d2 100644 --- a/src/gtphub/gtphub_sock.c +++ b/src/gtphub/gtphub_sock.c @@ -25,6 +25,11 @@ * along with this program. If not, see http://www.gnu.org/licenses/. */
+#include <errno.h> +#include <string.h> + +#include <osmocom/core/utils.h> + #include <osmocom/gtphub/gtphub.h> #include <osmocom/sgsn/debug.h>
diff --git a/tests/gtphub/gtphub_test.c b/tests/gtphub/gtphub_test.c index 4f58315..5fa730a 100644 --- a/tests/gtphub/gtphub_test.c +++ b/tests/gtphub/gtphub_test.c @@ -27,6 +27,7 @@
#include <osmocom/core/utils.h> #include <osmocom/core/application.h> +#include <osmocom/gsm/protocol/gsm_23_003.h>
#include <osmocom/sgsn/debug.h>
@@ -376,7 +377,7 @@ }
char resolve_ggsn_got_imsi[GSM23003_IMSI_MAX_DIGITS+1]; -char resolve_ggsn_got_ni[GSM_APN_LENGTH]; +char resolve_ggsn_got_ni[APN_MAXLEN+1];
struct sgsn_sockaddr resolved_ggsn_addr; static int resolve_to_ggsn(const char *addr, uint16_t port)