diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-07-11 12:46:53 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-07-11 12:46:53 +0200 |
commit | 0b8aa3c5f07f27ce8e78733b81c1a142b99666aa (patch) | |
tree | 9da8a371fedb22dc07ee69ae7e7547214c541edc /geoip.h | |
parent | e0e8ae1e85f3a835f6bc0e6ff686b2d662b22d77 (diff) |
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 <dborkman@redhat.com>
Diffstat (limited to 'geoip.h')
-rw-r--r-- | geoip.h | 84 |
1 files changed, 84 insertions, 0 deletions
@@ -1,8 +1,13 @@ #ifndef GEOIPH_H #define GEOIPH_H +#include <stdio.h> #include <netinet/in.h> +#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 */ |