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

View file

@ -40,8 +40,8 @@ typedef enum {
class Attr : public BroObj {
public:
Attr(attr_tag t, Expr* e = 0);
~Attr();
explicit Attr(attr_tag t, Expr* e = 0);
~Attr() override;
attr_tag Tag() const { return tag; }
Expr* AttrExpr() const { return expr; }
@ -56,7 +56,7 @@ public:
int RedundantAttrOkay() const
{ return tag == ATTR_REDEF || tag == ATTR_OPTIONAL; }
void Describe(ODesc* d) const;
void Describe(ODesc* d) const override;
void DescribeReST(ODesc* d) const;
bool operator==(const Attr& other) const
@ -84,7 +84,7 @@ protected:
class Attributes : public BroObj {
public:
Attributes(attr_list* a, BroType* t, bool in_record);
~Attributes();
~Attributes() override;
void AddAttr(Attr* a);
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
// Weird. Usage errors go to Reporter in any case. Empty alphabet
// indicates the default base64 alphabet.
Base64Converter(Connection* conn, const string& alphabet = "");
explicit Base64Converter(Connection* conn, const string& alphabet = "");
~Base64Converter();
// A note on Decode():

View file

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

View file

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

View file

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

View file

@ -57,7 +57,7 @@ class Connection : public BroObj {
public:
Connection(NetSessions* s, HashKey* k, double t, const ConnID* id,
uint32 flow, const Packet* pkt, const EncapsulationStack* arg_encap);
virtual ~Connection();
~Connection() override;
// Invoked when an encapsulation is discovered. It records the
// encapsulation with the connection and raises a "tunnel_changed"
@ -252,7 +252,7 @@ public:
// Sets the transport protocol in use.
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; }
@ -336,7 +336,7 @@ public:
double arg_t, int arg_do_expire, TimerType arg_type)
: Timer(arg_t, arg_type)
{ Init(arg_conn, arg_timer, arg_do_expire); }
virtual ~ConnectionTimer();
~ConnectionTimer() override;
void Dispatch(double t, int is_expire) override;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -21,7 +21,7 @@ class FragReassembler : public Reassembler {
public:
FragReassembler(NetSessions* s, const IP_Hdr* ip, const u_char* pkt,
HashKey* k, double t);
~FragReassembler();
~FragReassembler() override;
void AddFragment(double t, const IP_Hdr* ip, const u_char* pkt);
@ -33,8 +33,8 @@ public:
HashKey* Key() const { return key; }
protected:
void BlockInserted(DataBlock* start_block);
void Overlap(const u_char* b1, const u_char* b2, uint64 n);
void BlockInserted(DataBlock* start_block) override;
void Overlap(const u_char* b1, const u_char* b2, uint64 n) override;
void Weird(const char* name) const;
u_char* proto_hdr;
@ -53,9 +53,9 @@ public:
FragTimer(FragReassembler* arg_f, double arg_t)
: Timer(arg_t, TIMER_FRAG)
{ 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.
void ClearReassembler() { f = 0; }

View file

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

View file

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

View file

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

View file

@ -19,7 +19,7 @@ typedef enum { SCOPE_FUNCTION, SCOPE_MODULE, SCOPE_GLOBAL } IDScope;
class ID : public BroObj {
public:
ID(const char* name, IDScope arg_scope, bool arg_is_export);
~ID();
~ID() override;
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
* address or a hex IPv6 address.
*/
IPAddr(const BroString& s)
explicit IPAddr(const BroString& s)
{
Init(s.CheckString());
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,7 @@ class PriorityQueue;
class PQ_Element {
public:
PQ_Element(double t) { time = t; offset = -1; }
explicit PQ_Element(double t) { time = t; offset = -1; }
virtual ~PQ_Element() { }
double Time() const { return time; }
@ -28,7 +28,7 @@ protected:
class PriorityQueue {
public:
PriorityQueue(int initial_size = 16);
explicit PriorityQueue(int initial_size = 16);
~PriorityQueue();
// 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; }
protected:
BaseQueue(int = 0);
explicit BaseQueue(int = 0);
void push_front(ent); // add in front of queue
void push_back(ent); // add at end of queue
@ -73,7 +73,7 @@ protected:
struct Queue(type) : BaseQueue \
{ \
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_back(type a) { BaseQueue::push_back(ent(a)); } \
@ -88,7 +88,7 @@ struct Queue(type) : BaseQueue \
struct PQueue(type) : BaseQueue \
{ \
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_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 {
public:
Specific_RE_Matcher(match_type mt, int multiline=0);
explicit Specific_RE_Matcher(match_type mt, int multiline=0);
~Specific_RE_Matcher();
void AddPat(const char* pat);
@ -133,7 +133,7 @@ protected:
class RE_Match_State {
public:
RE_Match_State(Specific_RE_Matcher* matcher)
explicit RE_Match_State(Specific_RE_Matcher* matcher)
{
dfa = matcher->DFA() ? matcher->DFA() : 0;
ecs = matcher->EC()->EquivClasses();
@ -172,8 +172,8 @@ protected:
class RE_Matcher : SerialObj {
public:
RE_Matcher();
RE_Matcher(const char* pat);
virtual ~RE_Matcher();
explicit RE_Matcher(const char* pat);
~RE_Matcher() override;
void AddPat(const char* pat);

View file

@ -43,7 +43,7 @@ public:
class Reassembler : public BroObj {
public:
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);
@ -60,7 +60,7 @@ public:
uint64 TotalSize() const; // number of bytes buffered up
void Describe(ODesc* d) const;
void Describe(ODesc* d) const override;
bool Serialize(SerialInfo* info) const;
static Reassembler* Unserialize(UnserialInfo* info);

View file

@ -25,7 +25,7 @@ namespace threading {
class RemoteSerializer : public Serializer, public iosource::IOSource {
public:
RemoteSerializer();
virtual ~RemoteSerializer();
~RemoteSerializer() override;
// Initialize the remote serializer (calling this will fork).
void Enable();
@ -140,12 +140,12 @@ public:
void Finish();
// Overidden from IOSource:
virtual void GetFds(iosource::FD_Set* read, iosource::FD_Set* write,
iosource::FD_Set* except);
virtual double NextTimestamp(double* local_network_time);
virtual void Process();
virtual TimerMgr::Tag* GetCurrentTag();
virtual const char* Tag() { return "RemoteSerializer"; }
void GetFds(iosource::FD_Set* read, iosource::FD_Set* write,
iosource::FD_Set* except) override;
double NextTimestamp(double* local_network_time) override;
void Process() override;
TimerMgr::Tag* GetCurrentTag() override;
const char* Tag() override { return "RemoteSerializer"; }
// Gracefully finishes communication by first making sure that all
// 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);
virtual void ReportError(const char* msg);
void ReportError(const char* msg) override;
virtual void GotEvent(const char* name, double time,
EventHandlerPtr event, val_list* args);
virtual void GotFunctionCall(const char* name, double time,
Func* func, val_list* args);
virtual void GotID(ID* id, Val* val);
virtual void GotStateAccess(StateAccess* s);
virtual void GotTimer(Timer* t);
virtual void GotConnection(Connection* c);
virtual void GotPacket(Packet* packet);
void GotEvent(const char* name, double time,
EventHandlerPtr event, val_list* args) override;
void GotFunctionCall(const char* name, double time,
Func* func, val_list* args) override;
void GotID(ID* id, Val* val) override;
void GotStateAccess(StateAccess* s) override;
void GotTimer(Timer* t) override;
void GotConnection(Connection* c) override;
void GotPacket(Packet* packet) override;
void Fork();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -56,7 +56,7 @@ public:
: 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:
TimerMgr* mgr;
@ -260,9 +260,9 @@ public:
: Timer(t + BifConst::Tunnel::ip_tunnel_timeout,
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:
NetSessions::IPPair tunnel_idx;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -21,7 +21,7 @@ public:
// right away.
Trigger(Expr* cond, Stmt* body, Stmt* timeout_stmts, Expr* timeout,
Frame* f, bool is_return, const Location* loc);
~Trigger();
~Trigger() override;
// Evaluates the condition. If true, executes the body and deletes
// the object deleted.
@ -57,16 +57,16 @@ public:
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
// later to avoid race conditions.
virtual void Access(ID* id, const StateAccess& sa)
void Access(ID* id, const StateAccess& sa) override
{ QueueTrigger(this); }
virtual void Access(Val* val, const StateAccess& sa)
void Access(Val* val, const StateAccess& sa) override
{ QueueTrigger(this); }
virtual const char* Name() const;
const char* Name() const override;
static void QueueTrigger(Trigger* trigger);

View file

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

View file

@ -28,7 +28,7 @@ public:
* Construct a UID of a given bit-length, optionally from given values.
* @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); }
/**

View file

@ -914,6 +914,11 @@ AddrVal::AddrVal(const char* text) : Val(TYPE_ADDR)
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)
{
// ### perhaps do gethostbyaddr here?

View file

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

View file

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

View file

@ -61,7 +61,7 @@ public:
/**
* Destructor.
*/
~Component();
~Component() override;
/**
* 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
* 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.
*
* @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 {
public:
ARP_Analyzer();
virtual ~ARP_Analyzer();
~ARP_Analyzer() override;
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,
const char* spa, const char* sha,
const char* tpa, const char* tha);

View file

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

View file

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

View file

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

View file

@ -44,13 +44,13 @@ enum btt_benc_states {
class BitTorrentTracker_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public:
BitTorrentTracker_Analyzer(Connection* conn);
virtual ~BitTorrentTracker_Analyzer();
explicit BitTorrentTracker_Analyzer(Connection* conn);
~BitTorrentTracker_Analyzer() override;
virtual void Done();
virtual void DeliverStream(int len, const u_char* data, bool orig);
virtual void Undelivered(uint64 seq, int len, bool orig);
virtual void EndpointEOF(bool is_orig);
void Done() override;
void DeliverStream(int len, const u_char* data, bool orig) override;
void Undelivered(uint64 seq, int len, bool orig) override;
void EndpointEOF(bool is_orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new BitTorrentTracker_Analyzer(conn); }
@ -59,7 +59,7 @@ protected:
void ClientRequest(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);
@ -67,19 +67,19 @@ protected:
void RequestGet(char* uri);
void RequestHeader(char* name, char* value)
{ ParseHeader(name, value, true); }
void EmitRequest(void);
void EmitRequest();
bool ParseResponse(char* line);
void ResponseStatus(char* status);
void ResponseHeader(char* name, char* value)
{ ParseHeader(name, value, false); }
void ResponseBody(void);
void ResponseBody();
void ResponseBenc(int name_len, char* name, enum btt_benc_types type,
int value_len, char* value);
void ResponseBenc(int name_len, char* name, enum btt_benc_types type,
bro_int_t value);
int ResponseParseBenc(void);
void EmitResponse(void);
int ResponseParseBenc();
void EmitResponse();
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 {
public:
ConnSize_Analyzer(Connection* c);
virtual ~ConnSize_Analyzer();
explicit ConnSize_Analyzer(Connection* c);
~ConnSize_Analyzer() override;
virtual void Init();
virtual void Done();
void Init() override;
void Done() override;
// from Analyzer.h
virtual void UpdateConnVal(RecordVal *conn_val);
virtual void FlipRoles();
void UpdateConnVal(RecordVal *conn_val) override;
void FlipRoles() override;
void SetThreshold(uint64_t threshold, bool bytes, bool orig);
uint64 GetThreshold(bool bytes, bool orig);
@ -28,8 +28,8 @@ public:
{ return new ConnSize_Analyzer(conn); }
protected:
virtual void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen);
void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen) override;
void CheckSizes(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 {
public:
DCE_RPC_Analyzer(Connection* conn);
~DCE_RPC_Analyzer();
explicit DCE_RPC_Analyzer(Connection* conn);
~DCE_RPC_Analyzer() override;
void Done() 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 {
public:
DHCP_Analyzer(Connection* conn);
virtual ~DHCP_Analyzer();
explicit DHCP_Analyzer(Connection* conn);
~DHCP_Analyzer() override;
virtual void Done();
virtual void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen);
void Done() override;
void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen) override;
static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new DHCP_Analyzer(conn); }

View file

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

View file

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

View file

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

View file

@ -13,11 +13,11 @@ class File_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public:
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)
// { return new File_Analyzer(conn); }
@ -34,7 +34,7 @@ protected:
class IRC_Data : public File_Analyzer {
public:
IRC_Data(Connection* conn)
explicit IRC_Data(Connection* conn)
: File_Analyzer("IRC_Data", conn)
{ }
@ -44,7 +44,7 @@ public:
class FTP_Data : public File_Analyzer {
public:
FTP_Data(Connection* conn)
explicit FTP_Data(Connection* conn)
: File_Analyzer("FTP_Data", conn)
{ }

View file

@ -10,12 +10,12 @@ namespace analyzer { namespace finger {
class Finger_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public:
Finger_Analyzer(Connection* conn);
virtual ~Finger_Analyzer() {}
explicit Finger_Analyzer(Connection* conn);
~Finger_Analyzer() override {}
virtual void Done();
void Done() override;
// 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)
{ return new Finger_Analyzer(conn); }

View file

@ -10,10 +10,10 @@ namespace analyzer { namespace ftp {
class FTP_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public:
FTP_Analyzer(Connection* conn);
explicit FTP_Analyzer(Connection* conn);
virtual void Done();
virtual void DeliverStream(int len, const u_char* data, bool orig);
void Done() override;
void DeliverStream(int len, const u_char* data, bool orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn)
{
@ -40,7 +40,7 @@ public:
: SupportAnalyzer("FTP_ADAT", conn, arg_orig),
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:
// 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 {
public:
Gnutella_Analyzer(Connection* conn);
~Gnutella_Analyzer();
explicit Gnutella_Analyzer(Connection* conn);
~Gnutella_Analyzer() override;
virtual void Done ();
virtual void DeliverStream(int len, const u_char* data, bool orig);
void Done () override;
void DeliverStream(int len, const u_char* data, bool orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new Gnutella_Analyzer(conn); }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,16 +24,16 @@ typedef enum {
class Login_Analyzer : public tcp::TCP_ApplicationAnalyzer {
public:
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; }
void SetLoginState(login_state s) { state = s; }
virtual void EndpointEOF(bool is_orig);
void EndpointEOF(bool is_orig) override;
protected:
void NewLine(bool orig, char* line);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -38,15 +38,15 @@ struct ntpdata {
class NTP_Analyzer : public analyzer::Analyzer {
public:
NTP_Analyzer(Connection* conn);
explicit NTP_Analyzer(Connection* conn);
static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new NTP_Analyzer(conn); }
protected:
virtual void Done();
virtual void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen);
void Done() override;
void DeliverPacket(int len, const u_char* data, bool orig,
uint64 seq, const IP_Hdr* ip, int caplen) override;
int Request(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.
class PIA : public RuleMatcherState {
public:
PIA(analyzer::Analyzer* as_analyzer);
explicit PIA(analyzer::Analyzer* as_analyzer);
virtual ~PIA();
// Called when PIA wants to put an Analyzer in charge. rule is the
@ -90,43 +90,43 @@ private:
// PIA for UDP.
class PIA_UDP : public PIA, public analyzer::Analyzer {
public:
PIA_UDP(Connection* conn)
explicit PIA_UDP(Connection* conn)
: PIA(this), Analyzer("PIA_UDP", conn)
{ SetConn(conn); }
virtual ~PIA_UDP() { }
~PIA_UDP() override { }
static analyzer::Analyzer* Instantiate(Connection* conn)
{ return new PIA_UDP(conn); }
protected:
virtual void Done()
void Done() override
{
Analyzer::Done();
PIA_Done();
}
virtual void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen)
void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen) override
{
Analyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen);
PIA_DeliverPacket(len, data, is_orig, seq, ip, caplen, true);
}
virtual void ActivateAnalyzer(analyzer::Tag tag, const Rule* rule);
virtual void DeactivateAnalyzer(analyzer::Tag tag);
void ActivateAnalyzer(analyzer::Tag tag, const Rule* rule) override;
void DeactivateAnalyzer(analyzer::Tag tag) override;
};
// PIA for TCP. Accepts both packet and stream input (and reassembles
// packets before passing payload on to children).
class PIA_TCP : public PIA, public tcp::TCP_ApplicationAnalyzer {
public:
PIA_TCP(Connection* conn)
explicit PIA_TCP(Connection* conn)
: PIA(this), tcp::TCP_ApplicationAnalyzer("PIA_TCP", 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
// in here.
@ -144,25 +144,25 @@ public:
{ return new PIA_TCP(conn); }
protected:
virtual void Done()
void Done() override
{
Analyzer::Done();
PIA_Done();
}
virtual void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen)
void DeliverPacket(int len, const u_char* data, bool is_orig,
uint64 seq, const IP_Hdr* ip, int caplen) override
{
Analyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen);
PIA_DeliverPacket(len, data, is_orig, seq, ip, caplen, false);
}
virtual void DeliverStream(int len, const u_char* data, bool is_orig);
virtual void Undelivered(uint64 seq, int len, bool is_orig);
void DeliverStream(int len, const u_char* data, bool is_orig) override;
void Undelivered(uint64 seq, int len, bool is_orig) override;
virtual void ActivateAnalyzer(analyzer::Tag tag,
const Rule* rule = 0);
virtual void DeactivateAnalyzer(analyzer::Tag tag);
void ActivateAnalyzer(analyzer::Tag tag,
const Rule* rule = 0) override;
void DeactivateAnalyzer(analyzer::Tag tag) override;
private:
// 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 {
public:
POP3_Analyzer(Connection* conn);
~POP3_Analyzer();
explicit POP3_Analyzer(Connection* conn);
~POP3_Analyzer() override;
virtual void Done();
virtual void DeliverStream(int len, const u_char* data, bool orig);
void Done() override;
void DeliverStream(int len, const u_char* data, bool orig) override;
static analyzer::Analyzer* Instantiate(Connection* conn)
{

View file

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

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