mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
many helper functions
This commit is contained in:
parent
3654060246
commit
d7a3b85fcd
6 changed files with 245 additions and 31 deletions
|
@ -18,12 +18,17 @@ public:
|
|||
bool Init(string arg_source, int num_fields, const LogField* const* fields);
|
||||
|
||||
void Finish();
|
||||
|
||||
bool Update();
|
||||
|
||||
protected:
|
||||
// Methods that have to be overwritten by the individual readers
|
||||
virtual bool DoInit(string arg_source, int num_fields, const LogField* const * fields) = 0;
|
||||
|
||||
virtual void DoFinish() = 0;
|
||||
|
||||
// update file contents to logmgr
|
||||
virtual bool DoUpdate() = 0;
|
||||
|
||||
// Reports an error to the user.
|
||||
void Error(const char *msg);
|
||||
|
@ -31,6 +36,9 @@ protected:
|
|||
// The following methods return the information as passed to Init().
|
||||
const string Source() const { return source; }
|
||||
|
||||
// A thread-safe version of fmt(). (stolen from logwriter)
|
||||
const char* Fmt(const char* format, ...);
|
||||
|
||||
private:
|
||||
friend class InputMgr;
|
||||
|
||||
|
@ -44,6 +52,10 @@ private:
|
|||
bool disabled;
|
||||
|
||||
bool Disabled() { return disabled; }
|
||||
|
||||
// For implementing Fmt().
|
||||
char* buf;
|
||||
unsigned int buf_len;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue