diff --git a/src/EventRegistry.h b/src/EventRegistry.h index 2619f3e044..31b859986b 100644 --- a/src/EventRegistry.h +++ b/src/EventRegistry.h @@ -7,9 +7,6 @@ #include #include -using std::string; -using std::vector; - class EventHandler; class EventHandlerPtr; class RE_Matcher; @@ -23,17 +20,17 @@ public: void Register(EventHandlerPtr handler); // Return nil if unknown. - EventHandler* Lookup(const string& name); + EventHandler* Lookup(const std::string& name); // Returns a list of all local handlers that match the given pattern. // Passes ownership of list. - typedef vector string_list; + using string_list = std::vector; string_list Match(RE_Matcher* pattern); // Marks a handler as handling errors. Error handler will not be called // recursively to avoid infinite loops in case they trigger an error // themselves. - void SetErrorHandler(const string& name); + void SetErrorHandler(const std::string& name); string_list UnusedHandlers(); string_list UsedHandlers(); diff --git a/src/Expr.h b/src/Expr.h index 1ed01a57a9..9774288a07 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -2,6 +2,12 @@ #pragma once +#include +#include +#include +#include +#include + #include "BroList.h" #include "IntrusivePtr.h" #include "Timer.h" @@ -11,14 +17,6 @@ #include "Val.h" #include "ZeekArgs.h" -#include -#include -#include -#include -#include - -using std::string; - enum BroExprTag : int { EXPR_ANY = -1, EXPR_NAME, EXPR_CONST, @@ -683,7 +681,7 @@ public: protected: void ExprDescribe(ODesc* d) const override; - string field_name; + std::string field_name; }; class ArithCoerceExpr : public UnaryExpr { @@ -843,7 +841,7 @@ public: protected: void ExprDescribe(ODesc* d) const override; - string name; + std::string name; EventHandlerPtr handler; IntrusivePtr args; }; diff --git a/src/Func.h b/src/Func.h index c414e3ac85..9e8d7353df 100644 --- a/src/Func.h +++ b/src/Func.h @@ -2,13 +2,6 @@ #pragma once -#include "BroList.h" -#include "Obj.h" -#include "IntrusivePtr.h" -#include "Type.h" /* for function_flavor */ -#include "TraverseTypes.h" -#include "ZeekArgs.h" - #include #include #include @@ -19,8 +12,12 @@ #include #include -using std::string; -using std::vector; +#include "BroList.h" +#include "Obj.h" +#include "IntrusivePtr.h" +#include "Type.h" /* for function_flavor */ +#include "TraverseTypes.h" +#include "ZeekArgs.h" class Val; class ListExpr; @@ -49,7 +46,7 @@ public: { return priority > other.priority; } // reverse sort }; - const vector& GetBodies() const { return bodies; } + const std::vector& GetBodies() const { return bodies; } bool HasBodies() const { return bodies.size(); } [[deprecated("Remove in v4.1. Use zeek::Args overload instead.")]] @@ -108,13 +105,13 @@ protected: // Helper function for handling result of plugin hook. std::pair HandlePluginResult(std::pair plugin_result, function_flavor flavor) const; - vector bodies; + std::vector bodies; IntrusivePtr scope; Kind kind; IntrusivePtr type; - string name; + std::string name; uint32_t unique_id; - static vector unique_ids; + static std::vector unique_ids; }; @@ -244,7 +241,7 @@ struct function_ingredients { IntrusivePtr scope; }; -extern vector call_stack; +extern std::vector call_stack; extern std::string render_call_stack(); diff --git a/src/IP.h b/src/IP.h index 287bcf8fad..13aad9149c 100644 --- a/src/IP.h +++ b/src/IP.h @@ -4,8 +4,6 @@ #include "zeek-config.h" -#include - #include // for u_char #include #include @@ -14,7 +12,7 @@ #include #endif -using std::vector; +#include class IPAddr; class RecordVal; @@ -263,7 +261,7 @@ protected: void ProcessDstOpts(const struct ip6_dest* d, uint16_t len); #endif - vector chain; + std::vector chain; /** * The summation of all header lengths in the chain in bytes. diff --git a/src/IPAddr.h b/src/IPAddr.h index ba423a5026..6fb5a124dc 100644 --- a/src/IPAddr.h +++ b/src/IPAddr.h @@ -2,14 +2,13 @@ #pragma once -#include "threading/SerialTypes.h" - #include #include #include #include -using std::string; +#include "threading/SerialTypes.h" + struct ConnID; class BroString; class HashKey; @@ -317,7 +316,7 @@ public: if ( GetFamily() == IPv4 ) return AsString(); - return string("[") + AsString() + "]"; + return std::string("[") + AsString() + "]"; } /** diff --git a/src/Net.h b/src/Net.h index e7b7f3bd7f..e95cebf0c6 100644 --- a/src/Net.h +++ b/src/Net.h @@ -2,15 +2,13 @@ #pragma once +#include // for ino_t + #include #include #include #include -#include // for ino_t - -using std::string; - namespace iosource { class IOSource; class PktSrc; @@ -93,12 +91,12 @@ struct ScannedFile { dev_t dev; ino_t inode; int include_level; - string name; + std::string name; bool skipped; // This ScannedFile was @unload'd. bool prefixes_checked; // If loading prefixes for this file has been tried. ScannedFile(dev_t arg_dev, ino_t arg_inode, int arg_include_level, - const string& arg_name, bool arg_skipped = false, + const std::string& arg_name, bool arg_skipped = false, bool arg_prefixes_checked = false) : dev(arg_dev), inode(arg_inode), include_level(arg_include_level), @@ -108,4 +106,4 @@ struct ScannedFile { }; extern std::list files_scanned; -extern std::vector sig_files; +extern std::vector sig_files; diff --git a/src/OpaqueVal.h b/src/OpaqueVal.h index 288e94a7db..6ad65a4df3 100644 --- a/src/OpaqueVal.h +++ b/src/OpaqueVal.h @@ -306,7 +306,7 @@ public: size_t Count(const Val* val) const; void Clear(); bool Empty() const; - string InternalState() const; + std::string InternalState() const; static IntrusivePtr Merge(const BloomFilterVal* x, const BloomFilterVal* y); diff --git a/src/PrefixTable.h b/src/PrefixTable.h index 21b956756a..bcbd326df9 100644 --- a/src/PrefixTable.h +++ b/src/PrefixTable.h @@ -1,15 +1,12 @@ #pragma once -#include "IPAddr.h" - extern "C" { #include "patricia.h" } #include -using std::list; -using std::tuple; +#include "IPAddr.h" class Val; class SubNetVal; @@ -42,8 +39,8 @@ public: void* Lookup(const Val* value, bool exact = false) const; // Returns list of all found matches or empty list otherwise. - list> FindAll(const IPAddr& addr, int width) const; - list> FindAll(const SubNetVal* value) const; + std::list> FindAll(const IPAddr& addr, int width) const; + std::list> FindAll(const SubNetVal* value) const; // Returns pointer to data or nil if not found. void* Remove(const IPAddr& addr, int width); diff --git a/src/RuleAction.h b/src/RuleAction.h index 8604fa89a8..4719fdea01 100644 --- a/src/RuleAction.h +++ b/src/RuleAction.h @@ -6,8 +6,6 @@ #include // for u_char -using std::string; - class Rule; class RuleEndpointState; @@ -50,7 +48,7 @@ public: void PrintDebug() override; - string GetMIME() const + std::string GetMIME() const { return mime; } int GetStrength() const diff --git a/src/RuleMatcher.h b/src/RuleMatcher.h index 0650081000..ef0f641e67 100644 --- a/src/RuleMatcher.h +++ b/src/RuleMatcher.h @@ -1,8 +1,7 @@ #pragma once -#include "Rule.h" -#include "RE.h" -#include "CCL.h" +#include // for u_char +#include #include #include @@ -10,8 +9,9 @@ #include #include -#include // for u_char -#include +#include "Rule.h" +#include "RE.h" +#include "CCL.h" //#define MATCHER_PRINT_STATS @@ -27,11 +27,6 @@ extern FILE* rules_in; extern int rules_line_number; extern const char* current_rule_file; -using std::vector; -using std::map; -using std::set; -using std::string; - class Val; class BroFile; class IntSet; @@ -67,7 +62,7 @@ typedef PList bstr_list; // Get values from Bro's script-level variables. extern void id_to_maskedvallist(const char* id, maskedvalue_list* append_to, - vector* prefix_vector = 0); + std::vector* prefix_vector = 0); extern char* id_to_str(const char* id); extern uint32_t id_to_uint(const char* id); @@ -79,7 +74,7 @@ public: RuleHdrTest(Prot arg_prot, uint32_t arg_offset, uint32_t arg_size, Comp arg_comp, maskedvalue_list* arg_vals); - RuleHdrTest(Prot arg_prot, Comp arg_comp, vector arg_v); + RuleHdrTest(Prot arg_prot, Comp arg_comp, std::vector arg_v); ~RuleHdrTest(); void PrintDebug(); @@ -96,7 +91,7 @@ private: Prot prot; Comp comp; maskedvalue_list* vals; - vector prefix_vals; // for use with IPSrc/IPDst comparisons + std::vector prefix_vals; // for use with IPSrc/IPDst comparisons uint32_t offset; uint32_t size; @@ -241,7 +236,7 @@ public: * Ordered from greatest to least strength. Matches of the same strength * will be in the set in lexicographic order of the MIME type string. */ - typedef map, std::greater > MIME_Matches; + using MIME_Matches = std::map, std::greater>; /** * Matches a chunk of data against file magic signatures. diff --git a/src/Trigger.h b/src/Trigger.h index 5d91b17aa0..ae65134634 100644 --- a/src/Trigger.h +++ b/src/Trigger.h @@ -20,8 +20,6 @@ namespace trigger { // Triggers are the heart of "when" statements: expressions that when // they become true execute a body of statements. -using std::map; - class TriggerTimer; class TriggerTraversalCallback; @@ -110,7 +108,7 @@ private: std::vector> objs; - using ValCache = map; + using ValCache = std::map; ValCache cache; }; diff --git a/src/TunnelEncapsulation.h b/src/TunnelEncapsulation.h index 4f18b6118b..6c8b70b784 100644 --- a/src/TunnelEncapsulation.h +++ b/src/TunnelEncapsulation.h @@ -10,7 +10,6 @@ #include -using std::vector; class Connection; /** @@ -135,7 +134,7 @@ public: EncapsulationStack(const EncapsulationStack& other) { if ( other.conns ) - conns = new vector(*(other.conns)); + conns = new std::vector(*(other.conns)); else conns = 0; } @@ -148,7 +147,7 @@ public: delete conns; if ( other.conns ) - conns = new vector(*(other.conns)); + conns = new std::vector(*(other.conns)); else conns = 0; @@ -165,7 +164,7 @@ public: void Add(const EncapsulatingConn& c) { if ( ! conns ) - conns = new vector(); + conns = new std::vector(); conns->push_back(c); } @@ -215,5 +214,5 @@ public: } protected: - vector* conns; + std::vector* conns; }; diff --git a/src/Val.h b/src/Val.h index 96b610892d..d56db19cb7 100644 --- a/src/Val.h +++ b/src/Val.h @@ -15,9 +15,6 @@ #include // for u_char -using std::vector; -using std::string; - // We have four different port name spaces: TCP, UDP, ICMP, and UNKNOWN. // We distinguish between them based on the bits specified in the *_PORT_MASK // entries specified below. @@ -85,7 +82,7 @@ union BroValUnion { PDict* table_val; val_list* val_list_val; - vector* vector_val; + std::vector* vector_val; BroValUnion() = default; @@ -122,7 +119,7 @@ union BroValUnion { constexpr BroValUnion(val_list* value) noexcept : val_list_val(value) {} - constexpr BroValUnion(vector *value) noexcept + constexpr BroValUnion(std::vector *value) noexcept : vector_val(value) {} }; @@ -214,7 +211,7 @@ public: CONST_ACCESSOR(TYPE_RECORD, val_list*, val_list_val, AsRecord) CONST_ACCESSOR(TYPE_FILE, BroFile*, file_val, AsFile) CONST_ACCESSOR(TYPE_PATTERN, RE_Matcher*, re_val, AsPattern) - CONST_ACCESSOR(TYPE_VECTOR, vector*, vector_val, AsVector) + CONST_ACCESSOR(TYPE_VECTOR, std::vector*, vector_val, AsVector) const IPPrefix& AsSubNet() const { @@ -248,7 +245,7 @@ public: ACCESSOR(TYPE_FUNC, Func*, func_val, AsFunc) ACCESSOR(TYPE_FILE, BroFile*, file_val, AsFile) ACCESSOR(TYPE_PATTERN, RE_Matcher*, re_val, AsPattern) - ACCESSOR(TYPE_VECTOR, vector*, vector_val, AsVector) + ACCESSOR(TYPE_VECTOR, std::vector*, vector_val, AsVector) const IPPrefix& AsSubNet() { @@ -475,7 +472,7 @@ public: // Returns the port number in host order (not including the mask). uint32_t Port() const; - string Protocol() const; + std::string Protocol() const; // Tests for protocol types. bool IsTCP() const; @@ -553,7 +550,7 @@ class StringVal : public Val { public: explicit StringVal(BroString* s); explicit StringVal(const char* s); - explicit StringVal(const string& s); + explicit StringVal(const std::string& s); StringVal(int length, const char* s); IntrusivePtr SizeVal() const override; diff --git a/src/analyzer/Analyzer.h b/src/analyzer/Analyzer.h index 4d25fccb27..918d207a8f 100644 --- a/src/analyzer/Analyzer.h +++ b/src/analyzer/Analyzer.h @@ -2,6 +2,13 @@ #pragma once +#include // for u_char + +#include +#include +#include +#include + #include "Tag.h" #include "../Obj.h" @@ -9,16 +16,6 @@ #include "../Timer.h" #include "../IntrusivePtr.h" -#include -#include -#include -#include - -#include // for u_char - -using std::list; -using std::string; - class BroFile; class Rule; class Connection; @@ -34,7 +31,7 @@ class AnalyzerTimer; class SupportAnalyzer; class OutputHandler; -typedef list analyzer_list; +using analyzer_list = std::list; typedef uint32_t ID; typedef void (Analyzer::*analyzer_timer_func)(double t); @@ -624,8 +621,8 @@ protected: * Return a string represantation of an analyzer, containing its name * and ID. */ - static string fmt_analyzer(const Analyzer* a) - { return string(a->GetAnalyzerName()) + fmt("[%d]", a->GetID()); } + static std::string fmt_analyzer(const Analyzer* a) + { return std::string(a->GetAnalyzerName()) + fmt("[%d]", a->GetID()); } /** * Associates a connection with this analyzer. Must be called if diff --git a/src/analyzer/protocol/mime/MIME.h b/src/analyzer/protocol/mime/MIME.h index f7026bf758..3dda334b2e 100644 --- a/src/analyzer/protocol/mime/MIME.h +++ b/src/analyzer/protocol/mime/MIME.h @@ -5,7 +5,6 @@ #include #include #include -using namespace std; #include "BroString.h" #include "Reporter.h" @@ -61,7 +60,7 @@ public: BroString* get_concatenated_line(); protected: - vector buffer; + std::vector buffer; BroString* line; }; @@ -86,7 +85,7 @@ protected: }; -typedef vector MIME_HeaderList; +using MIME_HeaderList = std::vector; class MIME_Entity { public: @@ -255,13 +254,13 @@ protected: int compute_content_hash; int content_hash_length; EVP_MD_CTX* md5_hash; - vector entity_content; - vector all_content; + std::vector entity_content; + std::vector all_content; BroString* data_buffer; uint64_t cur_entity_len; - string cur_entity_id; + std::string cur_entity_id; }; diff --git a/src/analyzer/protocol/smtp/SMTP.h b/src/analyzer/protocol/smtp/SMTP.h index 929bdda45c..133402b0ec 100644 --- a/src/analyzer/protocol/smtp/SMTP.h +++ b/src/analyzer/protocol/smtp/SMTP.h @@ -3,7 +3,6 @@ #pragma once #include -using namespace std; #include "analyzer/protocol/tcp/TCP.h" #include "analyzer/protocol/tcp/ContentLine.h" diff --git a/src/file_analysis/AnalyzerSet.h b/src/file_analysis/AnalyzerSet.h index a1960a2e1a..7e4aaf8379 100644 --- a/src/file_analysis/AnalyzerSet.h +++ b/src/file_analysis/AnalyzerSet.h @@ -7,8 +7,6 @@ #include "Dict.h" #include "Tag.h" -using std::queue; - class CompositeHash; class RecordVal; @@ -204,7 +202,7 @@ private: HashKey* key; }; - typedef queue ModQueue; + using ModQueue = std::queue; ModQueue mod_queue; /**< A queue of analyzer additions/removals requests. */ }; diff --git a/src/file_analysis/File.h b/src/file_analysis/File.h index 3b0f06e6f4..3516bf6ca1 100644 --- a/src/file_analysis/File.h +++ b/src/file_analysis/File.h @@ -13,8 +13,6 @@ #include "ZeekArgs.h" #include "WeirdState.h" -using std::string; - class Connection; class RecordType; class RecordVal; @@ -46,13 +44,13 @@ public: * @return the value of the "source" field from #val record or an empty * string if it's not initialized. */ - string GetSource() const; + std::string GetSource() const; /** * Set the "source" field from #val record to \a source. * @param source the new value of the "source" field. */ - void SetSource(const string& source); + void SetSource(const std::string& source); /** * @return value (seconds) of the "timeout_interval" field from #val record. @@ -76,7 +74,7 @@ public: /** * @return value of the "id" field from #val record. */ - string GetID() const { return id; } + std::string GetID() const { return id; } /** * @return value of "last_active" field in #val record; @@ -212,7 +210,7 @@ public: * @return true if the mime type was set. False if it could not be set because * a mime type was already set or inferred. */ - bool SetMime(const string& mime_type); + bool SetMime(const std::string& mime_type); /** * Whether to permit a weird to carry on through the full reporter/weird @@ -236,7 +234,7 @@ protected: * of the connection to the responder. False indicates the other * direction. */ - File(const string& file_id, const string& source_name, Connection* conn = 0, + File(const std::string& file_id, const std::string& source_name, Connection* conn = 0, analyzer::Tag tag = analyzer::Tag::Error, bool is_orig = false); /** @@ -313,7 +311,7 @@ protected: */ void DeliverStream(const u_char* data, uint64_t len); - /** + /** * Perform chunk-wise delivery for analyzers that need it. */ void DeliverChunk(const u_char* data, uint64_t len, uint64_t offset); @@ -324,7 +322,7 @@ protected: * @param type the record type for which the field will be looked up. * @return the field offset in #val record corresponding to \a field_name. */ - static int Idx(const string& field_name, const RecordType* type); + static int Idx(const std::string& field_name, const RecordType* type); /** * Initializes static member. @@ -332,7 +330,7 @@ protected: static void StaticInit(); protected: - string id; /**< A pretty hash that likely identifies file */ + std::string id; /**< A pretty hash that likely identifies file */ RecordVal* val; /**< \c fa_file from script layer. */ FileReassembler* file_reassembler; /**< A reassembler for the file if it's needed. */ uint64_t stream_offset; /**< The offset of the file which has been forwarded. */ diff --git a/src/file_analysis/FileTimer.h b/src/file_analysis/FileTimer.h index 605fc2b8a8..1d09173f90 100644 --- a/src/file_analysis/FileTimer.h +++ b/src/file_analysis/FileTimer.h @@ -2,11 +2,8 @@ #pragma once -#include "Timer.h" - #include - -using std::string; +#include "Timer.h" namespace file_analysis { @@ -22,7 +19,7 @@ public: * @param id the file identifier which will be checked for inactivity. * @param interval amount of time after \a t to check for inactivity. */ - FileTimer(double t, const string& id, double interval); + FileTimer(double t, const std::string& id, double interval); /** * Check inactivity of file_analysis::File corresponding to #file_id, @@ -33,7 +30,7 @@ public: void Dispatch(double t, bool is_expire) override; private: - string file_id; + std::string file_id; }; } // namespace file_analysis diff --git a/src/file_analysis/Manager.h b/src/file_analysis/Manager.h index 02da6aa182..234b3d81f8 100644 --- a/src/file_analysis/Manager.h +++ b/src/file_analysis/Manager.h @@ -14,9 +14,6 @@ #include "analyzer/Tag.h" -using std::map; -using std::set; - class TableVal; class VectorVal; @@ -75,7 +72,7 @@ public: * a single file. * @return a prettified MD5 hash of \a handle, truncated to *bits_per_uid* bits. */ - string HashHandle(const string& handle) const; + std::string HashHandle(const std::string& handle) const; /** * Take in a unique file handle string to identify next piece of @@ -83,7 +80,7 @@ public: * @param handle a unique string (may contain NULs) which identifies * a single file. */ - void SetHandle(const string& handle); + void SetHandle(const std::string& handle); /** * Pass in non-sequential file data. @@ -150,8 +147,8 @@ public: * in human-readable form where the file input is coming from (e.g. * a local file path). */ - void DataIn(const u_char* data, uint64_t len, const string& file_id, - const string& source); + void DataIn(const u_char* data, uint64_t len, const std::string& file_id, + const std::string& source); /** * Signal the end of file data regardless of which direction it is being @@ -173,7 +170,7 @@ public: * Signal the end of file data being transferred using the file identifier. * @param file_id the file identifier/hash. */ - void EndOfFile(const string& file_id); + void EndOfFile(const std::string& file_id); /** * Signal a gap in the file data stream. @@ -219,7 +216,7 @@ public: * @param file_id the file identifier/hash. * @return false if file identifier did not map to anything, else true. */ - bool IgnoreFile(const string& file_id); + bool IgnoreFile(const std::string& file_id); /** * Set's an inactivity threshold for the file. @@ -229,22 +226,22 @@ public: * to be considered stale, timed out, and then resource reclaimed. * @return false if file identifier did not map to anything, else true. */ - bool SetTimeoutInterval(const string& file_id, double interval) const; + bool SetTimeoutInterval(const std::string& file_id, double interval) const; /** * Enable the reassembler for a file. */ - bool EnableReassembly(const string& file_id); - + bool EnableReassembly(const std::string& file_id); + /** * Disable the reassembler for a file. */ - bool DisableReassembly(const string& file_id); + bool DisableReassembly(const std::string& file_id); /** * Set the reassembly for a file in bytes. */ - bool SetReassemblyBuffer(const string& file_id, uint64_t max); + bool SetReassemblyBuffer(const std::string& file_id, uint64_t max); /** * Sets a limit on the maximum size allowed for extracting the file @@ -256,7 +253,7 @@ public: * @return false if file identifier and analyzer did not map to anything, * else true. */ - bool SetExtractionLimit(const string& file_id, RecordVal* args, + bool SetExtractionLimit(const std::string& file_id, RecordVal* args, uint64_t n) const; /** @@ -265,7 +262,7 @@ public: * @return the File object mapped to \a file_id, or a null pointer if no * mapping exists. */ - File* LookupFile(const string& file_id) const; + File* LookupFile(const std::string& file_id) const; /** * Queue attachment of an analzer to the file identifier. Multiple @@ -276,7 +273,7 @@ public: * @param args a \c AnalyzerArgs value which describes a file analyzer. * @return false if the analyzer failed to be instantiated, else true. */ - bool AddAnalyzer(const string& file_id, const file_analysis::Tag& tag, + bool AddAnalyzer(const std::string& file_id, const file_analysis::Tag& tag, RecordVal* args) const; /** @@ -286,7 +283,7 @@ public: * @param args a \c AnalyzerArgs value which describes a file analyzer. * @return true if the analyzer is active at the time of call, else false. */ - bool RemoveAnalyzer(const string& file_id, const file_analysis::Tag& tag, + bool RemoveAnalyzer(const std::string& file_id, const file_analysis::Tag& tag, RecordVal* args) const; /** @@ -294,7 +291,7 @@ public: * @param file_id the file identifier/hash. * @return whether the file mapped to \a file_id is being ignored. */ - bool IsIgnored(const string& file_id); + bool IsIgnored(const std::string& file_id); /** * Instantiates a new file analyzer instance for the file. @@ -358,7 +355,7 @@ protected: * exist, the activity time is refreshed along with any * connection-related fields. */ - File* GetFile(const string& file_id, Connection* conn = 0, + File* GetFile(const std::string& file_id, Connection* conn = 0, const analyzer::Tag& tag = analyzer::Tag::Error, bool is_orig = false, bool update_conn = true, const char* source_name = 0); @@ -370,14 +367,14 @@ protected: * @param is_termination whether the Manager (and probably Bro) is in a * terminating state. If true, then the timeout cannot be postponed. */ - void Timeout(const string& file_id, bool is_terminating = ::terminating); + void Timeout(const std::string& file_id, bool is_terminating = ::terminating); /** * Immediately remove file_analysis::File object associated with \a file_id. * @param file_id the file identifier/hash. * @return false if file id string did not map to anything, else true. */ - bool RemoveFile(const string& file_id); + bool RemoveFile(const std::string& file_id); /** * Sets #current_file_id to a hash of a unique file handle string based on @@ -403,20 +400,20 @@ protected: static bool IsDisabled(const analyzer::Tag& tag); private: - typedef set TagSet; - typedef map MIMEMap; + typedef std::set TagSet; + typedef std::map MIMEMap; - TagSet* LookupMIMEType(const string& mtype, bool add_if_not_found); + TagSet* LookupMIMEType(const std::string& mtype, bool add_if_not_found); - std::map id_map; /**< Map file ID to file_analysis::File records. */ - std::set ignored; /**< Ignored files. Will be finally removed on EOF. */ - string current_file_id; /**< Hash of what get_file_handle event sets. */ + std::map id_map; /**< Map file ID to file_analysis::File records. */ + std::set ignored; /**< Ignored files. Will be finally removed on EOF. */ + std::string current_file_id; /**< Hash of what get_file_handle event sets. */ RuleFileMagicState* magic_state; /**< File magic signature match state. */ MIMEMap mime_types;/**< Mapping of MIME types to analyzers. */ static TableVal* disabled; /**< Table of disabled analyzers. */ static TableType* tag_set_type; /**< Type for set[tag]. */ - static string salt; /**< A salt added to file handles before hashing. */ + static std::string salt; /**< A salt added to file handles before hashing. */ size_t cumulative_files; size_t max_files; diff --git a/src/threading/BasicThread.h b/src/threading/BasicThread.h index fba5acaeeb..fa1e097536 100644 --- a/src/threading/BasicThread.h +++ b/src/threading/BasicThread.h @@ -1,12 +1,10 @@ #pragma once -#include -#include - #include -using namespace std; +#include +#include namespace threading { diff --git a/src/threading/Formatter.h b/src/threading/Formatter.h index 64a8502bc5..83a3667145 100644 --- a/src/threading/Formatter.h +++ b/src/threading/Formatter.h @@ -2,12 +2,10 @@ #pragma once -#include "Type.h" -#include "SerialTypes.h" - #include -using std::string; +#include "Type.h" +#include "SerialTypes.h" namespace threading { @@ -17,7 +15,7 @@ namespace formatter { /** * A thread-safe class for converting values into some textual format. This - * is a base class that implements the interface for common + * is a base class that implements the interface for common * rendering/parsing code needed by a number of input/output threads. */ class Formatter { @@ -69,7 +67,7 @@ public: * @return Returns true on success, false on error. Errors are also * flagged via the thread. */ - virtual bool Describe(ODesc* desc, threading::Value* val, const string& name = "") const = 0; + virtual bool Describe(ODesc* desc, threading::Value* val, const std::string& name = "") const = 0; /** * Convert an implementation-specific textual representation of a @@ -83,7 +81,7 @@ public: * @return The new value, or null on error. Errors must also be * flagged via the thread. */ - virtual threading::Value* ParseValue(const string& s, const string& name, TypeTag type, TypeTag subtype = TYPE_ERROR) const = 0; + virtual threading::Value* ParseValue(const std::string& s, const std::string& name, TypeTag type, TypeTag subtype = TYPE_ERROR) const = 0; /** * Convert an IP address into a string. @@ -94,7 +92,7 @@ public: * * @return An ASCII representation of the address. */ - static string Render(const threading::Value::addr_t& addr); + static std::string Render(const threading::Value::addr_t& addr); /** * Convert an subnet value into a string. @@ -105,7 +103,7 @@ public: * * @return An ASCII representation of the subnet. */ - static string Render(const threading::Value::subnet_t& subnet); + static std::string Render(const threading::Value::subnet_t& subnet); /** * Convert a double into a string. This renders the double with Bro's @@ -117,7 +115,7 @@ public: * * @return An ASCII representation of the double. */ - static string Render(double d); + static std::string Render(double d); /** * Convert a transport protocol into a string. @@ -128,7 +126,7 @@ public: * * @return An ASCII representation of the protocol. */ - static string Render(TransportProto proto); + static std::string Render(TransportProto proto); /** * Convert a string into a TransportProto. The string must be one of @@ -141,7 +139,7 @@ public: * @return The transport protocol, which will be \c TRANSPORT_UNKNOWN * on error. Errors are also flagged via the thread. */ - TransportProto ParseProto(const string &proto) const; + TransportProto ParseProto(const std::string &proto) const; /** * Convert a string into a Value::addr_t. @@ -153,7 +151,7 @@ public: * @return The address, which will be all-zero on error. Errors are * also flagged via the thread. */ - threading::Value::addr_t ParseAddr(const string &addr) const; + threading::Value::addr_t ParseAddr(const std::string &addr) const; protected: /**