Wireshark  4.3.0
The Wireshark network protocol analyzer
maxmind_db.h
Go to the documentation of this file.
1 
13 #ifndef __MAXMIND_DB_H__
14 #define __MAXMIND_DB_H__
15 
16 #include <epan/prefs.h>
17 #include <wsutil/inet_ipv4.h>
18 #include <wsutil/inet_ipv6.h>
19 #include "ws_symbol_export.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 typedef struct _mmdb_lookup_t {
26  gboolean found;
27  const char *country;
28  const char *country_iso;
29  const char *city;
30  guint32 as_number;
31  const char *as_org;
32  double latitude;
33  double longitude;
34  guint16 accuracy;
36 
40 WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres);
41 
45 WS_DLL_LOCAL void maxmind_db_pref_cleanup(void);
46 
47 WS_DLL_LOCAL void maxmind_db_pref_apply(void);
48 
56 WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv4(const ws_in4_addr *addr);
57 
65 WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv6(const ws_in6_addr *addr);
66 
72 WS_DLL_PUBLIC gchar *maxmind_db_get_paths(void);
73 
79 WS_DLL_LOCAL gboolean maxmind_db_lookup_process(void);
80 
84 static inline gboolean maxmind_db_has_coords(const mmdb_lookup_t *result)
85 {
86  return result && result->found &&
87  result->longitude != DBL_MAX && result->latitude != DBL_MAX;
88 }
89 
100 WS_DLL_PUBLIC void maxmind_db_set_synchrony(gboolean synchronous);
101 
102 #ifdef __cplusplus
103 }
104 #endif /* __cplusplus */
105 
106 #endif /* __MAXMIND_DB_H__ */
107 
108 /*
109  * Editor modelines
110  *
111  * Local Variables:
112  * c-basic-offset: 4
113  * tab-width: 8
114  * indent-tabs-mode: nil
115  * End:
116  *
117  * ex: set shiftwidth=4 tabstop=8 expandtab:
118  * :indentSize=4:tabSize=8:noTabs=true:
119  */
WS_DLL_LOCAL gboolean maxmind_db_lookup_process(void)
Definition: maxmind_db.c:825
WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t * maxmind_db_lookup_ipv4(const ws_in4_addr *addr)
WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres)
WS_DLL_PUBLIC void maxmind_db_set_synchrony(gboolean synchronous)
Definition: maxmind_db.c:846
WS_DLL_LOCAL void maxmind_db_pref_cleanup(void)
Definition: maxmind_db.c:819
WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t * maxmind_db_lookup_ipv6(const ws_in6_addr *addr)
WS_DLL_PUBLIC gchar * maxmind_db_get_paths(void)
Definition: maxmind_db.c:841
Definition: maxmind_db.h:25
Definition: inet_ipv6.h:21
Definition: prefs-int.h:27