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
21typedef struct _mmdb_lookup_t {
22 bool found;
23 const char *country;
24 const char *country_iso;
25 const char *city;
26 uint32_t as_number;
27 const char *as_org;
28 double latitude;
29 double longitude;
30 uint16_t accuracy;
32
36WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres);
37
41WS_DLL_LOCAL void maxmind_db_pref_cleanup(void);
42
43WS_DLL_LOCAL void maxmind_db_pref_apply(void);
44
52WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv4(const ws_in4_addr *addr);
53
61WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv6(const ws_in6_addr *addr);
62
69WS_DLL_PUBLIC char *maxmind_db_get_paths(void);
70
76WS_DLL_LOCAL bool maxmind_db_lookup_process(void);
77
81static inline bool maxmind_db_has_coords(const mmdb_lookup_t *result)
82{
83 return result && result->found &&
84 result->longitude != DBL_MAX && result->latitude != DBL_MAX;
85}
86
97WS_DLL_PUBLIC void maxmind_db_set_synchrony(bool synchronous);
98
99#ifdef __cplusplus
100}
101#endif /* __cplusplus */
102
103/*
104 * Editor modelines
105 *
106 * Local Variables:
107 * c-basic-offset: 4
108 * tab-width: 8
109 * indent-tabs-mode: nil
110 * End:
111 *
112 * ex: set shiftwidth=4 tabstop=8 expandtab:
113 * :indentSize=4:tabSize=8:noTabs=true:
114 */
uint32_t ws_in4_addr
Represents a 32-bit IPv4 address in network byte order.
Definition inet_addr.h:22
WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t * maxmind_db_lookup_ipv6(const ws_in6_addr *addr)
WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres)
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_cleanup(void)
Definition maxmind_db.c:866
WS_DLL_LOCAL bool maxmind_db_lookup_process(void)
Definition maxmind_db.c:872
WS_DLL_PUBLIC void maxmind_db_set_synchrony(bool synchronous)
Definition maxmind_db.c:893
WS_DLL_PUBLIC char * maxmind_db_get_paths(void)
Definition maxmind_db.c:888
Definition maxmind_db.h:21
Represents a 128-bit IPv6 address.
Definition inet_addr.h:27
Definition prefs-int.h:24