| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
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 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
39WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres);
40
44WS_DLL_LOCAL void maxmind_db_pref_cleanup(void);
45
46WS_DLL_LOCAL void maxmind_db_pref_apply(void);
47
55WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv4(const ws_in4_addr *addr);
56
64WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t *maxmind_db_lookup_ipv6(const ws_in6_addr *addr);
65
72WS_DLL_PUBLIC char *maxmind_db_get_paths(void);
73
79WS_DLL_LOCAL bool maxmind_db_lookup_process(void);
80
84 static inline bool 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
100WS_DLL_PUBLIC void maxmind_db_set_synchrony(bool 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 */
inet_addr.h
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_lookup_ipv6
WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t * maxmind_db_lookup_ipv6(const ws_in6_addr *addr)
maxmind_db_pref_init
WS_DLL_LOCAL void maxmind_db_pref_init(module_t *nameres)
maxmind_db_lookup_ipv4
WS_DLL_PUBLIC WS_RETNONNULL const mmdb_lookup_t * maxmind_db_lookup_ipv4(const ws_in4_addr *addr)
maxmind_db_pref_cleanup
WS_DLL_LOCAL void maxmind_db_pref_cleanup(void)
Definition maxmind_db.c:866
maxmind_db_lookup_process
WS_DLL_LOCAL bool maxmind_db_lookup_process(void)
Definition maxmind_db.c:872
maxmind_db_set_synchrony
WS_DLL_PUBLIC void maxmind_db_set_synchrony(bool synchronous)
Definition maxmind_db.c:893
maxmind_db_get_paths
WS_DLL_PUBLIC char * maxmind_db_get_paths(void)
Definition maxmind_db.c:888
prefs.h
_mmdb_lookup_t
Definition maxmind_db.h:24
e_in6_addr
Represents a 128-bit IPv6 address.
Definition inet_addr.h:27
pref_module
Definition prefs-int.h:27