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

@ -38,8 +38,8 @@ public:
}
void EndOfData() override;
void Deliver(int len, const char* data, int trailing_CRLF) override;
int Undelivered(int64_t len);
void Deliver(int len, const char* data, bool trailing_CRLF) override;
bool Undelivered(int64_t len);
int64_t BodyLength() const { return body_length; }
int64_t HeaderLength() const { return header_length; }
void SkipBody() { deliver_body = 0; }
@ -57,9 +57,9 @@ protected:
int expect_body;
int64_t body_length;
int64_t header_length;
int deliver_body;
enum { IDENTITY, GZIP, COMPRESS, DEFLATE } encoding;
zip::ZIP_Analyzer* zip;
bool deliver_body;
bool is_partial_content;
uint64_t offset;
int64_t instance_length; // total length indicated by content-range
@ -68,8 +68,8 @@ protected:
MIME_Entity* NewChildEntity() override { return new HTTP_Entity(http_message, this, 1); }
void DeliverBody(int len, const char* data, int trailing_CRLF);
void DeliverBodyClear(int len, const char* data, int trailing_CRLF);
void DeliverBody(int len, const char* data, bool trailing_CRLF);
void DeliverBodyClear(int len, const char* data, bool trailing_CRLF);
void SubmitData(int len, const char* buf) override;
@ -103,17 +103,17 @@ public:
HTTP_Message(HTTP_Analyzer* analyzer, tcp::ContentLine_Analyzer* cl,
bool is_orig, int expect_body, int64_t init_header_length);
~HTTP_Message() override;
void Done(const int interrupted, const char* msg);
void Done() override { Done(0, "message ends normally"); }
void Done(bool interrupted, const char* msg);
void Done() override { Done(false, "message ends normally"); }
int Undelivered(int64_t len);
bool Undelivered(int64_t len);
void BeginEntity(mime::MIME_Entity* /* entity */) override;
void EndEntity(mime::MIME_Entity* entity) override;
void SubmitHeader(mime::MIME_Header* h) override;
void SubmitAllHeaders(mime::MIME_HeaderList& /* hlist */) override;
void SubmitData(int len, const char* buf) override;
int RequestBuffer(int* plen, char** pbuf) override;
bool RequestBuffer(int* plen, char** pbuf) override;
void SubmitAllData();
void SubmitEvent(int event_type, const char* detail) override;
@ -145,7 +145,7 @@ protected:
HTTP_Entity* current_entity;
Val* BuildMessageStat(const int interrupted, const char* msg);
Val* BuildMessageStat(bool interrupted, const char* msg);
};
class HTTP_Analyzer : public tcp::TCP_ApplicationAnalyzer {
@ -153,15 +153,15 @@ public:
HTTP_Analyzer(Connection* conn);
~HTTP_Analyzer() override;
void HTTP_Header(int is_orig, mime::MIME_Header* h);
void HTTP_EntityData(int is_orig, BroString* entity_data);
void HTTP_MessageDone(int is_orig, HTTP_Message* message);
void HTTP_Header(bool is_orig, mime::MIME_Header* h);
void HTTP_EntityData(bool is_orig, BroString* entity_data);
void HTTP_MessageDone(bool is_orig, HTTP_Message* message);
void HTTP_Event(const char* category, const char* detail);
void HTTP_Event(const char* category, StringVal *detail);
void SkipEntityData(int is_orig);
void SkipEntityData(bool is_orig);
int IsConnectionClose() { return connection_close; }
bool IsConnectionClose() { return connection_close; }
int HTTP_ReplyCode() const { return reply_code; };
// Overriden from Analyzer.
@ -171,7 +171,7 @@ public:
// Overriden from tcp::TCP_ApplicationAnalyzer
void EndpointEOF(bool is_orig) override;
void ConnectionFinished(int half_finished) override;
void ConnectionFinished(bool half_finished) override;
void ConnectionReset() override;
void PacketWithRST() override;
@ -219,18 +219,18 @@ protected:
const char* PrefixWordMatch(const char* line, const char* end_of_line,
const char* prefix);
int ParseRequest(const char* line, const char* end_of_line);
bool ParseRequest(const char* line, const char* end_of_line);
HTTP_VersionNumber HTTP_Version(int len, const char* data);
void SetVersion(HTTP_VersionNumber* version, HTTP_VersionNumber new_version);
int RequestExpected() const { return num_requests == 0 || keep_alive; }
bool RequestExpected() const { return num_requests == 0 || keep_alive; }
void HTTP_Request();
void HTTP_Reply();
void RequestMade(const int interrupted, const char* msg);
void ReplyMade(const int interrupted, const char* msg);
void RequestMade(bool interrupted, const char* msg);
void ReplyMade(bool interrupted, const char* msg);
void RequestClash(Val* clash_val);
const BroString* UnansweredRequestMethod();
@ -279,10 +279,10 @@ protected:
HTTP_Message* reply_message;
};
extern int is_reserved_URI_char(unsigned char ch);
extern int is_unreserved_URI_char(unsigned char ch);
extern bool is_reserved_URI_char(unsigned char ch);
extern bool is_unreserved_URI_char(unsigned char ch);
extern void escape_URI_char(unsigned char ch, unsigned char*& p);
extern BroString* unescape_URI(const u_char* line, const u_char* line_end,
analyzer::Analyzer* analyzer);
} } // namespace analyzer::*
} } // namespace analyzer::*