mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Move MMDB logic out of mmdb.bif and into MMDB.cc/h.
This does not change the implementation except for some light renaming where things are now naturally scoped within MMDB.cc.
This commit is contained in:
parent
20841ac689
commit
a06053ce75
4 changed files with 456 additions and 494 deletions
38
src/MMDB.h
Normal file
38
src/MMDB.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "zeek/Val.h"
|
||||
|
||||
namespace zeek {
|
||||
|
||||
#ifdef USE_GEOIP
|
||||
|
||||
#include <maxminddb.h>
|
||||
|
||||
class MMDB {
|
||||
public:
|
||||
MMDB(const char* filename, struct stat info);
|
||||
|
||||
~MMDB();
|
||||
|
||||
MMDB_lookup_result_s Lookup(const struct sockaddr* const sa);
|
||||
bool StaleDB();
|
||||
const char* Filename();
|
||||
|
||||
private:
|
||||
MMDB_s mmdb;
|
||||
struct stat file_info;
|
||||
bool lookup_error;
|
||||
double last_check;
|
||||
};
|
||||
|
||||
#endif // USE_GEOIP
|
||||
|
||||
ValPtr mmdb_open_location_db(zeek::StringVal* filename);
|
||||
ValPtr mmdb_open_asn_db(zeek::StringVal* filename);
|
||||
|
||||
RecordValPtr mmdb_lookup_location(zeek::AddrVal* addr);
|
||||
RecordValPtr mmdb_lookup_autonomous_system(zeek::AddrVal* addr);
|
||||
|
||||
} // namespace zeek
|
Loading…
Add table
Add a link
Reference in a new issue