From 0b8aa3c5f07f27ce8e78733b81c1a142b99666aa Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Thu, 11 Jul 2013 12:46:53 +0200 Subject: configure, netsniff-ng: make netsniff-ng's geoip dependency optional Geoip dependency should not be mandatory as it's not a core part of netsniff-ng. This also facilitates compilation on platforms where geoip is not available. Signed-off-by: Daniel Borkmann --- geoip.h | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'geoip.h') diff --git a/geoip.h b/geoip.h index b6884e7..c84b335 100644 --- a/geoip.h +++ b/geoip.h @@ -1,8 +1,13 @@ #ifndef GEOIPH_H #define GEOIPH_H +#include #include +#include "config.h" +#include "die.h" + +#ifdef HAVE_GEOIP extern void init_geoip(int enforce); extern void update_geoip(void); extern int geoip_working(void); @@ -19,5 +24,84 @@ extern float geoip6_latitude(struct sockaddr_in6 sa); extern const char *geoip4_as_name(struct sockaddr_in sa); extern const char *geoip6_as_name(struct sockaddr_in6 sa); extern void destroy_geoip(void); +#else +static inline void init_geoip(int enforce) +{ +} + +static inline void destroy_geoip(void) +{ +} + +static inline void update_geoip(void) +{ + panic("No built-in geoip support!\n"); +} + +static inline int geoip_working(void) +{ + return 0; +} + +static inline const char *geoip4_city_name(struct sockaddr_in sa) +{ + return NULL; +} + +static inline const char *geoip6_city_name(struct sockaddr_in6 sa) +{ + return NULL; +} + +static inline const char *geoip4_region_name(struct sockaddr_in sa) +{ + return NULL; +} + +static inline const char *geoip6_region_name(struct sockaddr_in6 sa) +{ + return NULL; +} + +static inline const char *geoip4_country_name(struct sockaddr_in sa) +{ + return NULL; +} + +static inline const char *geoip6_country_name(struct sockaddr_in6 sa) +{ + return NULL; +} + +static inline float geoip4_longitude(struct sockaddr_in sa) +{ + return .0f; +} + +static inline float geoip4_latitude(struct sockaddr_in sa) +{ + return .0f; +} + +static inline float geoip6_longitude(struct sockaddr_in6 sa) +{ + return .0f; +} + +static inline float geoip6_latitude(struct sockaddr_in6 sa) +{ + return .0f; +} + +static inline const char *geoip4_as_name(struct sockaddr_in sa) +{ + return NULL; +} + +static inline const char *geoip6_as_name(struct sockaddr_in6 sa) +{ + return NULL; +} +#endif #endif /* GEOIPH_H */ -- cgit v1.2.3-54-g00ecf