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 
71 WS_DLL_PUBLIC gchar *maxmind_db_get_paths(void);
72 
78 WS_DLL_LOCAL gboolean maxmind_db_lookup_process(void);
79 
83 static inline gboolean maxmind_db_has_coords(const mmdb_lookup_t *result)
84 {
85  return result && result->found &&
86  result->longitude != DBL_MAX && result->latitude != DBL_MAX;
87 }
88 
99 WS_DLL_PUBLIC void maxmind_db_set_synchrony(gboolean synchronous);
100 
101 #ifdef __cplusplus
102 }
103 #endif /* __cplusplus */
104 
105 #endif /* __MAXMIND_DB_H__ */
106 
107 /*
108  * Editor modelines
109  *
110  * Local Variables:
111  * c-basic-offset: 4
112  * tab-width: 8
113  * indent-tabs-mode: nil
114  * End:
115  *
116  * ex: set shiftwidth=4 tabstop=8 expandtab:
117  * :indentSize=4:tabSize=8:noTabs=true:
118  */
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