Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
maxmind_db.h
Go to the documentation of this file.
1
12#pragma once
13#include <epan/prefs.h>
14#include <wsutil/inet_addr.h>
15#include "ws_symbol_export.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
24typedef struct _mmdb_lookup_t {
25 bool found;
26 const char* country;
27 const char* country_iso;
28 const char* city;
29 uint32_t as_number;
30 const char* as_org;
31 double latitude;
32 double longitude;
33 uint16_t accuracy;
35
41WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres);
42
46WS_DLL_LOCAL void maxmind_db_pref_cleanup(void);
47
51WS_DLL_LOCAL void maxmind_db_pref_apply(void);
52
60WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv4(const ws_in4_addr *addr);
61
69WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv6(const ws_in6_addr *addr);
70
77WS_DLL_PUBLIC char *maxmind_db_get_paths(void);
78
84WS_DLL_LOCAL bool maxmind_db_lookup_process(void);
85
92static inline bool maxmind_db_has_coords(const mmdb_lookup_t *result)
93{
94 return result && result->found &&
95 result->longitude != DBL_MAX && result->latitude != DBL_MAX;
96}
97
109WS_DLL_PUBLIC void maxmind_db_set_synchrony(bool synchronous);
110
111#ifdef __cplusplus
112}
113#endif /* __cplusplus */
114
115/*
116 * Editor modelines
117 *
118 * Local Variables:
119 * c-basic-offset: 4
120 * tab-width: 8
121 * indent-tabs-mode: nil
122 * End:
123 *
124 * ex: set shiftwidth=4 tabstop=8 expandtab:
125 * :indentSize=4:tabSize=8:noTabs=true:
126 */
uint32_t ws_in4_addr
Represents a 32-bit IPv4 address in network byte order.
Definition inet_addr.h:22
WS_DLL_LOCAL void maxmind_db_pref_apply(void)
Apply preferences for MaxMind database resolution.
Definition maxmind_db.c:869
WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t * maxmind_db_lookup_ipv6(const ws_in6_addr *addr)
Look up an IPv6 address in a database.
WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres)
Init / reset function called from prefs_reset.
WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t * maxmind_db_lookup_ipv4(const ws_in4_addr *addr)
Look up an IPv4 address in a database.
struct _mmdb_lookup_t mmdb_lookup_t
Holds the result of a MaxMind database (MMDB) geolocation and ASN lookup for a single IP address.
WS_DLL_LOCAL void maxmind_db_pref_cleanup(void)
Cleanup function called from prefs_cleanup.
Definition maxmind_db.c:866
WS_DLL_LOCAL bool maxmind_db_lookup_process(void)
Process outstanding requests.
Definition maxmind_db.c:872
WS_DLL_PUBLIC void maxmind_db_set_synchrony(bool synchronous)
Select whether lookups should be performed synchronously.
Definition maxmind_db.c:893
WS_DLL_PUBLIC char * maxmind_db_get_paths(void)
Get all configured paths.
Definition maxmind_db.c:888
Holds the result of a MaxMind database (MMDB) geolocation and ASN lookup for a single IP address.
Definition maxmind_db.h:24
uint32_t as_number
Definition maxmind_db.h:29
const char * country_iso
Definition maxmind_db.h:27
uint16_t accuracy
Definition maxmind_db.h:33
bool found
Definition maxmind_db.h:25
double latitude
Definition maxmind_db.h:31
const char * as_org
Definition maxmind_db.h:30
const char * country
Definition maxmind_db.h:26
double longitude
Definition maxmind_db.h:32
const char * city
Definition maxmind_db.h:28
Represents a 128-bit IPv6 address.
Definition inet_addr.h:27
Represents a preference module grouping related preferences under a named, hierarchical entry in the ...
Definition prefs-int.h:27