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_addr.h>
18 #include "ws_symbol_export.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23 
24 typedef struct _mmdb_lookup_t {
25  gboolean found;
26  const char *country;
27  const char *country_iso;
28  const char *city;
29  guint32 as_number;
30  const char *as_org;
31  double latitude;
32  double longitude;
33  guint16 accuracy;
35 
39 WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres);
40 
44 WS_DLL_LOCAL void maxmind_db_pref_cleanup(void);
45 
46 WS_DLL_LOCAL void maxmind_db_pref_apply(void);
47 
55 WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv4(const ws_in4_addr *addr);
56 
64 WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv6(const ws_in6_addr *addr);
65 
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:833
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:854
WS_DLL_LOCAL void maxmind_db_pref_cleanup(void)
Definition: maxmind_db.c:827
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:849
Definition: maxmind_db.h:24
Definition: inet_addr.h:21
Definition: prefs-int.h:27