lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/40435?usp=email )
Change subject: gtp: move LOGP_WITH_ADDR & GTP_LOGPKG into gtp_internal.h ......................................................................
gtp: move LOGP_WITH_ADDR & GTP_LOGPKG into gtp_internal.h
Log macros will be used by multiple internal files.
Change-Id: I3b59b067fc75d2ca2cbfe5cec010615e9b788923 --- M gtp/gsn.c M gtp/gtp.c M gtp/gtp_internal.h 3 files changed, 16 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/35/40435/1
diff --git a/gtp/gsn.c b/gtp/gsn.c index 2409566..782858f 100644 --- a/gtp/gsn.c +++ b/gtp/gsn.c @@ -67,11 +67,6 @@
/* Error reporting functions */
-#define LOGP_WITH_ADDR(ss, level, addr, fmt, args...) \ - LOGP(ss, level, "addr(%s:%d) " fmt, \ - inet_ntoa((addr)->sin_addr), ntohs((addr)->sin_port), \ - ##args) - static const struct rate_ctr_desc gsn_ctr_description[] = { [GSN_CTR_ERR_SOCKET] = { "err:socket", "Socket error" }, [GSN_CTR_ERR_READFROM] = { "err:readfrom", "readfrom() errors" }, diff --git a/gtp/gtp.c b/gtp/gtp.c index 3074776..369be0c 100644 --- a/gtp/gtp.c +++ b/gtp/gtp.c @@ -65,17 +65,6 @@
/* Error reporting functions */
-#define GTP_LOGPKG(pri, peer, pack, len, fmt, args...) \ - logp2(DLGTP, pri, __FILE__, __LINE__, 0, \ - "Packet from %s:%u, length: %d content: %s: " fmt, \ - inet_ntoa((peer)->sin_addr), ntohs((peer)->sin_port), \ - len, osmo_hexdump((const uint8_t *) pack, len), \ - ##args); - -#define LOGP_WITH_ADDR(ss, level, addr, fmt, args...) \ - LOGP(ss, level, "addr(%s:%d) " fmt, \ - inet_ntoa((addr)->sin_addr), htons((addr)->sin_port), \ - ##args);
TALLOC_CTX *tall_libgtp_ctx = NULL;
diff --git a/gtp/gtp_internal.h b/gtp/gtp_internal.h index 06ba342..e3cbbca 100644 --- a/gtp/gtp_internal.h +++ b/gtp/gtp_internal.h @@ -3,6 +3,22 @@ #include <stdint.h> #include <talloc.h>
+#include <arpa/inet.h> +#include <netinet/in.h> +#include <sys/socket.h> + +#define GTP_LOGPKG(pri, peer, pack, len, fmt, args...) \ +logp2(DLGTP, pri, __FILE__, __LINE__, 0, \ + "Packet from %s:%u, length: %d content: %s: " fmt, \ + inet_ntoa((peer)->sin_addr), ntohs((peer)->sin_port), \ + len, osmo_hexdump((const uint8_t *) pack, len), \ + ##args); + +#define LOGP_WITH_ADDR(ss, level, peer, fmt, args...) \ +LOGP(ss, level, "addr(%s:%d) " fmt, \ + inet_ntoa((peer)->sin_addr), ntohs((peer)->sin_port), \ + ##args); + uint64_t gtp_imsi_str2gtp(const char *str);
extern TALLOC_CTX *tall_libgtp_ctx;