Remove other using statements from headers

This commit is contained in:
Tim Wojtulewicz 2020-04-07 13:14:17 -07:00
parent eb010290eb
commit a525f9532e
22 changed files with 123 additions and 171 deletions

View file

@ -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<Modification*> ModQueue;
using ModQueue = std::queue<Modification*>;
ModQueue mod_queue; /**< A queue of analyzer additions/removals requests. */
};

View file

@ -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. */

View file

@ -2,11 +2,8 @@
#pragma once
#include "Timer.h"
#include <string>
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

View file

@ -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<Tag> TagSet;
typedef map<string, TagSet*> MIMEMap;
typedef std::set<Tag> TagSet;
typedef std::map<std::string, TagSet*> MIMEMap;
TagSet* LookupMIMEType(const string& mtype, bool add_if_not_found);
TagSet* LookupMIMEType(const std::string& mtype, bool add_if_not_found);
std::map<string, File*> id_map; /**< Map file ID to file_analysis::File records. */
std::set<string> ignored; /**< Ignored files. Will be finally removed on EOF. */
string current_file_id; /**< Hash of what get_file_handle event sets. */
std::map<std::string, File*> id_map; /**< Map file ID to file_analysis::File records. */
std::set<std::string> 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;