The Great Embooleanating

A large number of functions had return values and/or arguments changed
to use ``bool`` types instead of ``int``.
This commit is contained in:
Tim Wojtulewicz 2020-03-11 10:41:46 -07:00 committed by Robin Sommer
parent 3c470ffe13
commit fd5e15b116
145 changed files with 1288 additions and 1331 deletions

View file

@ -12,7 +12,7 @@
// - TCP_Analyzer is the analyzer for the TCP protocol itself.
// - TCP_ApplicationAnalyzer is an abstract base class for analyzers for a
// protocol running on top of TCP.
//
//
namespace analyzer { namespace pia { class PIA_TCP; } };
namespace analyzer { namespace tcp {
@ -37,10 +37,10 @@ public:
bool RemoveChildAnalyzer(ID id) override;
// True if the connection has closed in some sense, false otherwise.
int IsClosed() const { return orig->did_close || resp->did_close; }
int BothClosed() const { return orig->did_close && resp->did_close; }
bool IsClosed() const { return orig->did_close || resp->did_close; }
bool BothClosed() const { return orig->did_close && resp->did_close; }
int IsPartial() const { return is_partial; }
bool IsPartial() const { return is_partial; }
bool HadGap(bool orig) const;
@ -58,7 +58,7 @@ public:
// which we have seen a FIN) - for it, data is pending unless
// everything's been delivered up to the FIN. For its peer,
// the test is whether it has any outstanding, un-acked data.
int DataPending(TCP_Endpoint* closing_endp);
bool DataPending(TCP_Endpoint* closing_endp);
void SetContentsFile(unsigned int direction, BroFile* f) override;
BroFile* GetContentsFile(unsigned int direction) const override;
@ -107,39 +107,39 @@ protected:
void UpdateStateMachine(double t,
TCP_Endpoint* endpoint, TCP_Endpoint* peer,
uint32_t base_seq, uint32_t ack_seq,
int len, int32_t delta_last, int is_orig, TCP_Flags flags,
int& do_close, int& gen_event);
int len, int32_t delta_last, bool is_orig, TCP_Flags flags,
bool& do_close, bool& gen_event);
void UpdateInactiveState(double t,
TCP_Endpoint* endpoint, TCP_Endpoint* peer,
uint32_t base_seq, uint32_t ack_seq,
int len, int is_orig, TCP_Flags flags,
int& do_close, int& gen_event);
int len, bool is_orig, TCP_Flags flags,
bool& do_close, bool& gen_event);
void UpdateSYN_SentState(TCP_Endpoint* endpoint, TCP_Endpoint* peer,
int len, int is_orig, TCP_Flags flags,
int& do_close, int& gen_event);
int len, bool is_orig, TCP_Flags flags,
bool& do_close, bool& gen_event);
void UpdateEstablishedState(TCP_Endpoint* endpoint, TCP_Endpoint* peer,
TCP_Flags flags, int& do_close, int& gen_event);
TCP_Flags flags, bool& do_close, bool& gen_event);
void UpdateClosedState(double t, TCP_Endpoint* endpoint,
int32_t delta_last, TCP_Flags flags,
int& do_close);
bool& do_close);
void UpdateResetState(int len, TCP_Flags flags);
void GeneratePacketEvent(uint64_t rel_seq, uint64_t rel_ack,
const u_char* data, int len, int caplen,
int is_orig, TCP_Flags flags);
bool is_orig, TCP_Flags flags);
int DeliverData(double t, const u_char* data, int len, int caplen,
bool DeliverData(double t, const u_char* data, int len, int caplen,
const IP_Hdr* ip, const struct tcphdr* tp,
TCP_Endpoint* endpoint, uint64_t rel_data_seq,
int is_orig, TCP_Flags flags);
bool is_orig, TCP_Flags flags);
void CheckRecording(int need_contents, TCP_Flags flags);
void CheckPIA_FirstPacket(int is_orig, const IP_Hdr* ip);
void CheckRecording(bool need_contents, TCP_Flags flags);
void CheckPIA_FirstPacket(bool is_orig, const IP_Hdr* ip);
friend class ConnectionTimer;
void AttemptTimer(double t);
@ -151,8 +151,8 @@ protected:
void EndpointEOF(TCP_Reassembler* endp);
void ConnectionClosed(TCP_Endpoint* endpoint,
TCP_Endpoint* peer, int gen_event);
void ConnectionFinished(int half_finished);
TCP_Endpoint* peer, bool gen_event);
void ConnectionFinished(bool half_finished);
void ConnectionReset();
void PacketWithRST();
@ -220,8 +220,8 @@ public:
// is now fully closed, a connection_finished event will be
// generated; otherwise not.
virtual void ConnectionClosed(analyzer::tcp::TCP_Endpoint* endpoint,
analyzer::tcp::TCP_Endpoint* peer, int gen_event);
virtual void ConnectionFinished(int half_finished);
analyzer::tcp::TCP_Endpoint* peer, bool gen_event);
virtual void ConnectionFinished(bool half_finished);
virtual void ConnectionReset();
// Called whenever a RST packet is seen - sometimes the invocation
@ -255,8 +255,8 @@ public:
// These are passed on from TCP_Analyzer.
virtual void EndpointEOF(bool is_orig) { }
virtual void ConnectionClosed(TCP_Endpoint* endpoint,
TCP_Endpoint* peer, int gen_event) { }
virtual void ConnectionFinished(int half_finished) { }
TCP_Endpoint* peer, bool gen_event) { }
virtual void ConnectionFinished(bool half_finished) { }
virtual void ConnectionReset() { }
virtual void PacketWithRST() { }
};
@ -266,7 +266,7 @@ class TCPStats_Endpoint {
public:
explicit TCPStats_Endpoint(TCP_Endpoint* endp);
int DataSent(double t, uint64_t seq, int len, int caplen, const u_char* data,
bool DataSent(double t, uint64_t seq, int len, int caplen, const u_char* data,
const IP_Hdr* ip, const struct tcphdr* tp);
RecordVal* BuildStats();
@ -303,4 +303,4 @@ protected:
TCPStats_Endpoint* resp_stats;
};
} } // namespace analyzer::*
} } // namespace analyzer::*