Mark one-parameter constructors as explicit & use override where possible

This commit marks (hopefully) ever one-parameter constructor as explicit.

It also uses override in (hopefully) all circumstances where a virtual
method is overridden.

There are a very few other minor changes - most of them were necessary
to get everything to compile (like one additional constructor). In one
case I changed an implicit operation to an explicit string conversion -
I think the automatically chosen conversion was much more convoluted.

This took longer than I want to admit but not as long as I feared :)
This commit is contained in:
Johanna Amann 2018-03-16 22:14:22 -07:00
parent 1f2bf50b49
commit 6d612ced3d
173 changed files with 1052 additions and 1046 deletions

View file

@ -66,7 +66,7 @@ protected:
class AnonymizeIPAddr_Seq : public AnonymizeIPAddr { class AnonymizeIPAddr_Seq : public AnonymizeIPAddr {
public: public:
AnonymizeIPAddr_Seq() { seq = 1; } AnonymizeIPAddr_Seq() { seq = 1; }
ipaddr32_t anonymize(ipaddr32_t addr); ipaddr32_t anonymize(ipaddr32_t addr) override;
protected: protected:
ipaddr32_t seq; ipaddr32_t seq;
@ -74,12 +74,12 @@ protected:
class AnonymizeIPAddr_RandomMD5 : public AnonymizeIPAddr { class AnonymizeIPAddr_RandomMD5 : public AnonymizeIPAddr {
public: public:
ipaddr32_t anonymize(ipaddr32_t addr); ipaddr32_t anonymize(ipaddr32_t addr) override;
}; };
class AnonymizeIPAddr_PrefixMD5 : public AnonymizeIPAddr { class AnonymizeIPAddr_PrefixMD5 : public AnonymizeIPAddr {
public: public:
ipaddr32_t anonymize(ipaddr32_t addr); ipaddr32_t anonymize(ipaddr32_t addr) override;
protected: protected:
struct anon_prefix { struct anon_prefix {
@ -91,10 +91,10 @@ protected:
class AnonymizeIPAddr_A50 : public AnonymizeIPAddr { class AnonymizeIPAddr_A50 : public AnonymizeIPAddr {
public: public:
AnonymizeIPAddr_A50() { init(); } AnonymizeIPAddr_A50() { init(); }
~AnonymizeIPAddr_A50(); ~AnonymizeIPAddr_A50() override;
ipaddr32_t anonymize(ipaddr32_t addr); ipaddr32_t anonymize(ipaddr32_t addr) override;
int PreservePrefix(ipaddr32_t input, int num_bits); int PreservePrefix(ipaddr32_t input, int num_bits) override;
protected: protected:
struct Node { struct Node {

View file

@ -40,8 +40,8 @@ typedef enum {
class Attr : public BroObj { class Attr : public BroObj {
public: public:
Attr(attr_tag t, Expr* e = 0); explicit Attr(attr_tag t, Expr* e = 0);
~Attr(); ~Attr() override;
attr_tag Tag() const { return tag; } attr_tag Tag() const { return tag; }
Expr* AttrExpr() const { return expr; } Expr* AttrExpr() const { return expr; }
@ -56,7 +56,7 @@ public:
int RedundantAttrOkay() const int RedundantAttrOkay() const
{ return tag == ATTR_REDEF || tag == ATTR_OPTIONAL; } { return tag == ATTR_REDEF || tag == ATTR_OPTIONAL; }
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
void DescribeReST(ODesc* d) const; void DescribeReST(ODesc* d) const;
bool operator==(const Attr& other) const bool operator==(const Attr& other) const
@ -84,7 +84,7 @@ protected:
class Attributes : public BroObj { class Attributes : public BroObj {
public: public:
Attributes(attr_list* a, BroType* t, bool in_record); Attributes(attr_list* a, BroType* t, bool in_record);
~Attributes(); ~Attributes() override;
void AddAttr(Attr* a); void AddAttr(Attr* a);
void AddAttrs(Attributes* a); // Unref's 'a' when done void AddAttrs(Attributes* a); // Unref's 'a' when done

View file

@ -18,7 +18,7 @@ public:
// encode_base64()), encoding-errors will go to Reporter instead of // encode_base64()), encoding-errors will go to Reporter instead of
// Weird. Usage errors go to Reporter in any case. Empty alphabet // Weird. Usage errors go to Reporter in any case. Empty alphabet
// indicates the default base64 alphabet. // indicates the default base64 alphabet.
Base64Converter(Connection* conn, const string& alphabet = ""); explicit Base64Converter(Connection* conn, const string& alphabet = "");
~Base64Converter(); ~Base64Converter();
// A note on Decode(): // A note on Decode():

View file

@ -36,8 +36,8 @@ public:
// Constructors creating internal copies of the data passed in. // Constructors creating internal copies of the data passed in.
BroString(const u_char* str, int arg_n, int add_NUL); BroString(const u_char* str, int arg_n, int add_NUL);
BroString(const char* str); explicit BroString(const char* str);
BroString(const string& str); explicit BroString(const string& str);
BroString(const BroString& bs); BroString(const BroString& bs);
// Constructor that takes owernship of the vector passed in. // Constructor that takes owernship of the vector passed in.
@ -158,7 +158,7 @@ protected:
// //
class BroStringLenCmp { class BroStringLenCmp {
public: public:
BroStringLenCmp(bool increasing = true) { _increasing = increasing; } explicit BroStringLenCmp(bool increasing = true) { _increasing = increasing; }
bool operator()(BroString*const& bst1, BroString*const& bst2); bool operator()(BroString*const& bst1, BroString*const& bst2);
private: private:

View file

@ -167,21 +167,21 @@ public:
// messages, and pid gives a pid to monitor (if the process dies, we // messages, and pid gives a pid to monitor (if the process dies, we
// return EOF). // return EOF).
ChunkedIOFd(int fd, const char* tag, pid_t pid = 0); ChunkedIOFd(int fd, const char* tag, pid_t pid = 0);
virtual ~ChunkedIOFd(); ~ChunkedIOFd() override;
virtual bool Read(Chunk** chunk, bool may_block = false); bool Read(Chunk** chunk, bool may_block = false) override;
virtual bool Write(Chunk* chunk); bool Write(Chunk* chunk) override;
virtual bool Flush(); bool Flush() override;
virtual const char* Error(); const char* Error() override;
virtual bool CanRead(); bool CanRead() override;
virtual bool CanWrite(); bool CanWrite() override;
virtual bool IsIdle(); bool IsIdle() override;
virtual bool IsFillingUp(); bool IsFillingUp() override;
virtual void Clear(); void Clear() override;
virtual bool Eof() { return eof; } bool Eof() override { return eof; }
virtual int Fd() { return fd; } int Fd() override { return fd; }
virtual iosource::FD_Set ExtraReadFDs() const; iosource::FD_Set ExtraReadFDs() const override;
virtual void Stats(char* buffer, int length); void Stats(char* buffer, int length) override;
private: private:
@ -252,22 +252,22 @@ public:
// Argument is an open socket and a flag indicating whether we are the // Argument is an open socket and a flag indicating whether we are the
// server side of the connection. // server side of the connection.
ChunkedIOSSL(int socket, bool server); ChunkedIOSSL(int socket, bool server);
virtual ~ChunkedIOSSL(); ~ChunkedIOSSL() override;
virtual bool Init(); bool Init() override;
virtual bool Read(Chunk** chunk, bool mayblock = false); bool Read(Chunk** chunk, bool mayblock = false) override;
virtual bool Write(Chunk* chunk); bool Write(Chunk* chunk) override;
virtual bool Flush(); bool Flush() override;
virtual const char* Error(); const char* Error() override;
virtual bool CanRead(); bool CanRead() override;
virtual bool CanWrite(); bool CanWrite() override;
virtual bool IsIdle(); bool IsIdle() override;
virtual bool IsFillingUp(); bool IsFillingUp() override;
virtual void Clear(); void Clear() override;
virtual bool Eof() { return eof; } bool Eof() override { return eof; }
virtual int Fd() { return socket; } int Fd() override { return socket; }
virtual iosource::FD_Set ExtraReadFDs() const; iosource::FD_Set ExtraReadFDs() const override;
virtual void Stats(char* buffer, int length); void Stats(char* buffer, int length) override;
private: private:
@ -315,27 +315,27 @@ private:
// Wrapper class around a another ChunkedIO which the (un-)compresses data. // Wrapper class around a another ChunkedIO which the (un-)compresses data.
class CompressedChunkedIO : public ChunkedIO { class CompressedChunkedIO : public ChunkedIO {
public: public:
CompressedChunkedIO(ChunkedIO* arg_io) // takes ownership explicit CompressedChunkedIO(ChunkedIO* arg_io) // takes ownership
: io(arg_io), zin(), zout(), error(), compress(), uncompress(), : io(arg_io), zin(), zout(), error(), compress(), uncompress(),
uncompressed_bytes_read(), uncompressed_bytes_written() {} uncompressed_bytes_read(), uncompressed_bytes_written() {}
virtual ~CompressedChunkedIO() { delete io; } ~CompressedChunkedIO() override { delete io; }
virtual bool Init(); // does *not* call arg_io->Init() bool Init() override; // does *not* call arg_io->Init()
virtual bool Read(Chunk** chunk, bool may_block = false); bool Read(Chunk** chunk, bool may_block = false) override;
virtual bool Write(Chunk* chunk); bool Write(Chunk* chunk) override;
virtual bool Flush() { return io->Flush(); } bool Flush() override { return io->Flush(); }
virtual const char* Error() { return error ? error : io->Error(); } const char* Error() override { return error ? error : io->Error(); }
virtual bool CanRead() { return io->CanRead(); } bool CanRead() override { return io->CanRead(); }
virtual bool CanWrite() { return io->CanWrite(); } bool CanWrite() override { return io->CanWrite(); }
virtual bool IsIdle() { return io->IsIdle(); } bool IsIdle() override { return io->IsIdle(); }
virtual bool IsFillingUp() { return io->IsFillingUp(); } bool IsFillingUp() override { return io->IsFillingUp(); }
virtual void Clear() { return io->Clear(); } void Clear() override { return io->Clear(); }
bool Eof() override { return io->Eof(); }
virtual bool Eof() { return io->Eof(); } int Fd() override { return io->Fd(); }
virtual int Fd() { return io->Fd(); } iosource::FD_Set ExtraReadFDs() const override
virtual iosource::FD_Set ExtraReadFDs() const
{ return io->ExtraReadFDs(); } { return io->ExtraReadFDs(); }
virtual void Stats(char* buffer, int length); void Stats(char* buffer, int length) override;
void EnableCompression(int level) void EnableCompression(int level)
{ deflateInit(&zout, level); compress = true; } { deflateInit(&zout, level); compress = true; }

View file

@ -10,7 +10,7 @@ class ListVal;
class CompositeHash { class CompositeHash {
public: public:
CompositeHash(TypeList* composite_type); explicit CompositeHash(TypeList* composite_type);
~CompositeHash(); ~CompositeHash();
// Compute the hash corresponding to the given index val, // Compute the hash corresponding to the given index val,

View file

@ -57,7 +57,7 @@ class Connection : public BroObj {
public: public:
Connection(NetSessions* s, HashKey* k, double t, const ConnID* id, Connection(NetSessions* s, HashKey* k, double t, const ConnID* id,
uint32 flow, const Packet* pkt, const EncapsulationStack* arg_encap); uint32 flow, const Packet* pkt, const EncapsulationStack* arg_encap);
virtual ~Connection(); ~Connection() override;
// Invoked when an encapsulation is discovered. It records the // Invoked when an encapsulation is discovered. It records the
// encapsulation with the connection and raises a "tunnel_changed" // encapsulation with the connection and raises a "tunnel_changed"
@ -252,7 +252,7 @@ public:
// Sets the transport protocol in use. // Sets the transport protocol in use.
void SetTransport(TransportProto arg_proto) { proto = arg_proto; } void SetTransport(TransportProto arg_proto) { proto = arg_proto; }
void SetUID(Bro::UID arg_uid) { uid = arg_uid; } void SetUID(const Bro::UID &arg_uid) { uid = arg_uid; }
Bro::UID GetUID() const { return uid; } Bro::UID GetUID() const { return uid; }
@ -336,7 +336,7 @@ public:
double arg_t, int arg_do_expire, TimerType arg_type) double arg_t, int arg_do_expire, TimerType arg_type)
: Timer(arg_t, arg_type) : Timer(arg_t, arg_type)
{ Init(arg_conn, arg_timer, arg_do_expire); } { Init(arg_conn, arg_timer, arg_do_expire); }
virtual ~ConnectionTimer(); ~ConnectionTimer() override;
void Dispatch(double t, int is_expire) override; void Dispatch(double t, int is_expire) override;

View file

@ -23,7 +23,7 @@ class DFA_State : public BroObj {
public: public:
DFA_State(int state_num, const EquivClass* ec, DFA_State(int state_num, const EquivClass* ec,
NFA_state_list* nfa_states, AcceptingSet* accept); NFA_state_list* nfa_states, AcceptingSet* accept);
~DFA_State(); ~DFA_State() override;
int StateNum() const { return state_num; } int StateNum() const { return state_num; }
int NFAStateNum() const { return nfa_states->length(); } int NFAStateNum() const { return nfa_states->length(); }
@ -44,7 +44,7 @@ public:
// Returns the equivalence classes of ec's corresponding to this state. // Returns the equivalence classes of ec's corresponding to this state.
const EquivClass* MetaECs() const { return meta_ec; } const EquivClass* MetaECs() const { return meta_ec; }
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
void Dump(FILE* f, DFA_Machine* m); void Dump(FILE* f, DFA_Machine* m);
void Stats(unsigned int* computed, unsigned int* uncomputed); void Stats(unsigned int* computed, unsigned int* uncomputed);
unsigned int Size(); unsigned int Size();
@ -117,7 +117,7 @@ typedef PList(DFA_State) DFA_state_list;
class DFA_Machine : public BroObj { class DFA_Machine : public BroObj {
public: public:
DFA_Machine(NFA_Machine* n, EquivClass* ec); DFA_Machine(NFA_Machine* n, EquivClass* ec);
~DFA_Machine(); ~DFA_Machine() override;
DFA_State* StartState() const { return start_state; } DFA_State* StartState() const { return start_state; }
@ -127,7 +127,7 @@ public:
int Rep(int sym); int Rep(int sym);
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
void Dump(FILE* f); void Dump(FILE* f);
unsigned int MemoryAllocation() const; unsigned int MemoryAllocation() const;

View file

@ -112,7 +112,7 @@ public:
IPAddr ReqAddr() const { return req_addr; } IPAddr ReqAddr() const { return req_addr; }
string ReqStr() const string ReqStr() const
{ {
return req_host ? req_host : req_addr; return req_host ? req_host : req_addr.AsString();
} }
ListVal* Addrs(); ListVal* Addrs();

View file

@ -42,8 +42,8 @@ enum DNS_MgrMode {
class DNS_Mgr : public iosource::IOSource { class DNS_Mgr : public iosource::IOSource {
public: public:
DNS_Mgr(DNS_MgrMode mode); explicit DNS_Mgr(DNS_MgrMode mode);
virtual ~DNS_Mgr(); ~DNS_Mgr() override;
void InitPostScript(); void InitPostScript();
void Flush(); void Flush();
@ -132,11 +132,11 @@ protected:
void DoProcess(bool flush); void DoProcess(bool flush);
// IOSource interface. // IOSource interface.
virtual void GetFds(iosource::FD_Set* read, iosource::FD_Set* write, void GetFds(iosource::FD_Set* read, iosource::FD_Set* write,
iosource::FD_Set* except); iosource::FD_Set* except) override;
virtual double NextTimestamp(double* network_time); double NextTimestamp(double* network_time) override;
virtual void Process(); void Process() override;
virtual const char* Tag() { return "DNS_Mgr"; } const char* Tag() override { return "DNS_Mgr"; }
DNS_MgrMode mode; DNS_MgrMode mode;

View file

@ -7,8 +7,8 @@
class DbgWatch { class DbgWatch {
public: public:
DbgWatch(BroObj* var_to_watch); explicit DbgWatch(BroObj* var_to_watch);
DbgWatch(Expr* expr_to_watch); explicit DbgWatch(Expr* expr_to_watch);
~DbgWatch(); ~DbgWatch();
protected: protected:

View file

@ -27,7 +27,7 @@ class BroType;
class ODesc { class ODesc {
public: public:
ODesc(desc_type t=DESC_READABLE, BroFile* f=0); explicit ODesc(desc_type t=DESC_READABLE, BroFile* f=0);
~ODesc(); ~ODesc();

View file

@ -29,7 +29,7 @@ extern void generic_delete_func(void*);
class Dictionary { class Dictionary {
public: public:
Dictionary(dict_order ordering = UNORDERED, explicit Dictionary(dict_order ordering = UNORDERED,
int initial_size = DEFAULT_DICT_SIZE); int initial_size = DEFAULT_DICT_SIZE);
virtual ~Dictionary(); virtual ~Dictionary();
@ -141,8 +141,8 @@ private:
int NextPrime(int n) const; int NextPrime(int n) const;
int IsPrime(int n) const; int IsPrime(int n) const;
void StartChangeSize(int new_size); void StartChangeSize(int new_size);
void FinishChangeSize(void); void FinishChangeSize();
void MoveChains(void); void MoveChains();
// The following get and set the "density" threshold - if the // The following get and set the "density" threshold - if the
// average hash chain length exceeds this threshold, the // average hash chain length exceeds this threshold, the
@ -195,7 +195,7 @@ private:
#define PDictdeclare(type) \ #define PDictdeclare(type) \
class PDict(type) : public Dictionary { \ class PDict(type) : public Dictionary { \
public: \ public: \
PDict(type)(dict_order ordering = UNORDERED, \ explicit PDict(type)(dict_order ordering = UNORDERED, \
int initial_size = DEFAULT_DICT_SIZE) : \ int initial_size = DEFAULT_DICT_SIZE) : \
Dictionary(ordering, initial_size) {} \ Dictionary(ordering, initial_size) {} \
type* Lookup(const char* key) const \ type* Lookup(const char* key) const \

View file

@ -9,7 +9,7 @@
class EquivClass { class EquivClass {
public: public:
EquivClass(int size); explicit EquivClass(int size);
~EquivClass(); ~EquivClass();
void UniqueChar(int sym); void UniqueChar(int sym);

View file

@ -16,7 +16,7 @@ public:
Event(EventHandlerPtr handler, val_list* args, Event(EventHandlerPtr handler, val_list* args,
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
TimerMgr* mgr = 0, BroObj* obj = 0); TimerMgr* mgr = 0, BroObj* obj = 0);
~Event(); ~Event() override;
void SetNext(Event* n) { next_event = n; } void SetNext(Event* n) { next_event = n; }
Event* NextEvent() const { return next_event; } Event* NextEvent() const { return next_event; }
@ -27,7 +27,7 @@ public:
EventHandlerPtr Handler() const { return handler; } EventHandlerPtr Handler() const { return handler; }
val_list* Args() const { return args; } val_list* Args() const { return args; }
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
protected: protected:
friend class EventMgr; friend class EventMgr;
@ -78,9 +78,9 @@ extern uint64 num_events_dispatched;
class EventMgr : public BroObj { class EventMgr : public BroObj {
public: public:
EventMgr(); EventMgr();
~EventMgr(); ~EventMgr() override;
void QueueEvent(EventHandlerPtr h, val_list* vl, void QueueEvent(const EventHandlerPtr &h, val_list* vl,
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
TimerMgr* mgr = 0, BroObj* obj = 0) TimerMgr* mgr = 0, BroObj* obj = 0)
{ {
@ -118,7 +118,7 @@ public:
// Returns a peer record describing the local Bro. // Returns a peer record describing the local Bro.
RecordVal* GetLocalPeerVal(); RecordVal* GetLocalPeerVal();
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
protected: protected:
void QueueEvent(Event* event); void QueueEvent(Event* event);

View file

@ -17,7 +17,7 @@ class UnserialInfo;
class EventHandler { class EventHandler {
public: public:
EventHandler(const char* name); explicit EventHandler(const char* name);
~EventHandler(); ~EventHandler();
const char* Name() { return name; } const char* Name() { return name; }
@ -44,7 +44,7 @@ public:
void Call(val_list* vl, bool no_remote = false); void Call(val_list* vl, bool no_remote = false);
// Returns true if there is at least one local or remote handler. // Returns true if there is at least one local or remote handler.
operator bool() const; explicit operator bool() const;
void SetUsed() { used = true; } void SetUsed() { used = true; }
bool Used() { return used; } bool Used() { return used; }

View file

@ -63,7 +63,7 @@ public:
BroType* Type() const { return type; } BroType* Type() const { return type; }
BroExprTag Tag() const { return tag; } BroExprTag Tag() const { return tag; }
virtual ~Expr(); ~Expr() override;
Expr* Ref() { ::Ref(this); return this; } Expr* Ref() { ::Ref(this); return this; }
@ -182,7 +182,7 @@ public:
return (AssignExpr*) this; return (AssignExpr*) this;
} }
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
bool Serialize(SerialInfo* info) const; bool Serialize(SerialInfo* info) const;
static Expr* Unserialize(UnserialInfo* info, BroExprTag want = EXPR_ANY); static Expr* Unserialize(UnserialInfo* info, BroExprTag want = EXPR_ANY);
@ -191,7 +191,7 @@ public:
protected: protected:
Expr() { type = 0; } Expr() { type = 0; }
Expr(BroExprTag arg_tag); explicit Expr(BroExprTag arg_tag);
virtual void ExprDescribe(ODesc* d) const = 0; virtual void ExprDescribe(ODesc* d) const = 0;
void AddTag(ODesc* d) const; void AddTag(ODesc* d) const;
@ -215,8 +215,8 @@ protected:
class NameExpr : public Expr { class NameExpr : public Expr {
public: public:
NameExpr(ID* id, bool const_init = false); explicit NameExpr(ID* id, bool const_init = false);
~NameExpr(); ~NameExpr() override;
ID* Id() const { return id; } ID* Id() const { return id; }
@ -241,8 +241,8 @@ protected:
class ConstExpr : public Expr { class ConstExpr : public Expr {
public: public:
ConstExpr(Val* val); explicit ConstExpr(Val* val);
~ConstExpr(); ~ConstExpr() override;
Val* Value() const { return val; } Val* Value() const { return val; }
@ -278,7 +278,7 @@ protected:
UnaryExpr() { op = 0; } UnaryExpr() { op = 0; }
UnaryExpr(BroExprTag arg_tag, Expr* arg_op); UnaryExpr(BroExprTag arg_tag, Expr* arg_op);
virtual ~UnaryExpr(); ~UnaryExpr() override;
void ExprDescribe(ODesc* d) const override; void ExprDescribe(ODesc* d) const override;
@ -316,7 +316,7 @@ protected:
if ( op1->IsError() || op2->IsError() ) if ( op1->IsError() || op2->IsError() )
SetError(); SetError();
} }
virtual ~BinaryExpr(); ~BinaryExpr() override;
// Returns the expression folded using the given constants. // Returns the expression folded using the given constants.
virtual Val* Fold(Val* v1, Val* v2) const; virtual Val* Fold(Val* v1, Val* v2) const;
@ -350,7 +350,7 @@ protected:
class CloneExpr : public UnaryExpr { class CloneExpr : public UnaryExpr {
public: public:
CloneExpr(Expr* op); explicit CloneExpr(Expr* op);
Val* Eval(Frame* f) const override; Val* Eval(Frame* f) const override;
protected: protected:
@ -379,7 +379,7 @@ protected:
class NotExpr : public UnaryExpr { class NotExpr : public UnaryExpr {
public: public:
NotExpr(Expr* op); explicit NotExpr(Expr* op);
protected: protected:
friend class Expr; friend class Expr;
@ -392,7 +392,7 @@ protected:
class PosExpr : public UnaryExpr { class PosExpr : public UnaryExpr {
public: public:
PosExpr(Expr* op); explicit PosExpr(Expr* op);
protected: protected:
friend class Expr; friend class Expr;
@ -405,7 +405,7 @@ protected:
class NegExpr : public UnaryExpr { class NegExpr : public UnaryExpr {
public: public:
NegExpr(Expr* op); explicit NegExpr(Expr* op);
protected: protected:
friend class Expr; friend class Expr;
@ -418,7 +418,7 @@ protected:
class SizeExpr : public UnaryExpr { class SizeExpr : public UnaryExpr {
public: public:
SizeExpr(Expr* op); explicit SizeExpr(Expr* op);
Val* Eval(Frame* f) const override; Val* Eval(Frame* f) const override;
protected: protected:
@ -559,7 +559,7 @@ protected:
class CondExpr : public Expr { class CondExpr : public Expr {
public: public:
CondExpr(Expr* op1, Expr* op2, Expr* op3); CondExpr(Expr* op1, Expr* op2, Expr* op3);
~CondExpr(); ~CondExpr() override;
const Expr* Op1() const { return op1; } const Expr* Op1() const { return op1; }
const Expr* Op2() const { return op2; } const Expr* Op2() const { return op2; }
@ -585,7 +585,7 @@ protected:
class RefExpr : public UnaryExpr { class RefExpr : public UnaryExpr {
public: public:
RefExpr(Expr* op); explicit RefExpr(Expr* op);
void Assign(Frame* f, Val* v, Opcode op = OP_ASSIGN) override; void Assign(Frame* f, Val* v, Opcode op = OP_ASSIGN) override;
Expr* MakeLvalue() override; Expr* MakeLvalue() override;
@ -602,7 +602,7 @@ public:
// If val is given, evaluating this expression will always yield the val // If val is given, evaluating this expression will always yield the val
// yet still perform the assignment. Used for triggers. // yet still perform the assignment. Used for triggers.
AssignExpr(Expr* op1, Expr* op2, int is_init, Val* val = 0, attr_list* attrs = 0); AssignExpr(Expr* op1, Expr* op2, int is_init, Val* val = 0, attr_list* attrs = 0);
virtual ~AssignExpr() { Unref(val); } ~AssignExpr() override { Unref(val); }
Val* Eval(Frame* f) const override; Val* Eval(Frame* f) const override;
void EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const override; void EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const override;
@ -657,7 +657,7 @@ protected:
class FieldExpr : public UnaryExpr { class FieldExpr : public UnaryExpr {
public: public:
FieldExpr(Expr* op, const char* field_name); FieldExpr(Expr* op, const char* field_name);
~FieldExpr(); ~FieldExpr() override;
int Field() const { return field; } int Field() const { return field; }
const char* FieldName() const { return field_name; } const char* FieldName() const { return field_name; }
@ -689,7 +689,7 @@ protected:
class HasFieldExpr : public UnaryExpr { class HasFieldExpr : public UnaryExpr {
public: public:
HasFieldExpr(Expr* op, const char* field_name); HasFieldExpr(Expr* op, const char* field_name);
~HasFieldExpr(); ~HasFieldExpr() override;
const char* FieldName() const { return field_name; } const char* FieldName() const { return field_name; }
@ -709,8 +709,8 @@ protected:
class RecordConstructorExpr : public UnaryExpr { class RecordConstructorExpr : public UnaryExpr {
public: public:
RecordConstructorExpr(ListExpr* constructor_list); explicit RecordConstructorExpr(ListExpr* constructor_list);
~RecordConstructorExpr(); ~RecordConstructorExpr() override;
protected: protected:
friend class Expr; friend class Expr;
@ -728,7 +728,7 @@ class TableConstructorExpr : public UnaryExpr {
public: public:
TableConstructorExpr(ListExpr* constructor_list, attr_list* attrs, TableConstructorExpr(ListExpr* constructor_list, attr_list* attrs,
BroType* arg_type = 0); BroType* arg_type = 0);
~TableConstructorExpr() { Unref(attrs); } ~TableConstructorExpr() override { Unref(attrs); }
Attributes* Attrs() { return attrs; } Attributes* Attrs() { return attrs; }
@ -751,7 +751,7 @@ class SetConstructorExpr : public UnaryExpr {
public: public:
SetConstructorExpr(ListExpr* constructor_list, attr_list* attrs, SetConstructorExpr(ListExpr* constructor_list, attr_list* attrs,
BroType* arg_type = 0); BroType* arg_type = 0);
~SetConstructorExpr() { Unref(attrs); } ~SetConstructorExpr() override { Unref(attrs); }
Attributes* Attrs() { return attrs; } Attributes* Attrs() { return attrs; }
@ -772,7 +772,7 @@ protected:
class VectorConstructorExpr : public UnaryExpr { class VectorConstructorExpr : public UnaryExpr {
public: public:
VectorConstructorExpr(ListExpr* constructor_list, BroType* arg_type = 0); explicit VectorConstructorExpr(ListExpr* constructor_list, BroType* arg_type = 0);
Val* Eval(Frame* f) const override; Val* Eval(Frame* f) const override;
@ -824,7 +824,7 @@ protected:
class RecordCoerceExpr : public UnaryExpr { class RecordCoerceExpr : public UnaryExpr {
public: public:
RecordCoerceExpr(Expr* op, RecordType* r); RecordCoerceExpr(Expr* op, RecordType* r);
~RecordCoerceExpr(); ~RecordCoerceExpr() override;
protected: protected:
friend class Expr; friend class Expr;
@ -844,7 +844,7 @@ protected:
class TableCoerceExpr : public UnaryExpr { class TableCoerceExpr : public UnaryExpr {
public: public:
TableCoerceExpr(Expr* op, TableType* r); TableCoerceExpr(Expr* op, TableType* r);
~TableCoerceExpr(); ~TableCoerceExpr() override;
protected: protected:
friend class Expr; friend class Expr;
@ -858,7 +858,7 @@ protected:
class VectorCoerceExpr : public UnaryExpr { class VectorCoerceExpr : public UnaryExpr {
public: public:
VectorCoerceExpr(Expr* op, VectorType* v); VectorCoerceExpr(Expr* op, VectorType* v);
~VectorCoerceExpr(); ~VectorCoerceExpr() override;
protected: protected:
friend class Expr; friend class Expr;
@ -873,7 +873,7 @@ protected:
// into a list of individual values. // into a list of individual values.
class FlattenExpr : public UnaryExpr { class FlattenExpr : public UnaryExpr {
public: public:
FlattenExpr(Expr* op); explicit FlattenExpr(Expr* op);
protected: protected:
friend class Expr; friend class Expr;
@ -892,9 +892,9 @@ class ScheduleTimer : public Timer {
public: public:
ScheduleTimer(EventHandlerPtr event, val_list* args, double t, ScheduleTimer(EventHandlerPtr event, val_list* args, double t,
TimerMgr* tmgr); TimerMgr* tmgr);
~ScheduleTimer(); ~ScheduleTimer() override;
void Dispatch(double t, int is_expire); void Dispatch(double t, int is_expire) override;
protected: protected:
EventHandlerPtr event; EventHandlerPtr event;
@ -905,7 +905,7 @@ protected:
class ScheduleExpr : public Expr { class ScheduleExpr : public Expr {
public: public:
ScheduleExpr(Expr* when, EventExpr* event); ScheduleExpr(Expr* when, EventExpr* event);
~ScheduleExpr(); ~ScheduleExpr() override;
int IsPure() const override; int IsPure() const override;
@ -945,7 +945,7 @@ protected:
class CallExpr : public Expr { class CallExpr : public Expr {
public: public:
CallExpr(Expr* func, ListExpr* args, bool in_hook = false); CallExpr(Expr* func, ListExpr* args, bool in_hook = false);
~CallExpr(); ~CallExpr() override;
Expr* Func() const { return func; } Expr* Func() const { return func; }
ListExpr* Args() const { return args; } ListExpr* Args() const { return args; }
@ -971,7 +971,7 @@ protected:
class EventExpr : public Expr { class EventExpr : public Expr {
public: public:
EventExpr(const char* name, ListExpr* args); EventExpr(const char* name, ListExpr* args);
~EventExpr(); ~EventExpr() override;
const char* Name() const { return name.c_str(); } const char* Name() const { return name.c_str(); }
ListExpr* Args() const { return args; } ListExpr* Args() const { return args; }
@ -997,8 +997,8 @@ protected:
class ListExpr : public Expr { class ListExpr : public Expr {
public: public:
ListExpr(); ListExpr();
ListExpr(Expr* e); explicit ListExpr(Expr* e);
~ListExpr(); ~ListExpr() override;
void Append(Expr* e); void Append(Expr* e);

View file

@ -22,10 +22,10 @@ class RotateTimer;
class BroFile : public BroObj { class BroFile : public BroObj {
public: public:
BroFile(FILE* arg_f); explicit BroFile(FILE* arg_f);
BroFile(FILE* arg_f, const char* filename, const char* access); BroFile(FILE* arg_f, const char* filename, const char* access);
BroFile(const char* filename, const char* access, BroType* arg_t = 0); BroFile(const char* filename, const char* access, BroType* arg_t = 0);
virtual ~BroFile(); ~BroFile() override;
const char* Name() const; const char* Name() const;

View file

@ -21,7 +21,7 @@ class FragReassembler : public Reassembler {
public: public:
FragReassembler(NetSessions* s, const IP_Hdr* ip, const u_char* pkt, FragReassembler(NetSessions* s, const IP_Hdr* ip, const u_char* pkt,
HashKey* k, double t); HashKey* k, double t);
~FragReassembler(); ~FragReassembler() override;
void AddFragment(double t, const IP_Hdr* ip, const u_char* pkt); void AddFragment(double t, const IP_Hdr* ip, const u_char* pkt);
@ -33,8 +33,8 @@ public:
HashKey* Key() const { return key; } HashKey* Key() const { return key; }
protected: protected:
void BlockInserted(DataBlock* start_block); void BlockInserted(DataBlock* start_block) override;
void Overlap(const u_char* b1, const u_char* b2, uint64 n); void Overlap(const u_char* b1, const u_char* b2, uint64 n) override;
void Weird(const char* name) const; void Weird(const char* name) const;
u_char* proto_hdr; u_char* proto_hdr;
@ -53,9 +53,9 @@ public:
FragTimer(FragReassembler* arg_f, double arg_t) FragTimer(FragReassembler* arg_f, double arg_t)
: Timer(arg_t, TIMER_FRAG) : Timer(arg_t, TIMER_FRAG)
{ f = arg_f; } { f = arg_f; }
~FragTimer(); ~FragTimer() override;
void Dispatch(double t, int is_expire); void Dispatch(double t, int is_expire) override;
// Break the association between this timer and its creator. // Break the association between this timer and its creator.
void ClearReassembler() { f = 0; } void ClearReassembler() { f = 0; }

View file

@ -15,7 +15,7 @@ class CallExpr;
class Frame : public BroObj { class Frame : public BroObj {
public: public:
Frame(int size, const BroFunc* func, const val_list *fn_args); Frame(int size, const BroFunc* func, const val_list *fn_args);
~Frame(); ~Frame() override;
Val* NthElement(int n) { return frame[n]; } Val* NthElement(int n) { return frame[n]; }
void SetElement(int n, Val* v) void SetElement(int n, Val* v)
@ -27,7 +27,7 @@ public:
void Reset(int startIdx); void Reset(int startIdx);
void Release(); void Release();
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
// For which function is this stack frame. // For which function is this stack frame.
const BroFunc* GetFunction() const { return function; } const BroFunc* GetFunction() const { return function; }

View file

@ -22,9 +22,9 @@ public:
enum Kind { BRO_FUNC, BUILTIN_FUNC }; enum Kind { BRO_FUNC, BUILTIN_FUNC };
Func(Kind arg_kind); explicit Func(Kind arg_kind);
virtual ~Func(); ~Func() override;
virtual int IsPure() const = 0; virtual int IsPure() const = 0;
function_flavor Flavor() const { return FType()->Flavor(); } function_flavor Flavor() const { return FType()->Flavor(); }
@ -56,7 +56,7 @@ public:
const char* Name() const { return name.c_str(); } const char* Name() const { return name.c_str(); }
void SetName(const char* arg_name) { name = arg_name; } void SetName(const char* arg_name) { name = arg_name; }
virtual void Describe(ODesc* d) const = 0; void Describe(ODesc* d) const override = 0;
virtual void DescribeDebug(ODesc* d, const val_list* args) const; virtual void DescribeDebug(ODesc* d, const val_list* args) const;
// This (un-)serializes only a single body (as given in SerialInfo). // This (un-)serializes only a single body (as given in SerialInfo).
@ -90,7 +90,7 @@ protected:
class BroFunc : public Func { class BroFunc : public Func {
public: public:
BroFunc(ID* id, Stmt* body, id_list* inits, int frame_size, int priority); BroFunc(ID* id, Stmt* body, id_list* inits, int frame_size, int priority);
~BroFunc(); ~BroFunc() override;
int IsPure() const override; int IsPure() const override;
Val* Call(val_list* args, Frame* parent) const override; Val* Call(val_list* args, Frame* parent) const override;
@ -116,7 +116,7 @@ typedef Val* (*built_in_func)(Frame* frame, val_list* args);
class BuiltinFunc : public Func { class BuiltinFunc : public Func {
public: public:
BuiltinFunc(built_in_func func, const char* name, int is_pure); BuiltinFunc(built_in_func func, const char* name, int is_pure);
~BuiltinFunc(); ~BuiltinFunc() override;
int IsPure() const override; int IsPure() const override;
Val* Call(val_list* args, Frame* parent) const override; Val* Call(val_list* args, Frame* parent) const override;

View file

@ -20,14 +20,14 @@ typedef enum {
class HashKey { class HashKey {
public: public:
HashKey(bro_int_t i); explicit HashKey(bro_int_t i);
HashKey(bro_uint_t u); explicit HashKey(bro_uint_t u);
HashKey(uint32 u); explicit HashKey(uint32 u);
HashKey(const uint32 u[], int n); HashKey(const uint32 u[], int n);
HashKey(double d); explicit HashKey(double d);
HashKey(const void* p); explicit HashKey(const void* p);
HashKey(const char* s); explicit HashKey(const char* s);
HashKey(const BroString* s); explicit HashKey(const BroString* s);
~HashKey() ~HashKey()
{ {
if ( is_our_dynamic ) if ( is_our_dynamic )

View file

@ -19,7 +19,7 @@ typedef enum { SCOPE_FUNCTION, SCOPE_MODULE, SCOPE_GLOBAL } IDScope;
class ID : public BroObj { class ID : public BroObj {
public: public:
ID(const char* name, IDScope arg_scope, bool arg_is_export); ID(const char* name, IDScope arg_scope, bool arg_is_export);
~ID(); ~ID() override;
const char* Name() const { return name; } const char* Name() const { return name; }

View file

@ -88,7 +88,7 @@ public:
* @param s String containing an IP address as either a dotted IPv4 * @param s String containing an IP address as either a dotted IPv4
* address or a hex IPv6 address. * address or a hex IPv6 address.
*/ */
IPAddr(const BroString& s) explicit IPAddr(const BroString& s)
{ {
Init(s.CheckString()); Init(s.CheckString());
} }

View file

@ -12,7 +12,7 @@
class IntSet { class IntSet {
public: public:
// n is a hint for the value of the largest integer. // n is a hint for the value of the largest integer.
IntSet(unsigned int n = 1); explicit IntSet(unsigned int n = 1);
~IntSet(); ~IntSet();
void Insert(unsigned int i); void Insert(unsigned int i);

View file

@ -42,7 +42,7 @@ public:
{ return padded_sizeof(*this) + pad_size(max_entries * sizeof(ent)); } { return padded_sizeof(*this) + pad_size(max_entries * sizeof(ent)); }
protected: protected:
BaseList(int = 0); explicit BaseList(int = 0);
BaseList(BaseList&); BaseList(BaseList&);
void insert(ent); // add at head of list void insert(ent); // add at head of list
@ -102,9 +102,9 @@ protected:
#define Listdeclare(type) \ #define Listdeclare(type) \
struct List(type) : BaseList \ struct List(type) : BaseList \
{ \ { \
List(type)(type ...); \ explicit List(type)(type ...); \
List(type)() : BaseList(0) {} \ List(type)() : BaseList(0) {} \
List(type)(int sz) : BaseList(sz) {} \ explicit List(type)(int sz) : BaseList(sz) {} \
List(type)(List(type)& l) : BaseList((BaseList&)l) {} \ List(type)(List(type)& l) : BaseList((BaseList&)l) {} \
\ \
void operator=(List(type)& l) \ void operator=(List(type)& l) \
@ -143,9 +143,9 @@ List(type)::List(type)(type e1 ...) : BaseList() \
#define PListdeclare(type) \ #define PListdeclare(type) \
struct PList(type) : BaseList \ struct PList(type) : BaseList \
{ \ { \
PList(type)(type* ...); \ explicit PList(type)(type* ...); \
PList(type)() : BaseList(0) {} \ PList(type)() : BaseList(0) {} \
PList(type)(int sz) : BaseList(sz) {} \ explicit PList(type)(int sz) : BaseList(sz) {} \
PList(type)(PList(type)& l) : BaseList((BaseList&)l) {} \ PList(type)(PList(type)& l) : BaseList((BaseList&)l) {} \
\ \
void operator=(PList(type)& l) \ void operator=(PList(type)& l) \

View file

@ -27,8 +27,8 @@ typedef PList(NFA_State) NFA_state_list;
class NFA_State : public BroObj { class NFA_State : public BroObj {
public: public:
NFA_State(int sym, EquivClass* ec); NFA_State(int sym, EquivClass* ec);
NFA_State(CCL* ccl); explicit NFA_State(CCL* ccl);
~NFA_State(); ~NFA_State() override;
void AddXtion(NFA_State* next_state) { xtions.append(next_state); } void AddXtion(NFA_State* next_state) { xtions.append(next_state); }
NFA_state_list* Transitions() { return &xtions; } NFA_state_list* Transitions() { return &xtions; }
@ -52,7 +52,7 @@ public:
NFA_state_list* EpsilonClosure(); NFA_state_list* EpsilonClosure();
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
void Dump(FILE* f); void Dump(FILE* f);
// Recursivly count all the reachable states. // Recursivly count all the reachable states.
@ -75,8 +75,8 @@ public:
class NFA_Machine : public BroObj { class NFA_Machine : public BroObj {
public: public:
NFA_Machine(NFA_State* first, NFA_State* final = 0); explicit NFA_Machine(NFA_State* first, NFA_State* final = 0);
~NFA_Machine(); ~NFA_Machine() override;
NFA_State* FirstState() const { return first_state; } NFA_State* FirstState() const { return first_state; }
@ -103,7 +103,7 @@ public:
void AppendState(NFA_State* new_state); void AppendState(NFA_State* new_state);
void AppendMachine(NFA_Machine* new_mach); void AppendMachine(NFA_Machine* new_mach);
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
void Dump(FILE* f); void Dump(FILE* f);
unsigned int MemoryAllocation() const unsigned int MemoryAllocation() const

View file

@ -81,7 +81,7 @@ enum FingerprintMode {
class OSFingerprint { class OSFingerprint {
public: public:
OSFingerprint(FingerprintMode mode); explicit OSFingerprint(FingerprintMode mode);
~OSFingerprint() {} ~OSFingerprint() {}
bool Error() const { return err; } bool Error() const { return err; }

View file

@ -36,7 +36,7 @@ public:
text = 0; text = 0;
} }
virtual ~Location() ~Location() override
{ {
if ( delete_data ) if ( delete_data )
delete [] filename; delete [] filename;
@ -112,7 +112,7 @@ public:
SetLocationInfo(&start_location, &end_location); SetLocationInfo(&start_location, &end_location);
} }
virtual ~BroObj(); ~BroObj() override;
// Report user warnings/errors. If obj2 is given, then it's // Report user warnings/errors. If obj2 is given, then it's
// included in the message, though if pinpoint_only is non-zero, // included in the message, though if pinpoint_only is non-zero,

View file

@ -23,7 +23,8 @@ public:
protected: protected:
HashVal() { }; HashVal() { };
HashVal(OpaqueType* t); explicit HashVal(OpaqueType* t);
virtual bool DoInit(); virtual bool DoInit();
virtual bool DoFeed(const void* data, size_t size); virtual bool DoFeed(const void* data, size_t size);
virtual StringVal* DoGet(); virtual StringVal* DoGet();
@ -48,9 +49,9 @@ public:
protected: protected:
friend class Val; friend class Val;
virtual bool DoInit() override; bool DoInit() override;
virtual bool DoFeed(const void* data, size_t size) override; bool DoFeed(const void* data, size_t size) override;
virtual StringVal* DoGet() override; StringVal* DoGet() override;
DECLARE_SERIAL(MD5Val); DECLARE_SERIAL(MD5Val);
@ -67,9 +68,9 @@ public:
protected: protected:
friend class Val; friend class Val;
virtual bool DoInit() override; bool DoInit() override;
virtual bool DoFeed(const void* data, size_t size) override; bool DoFeed(const void* data, size_t size) override;
virtual StringVal* DoGet() override; StringVal* DoGet() override;
DECLARE_SERIAL(SHA1Val); DECLARE_SERIAL(SHA1Val);
@ -86,9 +87,9 @@ public:
protected: protected:
friend class Val; friend class Val;
virtual bool DoInit() override; bool DoInit() override;
virtual bool DoFeed(const void* data, size_t size) override; bool DoFeed(const void* data, size_t size) override;
virtual StringVal* DoGet() override; StringVal* DoGet() override;
DECLARE_SERIAL(SHA256Val); DECLARE_SERIAL(SHA256Val);
@ -116,7 +117,7 @@ private:
class BloomFilterVal : public OpaqueVal { class BloomFilterVal : public OpaqueVal {
public: public:
explicit BloomFilterVal(probabilistic::BloomFilter* bf); explicit BloomFilterVal(probabilistic::BloomFilter* bf);
virtual ~BloomFilterVal(); ~BloomFilterVal() override;
BroType* Type() const; BroType* Type() const;
bool Typify(BroType* type); bool Typify(BroType* type);
@ -133,7 +134,7 @@ public:
protected: protected:
friend class Val; friend class Val;
BloomFilterVal(); BloomFilterVal();
BloomFilterVal(OpaqueType* t); explicit BloomFilterVal(OpaqueType* t);
DECLARE_SERIAL(BloomFilterVal); DECLARE_SERIAL(BloomFilterVal);
@ -151,7 +152,7 @@ private:
class CardinalityVal: public OpaqueVal { class CardinalityVal: public OpaqueVal {
public: public:
explicit CardinalityVal(probabilistic::CardinalityCounter*); explicit CardinalityVal(probabilistic::CardinalityCounter*);
virtual ~CardinalityVal(); ~CardinalityVal() override;
void Add(const Val* val); void Add(const Val* val);

View file

@ -12,7 +12,7 @@ using namespace std;
class PacketDumper { class PacketDumper {
public: public:
PacketDumper(pcap_dumper_t* pkt_dump); explicit PacketDumper(pcap_dumper_t* pkt_dump);
void DumpPacket(const struct pcap_pkthdr* hdr, void DumpPacket(const struct pcap_pkthdr* hdr,
const u_char* pkt, int len); const u_char* pkt, int len);

View file

@ -8,7 +8,7 @@
class PacketFilter { class PacketFilter {
public: public:
PacketFilter(bool arg_default) { default_match = arg_default; } explicit PacketFilter(bool arg_default) { default_match = arg_default; }
~PacketFilter() {} ~PacketFilter() {}
// Drops all packets from a particular source (which may be given // Drops all packets from a particular source (which may be given

View file

@ -11,7 +11,8 @@ class StateAccess;
class PersistenceSerializer : public FileSerializer { class PersistenceSerializer : public FileSerializer {
public: public:
PersistenceSerializer(); PersistenceSerializer();
virtual ~PersistenceSerializer();
~PersistenceSerializer() override;
// Define the directory where to store the data. // Define the directory where to store the data.
void SetDir(const char* arg_dir) { dir = copy_string(arg_dir); } void SetDir(const char* arg_dir) { dir = copy_string(arg_dir); }
@ -59,15 +60,15 @@ protected:
friend class RemoteSerializer; friend class RemoteSerializer;
friend class IncrementalWriteTimer; friend class IncrementalWriteTimer;
virtual void GotID(ID* id, Val* val); void GotID(ID* id, Val* val) override;
virtual void GotEvent(const char* name, double time, void GotEvent(const char* name, double time,
EventHandlerPtr event, val_list* args); EventHandlerPtr event, val_list* args) override;
virtual void GotFunctionCall(const char* name, double time, void GotFunctionCall(const char* name, double time,
Func* func, val_list* args) ; Func* func, val_list* args) override;
virtual void GotStateAccess(StateAccess* s); void GotStateAccess(StateAccess* s) override;
virtual void GotTimer(Timer* t); void GotTimer(Timer* t) override;
virtual void GotConnection(Connection* c); void GotConnection(Connection* c) override;
virtual void GotPacket(Packet* packet); void GotPacket(Packet* packet) override;
// If file has changed since last check, read it. // If file has changed since last check, read it.
bool CheckForFile(UnserialInfo* info, const char* file, bool CheckForFile(UnserialInfo* info, const char* file,

View file

@ -15,7 +15,7 @@ public:
* @param status_flags0 descriptor status flags to set on read end of pipe. * @param status_flags0 descriptor status flags to set on read end of pipe.
* @param status_flags1 descriptor status flags to set on write end of pipe. * @param status_flags1 descriptor status flags to set on write end of pipe.
*/ */
Pipe(int flags0 = 0, int flags1 = 0, int status_flags0 = 0, explicit Pipe(int flags0 = 0, int flags1 = 0, int status_flags0 = 0,
int status_flags1 = 0); int status_flags1 = 0);
/** /**

View file

@ -10,7 +10,7 @@ class PriorityQueue;
class PQ_Element { class PQ_Element {
public: public:
PQ_Element(double t) { time = t; offset = -1; } explicit PQ_Element(double t) { time = t; offset = -1; }
virtual ~PQ_Element() { } virtual ~PQ_Element() { }
double Time() const { return time; } double Time() const { return time; }
@ -28,7 +28,7 @@ protected:
class PriorityQueue { class PriorityQueue {
public: public:
PriorityQueue(int initial_size = 16); explicit PriorityQueue(int initial_size = 16);
~PriorityQueue(); ~PriorityQueue();
// Returns the top of queue, or nil if the queue is empty. // Returns the top of queue, or nil if the queue is empty.

View file

@ -39,7 +39,7 @@ public:
void incr(int& index) { index < max_entries ? ++index : index = 0; } void incr(int& index) { index < max_entries ? ++index : index = 0; }
protected: protected:
BaseQueue(int = 0); explicit BaseQueue(int = 0);
void push_front(ent); // add in front of queue void push_front(ent); // add in front of queue
void push_back(ent); // add at end of queue void push_back(ent); // add at end of queue
@ -73,7 +73,7 @@ protected:
struct Queue(type) : BaseQueue \ struct Queue(type) : BaseQueue \
{ \ { \
Queue(type)() : BaseQueue(0) {} \ Queue(type)() : BaseQueue(0) {} \
Queue(type)(int sz) : BaseQueue(sz) {} \ explicit Queue(type)(int sz) : BaseQueue(sz) {} \
\ \
void push_front(type a) { BaseQueue::push_front(ent(a)); } \ void push_front(type a) { BaseQueue::push_front(ent(a)); } \
void push_back(type a) { BaseQueue::push_back(ent(a)); } \ void push_back(type a) { BaseQueue::push_back(ent(a)); } \
@ -88,7 +88,7 @@ struct Queue(type) : BaseQueue \
struct PQueue(type) : BaseQueue \ struct PQueue(type) : BaseQueue \
{ \ { \
PQueue(type)() : BaseQueue(0) {} \ PQueue(type)() : BaseQueue(0) {} \
PQueue(type)(int sz) : BaseQueue(sz) {} \ explicit PQueue(type)(int sz) : BaseQueue(sz) {} \
\ \
void push_front(type* a){ BaseQueue::push_front(ent(a)); } \ void push_front(type* a){ BaseQueue::push_front(ent(a)); } \
void push_back(type* a) { BaseQueue::push_back(ent(a)); } \ void push_back(type* a) { BaseQueue::push_back(ent(a)); } \

View file

@ -49,7 +49,7 @@ typedef enum { MATCH_ANYWHERE, MATCH_EXACTLY, } match_type;
class Specific_RE_Matcher { class Specific_RE_Matcher {
public: public:
Specific_RE_Matcher(match_type mt, int multiline=0); explicit Specific_RE_Matcher(match_type mt, int multiline=0);
~Specific_RE_Matcher(); ~Specific_RE_Matcher();
void AddPat(const char* pat); void AddPat(const char* pat);
@ -133,7 +133,7 @@ protected:
class RE_Match_State { class RE_Match_State {
public: public:
RE_Match_State(Specific_RE_Matcher* matcher) explicit RE_Match_State(Specific_RE_Matcher* matcher)
{ {
dfa = matcher->DFA() ? matcher->DFA() : 0; dfa = matcher->DFA() ? matcher->DFA() : 0;
ecs = matcher->EC()->EquivClasses(); ecs = matcher->EC()->EquivClasses();
@ -172,8 +172,8 @@ protected:
class RE_Matcher : SerialObj { class RE_Matcher : SerialObj {
public: public:
RE_Matcher(); RE_Matcher();
RE_Matcher(const char* pat); explicit RE_Matcher(const char* pat);
virtual ~RE_Matcher(); ~RE_Matcher() override;
void AddPat(const char* pat); void AddPat(const char* pat);

View file

@ -43,7 +43,7 @@ public:
class Reassembler : public BroObj { class Reassembler : public BroObj {
public: public:
Reassembler(uint64 init_seq, ReassemblerType reassem_type = REASSEM_UNKNOWN); Reassembler(uint64 init_seq, ReassemblerType reassem_type = REASSEM_UNKNOWN);
virtual ~Reassembler(); ~Reassembler() override;
void NewBlock(double t, uint64 seq, uint64 len, const u_char* data); void NewBlock(double t, uint64 seq, uint64 len, const u_char* data);
@ -60,7 +60,7 @@ public:
uint64 TotalSize() const; // number of bytes buffered up uint64 TotalSize() const; // number of bytes buffered up
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
bool Serialize(SerialInfo* info) const; bool Serialize(SerialInfo* info) const;
static Reassembler* Unserialize(UnserialInfo* info); static Reassembler* Unserialize(UnserialInfo* info);

View file

@ -25,7 +25,7 @@ namespace threading {
class RemoteSerializer : public Serializer, public iosource::IOSource { class RemoteSerializer : public Serializer, public iosource::IOSource {
public: public:
RemoteSerializer(); RemoteSerializer();
virtual ~RemoteSerializer(); ~RemoteSerializer() override;
// Initialize the remote serializer (calling this will fork). // Initialize the remote serializer (calling this will fork).
void Enable(); void Enable();
@ -140,12 +140,12 @@ public:
void Finish(); void Finish();
// Overidden from IOSource: // Overidden from IOSource:
virtual void GetFds(iosource::FD_Set* read, iosource::FD_Set* write, void GetFds(iosource::FD_Set* read, iosource::FD_Set* write,
iosource::FD_Set* except); iosource::FD_Set* except) override;
virtual double NextTimestamp(double* local_network_time); double NextTimestamp(double* local_network_time) override;
virtual void Process(); void Process() override;
virtual TimerMgr::Tag* GetCurrentTag(); TimerMgr::Tag* GetCurrentTag() override;
virtual const char* Tag() { return "RemoteSerializer"; } const char* Tag() override { return "RemoteSerializer"; }
// Gracefully finishes communication by first making sure that all // Gracefully finishes communication by first making sure that all
// remaining data (parent & child) has been sent out. // remaining data (parent & child) has been sent out.
@ -246,17 +246,17 @@ protected:
static void Log(LogLevel level, const char* msg, Peer* peer, LogSrc src = LogParent); static void Log(LogLevel level, const char* msg, Peer* peer, LogSrc src = LogParent);
virtual void ReportError(const char* msg); void ReportError(const char* msg) override;
virtual void GotEvent(const char* name, double time, void GotEvent(const char* name, double time,
EventHandlerPtr event, val_list* args); EventHandlerPtr event, val_list* args) override;
virtual void GotFunctionCall(const char* name, double time, void GotFunctionCall(const char* name, double time,
Func* func, val_list* args); Func* func, val_list* args) override;
virtual void GotID(ID* id, Val* val); void GotID(ID* id, Val* val) override;
virtual void GotStateAccess(StateAccess* s); void GotStateAccess(StateAccess* s) override;
virtual void GotTimer(Timer* t); void GotTimer(Timer* t) override;
virtual void GotConnection(Connection* c); void GotConnection(Connection* c) override;
virtual void GotPacket(Packet* packet); void GotPacket(Packet* packet) override;
void Fork(); void Fork();

View file

@ -24,13 +24,13 @@ public:
// Implements the "event" keyword. // Implements the "event" keyword.
class RuleActionEvent : public RuleAction { class RuleActionEvent : public RuleAction {
public: public:
RuleActionEvent(const char* arg_msg) { msg = copy_string(arg_msg); } explicit RuleActionEvent(const char* arg_msg) { msg = copy_string(arg_msg); }
virtual ~RuleActionEvent() { delete [] msg; } ~RuleActionEvent() override { delete [] msg; }
virtual void DoAction(const Rule* parent, RuleEndpointState* state, void DoAction(const Rule* parent, RuleEndpointState* state,
const u_char* data, int len); const u_char* data, int len) override;
virtual void PrintDebug(); void PrintDebug() override;
private: private:
const char* msg; const char* msg;
@ -38,17 +38,17 @@ private:
class RuleActionMIME : public RuleAction { class RuleActionMIME : public RuleAction {
public: public:
RuleActionMIME(const char* arg_mime, int arg_strength = 0) explicit RuleActionMIME(const char* arg_mime, int arg_strength = 0)
{ mime = copy_string(arg_mime); strength = arg_strength; } { mime = copy_string(arg_mime); strength = arg_strength; }
virtual ~RuleActionMIME() ~RuleActionMIME() override
{ delete [] mime; } { delete [] mime; }
virtual void DoAction(const Rule* parent, RuleEndpointState* state, void DoAction(const Rule* parent, RuleEndpointState* state,
const u_char* data, int len) const u_char* data, int len) override
{ } { }
virtual void PrintDebug(); void PrintDebug() override;
string GetMIME() const string GetMIME() const
{ return mime; } { return mime; }
@ -64,12 +64,12 @@ private:
// Base class for enable/disable actions. // Base class for enable/disable actions.
class RuleActionAnalyzer : public RuleAction { class RuleActionAnalyzer : public RuleAction {
public: public:
RuleActionAnalyzer(const char* analyzer); explicit RuleActionAnalyzer(const char* analyzer);
virtual void DoAction(const Rule* parent, RuleEndpointState* state, void DoAction(const Rule* parent, RuleEndpointState* state,
const u_char* data, int len) = 0; const u_char* data, int len) override = 0;
virtual void PrintDebug(); void PrintDebug() override;
analyzer::Tag Analyzer() const { return analyzer; } analyzer::Tag Analyzer() const { return analyzer; }
analyzer::Tag ChildAnalyzer() const { return child_analyzer; } analyzer::Tag ChildAnalyzer() const { return child_analyzer; }
@ -81,22 +81,22 @@ private:
class RuleActionEnable : public RuleActionAnalyzer { class RuleActionEnable : public RuleActionAnalyzer {
public: public:
RuleActionEnable(const char* analyzer) : RuleActionAnalyzer(analyzer) {} explicit RuleActionEnable(const char* analyzer) : RuleActionAnalyzer(analyzer) {}
virtual void DoAction(const Rule* parent, RuleEndpointState* state, void DoAction(const Rule* parent, RuleEndpointState* state,
const u_char* data, int len); const u_char* data, int len) override;
virtual void PrintDebug(); void PrintDebug() override;
}; };
class RuleActionDisable : public RuleActionAnalyzer { class RuleActionDisable : public RuleActionAnalyzer {
public: public:
RuleActionDisable(const char* analyzer) : RuleActionAnalyzer(analyzer) {} explicit RuleActionDisable(const char* analyzer) : RuleActionAnalyzer(analyzer) {}
virtual void DoAction(const Rule* parent, RuleEndpointState* state, void DoAction(const Rule* parent, RuleEndpointState* state,
const u_char* data, int len); const u_char* data, int len) override;
virtual void PrintDebug(); void PrintDebug() override;
}; };
#endif #endif

View file

@ -31,15 +31,15 @@ public:
STATE_STATELESS = 8 STATE_STATELESS = 8
}; };
RuleConditionTCPState(int arg_tcpstates) explicit RuleConditionTCPState(int arg_tcpstates)
{ tcpstates = arg_tcpstates; } { tcpstates = arg_tcpstates; }
virtual ~RuleConditionTCPState() { } ~RuleConditionTCPState() override { }
virtual bool DoMatch(Rule* rule, RuleEndpointState* state, bool DoMatch(Rule* rule, RuleEndpointState* state,
const u_char* data, int len); const u_char* data, int len) override;
virtual void PrintDebug(); void PrintDebug() override;
private: private:
int tcpstates; int tcpstates;
@ -56,13 +56,15 @@ public:
OPT_SSRR = 8, OPT_SSRR = 8,
}; };
RuleConditionIPOptions(int arg_options) { options = arg_options; } explicit RuleConditionIPOptions(int arg_options) { options = arg_options; }
virtual ~RuleConditionIPOptions() { }
virtual bool DoMatch(Rule* rule, RuleEndpointState* state, ~RuleConditionIPOptions() override
const u_char* data, int len); { }
virtual void PrintDebug(); bool DoMatch(Rule* rule, RuleEndpointState* state,
const u_char* data, int len) override;
void PrintDebug() override;
private: private:
int options; int options;
@ -72,12 +74,12 @@ private:
class RuleConditionSameIP : public RuleCondition { class RuleConditionSameIP : public RuleCondition {
public: public:
RuleConditionSameIP() { } RuleConditionSameIP() { }
virtual ~RuleConditionSameIP() {} ~RuleConditionSameIP() override {}
virtual bool DoMatch(Rule* rule, RuleEndpointState* state, bool DoMatch(Rule* rule, RuleEndpointState* state,
const u_char* data, int len); const u_char* data, int len) override;
virtual void PrintDebug(); void PrintDebug() override;
}; };
// Implements "payload-size". // Implements "payload-size".
@ -88,12 +90,12 @@ public:
RuleConditionPayloadSize(uint32 arg_val, Comp arg_comp) RuleConditionPayloadSize(uint32 arg_val, Comp arg_comp)
{ val = arg_val; comp = arg_comp; } { val = arg_val; comp = arg_comp; }
virtual ~RuleConditionPayloadSize() {} ~RuleConditionPayloadSize() override {}
virtual bool DoMatch(Rule* rule, RuleEndpointState* state, bool DoMatch(Rule* rule, RuleEndpointState* state,
const u_char* data, int len); const u_char* data, int len) override;
virtual void PrintDebug(); void PrintDebug() override;
private: private:
uint32 val; uint32 val;
@ -103,13 +105,13 @@ private:
// Implements "eval" which evaluates the given Bro identifier. // Implements "eval" which evaluates the given Bro identifier.
class RuleConditionEval : public RuleCondition { class RuleConditionEval : public RuleCondition {
public: public:
RuleConditionEval(const char* func); explicit RuleConditionEval(const char* func);
virtual ~RuleConditionEval() {} ~RuleConditionEval() override {}
virtual bool DoMatch(Rule* rule, RuleEndpointState* state, bool DoMatch(Rule* rule, RuleEndpointState* state,
const u_char* data, int len); const u_char* data, int len) override;
virtual void PrintDebug(); void PrintDebug() override;
private: private:
ID* id; ID* id;
}; };

View file

@ -19,8 +19,8 @@ declare(PDict,ID);
class Scope : public BroObj { class Scope : public BroObj {
public: public:
Scope(ID* id); explicit Scope(ID* id);
~Scope(); ~Scope() override;
ID* Lookup(const char* name) const { return local->Lookup(name); } ID* Lookup(const char* name) const { return local->Lookup(name); }
void Insert(const char* name, ID* id) { local->Insert(name, id); } void Insert(const char* name, ID* id) { local->Insert(name, id); }
@ -47,7 +47,7 @@ public:
// Adds a variable to the list. // Adds a variable to the list.
void AddInit(ID* id) { inits->append(id); } void AddInit(ID* id) { inits->append(id); }
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
TraversalCode Traverse(TraversalCallback* cb) const; TraversalCode Traverse(TraversalCallback* cb) const;

View file

@ -163,16 +163,16 @@ public:
// Macro helpers. // Macro helpers.
#define DECLARE_ABSTRACT_SERIAL(classname) \ #define DECLARE_ABSTRACT_SERIAL(classname) \
virtual bool DoSerialize(SerialInfo*) const; \ bool DoSerialize(SerialInfo*) const override; \
virtual bool DoUnserialize(UnserialInfo*); \ bool DoUnserialize(UnserialInfo*) override; \
#define DECLARE_SERIAL(classname) \ #define DECLARE_SERIAL(classname) \
static classname* Instantiate(); \ static classname* Instantiate(); \
static SerialTypeRegistrator register_type; \ static SerialTypeRegistrator register_type; \
virtual bool DoSerialize(SerialInfo*) const override; \ bool DoSerialize(SerialInfo*) const override; \
virtual bool DoUnserialize(UnserialInfo*) override; \ bool DoUnserialize(UnserialInfo*) override; \
virtual const TransientID* GetTID() const override { return &tid; } \ const TransientID* GetTID() const override { return &tid; } \
virtual SerialType GetSerialType() const override; \ SerialType GetSerialType() const override; \
TransientID tid; TransientID tid;
// Only needed (and usable) for non-abstract classes. // Only needed (and usable) for non-abstract classes.

View file

@ -98,40 +98,40 @@ protected:
class BinarySerializationFormat : public SerializationFormat { class BinarySerializationFormat : public SerializationFormat {
public: public:
BinarySerializationFormat(); BinarySerializationFormat();
virtual ~BinarySerializationFormat(); ~BinarySerializationFormat() override;
virtual bool Read(int* v, const char* tag); bool Read(int* v, const char* tag) override;
virtual bool Read(uint16* v, const char* tag); bool Read(uint16* v, const char* tag) override;
virtual bool Read(uint32* v, const char* tag); bool Read(uint32* v, const char* tag) override;
virtual bool Read(int64* v, const char* tag); bool Read(int64* v, const char* tag) override;
virtual bool Read(uint64* v, const char* tag); bool Read(uint64* v, const char* tag) override;
virtual bool Read(char* v, const char* tag); bool Read(char* v, const char* tag) override;
virtual bool Read(bool* v, const char* tag); bool Read(bool* v, const char* tag) override;
virtual bool Read(double* d, const char* tag); bool Read(double* d, const char* tag) override;
virtual bool Read(char** str, int* len, const char* tag); bool Read(char** str, int* len, const char* tag) override;
virtual bool Read(string* s, const char* tag); bool Read(string* s, const char* tag) override;
virtual bool Read(IPAddr* addr, const char* tag); bool Read(IPAddr* addr, const char* tag) override;
virtual bool Read(IPPrefix* prefix, const char* tag); bool Read(IPPrefix* prefix, const char* tag) override;
virtual bool Read(struct in_addr* addr, const char* tag); bool Read(struct in_addr* addr, const char* tag) override;
virtual bool Read(struct in6_addr* addr, const char* tag); bool Read(struct in6_addr* addr, const char* tag) override;
virtual bool Write(int v, const char* tag); bool Write(int v, const char* tag) override;
virtual bool Write(uint16 v, const char* tag); bool Write(uint16 v, const char* tag) override;
virtual bool Write(uint32 v, const char* tag); bool Write(uint32 v, const char* tag) override;
virtual bool Write(int64 v, const char* tag); bool Write(int64 v, const char* tag) override;
virtual bool Write(uint64 v, const char* tag); bool Write(uint64 v, const char* tag) override;
virtual bool Write(char v, const char* tag); bool Write(char v, const char* tag) override;
virtual bool Write(bool v, const char* tag); bool Write(bool v, const char* tag) override;
virtual bool Write(double d, const char* tag); bool Write(double d, const char* tag) override;
virtual bool Write(const char* s, const char* tag); bool Write(const char* s, const char* tag) override;
virtual bool Write(const char* buf, int len, const char* tag); bool Write(const char* buf, int len, const char* tag) override;
virtual bool Write(const string& s, const char* tag); bool Write(const string& s, const char* tag) override;
virtual bool Write(const IPAddr& addr, const char* tag); bool Write(const IPAddr& addr, const char* tag) override;
virtual bool Write(const IPPrefix& prefix, const char* tag); bool Write(const IPPrefix& prefix, const char* tag) override;
virtual bool Write(const struct in_addr& addr, const char* tag); bool Write(const struct in_addr& addr, const char* tag) override;
virtual bool Write(const struct in6_addr& addr, const char* tag); bool Write(const struct in6_addr& addr, const char* tag) override;
virtual bool WriteOpenTag(const char* tag); bool WriteOpenTag(const char* tag) override;
virtual bool WriteCloseTag(const char* tag); bool WriteCloseTag(const char* tag) override;
virtual bool WriteSeparator(); bool WriteSeparator() override;
}; };
#endif #endif

View file

@ -96,7 +96,7 @@ public:
protected: protected:
// Format defaults to binary serialization. // Format defaults to binary serialization.
Serializer(SerializationFormat* format = 0); explicit Serializer(SerializationFormat* format = 0);
virtual ~Serializer(); virtual ~Serializer();
// Reads next object. // Reads next object.
@ -159,7 +159,7 @@ public:
// If max_cache_size is greater than zero, we'll remove old entries // If max_cache_size is greater than zero, we'll remove old entries
// automatically if limit is reached (LRU expiration). // automatically if limit is reached (LRU expiration).
SerializationCache(unsigned int max_cache_size = 0); explicit SerializationCache(unsigned int max_cache_size = 0);
~SerializationCache(); ~SerializationCache();
PermanentID Register(const SerialObj* obj, PermanentID pid, PermanentID Register(const SerialObj* obj, PermanentID pid,
@ -261,27 +261,27 @@ private:
// minimal implementation of Serializer! // minimal implementation of Serializer!
class CloneSerializer : public Serializer { class CloneSerializer : public Serializer {
public: public:
CloneSerializer(SerializationFormat* format = 0) : Serializer(format) { } explicit CloneSerializer(SerializationFormat* format = 0) : Serializer(format) { }
virtual ~CloneSerializer() { } ~CloneSerializer() override
{ }
protected: protected:
virtual void ReportError(const char* msg) { reporter->Error("%s", msg); } void ReportError(const char* msg) override { reporter->Error("%s", msg); }
virtual void GotID(ID* id, Val* val) { } void GotID(ID* id, Val* val) override { }
virtual void GotEvent(const char* name, double time, void GotEvent(const char* name, double time, EventHandlerPtr event, val_list* args) override { }
EventHandlerPtr event, val_list* args) { } void GotFunctionCall(const char* name, double time,
virtual void GotFunctionCall(const char* name, double time, Func* func, val_list* args) override { }
Func* func, val_list* args) { } void GotStateAccess(StateAccess* s) override { delete s; }
virtual void GotStateAccess(StateAccess* s) { delete s; } void GotTimer(Timer* t) override { }
virtual void GotTimer(Timer* t) { } void GotConnection(Connection* c) override { }
virtual void GotConnection(Connection* c) { } void GotPacket(Packet* packet) override { }
virtual void GotPacket(Packet* packet) { }
}; };
// Write values/events to file or fd. // Write values/events to file or fd.
class FileSerializer : public Serializer { class FileSerializer : public Serializer {
public: public:
FileSerializer(SerializationFormat* format = 0); explicit FileSerializer(SerializationFormat* format = 0);
virtual ~FileSerializer(); ~FileSerializer() override;
// Opens the file for serialization. // Opens the file for serialization.
bool Open(const char* file, bool pure = false); bool Open(const char* file, bool pure = false);
@ -291,16 +291,16 @@ public:
bool Read(UnserialInfo* info, const char* file, bool header = true); bool Read(UnserialInfo* info, const char* file, bool header = true);
protected: protected:
virtual void ReportError(const char* msg); void ReportError(const char* msg) override;
virtual void GotID(ID* id, Val* val); void GotID(ID* id, Val* val) override;
virtual void GotEvent(const char* name, double time, void GotEvent(const char* name, double time,
EventHandlerPtr event, val_list* args); EventHandlerPtr event, val_list* args) override;
virtual void GotFunctionCall(const char* name, double time, void GotFunctionCall(const char* name, double time,
Func* func, val_list* args); Func* func, val_list* args) override;
virtual void GotStateAccess(StateAccess* s); void GotStateAccess(StateAccess* s) override;
virtual void GotTimer(Timer* t); void GotTimer(Timer* t) override;
virtual void GotConnection(Connection* c); void GotConnection(Connection* c) override;
virtual void GotPacket(Packet* packet); void GotPacket(Packet* packet) override;
bool OpenFile(const char* file, bool readonly, bool should_exist = false); bool OpenFile(const char* file, bool readonly, bool should_exist = false);
void CloseFile(); void CloseFile();
@ -331,21 +331,21 @@ public:
// Plays a file of events back. // Plays a file of events back.
class EventPlayer : public FileSerializer, public iosource::IOSource { class EventPlayer : public FileSerializer, public iosource::IOSource {
public: public:
EventPlayer(const char* file); explicit EventPlayer(const char* file);
virtual ~EventPlayer(); ~EventPlayer() override;
virtual void GetFds(iosource::FD_Set* read, iosource::FD_Set* write, void GetFds(iosource::FD_Set* read, iosource::FD_Set* write,
iosource::FD_Set* except); iosource::FD_Set* except) override;
virtual double NextTimestamp(double* local_network_time); double NextTimestamp(double* local_network_time) override;
virtual void Process(); void Process() override;
virtual const char* Tag() { return "EventPlayer"; } const char* Tag() override { return "EventPlayer"; }
protected: protected:
virtual void GotID(ID* id, Val* val) {} void GotID(ID* id, Val* val) override {}
virtual void GotEvent(const char* name, double time, void GotEvent(const char* name, double time,
EventHandlerPtr event, val_list* args); EventHandlerPtr event, val_list* args) override;
virtual void GotFunctionCall(const char* name, double time, void GotFunctionCall(const char* name, double time,
Func* func, val_list* args); Func* func, val_list* args) override;
double stream_time; // time of first captured event double stream_time; // time of first captured event
double replay_time; // network time of replay start double replay_time; // network time of replay start

View file

@ -56,7 +56,7 @@ public:
: Timer(t, TIMER_TIMERMGR_EXPIRE), mgr(arg_mgr) : Timer(t, TIMER_TIMERMGR_EXPIRE), mgr(arg_mgr)
{ } { }
virtual void Dispatch(double t, int is_expire); void Dispatch(double t, int is_expire) override;
protected: protected:
TimerMgr* mgr; TimerMgr* mgr;
@ -260,9 +260,9 @@ public:
: Timer(t + BifConst::Tunnel::ip_tunnel_timeout, : Timer(t + BifConst::Tunnel::ip_tunnel_timeout,
TIMER_IP_TUNNEL_INACTIVITY), tunnel_idx(p) {} TIMER_IP_TUNNEL_INACTIVITY), tunnel_idx(p) {}
~IPTunnelTimer() {} ~IPTunnelTimer() override {}
void Dispatch(double t, int is_expire); void Dispatch(double t, int is_expire) override;
protected: protected:
NetSessions::IPPair tunnel_idx; NetSessions::IPPair tunnel_idx;

View file

@ -41,10 +41,10 @@ public:
typedef BSSAlignVec::iterator BSSAlignVecIt; typedef BSSAlignVec::iterator BSSAlignVecIt;
typedef BSSAlignVec::const_iterator BSSAlignVecCIt; typedef BSSAlignVec::const_iterator BSSAlignVecCIt;
BroSubstring(const string& string) explicit BroSubstring(const string& string)
: BroString(string), _num(), _new(false) { } : BroString(string), _num(), _new(false) { }
BroSubstring(const BroString& string) explicit BroSubstring(const BroString& string)
: BroString(string), _num(), _new(false) { } : BroString(string), _num(), _new(false) { }
BroSubstring(const BroSubstring& bst); BroSubstring(const BroSubstring& bst);
@ -97,7 +97,7 @@ private:
// //
class BroSubstringCmp { class BroSubstringCmp {
public: public:
BroSubstringCmp(unsigned int index) { _index = index; } explicit BroSubstringCmp(unsigned int index) { _index = index; }
bool operator()(const BroSubstring* bst1, const BroSubstring* bst2) const; bool operator()(const BroSubstring* bst1, const BroSubstring* bst2) const;
private: private:
@ -119,7 +119,7 @@ enum SWVariant {
// Parameters for Smith-Waterman are stored in this simple record. // Parameters for Smith-Waterman are stored in this simple record.
// //
struct SWParams { struct SWParams {
SWParams(unsigned int min_toklen = 3, SWVariant sw_variant = SW_SINGLE) explicit SWParams(unsigned int min_toklen = 3, SWVariant sw_variant = SW_SINGLE)
{ {
_min_toklen = min_toklen; _min_toklen = min_toklen;
_sw_variant = sw_variant; _sw_variant = sw_variant;

View file

@ -48,7 +48,7 @@ public:
StateAccess(const StateAccess& sa); StateAccess(const StateAccess& sa);
virtual ~StateAccess(); ~StateAccess() override;
// Replays this access in the our environment. // Replays this access in the our environment.
void Replay(); void Replay();

View file

@ -63,14 +63,14 @@ protected:
class ProfileLogger : public SegmentStatsReporter { class ProfileLogger : public SegmentStatsReporter {
public: public:
ProfileLogger(BroFile* file, double interval); ProfileLogger(BroFile* file, double interval);
~ProfileLogger(); ~ProfileLogger() override;
void Log(); void Log();
BroFile* File() { return file; } BroFile* File() { return file; }
protected: protected:
void SegmentProfile(const char* name, const Location* loc, void SegmentProfile(const char* name, const Location* loc,
double dtime, int dmem); double dtime, int dmem) override;
private: private:
BroFile* file; BroFile* file;
@ -82,7 +82,7 @@ private:
class SampleLogger : public SegmentStatsReporter { class SampleLogger : public SegmentStatsReporter {
public: public:
SampleLogger(); SampleLogger();
~SampleLogger(); ~SampleLogger() override;
// These are called to report that a given function or location // These are called to report that a given function or location
// has been seen during the sampling. // has been seen during the sampling.
@ -91,7 +91,7 @@ public:
protected: protected:
void SegmentProfile(const char* name, const Location* loc, void SegmentProfile(const char* name, const Location* loc,
double dtime, int dmem); double dtime, int dmem) override;
TableVal* load_samples; TableVal* load_samples;
}; };

View file

@ -23,15 +23,15 @@ class Stmt : public BroObj {
public: public:
BroStmtTag Tag() const { return tag; } BroStmtTag Tag() const { return tag; }
virtual ~Stmt(); ~Stmt() override;
virtual Val* Exec(Frame* f, stmt_flow_type& flow) const = 0; virtual Val* Exec(Frame* f, stmt_flow_type& flow) const = 0;
Stmt* Ref() { ::Ref(this); return this; } Stmt* Ref() { ::Ref(this); return this; }
bool SetLocationInfo(const Location* loc) bool SetLocationInfo(const Location* loc) override
{ return Stmt::SetLocationInfo(loc, loc); } { return Stmt::SetLocationInfo(loc, loc); }
bool SetLocationInfo(const Location* start, const Location* end); bool SetLocationInfo(const Location* start, const Location* end) override;
// True if the statement has no side effects, false otherwise. // True if the statement has no side effects, false otherwise.
virtual int IsPure() const; virtual int IsPure() const;
@ -58,7 +58,7 @@ public:
void AccessStats(ODesc* d) const; void AccessStats(ODesc* d) const;
uint32 GetAccessCount() const { return access_count; } uint32 GetAccessCount() const { return access_count; }
virtual void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
virtual void IncrBPCount() { ++breakpoint_count; } virtual void IncrBPCount() { ++breakpoint_count; }
virtual void DecrBPCount() virtual void DecrBPCount()
@ -78,7 +78,7 @@ public:
protected: protected:
Stmt() {} Stmt() {}
Stmt(BroStmtTag arg_tag); explicit Stmt(BroStmtTag arg_tag);
void AddTag(ODesc* d) const; void AddTag(ODesc* d) const;
void DescribeDone(ODesc* d) const; void DescribeDone(ODesc* d) const;
@ -97,18 +97,18 @@ class ExprListStmt : public Stmt {
public: public:
const ListExpr* ExprList() const { return l; } const ListExpr* ExprList() const { return l; }
TraversalCode Traverse(TraversalCallback* cb) const; TraversalCode Traverse(TraversalCallback* cb) const override;
protected: protected:
ExprListStmt() { l = 0; } ExprListStmt() { l = 0; }
ExprListStmt(BroStmtTag t, ListExpr* arg_l); ExprListStmt(BroStmtTag t, ListExpr* arg_l);
virtual ~ExprListStmt(); ~ExprListStmt() override;
Val* Exec(Frame* f, stmt_flow_type& flow) const; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
virtual Val* DoExec(val_list* vals, stmt_flow_type& flow) const = 0; virtual Val* DoExec(val_list* vals, stmt_flow_type& flow) const = 0;
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
void PrintVals(ODesc* d, val_list* vals, int offset) const; void PrintVals(ODesc* d, val_list* vals, int offset) const;
DECLARE_ABSTRACT_SERIAL(ExprListStmt); DECLARE_ABSTRACT_SERIAL(ExprListStmt);
@ -118,7 +118,7 @@ protected:
class PrintStmt : public ExprListStmt { class PrintStmt : public ExprListStmt {
public: public:
PrintStmt(ListExpr* l) : ExprListStmt(STMT_PRINT, l) { } explicit PrintStmt(ListExpr* l) : ExprListStmt(STMT_PRINT, l) { }
protected: protected:
friend class Stmt; friend class Stmt;
@ -131,8 +131,8 @@ protected:
class ExprStmt : public Stmt { class ExprStmt : public Stmt {
public: public:
ExprStmt(Expr* e); explicit ExprStmt(Expr* e);
virtual ~ExprStmt(); ~ExprStmt() override;
Val* Exec(Frame* f, stmt_flow_type& flow) const override; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
@ -159,7 +159,7 @@ protected:
class IfStmt : public ExprStmt { class IfStmt : public ExprStmt {
public: public:
IfStmt(Expr* test, Stmt* s1, Stmt* s2); IfStmt(Expr* test, Stmt* s1, Stmt* s2);
~IfStmt(); ~IfStmt() override;
const Stmt* TrueBranch() const { return s1; } const Stmt* TrueBranch() const { return s1; }
const Stmt* FalseBranch() const { return s2; } const Stmt* FalseBranch() const { return s2; }
@ -184,7 +184,7 @@ protected:
class Case : public BroObj { class Case : public BroObj {
public: public:
Case(ListExpr* c, Stmt* arg_s); Case(ListExpr* c, Stmt* arg_s);
~Case(); ~Case() override;
const ListExpr* Cases() const { return cases; } const ListExpr* Cases() const { return cases; }
ListExpr* Cases() { return cases; } ListExpr* Cases() { return cases; }
@ -212,7 +212,7 @@ protected:
class SwitchStmt : public ExprStmt { class SwitchStmt : public ExprStmt {
public: public:
SwitchStmt(Expr* index, case_list* cases); SwitchStmt(Expr* index, case_list* cases);
~SwitchStmt(); ~SwitchStmt() override;
const case_list* Cases() const { return cases; } const case_list* Cases() const { return cases; }
@ -250,7 +250,7 @@ protected:
class AddStmt : public ExprStmt { class AddStmt : public ExprStmt {
public: public:
AddStmt(Expr* e); explicit AddStmt(Expr* e);
int IsPure() const override; int IsPure() const override;
Val* Exec(Frame* f, stmt_flow_type& flow) const override; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
@ -266,7 +266,7 @@ protected:
class DelStmt : public ExprStmt { class DelStmt : public ExprStmt {
public: public:
DelStmt(Expr* e); explicit DelStmt(Expr* e);
int IsPure() const override; int IsPure() const override;
Val* Exec(Frame* f, stmt_flow_type& flow) const override; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
@ -282,7 +282,7 @@ protected:
class EventStmt : public ExprStmt { class EventStmt : public ExprStmt {
public: public:
EventStmt(EventExpr* e); explicit EventStmt(EventExpr* e);
Val* Exec(Frame* f, stmt_flow_type& flow) const override; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
@ -301,7 +301,7 @@ class WhileStmt : public Stmt {
public: public:
WhileStmt(Expr* loop_condition, Stmt* body); WhileStmt(Expr* loop_condition, Stmt* body);
~WhileStmt(); ~WhileStmt() override;
int IsPure() const override; int IsPure() const override;
@ -326,7 +326,7 @@ protected:
class ForStmt : public ExprStmt { class ForStmt : public ExprStmt {
public: public:
ForStmt(id_list* loop_vars, Expr* loop_expr); ForStmt(id_list* loop_vars, Expr* loop_expr);
~ForStmt(); ~ForStmt() override;
void AddBody(Stmt* arg_body) { body = arg_body; } void AddBody(Stmt* arg_body) { body = arg_body; }
@ -399,7 +399,7 @@ protected:
class ReturnStmt : public ExprStmt { class ReturnStmt : public ExprStmt {
public: public:
ReturnStmt(Expr* e); explicit ReturnStmt(Expr* e);
Val* Exec(Frame* f, stmt_flow_type& flow) const override; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
@ -415,7 +415,7 @@ protected:
class StmtList : public Stmt { class StmtList : public Stmt {
public: public:
StmtList(); StmtList();
~StmtList(); ~StmtList() override;
Val* Exec(Frame* f, stmt_flow_type& flow) const override; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
@ -456,14 +456,14 @@ protected:
class InitStmt : public Stmt { class InitStmt : public Stmt {
public: public:
InitStmt(id_list* arg_inits) : Stmt(STMT_INIT) explicit InitStmt(id_list* arg_inits) : Stmt(STMT_INIT)
{ {
inits = arg_inits; inits = arg_inits;
if ( arg_inits && arg_inits->length() ) if ( arg_inits && arg_inits->length() )
SetLocationInfo((*arg_inits)[0]->GetLocationInfo()); SetLocationInfo((*arg_inits)[0]->GetLocationInfo());
} }
~InitStmt(); ~InitStmt() override;
Val* Exec(Frame* f, stmt_flow_type& flow) const override; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
@ -501,7 +501,7 @@ class WhenStmt : public Stmt {
public: public:
// s2 is null if no timeout block given. // s2 is null if no timeout block given.
WhenStmt(Expr* cond, Stmt* s1, Stmt* s2, Expr* timeout, bool is_return); WhenStmt(Expr* cond, Stmt* s1, Stmt* s2, Expr* timeout, bool is_return);
~WhenStmt(); ~WhenStmt() override;
Val* Exec(Frame* f, stmt_flow_type& flow) const override; Val* Exec(Frame* f, stmt_flow_type& flow) const override;
int IsPure() const override; int IsPure() const override;

View file

@ -132,7 +132,7 @@ protected:
* *
* @param val An enum value of script type \c Analyzer::Tag. * @param val An enum value of script type \c Analyzer::Tag.
*/ */
Tag(EnumVal* val); explicit Tag(EnumVal* val);
private: private:
type_t type; // Main type. type_t type; // Main type.

View file

@ -56,7 +56,7 @@ class Timer : public SerialObj, public PQ_Element {
public: public:
Timer(double t, TimerType arg_type) : PQ_Element(t) Timer(double t, TimerType arg_type) : PQ_Element(t)
{ type = (char) arg_type; } { type = (char) arg_type; }
virtual ~Timer() { } ~Timer() override { }
TimerType Type() const { return (TimerType) type; } TimerType Type() const { return (TimerType) type; }
@ -118,7 +118,7 @@ public:
static unsigned int* CurrentTimers() { return current_timers; } static unsigned int* CurrentTimers() { return current_timers; }
protected: protected:
TimerMgr(const Tag& arg_tag) explicit TimerMgr(const Tag& arg_tag)
{ {
t = 0.0; t = 0.0;
num_expired = 0; num_expired = 0;
@ -141,19 +141,19 @@ protected:
class PQ_TimerMgr : public TimerMgr { class PQ_TimerMgr : public TimerMgr {
public: public:
PQ_TimerMgr(const Tag& arg_tag); explicit PQ_TimerMgr(const Tag& arg_tag);
~PQ_TimerMgr(); ~PQ_TimerMgr() override;
void Add(Timer* timer); void Add(Timer* timer) override;
void Expire(); void Expire() override;
int Size() const { return q->Size(); } int Size() const override { return q->Size(); }
int PeakSize() const { return q->PeakSize(); } int PeakSize() const override { return q->PeakSize(); }
uint64 CumulativeNum() const { return q->CumulativeNum(); } uint64 CumulativeNum() const override { return q->CumulativeNum(); }
protected: protected:
int DoAdvance(double t, int max_expire); int DoAdvance(double t, int max_expire) override;
void Remove(Timer* timer); void Remove(Timer* timer) override;
Timer* Remove() { return (Timer*) q->Remove(); } Timer* Remove() { return (Timer*) q->Remove(); }
Timer* Top() { return (Timer*) q->Top(); } Timer* Top() { return (Timer*) q->Top(); }
@ -163,20 +163,20 @@ protected:
class CQ_TimerMgr : public TimerMgr { class CQ_TimerMgr : public TimerMgr {
public: public:
CQ_TimerMgr(const Tag& arg_tag); explicit CQ_TimerMgr(const Tag& arg_tag);
~CQ_TimerMgr(); ~CQ_TimerMgr() override;
void Add(Timer* timer); void Add(Timer* timer) override;
void Expire(); void Expire() override;
int Size() const { return cq_size(cq); } int Size() const override { return cq_size(cq); }
int PeakSize() const { return cq_max_size(cq); } int PeakSize() const override { return cq_max_size(cq); }
uint64 CumulativeNum() const { return cq_cumulative_num(cq); } uint64 CumulativeNum() const override { return cq_cumulative_num(cq); }
unsigned int MemoryUsage() const; unsigned int MemoryUsage() const;
protected: protected:
int DoAdvance(double t, int max_expire); int DoAdvance(double t, int max_expire) override;
void Remove(Timer* timer); void Remove(Timer* timer) override;
struct cq_handle *cq; struct cq_handle *cq;
}; };

View file

@ -21,7 +21,7 @@ public:
// right away. // right away.
Trigger(Expr* cond, Stmt* body, Stmt* timeout_stmts, Expr* timeout, Trigger(Expr* cond, Stmt* body, Stmt* timeout_stmts, Expr* timeout,
Frame* f, bool is_return, const Location* loc); Frame* f, bool is_return, const Location* loc);
~Trigger(); ~Trigger() override;
// Evaluates the condition. If true, executes the body and deletes // Evaluates the condition. If true, executes the body and deletes
// the object deleted. // the object deleted.
@ -57,16 +57,16 @@ public:
bool Disabled() const { return disabled; } bool Disabled() const { return disabled; }
virtual void Describe(ODesc* d) const { d->Add("<trigger>"); } void Describe(ODesc* d) const override
{ d->Add("<trigger>"); }
// Overidden from Notifier. We queue the trigger and evaluate it // Overidden from Notifier. We queue the trigger and evaluate it
// later to avoid race conditions. // later to avoid race conditions.
virtual void Access(ID* id, const StateAccess& sa) void Access(ID* id, const StateAccess& sa) override
{ QueueTrigger(this); } { QueueTrigger(this); }
virtual void Access(Val* val, const StateAccess& sa) void Access(Val* val, const StateAccess& sa) override
{ QueueTrigger(this); } { QueueTrigger(this); }
virtual const char* Name() const; const char* Name() const override;
static void QueueTrigger(Trigger* trigger); static void QueueTrigger(Trigger* trigger);

View file

@ -82,8 +82,8 @@ const int MATCHES_INDEX_VECTOR = 2;
class BroType : public BroObj { class BroType : public BroObj {
public: public:
BroType(TypeTag tag, bool base_type = false); explicit BroType(TypeTag tag, bool base_type = false);
~BroType() { } ~BroType() override { }
BroType* Clone() const; BroType* Clone() const;
@ -249,7 +249,7 @@ public:
BroType* Ref() { ::Ref(this); return this; } BroType* Ref() { ::Ref(this); return this; }
virtual void Describe(ODesc* d) const override; void Describe(ODesc* d) const override;
virtual void DescribeReST(ODesc* d, bool roles_only = false) const; virtual void DescribeReST(ODesc* d, bool roles_only = false) const;
virtual unsigned MemoryAllocation() const; virtual unsigned MemoryAllocation() const;
@ -265,7 +265,7 @@ public:
static std::set<BroType*> GetAliases(const std::string& type_name) static std::set<BroType*> GetAliases(const std::string& type_name)
{ return BroType::type_aliases[type_name]; } { return BroType::type_aliases[type_name]; }
static void AddAlias(const std::string type_name, BroType* type) static void AddAlias(const std::string &type_name, BroType* type)
{ BroType::type_aliases[type_name].insert(type); } { BroType::type_aliases[type_name].insert(type); }
protected: protected:
@ -287,13 +287,13 @@ private:
class TypeList : public BroType { class TypeList : public BroType {
public: public:
TypeList(BroType* arg_pure_type = 0) : BroType(TYPE_LIST) explicit TypeList(BroType* arg_pure_type = 0) : BroType(TYPE_LIST)
{ {
pure_type = arg_pure_type; pure_type = arg_pure_type;
if ( pure_type ) if ( pure_type )
pure_type->Ref(); pure_type->Ref();
} }
~TypeList(); ~TypeList() override;
const type_list* Types() const { return &types; } const type_list* Types() const { return &types; }
type_list* Types() { return &types; } type_list* Types() { return &types; }
@ -352,7 +352,7 @@ protected:
indices = arg_indices; indices = arg_indices;
yield_type = arg_yield_type; yield_type = arg_yield_type;
} }
~IndexType(); ~IndexType() override;
DECLARE_SERIAL(IndexType) DECLARE_SERIAL(IndexType)
@ -379,7 +379,7 @@ protected:
class SetType : public TableType { class SetType : public TableType {
public: public:
SetType(TypeList* ind, ListExpr* arg_elements); SetType(TypeList* ind, ListExpr* arg_elements);
~SetType(); ~SetType() override;
ListExpr* SetElements() const { return elements; } ListExpr* SetElements() const { return elements; }
@ -395,7 +395,7 @@ class FuncType : public BroType {
public: public:
FuncType(RecordType* args, BroType* yield, function_flavor f); FuncType(RecordType* args, BroType* yield, function_flavor f);
~FuncType(); ~FuncType() override;
RecordType* Args() const { return args; } RecordType* Args() const { return args; }
BroType* YieldType() override; BroType* YieldType() override;
@ -428,8 +428,8 @@ protected:
class TypeType : public BroType { class TypeType : public BroType {
public: public:
TypeType(BroType* t) : BroType(TYPE_TYPE) { type = t->Ref(); } explicit TypeType(BroType* t) : BroType(TYPE_TYPE) { type = t->Ref(); }
~TypeType() { Unref(type); } ~TypeType() override { Unref(type); }
BroType* Type() { return type; } BroType* Type() { return type; }
@ -460,9 +460,9 @@ public:
class RecordType : public BroType { class RecordType : public BroType {
public: public:
RecordType(type_decl_list* types); explicit RecordType(type_decl_list* types);
~RecordType(); ~RecordType() override;
int HasField(const char* field) const override; int HasField(const char* field) const override;
BroType* FieldType(const char* field) const override; BroType* FieldType(const char* field) const override;
@ -512,8 +512,8 @@ protected:
class FileType : public BroType { class FileType : public BroType {
public: public:
FileType(BroType* yield_type); explicit FileType(BroType* yield_type);
~FileType(); ~FileType() override;
BroType* YieldType() override; BroType* YieldType() override;
@ -529,8 +529,8 @@ protected:
class OpaqueType : public BroType { class OpaqueType : public BroType {
public: public:
OpaqueType(const string& name); explicit OpaqueType(const string& name);
virtual ~OpaqueType() { }; ~OpaqueType() override { };
const string& Name() const { return name; } const string& Name() const { return name; }
@ -549,9 +549,9 @@ class EnumType : public BroType {
public: public:
typedef std::list<std::pair<string, bro_int_t> > enum_name_list; typedef std::list<std::pair<string, bro_int_t> > enum_name_list;
EnumType(EnumType* e); explicit EnumType(EnumType* e);
EnumType(const string& arg_name); explicit EnumType(const string& arg_name);
~EnumType(); ~EnumType() override;
// The value of this name is next internal counter value, starting // The value of this name is next internal counter value, starting
// with zero. The internal counter is incremented. // with zero. The internal counter is incremented.
@ -598,8 +598,8 @@ protected:
class VectorType : public BroType { class VectorType : public BroType {
public: public:
VectorType(BroType* t); explicit VectorType(BroType* t);
virtual ~VectorType(); ~VectorType() override;
BroType* YieldType() override; BroType* YieldType() override;
const BroType* YieldType() const; const BroType* YieldType() const;

View file

@ -28,7 +28,7 @@ public:
* Construct a UID of a given bit-length, optionally from given values. * Construct a UID of a given bit-length, optionally from given values.
* @see UID::Set * @see UID::Set
*/ */
UID(bro_uint_t bits, const uint64* v = 0, size_t n = 0) explicit UID(bro_uint_t bits, const uint64* v = 0, size_t n = 0)
{ Set(bits, v, n); } { Set(bits, v, n); }
/** /**

View file

@ -914,6 +914,11 @@ AddrVal::AddrVal(const char* text) : Val(TYPE_ADDR)
val.addr_val = new IPAddr(text); val.addr_val = new IPAddr(text);
} }
AddrVal::AddrVal(const std::string& text) : Val(TYPE_ADDR)
{
val.addr_val = new IPAddr(text);
}
AddrVal::AddrVal(uint32 addr) : Val(TYPE_ADDR) AddrVal::AddrVal(uint32 addr) : Val(TYPE_ADDR)
{ {
// ### perhaps do gethostbyaddr here? // ### perhaps do gethostbyaddr here?

View file

@ -131,11 +131,11 @@ public:
#endif #endif
} }
Val(Func* f); explicit Val(Func* f);
// Note, will unref 'f' when it's done, closing it unless // Note, will unref 'f' when it's done, closing it unless
// class has ref'd it. // class has ref'd it.
Val(BroFile* f); explicit Val(BroFile* f);
Val(BroType* t, bool type_type) // Extra arg to differentiate from protected version. Val(BroType* t, bool type_type) // Extra arg to differentiate from protected version.
{ {
@ -154,7 +154,7 @@ public:
#endif #endif
} }
virtual ~Val(); ~Val() override;
Val* Ref() { ::Ref(this); return this; } Val* Ref() { ::Ref(this); return this; }
virtual Val* Clone() const; virtual Val* Clone() const;
@ -365,7 +365,7 @@ protected:
virtual void ValDescribe(ODesc* d) const; virtual void ValDescribe(ODesc* d) const;
virtual void ValDescribeReST(ODesc* d) const; virtual void ValDescribeReST(ODesc* d) const;
Val(TypeTag t) explicit Val(TypeTag t)
{ {
type = base_type(t); type = base_type(t);
#ifdef DEBUG #ifdef DEBUG
@ -373,7 +373,7 @@ protected:
#endif #endif
} }
Val(BroType* t) explicit Val(BroType* t)
{ {
type = t->Ref(); type = t->Ref();
#ifdef DEBUG #ifdef DEBUG
@ -444,7 +444,7 @@ public:
#endif #endif
} }
virtual uint64 LastModified() const override { return last_modified; } uint64 LastModified() const override { return last_modified; }
// Mark value as changed. // Mark value as changed.
void Modified() void Modified()
@ -453,10 +453,10 @@ public:
} }
protected: protected:
MutableVal(BroType* t) : Val(t) explicit MutableVal(BroType* t) : Val(t)
{ props = 0; id = 0; last_modified = SerialObj::ALWAYS; } { props = 0; id = 0; last_modified = SerialObj::ALWAYS; }
MutableVal() { props = 0; id = 0; last_modified = SerialObj::ALWAYS; } MutableVal() { props = 0; id = 0; last_modified = SerialObj::ALWAYS; }
~MutableVal(); ~MutableVal() override;
friend class ID; friend class ID;
friend class Val; friend class Val;
@ -532,7 +532,7 @@ public:
// Host-order port number already masked with port space protocol mask. // Host-order port number already masked with port space protocol mask.
BRO_DEPRECATED("use port_mgr->Get() instead") BRO_DEPRECATED("use port_mgr->Get() instead")
PortVal(uint32 p); explicit PortVal(uint32 p);
Val* SizeVal() const override { return new Val(val.uint_val, TYPE_INT); } Val* SizeVal() const override { return new Val(val.uint_val, TYPE_INT); }
@ -569,36 +569,37 @@ protected:
class AddrVal : public Val { class AddrVal : public Val {
public: public:
AddrVal(const char* text); explicit AddrVal(const char* text);
~AddrVal(); explicit AddrVal(const std::string& text);
~AddrVal() override;
Val* SizeVal() const override; Val* SizeVal() const override;
// Constructor for address already in network order. // Constructor for address already in network order.
AddrVal(uint32 addr); // IPv4. explicit AddrVal(uint32 addr); // IPv4.
AddrVal(const uint32 addr[4]); // IPv6. explicit AddrVal(const uint32 addr[4]); // IPv6.
AddrVal(const IPAddr& addr); explicit AddrVal(const IPAddr& addr);
unsigned int MemoryAllocation() const override; unsigned int MemoryAllocation() const override;
protected: protected:
friend class Val; friend class Val;
AddrVal() {} AddrVal() {}
AddrVal(TypeTag t) : Val(t) { } explicit AddrVal(TypeTag t) : Val(t) { }
AddrVal(BroType* t) : Val(t) { } explicit AddrVal(BroType* t) : Val(t) { }
DECLARE_SERIAL(AddrVal); DECLARE_SERIAL(AddrVal);
}; };
class SubNetVal : public Val { class SubNetVal : public Val {
public: public:
SubNetVal(const char* text); explicit SubNetVal(const char* text);
SubNetVal(const char* text, int width); SubNetVal(const char* text, int width);
SubNetVal(uint32 addr, int width); // IPv4. SubNetVal(uint32 addr, int width); // IPv4.
SubNetVal(const uint32 addr[4], int width); // IPv6. SubNetVal(const uint32 addr[4], int width); // IPv6.
SubNetVal(const IPAddr& addr, int width); SubNetVal(const IPAddr& addr, int width);
SubNetVal(const IPPrefix& prefix); explicit SubNetVal(const IPPrefix& prefix);
~SubNetVal(); ~SubNetVal() override;
Val* SizeVal() const override; Val* SizeVal() const override;
@ -621,9 +622,9 @@ protected:
class StringVal : public Val { class StringVal : public Val {
public: public:
StringVal(BroString* s); explicit StringVal(BroString* s);
StringVal(const char* s); explicit StringVal(const char* s);
StringVal(const string& s); explicit StringVal(const string& s);
StringVal(int length, const char* s); StringVal(int length, const char* s);
Val* SizeVal() const override Val* SizeVal() const override
@ -653,8 +654,8 @@ protected:
class PatternVal : public Val { class PatternVal : public Val {
public: public:
PatternVal(RE_Matcher* re); explicit PatternVal(RE_Matcher* re);
~PatternVal(); ~PatternVal() override;
int AddTo(Val* v, int is_first_init) const override; int AddTo(Val* v, int is_first_init) const override;
@ -675,8 +676,8 @@ protected:
// element in their index. // element in their index.
class ListVal : public Val { class ListVal : public Val {
public: public:
ListVal(TypeTag t); explicit ListVal(TypeTag t);
~ListVal(); ~ListVal() override;
TypeTag BaseTag() const { return tag; } TypeTag BaseTag() const { return tag; }
@ -722,7 +723,7 @@ extern double bro_start_network_time;
class TableEntryVal { class TableEntryVal {
public: public:
TableEntryVal(Val* v) explicit TableEntryVal(Val* v)
{ {
val = v; val = v;
last_access_time = network_time; last_access_time = network_time;
@ -764,9 +765,9 @@ protected:
class TableValTimer : public Timer { class TableValTimer : public Timer {
public: public:
TableValTimer(TableVal* val, double t); TableValTimer(TableVal* val, double t);
~TableValTimer(); ~TableValTimer() override;
virtual void Dispatch(double t, int is_expire); void Dispatch(double t, int is_expire) override;
TableVal* Table() { return table; } TableVal* Table() { return table; }
@ -777,8 +778,8 @@ protected:
class CompositeHash; class CompositeHash;
class TableVal : public MutableVal { class TableVal : public MutableVal {
public: public:
TableVal(TableType* t, Attributes* attrs = 0); explicit TableVal(TableType* t, Attributes* attrs = 0);
~TableVal(); ~TableVal() override;
// Returns true if the assignment typechecked, false if not. The // Returns true if the assignment typechecked, false if not. The
// methods take ownership of new_val, but not of the index. Second // methods take ownership of new_val, but not of the index. Second
@ -919,8 +920,8 @@ protected:
class RecordVal : public MutableVal { class RecordVal : public MutableVal {
public: public:
RecordVal(RecordType* t); explicit RecordVal(RecordType* t);
~RecordVal(); ~RecordVal() override;
Val* SizeVal() const override Val* SizeVal() const override
{ return new Val(record_type->NumFields(), TYPE_COUNT); } { return new Val(record_type->NumFields(), TYPE_COUNT); }
@ -999,8 +1000,8 @@ protected:
class VectorVal : public MutableVal { class VectorVal : public MutableVal {
public: public:
VectorVal(VectorType* t); explicit VectorVal(VectorType* t);
~VectorVal(); ~VectorVal() override;
Val* SizeVal() const override Val* SizeVal() const override
{ return new Val(uint32(val.vector_val->size()), TYPE_COUNT); } { return new Val(uint32(val.vector_val->size()), TYPE_COUNT); }
@ -1061,8 +1062,8 @@ protected:
// functions). See OpaqueVal.h for derived classes. // functions). See OpaqueVal.h for derived classes.
class OpaqueVal : public Val { class OpaqueVal : public Val {
public: public:
OpaqueVal(OpaqueType* t); explicit OpaqueVal(OpaqueType* t);
virtual ~OpaqueVal(); ~OpaqueVal() override;
protected: protected:
friend class Val; friend class Val;

View file

@ -102,7 +102,7 @@ public:
* *
* @param conn The connection the analyzer is associated with. * @param conn The connection the analyzer is associated with.
*/ */
Analyzer(Connection* conn); explicit Analyzer(Connection* conn);
/** /**
* Destructor. * Destructor.
@ -731,7 +731,7 @@ public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~SupportAnalyzer() {} ~SupportAnalyzer() override {}
/** /**
* Returns true if this is a support analyzer for the connection's * Returns true if this is a support analyzer for the connection's
@ -755,8 +755,8 @@ public:
* *
* Parameters same as for Analyzer::ForwardPacket. * Parameters same as for Analyzer::ForwardPacket.
*/ */
virtual void ForwardPacket(int len, const u_char* data, bool orig, void ForwardPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
/** /**
* Passes stream input to the next sibling SupportAnalyzer if any, or * Passes stream input to the next sibling SupportAnalyzer if any, or
@ -766,7 +766,7 @@ public:
* *
* Parameters same as for Analyzer::ForwardStream. * Parameters same as for Analyzer::ForwardStream.
*/ */
virtual void ForwardStream(int len, const u_char* data, bool orig); void ForwardStream(int len, const u_char* data, bool orig) override;
/** /**
* Passes gap information to the next sibling SupportAnalyzer if any, * Passes gap information to the next sibling SupportAnalyzer if any,
@ -776,7 +776,7 @@ public:
* *
* Parameters same as for Analyzer::ForwardPacket. * Parameters same as for Analyzer::ForwardPacket.
*/ */
virtual void ForwardUndelivered(uint64 seq, int len, bool orig); void ForwardUndelivered(uint64 seq, int len, bool orig) override;
protected: protected:
friend class Analyzer; friend class Analyzer;
@ -814,7 +814,7 @@ public:
/** /**
* Overridden from parent class. * Overridden from parent class.
*/ */
virtual void Done(); void Done() override;
/** /**
* Returns true if the analyzer determines that in fact a new * Returns true if the analyzer determines that in fact a new

View file

@ -61,7 +61,7 @@ public:
/** /**
* Destructor. * Destructor.
*/ */
~Component(); ~Component() override;
/** /**
* Initialization function. This function has to be called before any * Initialization function. This function has to be called before any

View file

@ -99,14 +99,14 @@ protected:
* @param subtype The sub type, which is left to an analyzer for * @param subtype The sub type, which is left to an analyzer for
* interpretation. By default it's set to zero. * interpretation. By default it's set to zero.
*/ */
Tag(type_t type, subtype_t subtype = 0); explicit Tag(type_t type, subtype_t subtype = 0);
/** /**
* Constructor. * Constructor.
* *
* @param val An enum value of script type \c Analyzer::Tag. * @param val An enum value of script type \c Analyzer::Tag.
*/ */
Tag(EnumVal* val) : ::Tag(val) {} explicit Tag(EnumVal* val) : ::Tag(val) {}
}; };
} }

View file

@ -36,11 +36,11 @@ namespace analyzer { namespace arp {
class ARP_Analyzer : public BroObj { class ARP_Analyzer : public BroObj {
public: public:
ARP_Analyzer(); ARP_Analyzer();
virtual ~ARP_Analyzer(); ~ARP_Analyzer() override;
void NextPacket(double t, const Packet* pkt); void NextPacket(double t, const Packet* pkt);
void Describe(ODesc* d) const; void Describe(ODesc* d) const override;
void RREvent(EventHandlerPtr e, const u_char* src, const u_char* dst, void RREvent(EventHandlerPtr e, const u_char* src, const u_char* dst,
const char* spa, const char* sha, const char* spa, const char* sha,
const char* tpa, const char* tha); const char* tpa, const char* tha);

View file

@ -7,7 +7,7 @@ namespace analyzer { namespace ayiya {
class AYIYA_Analyzer : public analyzer::Analyzer { class AYIYA_Analyzer : public analyzer::Analyzer {
public: public:
AYIYA_Analyzer(Connection* conn); explicit AYIYA_Analyzer(Connection* conn);
virtual ~AYIYA_Analyzer(); virtual ~AYIYA_Analyzer();
virtual void Done(); virtual void Done();

View file

@ -12,7 +12,7 @@ namespace analyzer { namespace backdoor {
class BackDoorEndpoint { class BackDoorEndpoint {
public: public:
BackDoorEndpoint(tcp::TCP_Endpoint* e); explicit BackDoorEndpoint(tcp::TCP_Endpoint* e);
int DataSent(double t, uint64 seq, int len, int caplen, const u_char* data, int DataSent(double t, uint64 seq, int len, int caplen, const u_char* data,
const IP_Hdr* ip, const struct tcphdr* tp); const IP_Hdr* ip, const struct tcphdr* tp);
@ -66,11 +66,11 @@ protected:
class BackDoor_Analyzer : public tcp::TCP_ApplicationAnalyzer { class BackDoor_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
BackDoor_Analyzer(Connection* c); explicit BackDoor_Analyzer(Connection* c);
~BackDoor_Analyzer(); ~BackDoor_Analyzer() override;
virtual void Init(); void Init() override;
virtual void Done(); void Done() override;
void StatTimer(double t, int is_expire); void StatTimer(double t, int is_expire);
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
@ -79,9 +79,9 @@ public:
protected: protected:
// We support both packet and stream input, and can be instantiated // We support both packet and stream input, and can be instantiated
// even if the TCP analyzer is not yet reassembling. // even if the TCP analyzer is not yet reassembling.
virtual void DeliverPacket(int len, const u_char* data, bool is_orig, void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
virtual void DeliverStream(int len, const u_char* data, bool is_orig); void DeliverStream(int len, const u_char* data, bool is_orig) override;
void StatEvent(); void StatEvent();
void RemoveEvent(); void RemoveEvent();
@ -99,9 +99,9 @@ protected:
class BackDoorTimer : public Timer { class BackDoorTimer : public Timer {
public: public:
BackDoorTimer(double t, BackDoor_Analyzer* a); BackDoorTimer(double t, BackDoor_Analyzer* a);
~BackDoorTimer(); ~BackDoorTimer() override;
void Dispatch(double t, int is_expire); void Dispatch(double t, int is_expire) override;
protected: protected:
BackDoor_Analyzer* analyzer; BackDoor_Analyzer* analyzer;

View file

@ -11,13 +11,13 @@ namespace analyzer { namespace bittorrent {
class BitTorrent_Analyzer : public tcp::TCP_ApplicationAnalyzer { class BitTorrent_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
BitTorrent_Analyzer(Connection* conn); explicit BitTorrent_Analyzer(Connection* conn);
virtual ~BitTorrent_Analyzer(); ~BitTorrent_Analyzer() override;
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
virtual void EndpointEOF(bool is_orig); void EndpointEOF(bool is_orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new BitTorrent_Analyzer(conn); } { return new BitTorrent_Analyzer(conn); }

View file

@ -44,13 +44,13 @@ enum btt_benc_states {
class BitTorrentTracker_Analyzer : public tcp::TCP_ApplicationAnalyzer { class BitTorrentTracker_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
BitTorrentTracker_Analyzer(Connection* conn); explicit BitTorrentTracker_Analyzer(Connection* conn);
virtual ~BitTorrentTracker_Analyzer(); ~BitTorrentTracker_Analyzer() override;
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
virtual void EndpointEOF(bool is_orig); void EndpointEOF(bool is_orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new BitTorrentTracker_Analyzer(conn); } { return new BitTorrentTracker_Analyzer(conn); }
@ -59,7 +59,7 @@ protected:
void ClientRequest(int len, const u_char* data); void ClientRequest(int len, const u_char* data);
void ServerReply(int len, const u_char* data); void ServerReply(int len, const u_char* data);
void InitBencParser(void); void InitBencParser();
void DeliverWeird(const char* msg, bool orig); void DeliverWeird(const char* msg, bool orig);
@ -67,19 +67,19 @@ protected:
void RequestGet(char* uri); void RequestGet(char* uri);
void RequestHeader(char* name, char* value) void RequestHeader(char* name, char* value)
{ ParseHeader(name, value, true); } { ParseHeader(name, value, true); }
void EmitRequest(void); void EmitRequest();
bool ParseResponse(char* line); bool ParseResponse(char* line);
void ResponseStatus(char* status); void ResponseStatus(char* status);
void ResponseHeader(char* name, char* value) void ResponseHeader(char* name, char* value)
{ ParseHeader(name, value, false); } { ParseHeader(name, value, false); }
void ResponseBody(void); void ResponseBody();
void ResponseBenc(int name_len, char* name, enum btt_benc_types type, void ResponseBenc(int name_len, char* name, enum btt_benc_types type,
int value_len, char* value); int value_len, char* value);
void ResponseBenc(int name_len, char* name, enum btt_benc_types type, void ResponseBenc(int name_len, char* name, enum btt_benc_types type,
bro_int_t value); bro_int_t value);
int ResponseParseBenc(void); int ResponseParseBenc();
void EmitResponse(void); void EmitResponse();
void ParseHeader(char* name, char* value, bool is_request); void ParseHeader(char* name, char* value, bool is_request);

View file

@ -11,15 +11,15 @@ namespace analyzer { namespace conn_size {
class ConnSize_Analyzer : public analyzer::Analyzer { class ConnSize_Analyzer : public analyzer::Analyzer {
public: public:
ConnSize_Analyzer(Connection* c); explicit ConnSize_Analyzer(Connection* c);
virtual ~ConnSize_Analyzer(); ~ConnSize_Analyzer() override;
virtual void Init(); void Init() override;
virtual void Done(); void Done() override;
// from Analyzer.h // from Analyzer.h
virtual void UpdateConnVal(RecordVal *conn_val); void UpdateConnVal(RecordVal *conn_val) override;
virtual void FlipRoles(); void FlipRoles() override;
void SetThreshold(uint64_t threshold, bool bytes, bool orig); void SetThreshold(uint64_t threshold, bool bytes, bool orig);
uint64 GetThreshold(bool bytes, bool orig); uint64 GetThreshold(bool bytes, bool orig);
@ -28,8 +28,8 @@ public:
{ return new ConnSize_Analyzer(conn); } { return new ConnSize_Analyzer(conn); }
protected: protected:
virtual void DeliverPacket(int len, const u_char* data, bool is_orig, void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
void CheckSizes(bool is_orig); void CheckSizes(bool is_orig);
void ThresholdEvent(EventHandlerPtr f, uint64 threshold, bool is_orig); void ThresholdEvent(EventHandlerPtr f, uint64 threshold, bool is_orig);

View file

@ -14,8 +14,8 @@ namespace analyzer { namespace dce_rpc {
class DCE_RPC_Analyzer : public tcp::TCP_ApplicationAnalyzer { class DCE_RPC_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
DCE_RPC_Analyzer(Connection* conn); explicit DCE_RPC_Analyzer(Connection* conn);
~DCE_RPC_Analyzer(); ~DCE_RPC_Analyzer() override;
void Done() override; void Done() override;
void DeliverStream(int len, const u_char* data, bool orig) override; void DeliverStream(int len, const u_char* data, bool orig) override;

View file

@ -9,12 +9,12 @@ namespace analyzer { namespace dhcp {
class DHCP_Analyzer : public analyzer::Analyzer { class DHCP_Analyzer : public analyzer::Analyzer {
public: public:
DHCP_Analyzer(Connection* conn); explicit DHCP_Analyzer(Connection* conn);
virtual ~DHCP_Analyzer(); ~DHCP_Analyzer() override;
virtual void Done(); void Done() override;
virtual void DeliverPacket(int len, const u_char* data, bool orig, void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new DHCP_Analyzer(conn); } { return new DHCP_Analyzer(conn); }

View file

@ -11,7 +11,7 @@ namespace analyzer { namespace dnp3 {
class DNP3_Base { class DNP3_Base {
public: public:
DNP3_Base(analyzer::Analyzer* analyzer); explicit DNP3_Base(analyzer::Analyzer* analyzer);
virtual ~DNP3_Base(); virtual ~DNP3_Base();
binpac::DNP3::DNP3_Conn* Interpreter() { return interp; } binpac::DNP3::DNP3_Conn* Interpreter() { return interp; }
@ -64,13 +64,13 @@ protected:
class DNP3_TCP_Analyzer : public DNP3_Base, public tcp::TCP_ApplicationAnalyzer { class DNP3_TCP_Analyzer : public DNP3_Base, public tcp::TCP_ApplicationAnalyzer {
public: public:
DNP3_TCP_Analyzer(Connection* conn); explicit DNP3_TCP_Analyzer(Connection* conn);
virtual ~DNP3_TCP_Analyzer(); ~DNP3_TCP_Analyzer() override;
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
virtual void EndpointEOF(bool is_orig); void EndpointEOF(bool is_orig) override;
static Analyzer* Instantiate(Connection* conn) static Analyzer* Instantiate(Connection* conn)
{ return new DNP3_TCP_Analyzer(conn); } { return new DNP3_TCP_Analyzer(conn); }
@ -78,11 +78,11 @@ public:
class DNP3_UDP_Analyzer : public DNP3_Base, public analyzer::Analyzer { class DNP3_UDP_Analyzer : public DNP3_Base, public analyzer::Analyzer {
public: public:
DNP3_UDP_Analyzer(Connection* conn); explicit DNP3_UDP_Analyzer(Connection* conn);
virtual ~DNP3_UDP_Analyzer(); ~DNP3_UDP_Analyzer() override;
virtual void DeliverPacket(int len, const u_char* data, bool orig, void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new DNP3_UDP_Analyzer(conn); } { return new DNP3_UDP_Analyzer(conn); }

View file

@ -182,7 +182,7 @@ int DNS_Interpreter::ParseQuestion(DNS_MsgInfo* msg,
return 0; return 0;
} }
EventHandlerPtr dns_event = 0; EventHandlerPtr dns_event = nullptr;
if ( msg->QR == 0 ) if ( msg->QR == 0 )
dns_event = dns_request; dns_event = dns_request;

View file

@ -151,7 +151,7 @@ public:
class DNS_Interpreter { class DNS_Interpreter {
public: public:
DNS_Interpreter(analyzer::Analyzer* analyzer); explicit DNS_Interpreter(analyzer::Analyzer* analyzer);
int ParseMessage(const u_char* data, int len, int is_query); int ParseMessage(const u_char* data, int len, int is_query);
@ -239,14 +239,14 @@ typedef enum {
class Contents_DNS : public tcp::TCP_SupportAnalyzer { class Contents_DNS : public tcp::TCP_SupportAnalyzer {
public: public:
Contents_DNS(Connection* c, bool orig, DNS_Interpreter* interp); Contents_DNS(Connection* c, bool orig, DNS_Interpreter* interp);
~Contents_DNS(); ~Contents_DNS() override;
void Flush(); ///< process any partially-received data void Flush(); ///< process any partially-received data
TCP_DNS_state State() const { return state; } TCP_DNS_state State() const { return state; }
protected: protected:
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
DNS_Interpreter* interp; DNS_Interpreter* interp;
@ -260,16 +260,16 @@ protected:
// Works for both TCP and UDP. // Works for both TCP and UDP.
class DNS_Analyzer : public tcp::TCP_ApplicationAnalyzer { class DNS_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
DNS_Analyzer(Connection* conn); explicit DNS_Analyzer(Connection* conn);
~DNS_Analyzer(); ~DNS_Analyzer() override;
virtual void DeliverPacket(int len, const u_char* data, bool orig, void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
virtual void Init(); void Init() override;
virtual void Done(); void Done() override;
virtual void ConnectionClosed(tcp::TCP_Endpoint* endpoint, void ConnectionClosed(tcp::TCP_Endpoint* endpoint,
tcp::TCP_Endpoint* peer, int gen_event); tcp::TCP_Endpoint* peer, int gen_event) override;
void ExpireTimer(double t); void ExpireTimer(double t);

View file

@ -13,11 +13,11 @@ class File_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
File_Analyzer(const char* name, Connection* conn); File_Analyzer(const char* name, Connection* conn);
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
// static analyzer::Analyzer* Instantiate(Connection* conn) // static analyzer::Analyzer* Instantiate(Connection* conn)
// { return new File_Analyzer(conn); } // { return new File_Analyzer(conn); }
@ -34,7 +34,7 @@ protected:
class IRC_Data : public File_Analyzer { class IRC_Data : public File_Analyzer {
public: public:
IRC_Data(Connection* conn) explicit IRC_Data(Connection* conn)
: File_Analyzer("IRC_Data", conn) : File_Analyzer("IRC_Data", conn)
{ } { }
@ -44,7 +44,7 @@ public:
class FTP_Data : public File_Analyzer { class FTP_Data : public File_Analyzer {
public: public:
FTP_Data(Connection* conn) explicit FTP_Data(Connection* conn)
: File_Analyzer("FTP_Data", conn) : File_Analyzer("FTP_Data", conn)
{ } { }

View file

@ -10,12 +10,12 @@ namespace analyzer { namespace finger {
class Finger_Analyzer : public tcp::TCP_ApplicationAnalyzer { class Finger_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
Finger_Analyzer(Connection* conn); explicit Finger_Analyzer(Connection* conn);
virtual ~Finger_Analyzer() {} ~Finger_Analyzer() override {}
virtual void Done(); void Done() override;
// Line-based input. // Line-based input.
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new Finger_Analyzer(conn); } { return new Finger_Analyzer(conn); }

View file

@ -10,10 +10,10 @@ namespace analyzer { namespace ftp {
class FTP_Analyzer : public tcp::TCP_ApplicationAnalyzer { class FTP_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
FTP_Analyzer(Connection* conn); explicit FTP_Analyzer(Connection* conn);
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ {
@ -40,7 +40,7 @@ public:
: SupportAnalyzer("FTP_ADAT", conn, arg_orig), : SupportAnalyzer("FTP_ADAT", conn, arg_orig),
first_token(true) { } first_token(true) { }
void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
protected: protected:
// Used by the client-side analyzer to tell if it needs to peek at the // Used by the client-side analyzer to tell if it needs to peek at the

View file

@ -36,11 +36,11 @@ public:
class Gnutella_Analyzer : public tcp::TCP_ApplicationAnalyzer { class Gnutella_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
Gnutella_Analyzer(Connection* conn); explicit Gnutella_Analyzer(Connection* conn);
~Gnutella_Analyzer(); ~Gnutella_Analyzer() override;
virtual void Done (); void Done () override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new Gnutella_Analyzer(conn); } { return new Gnutella_Analyzer(conn); }

View file

@ -15,8 +15,8 @@ class GSSAPI_Analyzer
: public tcp::TCP_ApplicationAnalyzer { : public tcp::TCP_ApplicationAnalyzer {
public: public:
GSSAPI_Analyzer(Connection* conn); explicit GSSAPI_Analyzer(Connection* conn);
virtual ~GSSAPI_Analyzer(); ~GSSAPI_Analyzer() override;
// Overriden from Analyzer. // Overriden from Analyzer.
void Done() override; void Done() override;

View file

@ -7,7 +7,7 @@ namespace analyzer { namespace gtpv1 {
class GTPv1_Analyzer : public analyzer::Analyzer { class GTPv1_Analyzer : public analyzer::Analyzer {
public: public:
GTPv1_Analyzer(Connection* conn); explicit GTPv1_Analyzer(Connection* conn);
virtual ~GTPv1_Analyzer(); virtual ~GTPv1_Analyzer();
virtual void Done(); virtual void Done();

View file

@ -34,7 +34,7 @@ class HTTP_Entity : public mime::MIME_Entity {
public: public:
HTTP_Entity(HTTP_Message* msg, MIME_Entity* parent_entity, HTTP_Entity(HTTP_Message* msg, MIME_Entity* parent_entity,
int expect_body); int expect_body);
~HTTP_Entity() ~HTTP_Entity() override
{ {
if ( zip ) if ( zip )
{ zip->Done(); delete zip; } { zip->Done(); delete zip; }
@ -104,7 +104,7 @@ friend class HTTP_Entity;
public: public:
HTTP_Message(HTTP_Analyzer* analyzer, tcp::ContentLine_Analyzer* cl, HTTP_Message(HTTP_Analyzer* analyzer, tcp::ContentLine_Analyzer* cl,
bool is_orig, int expect_body, int64_t init_header_length); bool is_orig, int expect_body, int64_t init_header_length);
~HTTP_Message(); ~HTTP_Message() override;
void Done(const int interrupted, const char* msg); void Done(const int interrupted, const char* msg);
void Done() override { Done(0, "message ends normally"); } void Done() override { Done(0, "message ends normally"); }
@ -153,7 +153,7 @@ protected:
class HTTP_Analyzer : public tcp::TCP_ApplicationAnalyzer { class HTTP_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
HTTP_Analyzer(Connection* conn); HTTP_Analyzer(Connection* conn);
~HTTP_Analyzer(); ~HTTP_Analyzer() override;
void HTTP_Header(int is_orig, mime::MIME_Header* h); void HTTP_Header(int is_orig, mime::MIME_Header* h);
void HTTP_EntityData(int is_orig, BroString* entity_data); void HTTP_EntityData(int is_orig, BroString* entity_data);

View file

@ -17,19 +17,19 @@ typedef enum {
// RuleMatcherState to perform our own matching. // RuleMatcherState to perform our own matching.
class ICMP_Analyzer : public analyzer::TransportLayerAnalyzer { class ICMP_Analyzer : public analyzer::TransportLayerAnalyzer {
public: public:
ICMP_Analyzer(Connection* conn); explicit ICMP_Analyzer(Connection* conn);
virtual void UpdateConnVal(RecordVal *conn_val); void UpdateConnVal(RecordVal *conn_val) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new ICMP_Analyzer(conn); } { return new ICMP_Analyzer(conn); }
protected: protected:
virtual void Done(); void Done() override;
virtual void DeliverPacket(int len, const u_char* data, bool orig, void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
virtual bool IsReuse(double t, const u_char* pkt); bool IsReuse(double t, const u_char* pkt) override;
virtual unsigned int MemoryAllocation() const; unsigned int MemoryAllocation() const override;
void ICMP_Sent(const struct icmp* icmpp, int len, int caplen, int icmpv6, void ICMP_Sent(const struct icmp* icmpp, int len, int caplen, int icmpv6,
const u_char* data, const IP_Hdr* ip_hdr); const u_char* data, const IP_Hdr* ip_hdr);

View file

@ -10,10 +10,10 @@ namespace analyzer { namespace ident {
class Ident_Analyzer : public tcp::TCP_ApplicationAnalyzer { class Ident_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
Ident_Analyzer(Connection* conn); explicit Ident_Analyzer(Connection* conn);
virtual void Done(); void Done() override;
virtual void DeliverStream(int length, const u_char* data, bool is_orig); void DeliverStream(int length, const u_char* data, bool is_orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new Ident_Analyzer(conn); } { return new Ident_Analyzer(conn); }

View file

@ -13,15 +13,15 @@ namespace analyzer { namespace imap {
class IMAP_Analyzer : public tcp::TCP_ApplicationAnalyzer { class IMAP_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
IMAP_Analyzer(Connection* conn); explicit IMAP_Analyzer(Connection* conn);
virtual ~IMAP_Analyzer(); ~IMAP_Analyzer() override;
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
// Overriden from tcp::TCP_ApplicationAnalyzer. // Overriden from tcp::TCP_ApplicationAnalyzer.
virtual void EndpointEOF(bool is_orig); void EndpointEOF(bool is_orig) override;
void StartTLS(); void StartTLS();

View file

@ -11,7 +11,7 @@ namespace analyzer { namespace interconn {
class InterConnEndpoint : public BroObj { class InterConnEndpoint : public BroObj {
public: public:
InterConnEndpoint(tcp::TCP_Endpoint* e); explicit InterConnEndpoint(tcp::TCP_Endpoint* e);
int DataSent(double t, uint64 seq, int len, int caplen, const u_char* data, int DataSent(double t, uint64 seq, int len, int caplen, const u_char* data,
const IP_Hdr* ip, const struct tcphdr* tp); const IP_Hdr* ip, const struct tcphdr* tp);
@ -42,11 +42,11 @@ protected:
class InterConn_Analyzer : public tcp::TCP_ApplicationAnalyzer { class InterConn_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
InterConn_Analyzer(Connection* c); explicit InterConn_Analyzer(Connection* c);
~InterConn_Analyzer(); ~InterConn_Analyzer() override;
virtual void Init(); void Init() override;
virtual void Done(); void Done() override;
void StatTimer(double t, int is_expire); void StatTimer(double t, int is_expire);
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
@ -55,9 +55,9 @@ public:
protected: protected:
// We support both packet and stream input and can be put in place even // We support both packet and stream input and can be put in place even
// if the TCP analyzer is not yet reassembling. // if the TCP analyzer is not yet reassembling.
virtual void DeliverPacket(int len, const u_char* data, bool is_orig, void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
virtual void DeliverStream(int len, const u_char* data, bool is_orig); void DeliverStream(int len, const u_char* data, bool is_orig) override;
void StatEvent(); void StatEvent();
void RemoveEvent(); void RemoveEvent();
@ -75,9 +75,9 @@ protected:
class InterConnTimer : public Timer { class InterConnTimer : public Timer {
public: public:
InterConnTimer(double t, InterConn_Analyzer* a); InterConnTimer(double t, InterConn_Analyzer* a);
~InterConnTimer(); ~InterConnTimer() override;
void Dispatch(double t, int is_expire); void Dispatch(double t, int is_expire) override;
protected: protected:
InterConn_Analyzer* analyzer; InterConn_Analyzer* analyzer;

View file

@ -17,7 +17,7 @@ public:
/** /**
* \brief Constructor, builds a new analyzer object. * \brief Constructor, builds a new analyzer object.
*/ */
IRC_Analyzer(Connection* conn); explicit IRC_Analyzer(Connection* conn);
/** /**
* \brief Called when connection is closed. * \brief Called when connection is closed.

View file

@ -10,7 +10,7 @@ namespace analyzer { namespace krb {
class KRB_Analyzer : public analyzer::Analyzer { class KRB_Analyzer : public analyzer::Analyzer {
public: public:
KRB_Analyzer(Connection* conn); explicit KRB_Analyzer(Connection* conn);
virtual ~KRB_Analyzer(); virtual ~KRB_Analyzer();
virtual void Done(); virtual void Done();

View file

@ -12,15 +12,15 @@ namespace analyzer { namespace krb_tcp {
class KRB_Analyzer : public tcp::TCP_ApplicationAnalyzer { class KRB_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
KRB_Analyzer(Connection* conn); explicit KRB_Analyzer(Connection* conn);
virtual ~KRB_Analyzer(); ~KRB_Analyzer() override;
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
// Overriden from tcp::TCP_ApplicationAnalyzer. // Overriden from tcp::TCP_ApplicationAnalyzer.
virtual void EndpointEOF(bool is_orig); void EndpointEOF(bool is_orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new KRB_Analyzer(conn); } { return new KRB_Analyzer(conn); }

View file

@ -24,16 +24,16 @@ typedef enum {
class Login_Analyzer : public tcp::TCP_ApplicationAnalyzer { class Login_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
Login_Analyzer(const char* name, Connection* conn); Login_Analyzer(const char* name, Connection* conn);
~Login_Analyzer(); ~Login_Analyzer() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void SetEnv(bool orig, char* name, char* val); void SetEnv(bool orig, char* name, char* val) override;
login_state LoginState() const { return state; } login_state LoginState() const { return state; }
void SetLoginState(login_state s) { state = s; } void SetLoginState(login_state s) { state = s; }
virtual void EndpointEOF(bool is_orig); void EndpointEOF(bool is_orig) override;
protected: protected:
void NewLine(bool orig, char* line); void NewLine(bool orig, char* line);

View file

@ -61,19 +61,19 @@ protected:
class TelnetTerminalOption : public TelnetOption { class TelnetTerminalOption : public TelnetOption {
public: public:
TelnetTerminalOption(NVT_Analyzer* arg_endp) explicit TelnetTerminalOption(NVT_Analyzer* arg_endp)
: TelnetOption(arg_endp, TELNET_OPTION_TERMINAL) { } : TelnetOption(arg_endp, TELNET_OPTION_TERMINAL) { }
void RecvSubOption(u_char* data, int len); void RecvSubOption(u_char* data, int len) override;
}; };
class TelnetEncryptOption : public TelnetOption { class TelnetEncryptOption : public TelnetOption {
public: public:
TelnetEncryptOption(NVT_Analyzer* arg_endp) explicit TelnetEncryptOption(NVT_Analyzer* arg_endp)
: TelnetOption(arg_endp, TELNET_OPTION_ENCRYPT) : TelnetOption(arg_endp, TELNET_OPTION_ENCRYPT)
{ did_encrypt_request = doing_encryption = 0; } { did_encrypt_request = doing_encryption = 0; }
void RecvSubOption(u_char* data, int len); void RecvSubOption(u_char* data, int len) override;
int DidRequest() const { return did_encrypt_request; } int DidRequest() const { return did_encrypt_request; }
int DoingEncryption() const { return doing_encryption; } int DoingEncryption() const { return doing_encryption; }
@ -85,11 +85,11 @@ protected:
class TelnetAuthenticateOption : public TelnetOption { class TelnetAuthenticateOption : public TelnetOption {
public: public:
TelnetAuthenticateOption(NVT_Analyzer* arg_endp) explicit TelnetAuthenticateOption(NVT_Analyzer* arg_endp)
: TelnetOption(arg_endp, TELNET_OPTION_AUTHENTICATE) : TelnetOption(arg_endp, TELNET_OPTION_AUTHENTICATE)
{ authentication_requested = 0; } { authentication_requested = 0; }
void RecvSubOption(u_char* data, int len); void RecvSubOption(u_char* data, int len) override;
int DidRequestAuthentication() const int DidRequestAuthentication() const
{ return authentication_requested; } { return authentication_requested; }
@ -101,11 +101,11 @@ protected:
class TelnetEnvironmentOption : public TelnetOption { class TelnetEnvironmentOption : public TelnetOption {
public: public:
TelnetEnvironmentOption(NVT_Analyzer* arg_endp) explicit TelnetEnvironmentOption(NVT_Analyzer* arg_endp)
: TelnetOption(arg_endp, TELNET_OPTION_ENVIRON) : TelnetOption(arg_endp, TELNET_OPTION_ENVIRON)
{ } { }
void RecvSubOption(u_char* data, int len); void RecvSubOption(u_char* data, int len) override;
protected: protected:
char* ExtractEnv(u_char*& data, int& len, int& code); char* ExtractEnv(u_char*& data, int& len, int& code);
@ -113,20 +113,20 @@ protected:
class TelnetBinaryOption : public TelnetOption { class TelnetBinaryOption : public TelnetOption {
public: public:
TelnetBinaryOption(NVT_Analyzer* arg_endp) explicit TelnetBinaryOption(NVT_Analyzer* arg_endp)
: TelnetOption(arg_endp, TELNET_OPTION_BINARY) : TelnetOption(arg_endp, TELNET_OPTION_BINARY)
{ } { }
void SetActive(int is_active); void SetActive(int is_active) override;
protected: protected:
void InconsistentOption(unsigned int type); void InconsistentOption(unsigned int type) override;
}; };
class NVT_Analyzer : public tcp::ContentLine_Analyzer { class NVT_Analyzer : public tcp::ContentLine_Analyzer {
public: public:
NVT_Analyzer(Connection* conn, bool orig); NVT_Analyzer(Connection* conn, bool orig);
~NVT_Analyzer(); ~NVT_Analyzer() override;
TelnetOption* FindOption(unsigned int code); TelnetOption* FindOption(unsigned int code);
TelnetOption* FindPeerOption(unsigned int code); TelnetOption* FindPeerOption(unsigned int code);
@ -146,7 +146,7 @@ public:
{ return authentication_has_been_accepted; } { return authentication_has_been_accepted; }
protected: protected:
void DoDeliver(int len, const u_char* data); void DoDeliver(int len, const u_char* data) override;
void ScanOption(int seq, int len, const u_char* data); void ScanOption(int seq, int len, const u_char* data);
virtual void SawOption(unsigned int code); virtual void SawOption(unsigned int code);

View file

@ -26,12 +26,12 @@ class Rsh_Analyzer;
class Contents_Rsh_Analyzer : public tcp::ContentLine_Analyzer { class Contents_Rsh_Analyzer : public tcp::ContentLine_Analyzer {
public: public:
Contents_Rsh_Analyzer(Connection* conn, bool orig, Rsh_Analyzer* analyzer); Contents_Rsh_Analyzer(Connection* conn, bool orig, Rsh_Analyzer* analyzer);
~Contents_Rsh_Analyzer(); ~Contents_Rsh_Analyzer() override;
rsh_state RshSaveState() const { return save_state; } rsh_state RshSaveState() const { return save_state; }
protected: protected:
virtual void DoDeliver(int len, const u_char* data); void DoDeliver(int len, const u_char* data) override;
void BadProlog(); void BadProlog();
rsh_state state, save_state; rsh_state state, save_state;
@ -42,9 +42,9 @@ protected:
class Rsh_Analyzer : public Login_Analyzer { class Rsh_Analyzer : public Login_Analyzer {
public: public:
Rsh_Analyzer(Connection* conn); explicit Rsh_Analyzer(Connection* conn);
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
void ClientUserName(const char* s); void ClientUserName(const char* s);
void ServerUserName(const char* s); void ServerUserName(const char* s);

View file

@ -35,7 +35,7 @@ class Contents_Rlogin_Analyzer : public tcp::ContentLine_Analyzer {
public: public:
Contents_Rlogin_Analyzer(Connection* conn, bool orig, Contents_Rlogin_Analyzer(Connection* conn, bool orig,
Rlogin_Analyzer* analyzer); Rlogin_Analyzer* analyzer);
~Contents_Rlogin_Analyzer(); ~Contents_Rlogin_Analyzer() override;
void SetPeer(Contents_Rlogin_Analyzer* arg_peer) void SetPeer(Contents_Rlogin_Analyzer* arg_peer)
{ peer = arg_peer; } { peer = arg_peer; }
@ -44,7 +44,7 @@ public:
{ return state; } { return state; }
protected: protected:
void DoDeliver(int len, const u_char* data); void DoDeliver(int len, const u_char* data) override;
void BadProlog(); void BadProlog();
rlogin_state state, save_state; rlogin_state state, save_state;
@ -56,7 +56,7 @@ protected:
class Rlogin_Analyzer : public Login_Analyzer { class Rlogin_Analyzer : public Login_Analyzer {
public: public:
Rlogin_Analyzer(Connection* conn); explicit Rlogin_Analyzer(Connection* conn);
void ClientUserName(const char* s); void ClientUserName(const char* s);
void ServerUserName(const char* s); void ServerUserName(const char* s);

View file

@ -9,8 +9,8 @@ namespace analyzer { namespace login {
class Telnet_Analyzer : public Login_Analyzer { class Telnet_Analyzer : public Login_Analyzer {
public: public:
Telnet_Analyzer(Connection* conn); explicit Telnet_Analyzer(Connection* conn);
virtual ~Telnet_Analyzer() {} ~Telnet_Analyzer() override {}
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new Telnet_Analyzer(conn); } { return new Telnet_Analyzer(conn); }

View file

@ -65,7 +65,7 @@ protected:
class MIME_Header { class MIME_Header {
public: public:
MIME_Header(MIME_Multiline* hl); explicit MIME_Header(MIME_Multiline* hl);
~MIME_Header(); ~MIME_Header();
data_chunk_t get_name() const { return name; } data_chunk_t get_name() const { return name; }
@ -181,7 +181,7 @@ protected:
class MIME_Message { class MIME_Message {
public: public:
MIME_Message(analyzer::Analyzer* arg_analyzer) explicit MIME_Message(analyzer::Analyzer* arg_analyzer)
{ {
// Cannot initialize top_level entity because we do // Cannot initialize top_level entity because we do
// not know its type yet (MIME_Entity / MIME_Mail / // not know its type yet (MIME_Entity / MIME_Mail /
@ -231,7 +231,7 @@ protected:
class MIME_Mail : public MIME_Message { class MIME_Mail : public MIME_Message {
public: public:
MIME_Mail(analyzer::Analyzer* mail_conn, bool is_orig, int buf_size = 0); MIME_Mail(analyzer::Analyzer* mail_conn, bool is_orig, int buf_size = 0);
~MIME_Mail(); ~MIME_Mail() override;
void Done() override; void Done() override;
void BeginEntity(MIME_Entity* entity) override; void BeginEntity(MIME_Entity* entity) override;

View file

@ -8,14 +8,14 @@ namespace analyzer { namespace modbus {
class ModbusTCP_Analyzer : public tcp::TCP_ApplicationAnalyzer { class ModbusTCP_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
ModbusTCP_Analyzer(Connection* conn); explicit ModbusTCP_Analyzer(Connection* conn);
virtual ~ModbusTCP_Analyzer(); ~ModbusTCP_Analyzer() override;
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
virtual void EndpointEOF(bool is_orig); void EndpointEOF(bool is_orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new ModbusTCP_Analyzer(conn); } { return new ModbusTCP_Analyzer(conn); }

View file

@ -15,17 +15,17 @@ class MySQL_Analyzer
: public tcp::TCP_ApplicationAnalyzer { : public tcp::TCP_ApplicationAnalyzer {
public: public:
MySQL_Analyzer(Connection* conn); explicit MySQL_Analyzer(Connection* conn);
virtual ~MySQL_Analyzer(); ~MySQL_Analyzer() override;
// Overriden from Analyzer. // Overriden from Analyzer.
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
// Overriden from tcp::TCP_ApplicationAnalyzer. // Overriden from tcp::TCP_ApplicationAnalyzer.
virtual void EndpointEOF(bool is_orig); void EndpointEOF(bool is_orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new MySQL_Analyzer(conn); } { return new MySQL_Analyzer(conn); }

View file

@ -31,7 +31,7 @@ namespace analyzer { namespace ncp {
class NCP_Session { class NCP_Session {
public: public:
NCP_Session(analyzer::Analyzer* analyzer); explicit NCP_Session(analyzer::Analyzer* analyzer);
virtual ~NCP_Session() {} virtual ~NCP_Session() {}
virtual void Deliver(int is_orig, int len, const u_char* data); virtual void Deliver(int is_orig, int len, const u_char* data);
@ -51,7 +51,7 @@ protected:
class FrameBuffer { class FrameBuffer {
public: public:
FrameBuffer(int header_length); explicit FrameBuffer(int header_length);
virtual ~FrameBuffer(); virtual ~FrameBuffer();
// Returns true if a frame is ready // Returns true if a frame is ready
@ -80,17 +80,17 @@ public:
NCP_FrameBuffer() : FrameBuffer(NCP_TCPIP_HEADER_LENGTH) {} NCP_FrameBuffer() : FrameBuffer(NCP_TCPIP_HEADER_LENGTH) {}
protected: protected:
void compute_msg_length(); void compute_msg_length() override;
}; };
class Contents_NCP_Analyzer : public tcp::TCP_SupportAnalyzer { class Contents_NCP_Analyzer : public tcp::TCP_SupportAnalyzer {
public: public:
Contents_NCP_Analyzer(Connection* conn, bool orig, NCP_Session* session); Contents_NCP_Analyzer(Connection* conn, bool orig, NCP_Session* session);
~Contents_NCP_Analyzer(); ~Contents_NCP_Analyzer() override;
protected: protected:
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
virtual void Undelivered(uint64 seq, int len, bool orig); void Undelivered(uint64 seq, int len, bool orig) override;
NCP_FrameBuffer buffer; NCP_FrameBuffer buffer;
NCP_Session* session; NCP_Session* session;
@ -101,8 +101,8 @@ protected:
class NCP_Analyzer : public tcp::TCP_ApplicationAnalyzer { class NCP_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
NCP_Analyzer(Connection* conn); explicit NCP_Analyzer(Connection* conn);
virtual ~NCP_Analyzer(); ~NCP_Analyzer() override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new NCP_Analyzer(conn); } { return new NCP_Analyzer(conn); }

View file

@ -64,7 +64,7 @@ struct NetbiosDGM_RawMsgHdr {
class NetbiosSSN_Interpreter { class NetbiosSSN_Interpreter {
public: public:
NetbiosSSN_Interpreter(Analyzer* analyzer); explicit NetbiosSSN_Interpreter(Analyzer* analyzer);
int ParseMessage(unsigned int type, unsigned int flags, int ParseMessage(unsigned int type, unsigned int flags,
const u_char* data, int len, int is_query); const u_char* data, int len, int is_query);
@ -117,7 +117,7 @@ class Contents_NetbiosSSN : public tcp::TCP_SupportAnalyzer {
public: public:
Contents_NetbiosSSN(Connection* conn, bool orig, Contents_NetbiosSSN(Connection* conn, bool orig,
NetbiosSSN_Interpreter* interp); NetbiosSSN_Interpreter* interp);
~Contents_NetbiosSSN(); ~Contents_NetbiosSSN() override;
void Flush(); // process any partially-received data void Flush(); // process any partially-received data
@ -141,8 +141,8 @@ protected:
class NetbiosSSN_Analyzer : public tcp::TCP_ApplicationAnalyzer { class NetbiosSSN_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
NetbiosSSN_Analyzer(Connection* conn); explicit NetbiosSSN_Analyzer(Connection* conn);
~NetbiosSSN_Analyzer(); ~NetbiosSSN_Analyzer() override;
void Done() override; void Done() override;
void DeliverPacket(int len, const u_char* data, bool orig, void DeliverPacket(int len, const u_char* data, bool orig,

View file

@ -15,8 +15,8 @@ class NTLM_Analyzer
: public tcp::TCP_ApplicationAnalyzer { : public tcp::TCP_ApplicationAnalyzer {
public: public:
NTLM_Analyzer(Connection* conn); explicit NTLM_Analyzer(Connection* conn);
virtual ~NTLM_Analyzer(); ~NTLM_Analyzer() override;
// Overriden from Analyzer. // Overriden from Analyzer.
void Done() override; void Done() override;

View file

@ -38,15 +38,15 @@ struct ntpdata {
class NTP_Analyzer : public analyzer::Analyzer { class NTP_Analyzer : public analyzer::Analyzer {
public: public:
NTP_Analyzer(Connection* conn); explicit NTP_Analyzer(Connection* conn);
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new NTP_Analyzer(conn); } { return new NTP_Analyzer(conn); }
protected: protected:
virtual void Done(); void Done() override;
virtual void DeliverPacket(int len, const u_char* data, bool orig, void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
int Request(const u_char* data, int len); int Request(const u_char* data, int len);
int Reply(const u_char* data, int len); int Reply(const u_char* data, int len);

View file

@ -19,7 +19,7 @@ namespace analyzer { namespace pia {
// PIAs and then each needs its own matching-state. // PIAs and then each needs its own matching-state.
class PIA : public RuleMatcherState { class PIA : public RuleMatcherState {
public: public:
PIA(analyzer::Analyzer* as_analyzer); explicit PIA(analyzer::Analyzer* as_analyzer);
virtual ~PIA(); virtual ~PIA();
// Called when PIA wants to put an Analyzer in charge. rule is the // Called when PIA wants to put an Analyzer in charge. rule is the
@ -90,43 +90,43 @@ private:
// PIA for UDP. // PIA for UDP.
class PIA_UDP : public PIA, public analyzer::Analyzer { class PIA_UDP : public PIA, public analyzer::Analyzer {
public: public:
PIA_UDP(Connection* conn) explicit PIA_UDP(Connection* conn)
: PIA(this), Analyzer("PIA_UDP", conn) : PIA(this), Analyzer("PIA_UDP", conn)
{ SetConn(conn); } { SetConn(conn); }
virtual ~PIA_UDP() { } ~PIA_UDP() override { }
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new PIA_UDP(conn); } { return new PIA_UDP(conn); }
protected: protected:
virtual void Done() void Done() override
{ {
Analyzer::Done(); Analyzer::Done();
PIA_Done(); PIA_Done();
} }
virtual void DeliverPacket(int len, const u_char* data, bool is_orig, void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen) uint64 seq, const IP_Hdr* ip, int caplen) override
{ {
Analyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen); Analyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen);
PIA_DeliverPacket(len, data, is_orig, seq, ip, caplen, true); PIA_DeliverPacket(len, data, is_orig, seq, ip, caplen, true);
} }
virtual void ActivateAnalyzer(analyzer::Tag tag, const Rule* rule); void ActivateAnalyzer(analyzer::Tag tag, const Rule* rule) override;
virtual void DeactivateAnalyzer(analyzer::Tag tag); void DeactivateAnalyzer(analyzer::Tag tag) override;
}; };
// PIA for TCP. Accepts both packet and stream input (and reassembles // PIA for TCP. Accepts both packet and stream input (and reassembles
// packets before passing payload on to children). // packets before passing payload on to children).
class PIA_TCP : public PIA, public tcp::TCP_ApplicationAnalyzer { class PIA_TCP : public PIA, public tcp::TCP_ApplicationAnalyzer {
public: public:
PIA_TCP(Connection* conn) explicit PIA_TCP(Connection* conn)
: PIA(this), tcp::TCP_ApplicationAnalyzer("PIA_TCP", conn) : PIA(this), tcp::TCP_ApplicationAnalyzer("PIA_TCP", conn)
{ stream_mode = false; SetConn(conn); } { stream_mode = false; SetConn(conn); }
virtual ~PIA_TCP(); ~PIA_TCP() override;
virtual void Init(); void Init() override;
// The first packet for each direction of a connection is passed // The first packet for each direction of a connection is passed
// in here. // in here.
@ -144,25 +144,25 @@ public:
{ return new PIA_TCP(conn); } { return new PIA_TCP(conn); }
protected: protected:
virtual void Done() void Done() override
{ {
Analyzer::Done(); Analyzer::Done();
PIA_Done(); PIA_Done();
} }
virtual void DeliverPacket(int len, const u_char* data, bool is_orig, void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen) uint64 seq, const IP_Hdr* ip, int caplen) override
{ {
Analyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen); Analyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen);
PIA_DeliverPacket(len, data, is_orig, seq, ip, caplen, false); PIA_DeliverPacket(len, data, is_orig, seq, ip, caplen, false);
} }
virtual void DeliverStream(int len, const u_char* data, bool is_orig); void DeliverStream(int len, const u_char* data, bool is_orig) override;
virtual void Undelivered(uint64 seq, int len, bool is_orig); void Undelivered(uint64 seq, int len, bool is_orig) override;
virtual void ActivateAnalyzer(analyzer::Tag tag, void ActivateAnalyzer(analyzer::Tag tag,
const Rule* rule = 0); const Rule* rule = 0) override;
virtual void DeactivateAnalyzer(analyzer::Tag tag); void DeactivateAnalyzer(analyzer::Tag tag) override;
private: private:
// FIXME: Not sure yet whether we need both pkt_buffer and stream_buffer. // FIXME: Not sure yet whether we need both pkt_buffer and stream_buffer.

View file

@ -64,11 +64,11 @@ typedef enum {
class POP3_Analyzer : public tcp::TCP_ApplicationAnalyzer { class POP3_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public: public:
POP3_Analyzer(Connection* conn); explicit POP3_Analyzer(Connection* conn);
~POP3_Analyzer(); ~POP3_Analyzer() override;
virtual void Done(); void Done() override;
virtual void DeliverStream(int len, const u_char* data, bool orig); void DeliverStream(int len, const u_char* data, bool orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ {

View file

@ -14,13 +14,13 @@ namespace analyzer { namespace RADIUS {
class RADIUS_Analyzer : public analyzer::Analyzer { class RADIUS_Analyzer : public analyzer::Analyzer {
public: public:
RADIUS_Analyzer(Connection* conn); explicit RADIUS_Analyzer(Connection* conn);
virtual ~RADIUS_Analyzer(); ~RADIUS_Analyzer() override;
// Overriden from Analyzer. // Overriden from Analyzer.
virtual void Done(); void Done() override;
virtual void DeliverPacket(int len, const u_char* data, bool orig, void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen); uint64 seq, const IP_Hdr* ip, int caplen) override;
static analyzer::Analyzer* Instantiate(Connection* conn) static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new RADIUS_Analyzer(conn); } { return new RADIUS_Analyzer(conn); }

Some files were not shown because too many files have changed in this diff Show more