| Wireshark 4.7.3 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
18 extern "C" {
19#endif /* __cplusplus */
20
24 typedef 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;
34} mmdb_lookup_t;
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
92 static 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 */
inet_addr.h
ws_in6_addr
struct e_in6_addr ws_in6_addr
Represents a 128-bit IPv6 address.
ws_in4_addr
uint32_t ws_in4_addr
Represents a 32-bit IPv4 address in network byte order.
Definition inet_addr.h:22
maxmind_db_pref_apply
WS_DLL_LOCAL void maxmind_db_pref_apply(void)
Apply preferences for MaxMind database resolution.
Definition maxmind_db.c:869
maxmind_db_lookup_ipv6
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.
maxmind_db_pref_init
WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres)
Init / reset function called from prefs_reset.
maxmind_db_lookup_ipv4
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.
mmdb_lookup_t
struct _mmdb_lookup_t mmdb_lookup_t
Holds the result of a MaxMind database (MMDB) geolocation and ASN lookup for a single IP address.
maxmind_db_pref_cleanup
WS_DLL_LOCAL void maxmind_db_pref_cleanup(void)
Cleanup function called from prefs_cleanup.
Definition maxmind_db.c:866
maxmind_db_lookup_process
WS_DLL_LOCAL bool maxmind_db_lookup_process(void)
Process outstanding requests.
Definition maxmind_db.c:872
maxmind_db_set_synchrony
WS_DLL_PUBLIC void maxmind_db_set_synchrony(bool synchronous)
Select whether lookups should be performed synchronously.
Definition maxmind_db.c:893
maxmind_db_get_paths
WS_DLL_PUBLIC char * maxmind_db_get_paths(void)
Get all configured paths.
Definition maxmind_db.c:888
prefs.h
_mmdb_lookup_t
Holds the result of a MaxMind database (MMDB) geolocation and ASN lookup for a single IP address.
Definition maxmind_db.h:24
_mmdb_lookup_t::as_number
uint32_t as_number
Definition maxmind_db.h:29
_mmdb_lookup_t::country_iso
const char * country_iso
Definition maxmind_db.h:27
_mmdb_lookup_t::accuracy
uint16_t accuracy
Definition maxmind_db.h:33
_mmdb_lookup_t::found
bool found
Definition maxmind_db.h:25
_mmdb_lookup_t::latitude
double latitude
Definition maxmind_db.h:31
_mmdb_lookup_t::as_org
const char * as_org
Definition maxmind_db.h:30
_mmdb_lookup_t::country
const char * country
Definition maxmind_db.h:26
_mmdb_lookup_t::longitude
double longitude
Definition maxmind_db.h:32
_mmdb_lookup_t::city
const char * city
Definition maxmind_db.h:28