Remove 'using namespace std' from SerialTypes.h

This unfortunately cuases a ton of flow-down changes because a lot of other
code was depending on that definition existing. This has a fairly large chance
to break builds of external plugins, considering how many internal ones it broke.
This commit is contained in:
Tim Wojtulewicz 2020-04-07 15:45:20 -07:00
parent a525f9532e
commit d53c1454c0
119 changed files with 402 additions and 383 deletions

View file

@ -56,7 +56,7 @@ int bi_ffs(uint32_t value)
ipaddr32_t AnonymizeIPAddr::Anonymize(ipaddr32_t addr)
{
map<ipaddr32_t, ipaddr32_t>::iterator p = mapping.find(addr);
std::map<ipaddr32_t, ipaddr32_t>::iterator p = mapping.find(addr);
if ( p != mapping.end() )
return p->second;
else

View file

@ -106,7 +106,7 @@ void Attr::DescribeReST(ODesc* d, bool shorten) const
ODesc dd;
dd.SetQuotes(true);
expr->Describe(&dd);
string s = dd.Description();
std::string s = dd.Description();
add_long_expr_string(d, s, shorten);
}
@ -114,7 +114,7 @@ void Attr::DescribeReST(ODesc* d, bool shorten) const
{
ODesc dd;
expr->Eval(nullptr)->Describe(&dd);
string s = dd.Description();
std::string s = dd.Description();
for ( size_t i = 0; i < s.size(); ++i )
if ( s[i] == '\n' )

View file

@ -7,7 +7,7 @@
#include <math.h>
int Base64Converter::default_base64_table[256];
const string Base64Converter::default_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const std::string Base64Converter::default_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
void Base64Converter::Encode(int len, const unsigned char* data, int* pblen, char** pbuf)
{
@ -46,7 +46,7 @@ void Base64Converter::Encode(int len, const unsigned char* data, int* pblen, cha
}
int* Base64Converter::InitBase64Table(const string& alphabet)
int* Base64Converter::InitBase64Table(const std::string& alphabet)
{
assert(alphabet.size() == 64);
@ -86,7 +86,7 @@ int* Base64Converter::InitBase64Table(const string& alphabet)
return base64_table;
}
Base64Converter::Base64Converter(Connection* arg_conn, const string& arg_alphabet)
Base64Converter::Base64Converter(Connection* arg_conn, const std::string& arg_alphabet)
{
if ( arg_alphabet.size() > 0 )
{

View file

@ -44,7 +44,7 @@ BroString::BroString(const char* str) : BroString()
Set(str);
}
BroString::BroString(const string &str) : BroString()
BroString::BroString(const std::string &str) : BroString()
{
Set(str);
}
@ -137,7 +137,7 @@ void BroString::Set(const char* str)
use_free_to_delete = false;
}
void BroString::Set(const string& str)
void BroString::Set(const std::string& str)
{
Reset();
@ -234,7 +234,7 @@ char* BroString::Render(int format, int* len) const
return s;
}
ostream& BroString::Render(ostream &os, int format) const
std::ostream& BroString::Render(std::ostream &os, int format) const
{
char* tmp = Render(format);
os << tmp;
@ -242,7 +242,7 @@ ostream& BroString::Render(ostream &os, int format) const
return os;
}
istream& BroString::Read(istream &is, int format)
std::istream& BroString::Read(std::istream &is, int format)
{
if ( (format & BroString::ESC_SER) )
{
@ -260,7 +260,7 @@ istream& BroString::Read(istream &is, int format)
}
else
{
string str;
std::string str;
is >> str;
Set(str);
}
@ -376,7 +376,7 @@ BroString::Vec* BroString::VecFromPolicy(VectorVal* vec)
char* BroString::VecToString(const Vec* vec)
{
string result("[");
std::string result("[");
for ( BroString::VecCIt it = vec->begin(); it != vec->end(); ++it )
{
@ -396,7 +396,7 @@ bool BroStringLenCmp::operator()(BroString * const& bst1,
(bst1->Len() > bst2->Len());
}
ostream& operator<<(ostream& os, const BroString& bs)
std::ostream& operator<<(std::ostream& os, const BroString& bs)
{
char* tmp = bs.Render(BroString::EXPANDED_STRING);
os << tmp;
@ -414,7 +414,7 @@ int Bstr_eq(const BroString* s1, const BroString* s2)
int Bstr_cmp(const BroString* s1, const BroString* s2)
{
int n = min(s1->Len(), s2->Len());
int n = std::min(s1->Len(), s2->Len());
int cmp = memcmp(s1->Bytes(), s2->Bytes(), n);
if ( cmp || s1->Len() == s2->Len() )

View file

@ -13,6 +13,8 @@
#include "Reporter.h"
#include "util.h"
using namespace std;
Brofiler::Brofiler()
: ignoring(0), delim('\t')
{

View file

@ -906,7 +906,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
RecordType* rt = t->AsRecordType();
int num_fields = rt->NumFields();
vector<Val*> values;
std::vector<Val*> values;
int i;
for ( i = 0; i < num_fields; ++i )
{

View file

@ -369,7 +369,7 @@ protected:
static uint64_t total_connections;
static uint64_t current_connections;
string history;
std::string history;
uint32_t hist_seen;
analyzer::TransportLayerAnalyzer* root_analyzer;

View file

@ -50,6 +50,7 @@ extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
#include "nb_dns.h"
}
using namespace std;
class DNS_Mgr_Request {
public:

View file

@ -60,8 +60,8 @@ public:
bool Save();
const char* LookupAddrInCache(const IPAddr& addr);
IntrusivePtr<TableVal> LookupNameInCache(const string& name);
const char* LookupTextInCache(const string& name);
IntrusivePtr<TableVal> LookupNameInCache(const std::string& name);
const char* LookupTextInCache(const std::string& name);
// Support for async lookups.
class LookupCallback {
@ -75,8 +75,8 @@ public:
};
void AsyncLookupAddr(const IPAddr& host, LookupCallback* callback);
void AsyncLookupName(const string& name, LookupCallback* callback);
void AsyncLookupNameText(const string& name, LookupCallback* callback);
void AsyncLookupName(const std::string& name, LookupCallback* callback);
void AsyncLookupNameText(const std::string& name, LookupCallback* callback);
struct Stats {
unsigned long requests; // These count only async requests.
@ -108,9 +108,9 @@ protected:
IntrusivePtr<ListVal> AddrListDelta(ListVal* al1, ListVal* al2);
void DumpAddrList(FILE* f, ListVal* al);
typedef map<string, pair<DNS_Mapping*, DNS_Mapping*> > HostMap;
typedef map<IPAddr, DNS_Mapping*> AddrMap;
typedef map<string, DNS_Mapping*> TextMap;
typedef std::map<std::string, std::pair<DNS_Mapping*, DNS_Mapping*> > HostMap;
typedef std::map<IPAddr, DNS_Mapping*> AddrMap;
typedef std::map<std::string, DNS_Mapping*> TextMap;
void LoadCache(FILE* f);
void Save(FILE* f, const AddrMap& m);
void Save(FILE* f, const HostMap& m);
@ -159,14 +159,14 @@ protected:
RecordType* dm_rec;
typedef list<LookupCallback*> CallbackList;
typedef std::list<LookupCallback*> CallbackList;
struct AsyncRequest {
double time;
bool is_txt;
bool processed;
IPAddr host;
string name;
std::string name;
CallbackList callbacks;
AsyncRequest() : time(0.0), is_txt(false), processed(false) { }
@ -211,16 +211,16 @@ protected:
};
typedef map<IPAddr, AsyncRequest*> AsyncRequestAddrMap;
typedef std::map<IPAddr, AsyncRequest*> AsyncRequestAddrMap;
AsyncRequestAddrMap asyncs_addrs;
typedef map<string, AsyncRequest*> AsyncRequestNameMap;
typedef std::map<std::string, AsyncRequest*> AsyncRequestNameMap;
AsyncRequestNameMap asyncs_names;
typedef map<string, AsyncRequest*> AsyncRequestTextMap;
typedef std::map<std::string, AsyncRequest*> AsyncRequestTextMap;
AsyncRequestTextMap asyncs_texts;
typedef list<AsyncRequest*> QueuedList;
typedef std::list<AsyncRequest*> QueuedList;
QueuedList asyncs_queued;
struct AsyncRequestCompare {
@ -230,7 +230,7 @@ protected:
}
};
typedef priority_queue<AsyncRequest*, std::vector<AsyncRequest*>, AsyncRequestCompare> TimeoutQueue;
typedef std::priority_queue<AsyncRequest*, std::vector<AsyncRequest*>, AsyncRequestCompare> TimeoutQueue;
TimeoutQueue asyncs_timeouts;
int asyncs_pending;

View file

@ -90,7 +90,7 @@ void DbgBreakpoint::AddToGlobalMap()
void DbgBreakpoint::RemoveFromGlobalMap()
{
pair<BPMapType::iterator, BPMapType::iterator> p;
std::pair<BPMapType::iterator, BPMapType::iterator> p;
p = g_debugger_state.breakpoint_map.equal_range(at_stmt);
for ( BPMapType::iterator i = p.first; i != p.second; )
@ -120,7 +120,7 @@ void DbgBreakpoint::RemoveFromStmt()
}
bool DbgBreakpoint::SetLocation(ParseLocationRec plr, string_view loc_str)
bool DbgBreakpoint::SetLocation(ParseLocationRec plr, std::string_view loc_str)
{
if ( plr.type == plrUnknown )
{
@ -224,7 +224,7 @@ bool DbgBreakpoint::Reset()
return false;
}
bool DbgBreakpoint::SetCondition(const string& new_condition)
bool DbgBreakpoint::SetCondition(const std::string& new_condition)
{
condition = new_condition;
return true;

View file

@ -25,6 +25,8 @@
#include "Val.h"
#include "util.h"
using namespace std;
//
// Helper routines
//

View file

@ -165,7 +165,7 @@ void DebugLogger::Log(DebugStream stream, const char* fmt, ...)
void DebugLogger::Log(const plugin::Plugin& plugin, const char* fmt, ...)
{
string tok = string("plugin-") + plugin.Name();
std::string tok = std::string("plugin-") + plugin.Name();
tok = strreplace(tok, "::", "-");
if ( enabled_streams.find(tok) == enabled_streams.end() )

View file

@ -251,7 +251,7 @@ size_t ODesc::StartsWithEscapeSequence(const char* start, const char* end)
for ( it = escape_sequences.begin(); it != escape_sequences.end(); ++it )
{
const string& esc_str = *it;
const std::string& esc_str = *it;
size_t esc_len = esc_str.length();
if ( start + esc_len > end )
@ -264,9 +264,9 @@ size_t ODesc::StartsWithEscapeSequence(const char* start, const char* end)
return 0;
}
pair<const char*, size_t> ODesc::FirstEscapeLoc(const char* bytes, size_t n)
std::pair<const char*, size_t> ODesc::FirstEscapeLoc(const char* bytes, size_t n)
{
typedef pair<const char*, size_t> escape_pos;
typedef std::pair<const char*, size_t> escape_pos;
if ( IsBinary() )
return escape_pos(0, 0);
@ -327,7 +327,7 @@ void ODesc::AddBytes(const void* bytes, unsigned int n)
while ( s < e )
{
pair<const char*, size_t> p = FirstEscapeLoc(s, e - s);
std::pair<const char*, size_t> p = FirstEscapeLoc(s, e - s);
if ( p.first )
{

View file

@ -161,7 +161,7 @@ Val* Discarder::BuildData(const u_char* data, int hdrlen, int len, int caplen)
caplen -= hdrlen;
data += hdrlen;
len = max(min(min(len, caplen), discarder_maxlen), 0);
len = std::max(std::min(std::min(len, caplen), discarder_maxlen), 0);
return new StringVal(new BroString(data, len, true));
}

View file

@ -83,7 +83,7 @@ void EventHandler::Call(const zeek::Args& vl, bool no_remote)
auto opt_data = bro_broker::val_to_data(vl[i].get());
if ( opt_data )
xs.emplace_back(move(*opt_data));
xs.emplace_back(std::move(*opt_data));
else
{
valid_args = false;

View file

@ -8,10 +8,10 @@ EventRegistry::~EventRegistry() noexcept = default;
void EventRegistry::Register(EventHandlerPtr handler)
{
handlers[string(handler->Name())] = std::unique_ptr<EventHandler>(handler.Ptr());
handlers[std::string(handler->Name())] = std::unique_ptr<EventHandler>(handler.Ptr());
}
EventHandler* EventRegistry::Lookup(const string& name)
EventHandler* EventRegistry::Lookup(const std::string& name)
{
auto it = handlers.find(name);
if ( it != handlers.end() )
@ -86,7 +86,7 @@ void EventRegistry::PrintDebug()
}
}
void EventRegistry::SetErrorHandler(const string& name)
void EventRegistry::SetErrorHandler(const std::string& name)
{
EventHandler* eh = Lookup(name);

View file

@ -709,7 +709,7 @@ IntrusivePtr<Val> BinaryExpr::StringFold(Val* v1, Val* v2) const
case EXPR_ADD:
case EXPR_ADD_TO:
{
vector<const BroString*> strings;
std::vector<const BroString*> strings;
strings.push_back(s1);
strings.push_back(s2);
@ -3602,7 +3602,7 @@ RecordCoerceExpr::RecordCoerceExpr(IntrusivePtr<Expr> arg_op,
if ( ! is_arithmetic_promotable(sup_t_i, sub_t_i) &&
! is_record_promotable(sup_t_i, sub_t_i) )
{
string error_msg = fmt(
std::string error_msg = fmt(
"type clash for field \"%s\"", sub_r->FieldName(i));
Error(error_msg.c_str(), sub_t_i);
SetError();
@ -3622,7 +3622,7 @@ RecordCoerceExpr::RecordCoerceExpr(IntrusivePtr<Expr> arg_op,
{
if ( ! t_r->FieldDecl(i)->FindAttr(ATTR_OPTIONAL) )
{
string error_msg = fmt(
std::string error_msg = fmt(
"non-optional field \"%s\" missing", t_r->FieldName(i));
Error(error_msg.c_str());
SetError();
@ -4832,7 +4832,7 @@ RecordAssignExpr::RecordAssignExpr(const IntrusivePtr<Expr>& record,
}
else
{
string s = "No such field '";
std::string s = "No such field '";
s += field_name;
s += "'";
init_list->SetError(s.c_str());

View file

@ -12,7 +12,7 @@
#include "Val.h"
#include "ID.h"
vector<Frame*> g_frame_stack;
std::vector<Frame*> g_frame_stack;
Frame::Frame(int arg_size, const BroFunc* func, const zeek::Args* fn_args)
{

View file

@ -56,10 +56,10 @@
extern RETSIGTYPE sig_handler(int signo);
vector<CallInfo> call_stack;
std::vector<CallInfo> call_stack;
bool did_builtin_init = false;
vector<Func*> Func::unique_ids;
std::vector<Func*> Func::unique_ids;
static const std::pair<bool, Val*> empty_hook_result(false, NULL);
std::string render_call_stack()

View file

@ -45,7 +45,7 @@ ID::~ID()
Unref(val);
}
string ID::ModuleName() const
std::string ID::ModuleName() const
{
return extract_module_name(name);
}
@ -214,9 +214,9 @@ void ID::MakeDeprecated(IntrusivePtr<Expr> deprecation)
AddAttrs(make_intrusive<Attributes>(attr, IntrusivePtr{NewRef{}, Type()}, false, IsGlobal()));
}
string ID::GetDeprecationWarning() const
std::string ID::GetDeprecationWarning() const
{
string result;
std::string result;
Attr* depr_attr = FindAttr(ATTR_DEPRECATED);
if ( depr_attr )
{
@ -541,12 +541,12 @@ void ID::AddOptionHandler(IntrusivePtr<Func> callback, int priority)
option_handlers.emplace(priority, std::move(callback));
}
vector<Func*> ID::GetOptionHandlers() const
std::vector<Func*> ID::GetOptionHandlers() const
{
// multimap is sorted
// It might be worth caching this if we expect it to be called
// a lot...
vector<Func*> v;
std::vector<Func*> v;
for ( auto& element : option_handlers )
v.push_back(element.second.get());
return v;

View file

@ -153,7 +153,7 @@ void IPAddr::Init(const char* s)
}
}
string IPAddr::AsString() const
std::string IPAddr::AsString() const
{
if ( GetFamily() == IPv4 )
{
@ -175,7 +175,7 @@ string IPAddr::AsString() const
}
}
string IPAddr::AsHexString() const
std::string IPAddr::AsHexString() const
{
char buf[33];
@ -195,7 +195,7 @@ string IPAddr::AsHexString() const
return buf;
}
string IPAddr::PtrName() const
std::string IPAddr::PtrName() const
{
if ( GetFamily() == IPv4 )
{
@ -212,7 +212,7 @@ string IPAddr::PtrName() const
else
{
static const char hex_digit[] = "0123456789abcdef";
string ptr_name("ip6.arpa");
std::string ptr_name("ip6.arpa");
uint32_t* p = (uint32_t*) in6.s6_addr;
for ( unsigned int i = 0; i < 4; ++i )
@ -290,7 +290,7 @@ IPPrefix::IPPrefix(const IPAddr& addr, uint8_t length, bool len_is_v6_relative)
prefix.Mask(this->length);
}
string IPPrefix::AsString() const
std::string IPPrefix::AsString() const
{
char l[16];
@ -317,10 +317,10 @@ HashKey* IPPrefix::GetHashKey() const
bool IPPrefix::ConvertString(const char* text, IPPrefix* result)
{
string s(text);
std::string s(text);
size_t slash_loc = s.find('/');
if ( slash_loc == string::npos )
if ( slash_loc == std::string::npos )
return false;
auto ip_str = s.substr(0, slash_loc);

View file

@ -65,7 +65,7 @@ iosource::PktSrc* current_pktsrc = nullptr;
iosource::IOSource* current_iosrc = nullptr;
std::list<ScannedFile> files_scanned;
std::vector<string> sig_files;
std::vector<std::string> sig_files;
RETSIGTYPE watchdog(int /* signo */)
{

View file

@ -777,7 +777,7 @@ bool BloomFilterVal::Empty() const
return bloom_filter->Empty();
}
string BloomFilterVal::InternalState() const
std::string BloomFilterVal::InternalState() const
{
return bloom_filter->InternalState();
}

View file

@ -63,9 +63,9 @@ void* PrefixTable::Insert(const Val* value, void* data)
}
}
list<tuple<IPPrefix,void*>> PrefixTable::FindAll(const IPAddr& addr, int width) const
std::list<std::tuple<IPPrefix,void*>> PrefixTable::FindAll(const IPAddr& addr, int width) const
{
std::list<tuple<IPPrefix,void*>> out;
std::list<std::tuple<IPPrefix,void*>> out;
prefix_t* prefix = MakePrefix(addr, width);
int elems = 0;
@ -81,7 +81,7 @@ list<tuple<IPPrefix,void*>> PrefixTable::FindAll(const IPAddr& addr, int width)
return out;
}
list<tuple<IPPrefix,void*>> PrefixTable::FindAll(const SubNetVal* value) const
std::list<std::tuple<IPPrefix,void*>> PrefixTable::FindAll(const SubNetVal* value) const
{
return FindAll(value->AsSubNet().Prefix(), value->AsSubNet().LengthIPv6());
}

View file

@ -195,13 +195,13 @@ bool Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx
return true;
}
string Specific_RE_Matcher::LookupDef(const string& def)
std::string Specific_RE_Matcher::LookupDef(const std::string& def)
{
const auto& iter = defs.find(def);
if ( iter != defs.end() )
return iter->second;
return string();
return std::string();
}
bool Specific_RE_Matcher::MatchAll(const char* s)

View file

@ -78,7 +78,7 @@ void Reporter::InitOptions()
while ( (v = wl_table->NextEntry(k, c)) )
{
auto index = wl_val->RecoverIndex(k);
string key = index->Index(0)->AsString()->CheckString();
std::string key = index->Index(0)->AsString()->CheckString();
weird_sampling_whitelist.emplace(move(key));
delete k;
}
@ -384,11 +384,11 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
char* buffer = tmp;
char* alloced = 0;
string loc_str;
std::string loc_str;
if ( location )
{
string loc_file = "";
std::string loc_file = "";
int loc_line = 0;
if ( locations.size() )
@ -427,7 +427,7 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
loc_str = filename;
char tmp[32];
snprintf(tmp, 32, "%d", line_number);
loc_str += string(", line ") + string(tmp);
loc_str += std::string(", line ") + std::string(tmp);
}
}
@ -514,21 +514,21 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
if ( out )
{
string s = "";
std::string s = "";
if ( bro_start_network_time != 0.0 )
{
char tmp[32];
snprintf(tmp, 32, "%.6f", network_time);
s += string(tmp) + " ";
s += std::string(tmp) + " ";
}
if ( prefix && *prefix )
{
if ( loc_str != "" )
s += string(prefix) + " in " + loc_str + ": ";
s += std::string(prefix) + " in " + loc_str + ": ";
else
s += string(prefix) + ": ";
s += std::string(prefix) + ": ";
}
else

View file

@ -21,6 +21,8 @@
#include "Reporter.h"
#include "module_util.h"
using namespace std;
// FIXME: Things that are not fully implemented/working yet:
//
// - "ip-options" always evaluates to false

View file

@ -121,9 +121,9 @@ IntrusivePtr<ID> lookup_ID(const char* name, const char* curr_module,
bool no_global, bool same_module_only,
bool check_export)
{
string fullname = make_full_var_name(curr_module, name);
std::string fullname = make_full_var_name(curr_module, name);
string ID_module = extract_module_name(fullname.c_str());
std::string ID_module = extract_module_name(fullname.c_str());
bool need_export = check_export && (ID_module != GLOBAL_MODULE_NAME &&
ID_module != curr_module);
@ -143,7 +143,7 @@ IntrusivePtr<ID> lookup_ID(const char* name, const char* curr_module,
if ( ! no_global && (strcmp(GLOBAL_MODULE_NAME, curr_module) == 0 ||
! same_module_only) )
{
string globalname = make_full_var_name(GLOBAL_MODULE_NAME, name);
std::string globalname = make_full_var_name(GLOBAL_MODULE_NAME, name);
ID* id = global_scope()->Lookup(globalname);
if ( id )
return {NewRef{}, id};
@ -168,7 +168,7 @@ IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
else
scope = SCOPE_FUNCTION;
string full_name = make_full_var_name(module_name, name);
std::string full_name = make_full_var_name(module_name, name);
auto id = make_intrusive<ID>(full_name.data(), scope, is_export);

View file

@ -219,7 +219,7 @@ bool BinarySerializationFormat::Read(char** str, int* len, const char* tag)
return true;
}
bool BinarySerializationFormat::Read(string* v, const char* tag)
bool BinarySerializationFormat::Read(std::string* v, const char* tag)
{
char* buffer;
int len;
@ -227,7 +227,7 @@ bool BinarySerializationFormat::Read(string* v, const char* tag)
if ( ! Read(&buffer, &len, tag) )
return false;
*v = string(buffer, len);
*v = std::string(buffer, len);
delete [] buffer;
return true;
@ -362,7 +362,7 @@ bool BinarySerializationFormat::Write(const char* s, const char* tag)
return Write(s, strlen(s), tag);
}
bool BinarySerializationFormat::Write(const string& s, const char* tag)
bool BinarySerializationFormat::Write(const std::string& s, const char* tag)
{
return Write(s.data(), s.size(), tag);
}

View file

@ -1196,7 +1196,7 @@ Connection* NetSessions::LookupConn(const ConnectionMap& conns, const ConnIDKey&
bool NetSessions::IsLikelyServerPort(uint32_t port, TransportProto proto) const
{
// We keep a cached in-core version of the table to speed up the lookup.
static set<bro_uint_t> port_cache;
static std::set<bro_uint_t> port_cache;
static bool have_cache = false;
if ( ! have_cache )

View file

@ -221,9 +221,9 @@ protected:
SessionStats stats;
typedef pair<IPAddr, IPAddr> IPPair;
typedef pair<EncapsulatingConn, double> TunnelActivity;
typedef std::map<IPPair, TunnelActivity> IPTunnelMap;
using IPPair = std::pair<IPAddr, IPAddr>;
using TunnelActivity = std::pair<EncapsulatingConn, double>;
using IPTunnelMap = std::map<IPPair, TunnelActivity>;
IPTunnelMap ip_tunnels;
analyzer::arp::ARP_Analyzer* arp_analyzer;

View file

@ -143,7 +143,7 @@ BroSubstring::Vec* BroSubstring::VecFromPolicy(VectorVal* vec)
char* BroSubstring::VecToString(Vec* vec)
{
string result("[");
std::string result("[");
for ( BroSubstring::VecIt it = vec->begin(); it != vec->end(); ++it )
{
@ -276,7 +276,7 @@ private:
static void sw_collect_single(BroSubstring::Vec* result, SWNodeMatrix& matrix,
SWNode* node, SWParams& params)
{
string substring("");
std::string substring("");
int row = 0, col = 0;
while ( node )
@ -340,7 +340,7 @@ static void sw_collect_single(BroSubstring::Vec* result, SWNodeMatrix& matrix,
static void sw_collect_multiple(BroSubstring::Vec* result,
SWNodeMatrix& matrix, SWParams& params)
{
vector<BroSubstring::Vec*> als;
std::vector<BroSubstring::Vec*> als;
for ( int i = matrix.GetHeight() - 1; i > 0; --i )
{
@ -354,7 +354,7 @@ static void sw_collect_multiple(BroSubstring::Vec* result,
BroSubstring::Vec* new_al = new BroSubstring::Vec();
sw_collect_single(new_al, matrix, node, params);
for ( vector<BroSubstring::Vec*>::iterator it = als.begin();
for ( std::vector<BroSubstring::Vec*>::iterator it = als.begin();
it != als.end(); ++it )
{
BroSubstring::Vec* old_al = *it;
@ -393,7 +393,7 @@ end_loop:
}
}
for ( vector<BroSubstring::Vec*>::iterator it = als.begin();
for ( std::vector<BroSubstring::Vec*>::iterator it = als.begin();
it != als.end(); ++it )
{
BroSubstring::Vec* al = *it;
@ -506,7 +506,7 @@ BroSubstring::Vec* smith_waterman(const BroString* s1, const BroString* s2,
if ( current->swn_byte_assigned )
current->swn_score = score_tl;
else
current->swn_score = max(max(score_t, score_l), score_tl);
current->swn_score = std::max(std::max(score_t, score_l), score_tl);
// Establish predecessor chain according to neighbor
// with best score.

View file

@ -20,6 +20,8 @@
#include <list>
#include <map>
using namespace std;
BroType::TypeAliasMap BroType::type_aliases;
// Note: This function must be thread-safe.

View file

@ -40,6 +40,8 @@
#include "threading/formatters/JSON.h"
using namespace std;
Val::Val(Func* f)
: val(f), type(f->FType()->Ref())
{

View file

@ -272,8 +272,8 @@ extern IntrusivePtr<Expr> add_and_assign_local(IntrusivePtr<ID> id,
void add_type(ID* id, IntrusivePtr<BroType> t, attr_list* attr)
{
string new_type_name = id->Name();
string old_type_name = t->GetName();
std::string new_type_name = id->Name();
std::string old_type_name = t->GetName();
IntrusivePtr<BroType> tnew;
if ( (t->Tag() == TYPE_RECORD || t->Tag() == TYPE_ENUM) &&
@ -427,7 +427,7 @@ public:
TraversalCode PostExpr(const Expr*) override;
std::vector<Scope*> scopes;
vector<const NameExpr*> outer_id_references;
std::vector<const NameExpr*> outer_id_references;
};
TraversalCode OuterIDBindingFinder::PreExpr(const Expr* expr)

View file

@ -108,8 +108,8 @@ void Manager::DumpDebug()
{
#ifdef DEBUG
DBG_LOG(DBG_ANALYZER, "Available analyzers after zeek_init():");
list<Component*> all_analyzers = GetComponents();
for ( list<Component*>::const_iterator i = all_analyzers.begin(); i != all_analyzers.end(); ++i )
std::list<Component*> all_analyzers = GetComponents();
for ( std::list<Component*>::const_iterator i = all_analyzers.begin(); i != all_analyzers.end(); ++i )
DBG_LOG(DBG_ANALYZER, " %s (%s)", (*i)->Name().c_str(),
IsEnabled((*i)->Tag()) ? "enabled" : "disabled");
@ -118,20 +118,20 @@ void Manager::DumpDebug()
for ( analyzer_map_by_port::const_iterator i = analyzers_by_port_tcp.begin(); i != analyzers_by_port_tcp.end(); i++ )
{
string s;
std::string s;
for ( tag_set::const_iterator j = i->second->begin(); j != i->second->end(); j++ )
s += string(GetComponentName(*j)) + " ";
s += std::string(GetComponentName(*j)) + " ";
DBG_LOG(DBG_ANALYZER, " %d/tcp: %s", i->first, s.c_str());
}
for ( analyzer_map_by_port::const_iterator i = analyzers_by_port_udp.begin(); i != analyzers_by_port_udp.end(); i++ )
{
string s;
std::string s;
for ( tag_set::const_iterator j = i->second->begin(); j != i->second->end(); j++ )
s += string(GetComponentName(*j)) + " ";
s += std::string(GetComponentName(*j)) + " ";
DBG_LOG(DBG_ANALYZER, " %d/udp: %s", i->first, s.c_str());
}
@ -199,8 +199,8 @@ void Manager::DisableAllAnalyzers()
{
DBG_LOG(DBG_ANALYZER, "Disabling all analyzers");
list<Component*> all_analyzers = GetComponents();
for ( list<Component*>::const_iterator i = all_analyzers.begin(); i != all_analyzers.end(); ++i )
std::list<Component*> all_analyzers = GetComponents();
for ( std::list<Component*>::const_iterator i = all_analyzers.begin(); i != all_analyzers.end(); ++i )
(*i)->SetEnabled(false);
}

View file

@ -342,8 +342,9 @@ public:
{ return vxlan_ports; }
private:
typedef set<Tag> tag_set;
typedef map<uint32_t, tag_set*> analyzer_map_by_port;
using tag_set = std::set<Tag>;
using analyzer_map_by_port = std::map<uint32_t, tag_set*>;
tag_set* LookupPort(PortVal* val, bool add_if_not_found);
tag_set* LookupPort(TransportProto proto, uint32_t port, bool add_if_not_found);
@ -387,10 +388,10 @@ private:
};
};
typedef std::multimap<ConnIndex, ScheduledAnalyzer*> conns_map;
typedef std::priority_queue<ScheduledAnalyzer*,
vector<ScheduledAnalyzer*>,
ScheduledAnalyzer::Comparator> conns_queue;
using conns_map = std::multimap<ConnIndex, ScheduledAnalyzer*>;
using conns_queue = std::priority_queue<ScheduledAnalyzer*,
std::vector<ScheduledAnalyzer*>,
ScheduledAnalyzer::Comparator>;
conns_map conns;
conns_queue conns_by_timeout;

View file

@ -745,7 +745,7 @@ int BitTorrentTracker_Analyzer::ResponseParseBenc(void)
if ( benc_str_have < benc_str_len )
{
unsigned int seek =
min(len, benc_str_len - benc_str_have);
std::min(len, benc_str_len - benc_str_have);
benc_str_have += seek;
if ( benc_raw_type != BENC_TYPE_NONE )

View file

@ -106,8 +106,8 @@ protected:
TableVal* res_val_peers;
TableVal* res_val_benc;
vector<char> benc_stack;
vector<unsigned int> benc_count;
std::vector<char> benc_stack;
std::vector<unsigned int> benc_count;
enum btt_benc_states benc_state;
char* benc_raw;

View file

@ -21,7 +21,7 @@ void File_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
{
tcp::TCP_ApplicationAnalyzer::DeliverStream(len, data, orig);
int n = min(len, BUFFER_SIZE - buffer_len);
int n = std::min(len, BUFFER_SIZE - buffer_len);
if ( n )
{
@ -75,7 +75,7 @@ void File_Analyzer::Identify()
RuleMatcher::MIME_Matches matches;
file_mgr->DetectMIME(reinterpret_cast<const u_char*>(buffer), buffer_len,
&matches);
string match = matches.empty() ? "<unknown>"
std::string match = matches.empty() ? "<unknown>"
: *(matches.begin()->second.begin());
if ( file_transferred )

View file

@ -27,8 +27,8 @@ protected:
static const int BUFFER_SIZE = 1024;
char buffer[BUFFER_SIZE];
int buffer_len;
string file_id_orig;
string file_id_resp;
std::string file_id_orig;
std::string file_id_resp;
};
class IRC_Data : public File_Analyzer {

View file

@ -107,7 +107,7 @@ void FTP_Analyzer::DeliverStream(int length, const u_char* data, bool orig)
if ( strncmp((const char*) cmd_str->Bytes(),
"AUTH", cmd_len) == 0 )
auth_requested = string(line, end_of_line - line);
auth_requested = std::string(line, end_of_line - line);
if ( rule_matcher )
Conn()->Match(Rule::FTP, (const u_char *) cmd,

View file

@ -24,7 +24,7 @@ protected:
login::NVT_Analyzer* nvt_orig;
login::NVT_Analyzer* nvt_resp;
uint32_t pending_reply; // code associated with multi-line reply, or 0
string auth_requested; // AUTH method requested
std::string auth_requested; // AUTH method requested
};
/**

View file

@ -86,7 +86,7 @@ static Val* parse_eftp(const char* line)
good = 0;
}
string s(line, nptr-line); // extract IP address
std::string s(line, nptr-line); // extract IP address
IPAddr tmp(s);
// on error, "tmp" will have all 128 bits zero
if ( tmp == addr )

View file

@ -112,9 +112,9 @@ bool Gnutella_Analyzer::NextLine(const u_char* data, int len)
}
bool Gnutella_Analyzer::IsHTTP(string header)
bool Gnutella_Analyzer::IsHTTP(std::string header)
{
if ( header.find(" HTTP/1.") == string::npos )
if ( header.find(" HTTP/1.") == std::string::npos )
return false;
if ( gnutella_http_notify )
@ -139,7 +139,7 @@ bool Gnutella_Analyzer::IsHTTP(string header)
}
bool Gnutella_Analyzer::GnutellaOK(string header)
bool Gnutella_Analyzer::GnutellaOK(std::string header)
{
if ( strncmp("GNUTELLA", header.data(), 8) )
return false;
@ -223,7 +223,7 @@ void Gnutella_Analyzer::SendEvents(GnutellaMsgState* p, bool is_orig)
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(p->msg_len)},
make_intrusive<StringVal>(p->payload),
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(p->payload_len)},
IntrusivePtr{AdoptRef{}, val_mgr->GetBool((p->payload_len < min(p->msg_len, (unsigned int)GNUTELLA_MAX_PAYLOAD)))},
IntrusivePtr{AdoptRef{}, val_mgr->GetBool((p->payload_len < std::min(p->msg_len, (unsigned int)GNUTELLA_MAX_PAYLOAD)))},
IntrusivePtr{AdoptRef{}, val_mgr->GetBool((p->payload_left == 0))}
);
}

View file

@ -16,10 +16,10 @@ class GnutellaMsgState {
public:
GnutellaMsgState ();
string buffer;
std::string buffer;
int current_offset;
int got_CR;
string headers;
std::string headers;
char msg[GNUTELLA_MSG_SIZE];
u_char msg_hops;
unsigned int msg_len;
@ -47,8 +47,8 @@ public:
private:
bool NextLine(const u_char* data, int len);
bool GnutellaOK(string header);
bool IsHTTP(string header);
bool GnutellaOK(std::string header);
bool IsHTTP(std::string header);
bool Established() const { return state == (ORIG_OK | RESP_OK); }

View file

@ -45,7 +45,7 @@ void ICMP_Analyzer::DeliverPacket(int len, const u_char* data,
// caplen > len.
if ( packet_contents )
// Subtract off the common part of ICMP header.
PacketContents(data + 8, min(len, caplen) - 8);
PacketContents(data + 8, std::min(len, caplen) - 8);
const struct icmp* icmpp = (const struct icmp*) data;
@ -209,7 +209,7 @@ void ICMP_Analyzer::ICMP_Sent(const struct icmp* icmpp, int len, int caplen,
if ( icmp_sent_payload )
{
BroString* payload = new BroString(data, min(len, caplen), false);
BroString* payload = new BroString(data, std::min(len, caplen), false);
EnqueueConnEvent(icmp_sent_payload,
IntrusivePtr{AdoptRef{}, BuildConnVal()},
@ -841,7 +841,7 @@ VectorVal* ICMP_Analyzer::BuildNDOptionsVal(int caplen, const u_char* data)
if ( set_payload_field )
{
BroString* payload = new BroString(data, min((int)length, caplen), false);
BroString* payload = new BroString(data, std::min((int)length, caplen), false);
rv->Assign(6, make_intrusive<StringVal>(payload));
}

View file

@ -10,6 +10,7 @@
#include "events.bif.h"
using namespace analyzer::irc;
using namespace std;
IRC_Analyzer::IRC_Analyzer(Connection* conn)
: tcp::TCP_ApplicationAnalyzer("IRC", conn)

View file

@ -46,7 +46,7 @@ protected:
private:
void StartTLS();
inline void SkipLeadingWhitespace(string& str);
inline void SkipLeadingWhitespace(std::string& str);
/** \brief counts number of invalid IRC messages */
int invalid_msg_count;
@ -62,7 +62,7 @@ private:
* \param split character which separates the words
* \return vector containing words
*/
vector<string> SplitWords(const string& input, char split);
std::vector<std::string> SplitWords(const std::string& input, char split);
tcp::ContentLine_Analyzer* cl_orig;
tcp::ContentLine_Analyzer* cl_resp;

View file

@ -1215,7 +1215,7 @@ void MIME_Entity::DataOctets(int len, const char* data)
if ( data_buf_offset < 0 && ! GetDataBuffer() )
return;
int n = min(data_buf_length - data_buf_offset, len);
int n = std::min(data_buf_length - data_buf_offset, len);
memcpy(data_buf_data + data_buf_offset, data, n);
data += n;
data_buf_offset += n;

View file

@ -86,7 +86,7 @@ void POP3_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
ProcessReply(len, (char*) terminated_string.Bytes());
}
static string trim_whitespace(const char* in)
static std::string trim_whitespace(const char* in)
{
int n = strlen(in);
char* out = new char[n + 1];
@ -121,7 +121,7 @@ static string trim_whitespace(const char* in)
*out_p = 0;
string rval(out);
std::string rval(out);
delete [] out;
return rval;
}
@ -231,7 +231,7 @@ void POP3_Analyzer::ProcessRequest(int length, const char* line)
// Some clients pipeline their commands (i.e., keep sending
// without waiting for a server's responses). Therefore we
// keep a list of pending commands.
cmds.push_back(string(line));
cmds.push_back(std::string(line));
if ( cmds.size() == 1 )
// Not waiting for another server response,
@ -241,7 +241,7 @@ void POP3_Analyzer::ProcessRequest(int length, const char* line)
}
static string commands[] = {
static std::string commands[] = {
"OK", "ERR", "USER", "PASS", "APOP", "AUTH",
"STAT", "LIST", "RETR", "DELE", "RSET", "NOOP", "LAST", "QUIT",
"TOP", "CAPA", "UIDL", "STLS", "XSENDER",
@ -258,8 +258,8 @@ void POP3_Analyzer::ProcessClientCmd()
if ( ! cmds.size() )
return;
string str = trim_whitespace(cmds.front().c_str());
vector<string> tokens = TokenizeLine(str, ' ');
std::string str = trim_whitespace(cmds.front().c_str());
std::vector<std::string> tokens = TokenizeLine(str, ' ');
int cmd_code = -1;
const char* cmd = "";
@ -593,7 +593,7 @@ void POP3_Analyzer::FinishClientCmd()
void POP3_Analyzer::ProcessReply(int length, const char* line)
{
const char* end_of_line = line + length;
string str = trim_whitespace(line);
std::string str = trim_whitespace(line);
if ( multiLine == true )
{
@ -631,7 +631,7 @@ void POP3_Analyzer::ProcessReply(int length, const char* line)
int cmd_code = -1;
const char* cmd = "";
vector<string> tokens = TokenizeLine(str, ' ');
std::vector<std::string> tokens = TokenizeLine(str, ' ');
if ( tokens.size() > 0 )
cmd_code = ParseCmd(tokens[0]);
@ -863,7 +863,7 @@ void POP3_Analyzer::ProcessData(int length, const char* line)
mail->Deliver(length, line, true);
}
int POP3_Analyzer::ParseCmd(string cmd)
int POP3_Analyzer::ParseCmd(std::string cmd)
{
if ( cmd.size() == 0 )
return -1;
@ -884,18 +884,18 @@ int POP3_Analyzer::ParseCmd(string cmd)
return -1;
}
vector<string> POP3_Analyzer::TokenizeLine(const string& input, char split)
std::vector<std::string> POP3_Analyzer::TokenizeLine(const std::string& input, char split)
{
vector<string> tokens;
std::vector<std::string> tokens;
if ( input.size() < 1 )
return tokens;
int start = 0;
unsigned int splitPos = 0;
string token = "";
std::string token = "";
if ( input.find(split, 0) == string::npos )
if ( input.find(split, 0) == std::string::npos )
{
tokens.push_back(input);
return tokens;

View file

@ -86,8 +86,8 @@ protected:
int lastRequiredCommand;
int authLines;
string user;
string password;
std::string user;
std::string password;
void ProcessRequest(int length, const char* line);
void ProcessReply(int length, const char* line);
@ -99,14 +99,14 @@ protected:
void EndData();
void StartTLS();
vector<string> TokenizeLine(const string& input, char split);
int ParseCmd(string cmd);
std::vector<std::string> TokenizeLine(const std::string& input, char split);
int ParseCmd(std::string cmd);
void AuthSuccessfull();
void POP3Event(EventHandlerPtr event, bool is_orig,
const char* arg1 = 0, const char* arg2 = 0);
mime::MIME_Mail* mail;
list<string> cmds;
std::list<std::string> cmds;
private:
bool tls;

View file

@ -309,8 +309,8 @@ StringVal* NFS_Interp::nfs3_file_data(const u_char*& buf, int& n, uint64_t offse
return 0;
// Ok, so we want to return some data
data_n = min(data_n, size);
data_n = min(data_n, int(BifConst::NFS3::return_data_max));
data_n = std::min(data_n, size);
data_n = std::min(data_n, int(BifConst::NFS3::return_data_max));
if ( data && data_n > 0 )
return new StringVal(new BroString(data, data_n, false));

View file

@ -394,14 +394,14 @@ bool RPC_Reasm_Buffer::ConsumeChunk(const u_char*& data, int& len)
// How many bytes do we want to process with this call? Either the
// all of the bytes available or the number of bytes that we are
// still missing.
int64_t to_process = min(int64_t(len), (expected-processed));
int64_t to_process = std::min(int64_t(len), (expected-processed));
if ( fill < maxsize )
{
// We haven't yet filled the buffer. How many bytes to copy
// into the buff. Either all of the bytes we want to process
// or the number of bytes until we reach maxsize.
int64_t to_copy = min( to_process, (maxsize-fill) );
int64_t to_copy = std::min( to_process, (maxsize-fill) );
if ( to_copy )
memcpy(buf+fill, data, to_copy);
@ -741,7 +741,7 @@ void RPC_Analyzer::DeliverPacket(int len, const u_char* data, bool orig,
uint64_t seq, const IP_Hdr* ip, int caplen)
{
tcp::TCP_ApplicationAnalyzer::DeliverPacket(len, data, orig, seq, ip, caplen);
len = min(len, caplen);
len = std::min(len, caplen);
if ( orig )
{

View file

@ -82,7 +82,7 @@ protected:
int last_replied_cmd;
int first_cmd; // first un-replied SMTP cmd, or -1
int pending_reply; // code assoc. w/ multi-line reply, or 0
list<int> pending_cmd_q; // to support pipelining
std::list<int> pending_cmd_q; // to support pipelining
bool skip_data; // whether to skip message body
BroString* line_after_gap; // last line before the first reply
// after a gap

View file

@ -145,7 +145,7 @@ void ContentLine_Analyzer::DoDeliver(int len, const u_char* data)
if ( plain_delivery_length > 0 )
{
int deliver_plain = min(plain_delivery_length, (int64_t)len);
int deliver_plain = std::min(plain_delivery_length, (int64_t)len);
last_char = 0; // clear last_char
plain_delivery_length -= deliver_plain;

View file

@ -794,7 +794,7 @@ void TCP_Analyzer::GeneratePacketEvent(
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(len)},
// We need the min() here because Ethernet padding can lead to
// caplen > len.
make_intrusive<StringVal>(min(caplen, len), (const char*) data)
make_intrusive<StringVal>(std::min(caplen, len), (const char*) data)
);
}
@ -1055,7 +1055,7 @@ void TCP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
// We need the min() here because Ethernet frame padding can lead to
// caplen > len.
if ( packet_contents )
PacketContents(data, min(len, caplen));
PacketContents(data, std::min(len, caplen));
TCP_Endpoint* endpoint = is_orig ? orig : resp;
TCP_Endpoint* peer = endpoint->peer;
@ -1906,7 +1906,7 @@ void TCP_ApplicationAnalyzer::DeliverPacket(int len, const u_char* data,
Analyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen);
DBG_LOG(DBG_ANALYZER, "TCP_ApplicationAnalyzer ignoring DeliverPacket(%d, %s, %" PRIu64", %p, %d) [%s%s]",
len, is_orig ? "T" : "F", seq, ip, caplen,
fmt_bytes((const char*) data, min(40, len)), len > 40 ? "..." : "");
fmt_bytes((const char*) data, std::min(40, len)), len > 40 ? "..." : "");
}
void TCP_ApplicationAnalyzer::SetEnv(bool /* is_orig */, char* name, char* val)

View file

@ -169,7 +169,7 @@ private:
TCP_Endpoint* orig;
TCP_Endpoint* resp;
typedef list<analyzer::Analyzer*> analyzer_list;
using analyzer_list = std::list<analyzer::Analyzer*>;
analyzer_list packet_children;
unsigned int first_packet_seen: 2;

View file

@ -14,13 +14,13 @@ public:
bool URG() const { return flags & TH_URG; }
bool PUSH() const { return flags & TH_PUSH; }
string AsString() const;
std::string AsString() const;
protected:
u_char flags;
};
inline string TCP_Flags::AsString() const
inline std::string TCP_Flags::AsString() const
{
char tcp_flags[10];
char* p = tcp_flags;

View file

@ -58,7 +58,7 @@ void UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
// We need the min() here because Ethernet frame padding can lead to
// caplen > len.
if ( packet_contents )
PacketContents(data, min(len, caplen) - sizeof(struct udphdr));
PacketContents(data, std::min(len, caplen) - sizeof(struct udphdr));
int chksum = up->uh_sum;

View file

@ -194,7 +194,7 @@ public:
* See the Broker::SendFlags record type.
* @return true if the message is sent successfully.
*/
bool PublishLogWrite(EnumVal* stream, EnumVal* writer, string path, int num_vals,
bool PublishLogWrite(EnumVal* stream, EnumVal* writer, std::string path, int num_vals,
const threading::Value* const * vals);
/**

View file

@ -52,7 +52,7 @@ class StoreQueryCallback {
public:
StoreQueryCallback(trigger::Trigger* arg_trigger, const CallExpr* arg_call,
broker::store store)
: trigger(arg_trigger), call(arg_call), store(move(store))
: trigger(arg_trigger), call(arg_call), store(std::move(store))
{
Ref(trigger);
}

View file

@ -80,7 +80,7 @@ void File::StaticInit()
meta_inferred_idx = Idx("inferred", fa_metadata_type);
}
File::File(const string& file_id, const string& source_name, Connection* conn,
File::File(const std::string& file_id, const std::string& source_name, Connection* conn,
analyzer::Tag tag, bool is_orig)
: id(file_id), val(0), file_reassembler(0), stream_offset(0),
reassembly_max_buffer(0), did_metadata_inference(false),
@ -174,7 +174,7 @@ double File::LookupFieldDefaultInterval(int idx) const
return v->AsInterval();
}
int File::Idx(const string& field, const RecordType* type)
int File::Idx(const std::string& field, const RecordType* type)
{
int rval = type->FieldOffset(field.c_str());
@ -185,14 +185,14 @@ int File::Idx(const string& field, const RecordType* type)
return rval;
}
string File::GetSource() const
std::string File::GetSource() const
{
Val* v = val->Lookup(source_idx);
return v ? v->AsString()->CheckString() : string();
return v ? v->AsString()->CheckString() : std::string();
}
void File::SetSource(const string& source)
void File::SetSource(const std::string& source)
{
val->Assign(source_idx, make_intrusive<StringVal>(source.c_str()));
}
@ -288,7 +288,7 @@ void File::SetReassemblyBuffer(uint64_t max)
reassembly_max_buffer = max;
}
bool File::SetMime(const string& mime_type)
bool File::SetMime(const std::string& mime_type)
{
if ( mime_type.empty() || bof_buffer.size != 0 || did_metadata_inference )
return false;
@ -329,7 +329,7 @@ void File::InferMetadata()
RuleMatcher::MIME_Matches matches;
const u_char* data = bof_buffer_val->AsString()->Bytes();
uint64_t len = bof_buffer_val->AsString()->Len();
len = min(len, LookupFieldDefaultCount(bof_buffer_size_idx));
len = std::min(len, LookupFieldDefaultCount(bof_buffer_size_idx));
file_mgr->DetectMIME(data, len, &matches);
auto meta = make_intrusive<RecordVal>(fa_metadata_type);
@ -383,7 +383,7 @@ void File::DeliverStream(const u_char* data, uint64_t len)
"[%s] %" PRIu64 " stream bytes in at offset %" PRIu64 "; %s [%s%s]",
id.c_str(), len, stream_offset,
IsComplete() ? "complete" : "incomplete",
fmt_bytes((const char*) data, min((uint64_t)40, len)),
fmt_bytes((const char*) data, std::min((uint64_t)40, len)),
len > 40 ? "..." : "");
file_analysis::Analyzer* a = 0;
@ -487,7 +487,7 @@ void File::DeliverChunk(const u_char* data, uint64_t len, uint64_t offset)
"[%s] %" PRIu64 " chunk bytes in at offset %" PRIu64 "; %s [%s%s]",
id.c_str(), len, offset,
IsComplete() ? "complete" : "incomplete",
fmt_bytes((const char*) data, min((uint64_t)40, len)),
fmt_bytes((const char*) data, std::min((uint64_t)40, len)),
len > 40 ? "..." : "");
file_analysis::Analyzer* a = 0;

View file

@ -6,7 +6,7 @@
using namespace file_analysis;
FileTimer::FileTimer(double t, const string& id, double interval)
FileTimer::FileTimer(double t, const std::string& id, double interval)
: Timer(t + interval, TIMER_FILE_ANALYSIS_INACTIVITY), file_id(id)
{
DBG_LOG(DBG_FILE_ANALYSIS, "New %f second timeout timer for %s",

View file

@ -15,6 +15,7 @@
#include <openssl/md5.h>
using namespace file_analysis;
using namespace std;
TableVal* Manager::disabled = 0;
TableType* Manager::tag_set_type = 0;

View file

@ -10,7 +10,7 @@
using namespace file_analysis;
Extract::Extract(RecordVal* args, File* file, const string& arg_filename,
Extract::Extract(RecordVal* args, File* file, const std::string& arg_filename,
uint64_t arg_limit)
: file_analysis::Analyzer(file_mgr->GetComponentTag("EXTRACT"), args, file),
filename(arg_filename), limit(arg_limit), depth(0)

View file

@ -66,11 +66,11 @@ protected:
* to which the contents of the file will be extracted/written.
* @param arg_limit the maximum allowed file size.
*/
Extract(RecordVal* args, File* file, const string& arg_filename,
Extract(RecordVal* args, File* file, const std::string& arg_filename,
uint64_t arg_limit);
private:
string filename;
std::string filename;
int fd;
uint64_t limit;
uint64_t depth;

View file

@ -703,7 +703,7 @@ function sct_verify%(cert: opaque of x509, logid: string, log_key: string, signa
EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
assert(mdctx);
string errstr;
std::string errstr;
int success = 0;
const EVP_MD* hash = hash_to_evp(hash_algorithm);

View file

@ -22,6 +22,7 @@
#include "../threading/SerialTypes.h"
using namespace input;
using namespace std;
using threading::Value;
using threading::Field;

View file

@ -4,14 +4,14 @@
#pragma once
#include <map>
#include "Component.h"
#include "EventHandler.h"
#include "plugin/ComponentManager.h"
#include "threading/SerialTypes.h"
#include "Tag.h"
#include <map>
class RecordVal;
namespace input {
@ -81,7 +81,7 @@ public:
* This method corresponds directly to the internal BiF defined in
* input.bif, which just forwards here.
*/
bool ForceUpdate(const string &id);
bool ForceUpdate(const std::string &id);
/**
* Deletes an existing input stream.
@ -91,7 +91,7 @@ public:
* This method corresponds directly to the internal BiF defined in
* input.bif, which just forwards here.
*/
bool RemoveStream(const string &id);
bool RemoveStream(const std::string &id);
/**
* Signals the manager to shutdown at Bro's termination.
@ -145,7 +145,7 @@ protected:
// Allows readers to directly send Bro events. The num_vals and vals
// must be the same the named event expects. Takes ownership of
// threading::Value fields.
bool SendEvent(ReaderFrontend* reader, const string& name, const int num_vals, threading::Value* *vals) const;
bool SendEvent(ReaderFrontend* reader, const std::string& name, const int num_vals, threading::Value* *vals) const;
// Instantiates a new ReaderBackend of the given type (note that
// doing so creates a new thread!).
@ -205,11 +205,11 @@ private:
// Check if a record is made up of compatible types and return a list
// of all fields that are in the record in order. Recursively unrolls
// records
bool UnrollRecordType(vector<threading::Field*> *fields, const RecordType *rec, const string& nameprepend, bool allow_file_func) const;
bool UnrollRecordType(std::vector<threading::Field*> *fields, const RecordType *rec, const std::string& nameprepend, bool allow_file_func) const;
// Send events
void SendEvent(EventHandlerPtr ev, const int numvals, ...) const;
void SendEvent(EventHandlerPtr ev, list<Val*> events) const;
void SendEvent(EventHandlerPtr ev, std::list<Val*> events) const;
// Implementation of SendEndOfData (send end_of_data event).
void SendEndOfData(const Stream *i);
@ -257,12 +257,12 @@ private:
void ErrorHandler(const Stream* i, ErrorType et, bool reporter_send, const char* fmt, ...) const __attribute__((format(printf, 5, 6)));
void ErrorHandler(const Stream* i, ErrorType et, bool reporter_send, const char* fmt, va_list ap) const __attribute__((format(printf, 5, 0)));
Stream* FindStream(const string &name) const;
Stream* FindStream(const std::string &name) const;
Stream* FindStream(ReaderFrontend* reader) const;
enum StreamType { TABLE_STREAM, EVENT_STREAM, ANALYSIS_STREAM };
map<ReaderFrontend*, Stream*> readers;
std::map<ReaderFrontend*, Stream*> readers;
EventHandlerPtr end_of_data;
};
@ -271,4 +271,3 @@ private:
}
extern input::Manager* input_mgr;

View file

@ -14,6 +14,7 @@
using namespace input::reader;
using namespace threading;
using namespace std;
using threading::Value;
using threading::Field;
@ -468,4 +469,3 @@ bool Ascii::DoHeartbeat(double network_time, double current_time)
return true;
}

View file

@ -15,15 +15,15 @@ namespace input { namespace reader {
// Description for input field mapping.
struct FieldMapping {
string name;
std::string name;
TypeTag type;
TypeTag subtype; // internal type for sets and vectors
int position;
int secondary_position; // for ports: pos of the second field
bool present;
FieldMapping(const string& arg_name, const TypeTag& arg_type, int arg_position);
FieldMapping(const string& arg_name, const TypeTag& arg_type, const TypeTag& arg_subtype, int arg_position);
FieldMapping(const std::string& arg_name, const TypeTag& arg_type, int arg_position);
FieldMapping(const std::string& arg_name, const TypeTag& arg_type, const TypeTag& arg_subtype, int arg_position);
FieldMapping(const FieldMapping& arg);
FieldMapping() { position = -1; secondary_position = -1; }
@ -54,32 +54,32 @@ protected:
private:
bool ReadHeader(bool useCached);
bool GetLine(string& str);
bool GetLine(std::string& str);
bool OpenFile();
ifstream file;
std::ifstream file;
time_t mtime;
ino_t ino;
// The name using which we actually load the file -- compared
// to the input source name, this one may have a path_prefix
// attached to it.
string fname;
std::string fname;
// map columns in the file to columns to send back to the manager
vector<FieldMapping> columnMap;
std::vector<FieldMapping> columnMap;
// keep a copy of the headerline to determine field locations when stream descriptions change
string headerline;
std::string headerline;
// options set from the script-level.
string separator;
string set_separator;
string empty_field;
string unset_field;
std::string separator;
std::string set_separator;
std::string empty_field;
std::string unset_field;
bool fail_on_invalid_lines;
bool fail_on_file_problem;
string path_prefix;
std::string path_prefix;
std::unique_ptr<threading::formatter::Formatter> formatter;
};

View file

@ -55,9 +55,9 @@ bool Benchmark::DoInit(const ReaderInfo& info, int num_fields, const Field* cons
return true;
}
string Benchmark::RandomString(const int len)
std::string Benchmark::RandomString(const int len)
{
string s(len, ' ');
std::string s(len, ' ');
static const char values[] =
"0123456789!@#$%^&*()-_=+{}[]\\|"
@ -135,7 +135,7 @@ threading::Value* Benchmark::EntryToVal(TypeTag type, TypeTag subtype)
case TYPE_STRING:
{
string rnd = RandomString(10);
std::string rnd = RandomString(10);
val->val.string_val.data = copy_string(rnd.c_str());
val->val.string_val.length = rnd.size();
break;

View file

@ -25,7 +25,7 @@ protected:
private:
double CurrTime();
string RandomString(const int len);
std::string RandomString(const int len);
threading::Value* EntryToVal(TypeTag Type, TypeTag subtype);
int num_lines;

View file

@ -8,6 +8,7 @@
#include "threading/SerialTypes.h"
using namespace input::reader;
using namespace std;
using threading::Value;
using threading::Field;

View file

@ -30,18 +30,18 @@ protected:
private:
bool OpenInput();
bool CloseInput();
streamsize GetChunk(char** chunk);
std::streamsize GetChunk(char** chunk);
int UpdateModificationTime();
string fname;
ifstream* in;
std::string fname;
std::ifstream* in;
time_t mtime;
ino_t ino;
bool firstrun;
// options set from the script-level.
static streamsize chunk_size;
string path_prefix;
static std::streamsize chunk_size;
std::string path_prefix;
};
}

View file

@ -72,7 +72,7 @@ bool Config::DoInit(const ReaderInfo& info, int num_fields, const Field* const*
BifConst::InputConfig::empty_field->Len());
formatter::Ascii::SeparatorInfo sep_info("\t", set_separator, "", empty_field);
formatter = unique_ptr<threading::formatter::Formatter>(new formatter::Ascii(this, sep_info));
formatter = std::unique_ptr<threading::formatter::Formatter>(new formatter::Ascii(this, sep_info));
return DoUpdate();
}
@ -94,7 +94,7 @@ bool Config::OpenFile()
return true;
}
bool Config::GetLine(string& str)
bool Config::GetLine(std::string& str)
{
while ( getline(file, str) )
{
@ -170,7 +170,7 @@ bool Config::DoUpdate()
assert(false);
}
string line;
std::string line;
file.sync();
// keep a list of options to remove because they were no longer in the input file.
@ -197,8 +197,8 @@ bool Config::DoUpdate()
continue;
}
string key = line.substr(match[1].rm_so, match[1].rm_eo - match[1].rm_so);
string value;
std::string key = line.substr(match[1].rm_so, match[1].rm_eo - match[1].rm_so);
std::string value;
if ( match[2].rm_so > 0 )
value = line.substr(match[2].rm_so, match[2].rm_eo - match[2].rm_so);
@ -308,4 +308,3 @@ bool Config::DoHeartbeat(double network_time, double current_time)
return true;
}

View file

@ -37,17 +37,17 @@ protected:
bool DoHeartbeat(double network_time, double current_time) override;
private:
bool GetLine(string& str);
bool GetLine(std::string& str);
bool OpenFile();
ifstream file;
std::ifstream file;
time_t mtime;
ino_t ino;
bool fail_on_file_problem;
string set_separator;
string empty_field;
std::string set_separator;
std::string empty_field;
std::unique_ptr<threading::formatter::Formatter> formatter;
std::unordered_map<std::string, std::tuple<TypeTag, TypeTag>> option_types;

View file

@ -348,7 +348,7 @@ bool Raw::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fie
int want_fields = 1;
bool result;
string source = string(info.source);
std::string source = std::string(info.source);
char last = info.source[source.length() - 1];
if ( last == '|' )
{
@ -379,7 +379,7 @@ bool Raw::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fie
it = info.config.find("offset"); // we want to seek to a given offset inside the file
if ( it != info.config.end() && ! execute && (Info().mode == MODE_STREAM || Info().mode == MODE_MANUAL) )
{
string offset_s = it->second;
std::string offset_s = it->second;
offset = strtoll(offset_s.c_str(), 0, 10);
}
else if ( it != info.config.end() )
@ -585,7 +585,7 @@ bool Raw::DoUpdate()
}
}
string line;
std::string line;
assert ( (NumFields() == 1 && !use_stderr) || (NumFields() == 2 && use_stderr));
for ( ;; )
{

View file

@ -45,7 +45,7 @@ private:
bool Execute();
void WriteToStdin();
string fname; // Source with a potential "|" removed.
std::string fname; // Source with a potential "|" removed.
std::unique_ptr<FILE, int(*)(FILE*)> file;
std::unique_ptr<FILE, int(*)(FILE*)> stderrfile;
bool execute;
@ -54,7 +54,7 @@ private:
ino_t ino;
// options set from the script-level.
string separator;
std::string separator;
unsigned int sep_length; // length of the separator
int bufpos;
@ -65,7 +65,7 @@ private:
int stdout_fileno;
int stderr_fileno;
string stdin_string;
std::string stdin_string;
uint64_t stdin_towrite;
bool use_stderr;

View file

@ -38,7 +38,7 @@ SQLite::SQLite(ReaderFrontend *frontend)
BifConst::InputSQLite::empty_field->Len()
);
io = new threading::formatter::Ascii(this, threading::formatter::Ascii::SeparatorInfo(string(), set_separator, unset_field, empty_field));
io = new threading::formatter::Ascii(this, threading::formatter::Ascii::SeparatorInfo(std::string(), set_separator, unset_field, empty_field));
}
SQLite::~SQLite()
@ -90,10 +90,10 @@ bool SQLite::DoInit(const ReaderInfo& info, int arg_num_fields, const threading:
started = false;
string fullpath(info.source);
std::string fullpath(info.source);
fullpath.append(".sqlite");
string query;
std::string query;
ReaderInfo::config_map::const_iterator it = info.config.find("query");
if ( it == info.config.end() )
{
@ -199,7 +199,7 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p
Error("Port protocol definition did not contain text");
else
{
string s(text, sqlite3_column_bytes(st, subpos));
std::string s(text, sqlite3_column_bytes(st, subpos));
val->val.port_val.proto = io->ParseProto(s);
}
}
@ -209,10 +209,10 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p
case TYPE_SUBNET:
{
const char *text = (const char*) sqlite3_column_text(st, pos);
string s(text, sqlite3_column_bytes(st, pos));
std::string s(text, sqlite3_column_bytes(st, pos));
int pos = s.find('/');
int width = atoi(s.substr(pos+1).c_str());
string addr = s.substr(0, pos);
std::string addr = s.substr(0, pos);
val->val.subnet_val.prefix = io->ParseAddr(addr);
val->val.subnet_val.length = width;
@ -222,7 +222,7 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p
case TYPE_ADDR:
{
const char *text = (const char*) sqlite3_column_text(st, pos);
string s(text, sqlite3_column_bytes(st, pos));
std::string s(text, sqlite3_column_bytes(st, pos));
val->val.addr_val = io->ParseAddr(s);
break;
}
@ -231,7 +231,7 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p
case TYPE_VECTOR:
{
const char *text = (const char*) sqlite3_column_text(st, pos);
string s(text, sqlite3_column_bytes(st, pos));
std::string s(text, sqlite3_column_bytes(st, pos));
delete val;
val = io->ParseValue(s, "", field->type, field->subtype);
break;
@ -342,4 +342,3 @@ bool SQLite::DoUpdate()
return true;
}

View file

@ -35,14 +35,14 @@ private:
unsigned int num_fields;
int mode;
bool started;
string query;
std::string query;
sqlite3 *db;
sqlite3_stmt *st;
threading::formatter::Ascii* io;
string set_separator;
string unset_field;
string empty_field;
std::string set_separator;
std::string unset_field;
std::string empty_field;
};

View file

@ -38,7 +38,7 @@ const std::vector<std::string>& PktSrcComponent::Prefixes() const
return prefixes;
}
bool PktSrcComponent::HandlesPrefix(const string& prefix) const
bool PktSrcComponent::HandlesPrefix(const std::string& prefix) const
{
for ( std::vector<std::string>::const_iterator i = prefixes.begin();
i != prefixes.end(); i++ )
@ -69,7 +69,7 @@ void PktSrcComponent::DoDescribe(ODesc* d) const
{
iosource::Component::DoDescribe(d);
string prefs;
std::string prefs;
for ( std::vector<std::string>::const_iterator i = prefixes.begin();
i != prefixes.end(); i++ )
@ -128,7 +128,7 @@ const std::vector<std::string>& PktDumperComponent::Prefixes() const
return prefixes;
}
bool PktDumperComponent::HandlesPrefix(const string& prefix) const
bool PktDumperComponent::HandlesPrefix(const std::string& prefix) const
{
for ( std::vector<std::string>::const_iterator i = prefixes.begin();
i != prefixes.end(); i++ )
@ -144,7 +144,7 @@ void PktDumperComponent::DoDescribe(ODesc* d) const
{
plugin::Component::DoDescribe(d);
string prefs;
std::string prefs;
for ( std::vector<std::string>::const_iterator i = prefixes.begin();
i != prefixes.end(); i++ )

View file

@ -364,7 +364,7 @@ PktSrc* Manager::OpenPktSrc(const std::string& path, bool is_live)
}
PktDumper* Manager::OpenPktDumper(const string& path, bool append)
PktDumper* Manager::OpenPktDumper(const std::string& path, bool append)
{
std::pair<std::string, std::string> t = split_prefix(path);
std::string prefix = t.first;

View file

@ -273,10 +273,10 @@ bool PktSrc::PrecompileBPFFilter(int index, const std::string& filter)
if ( ! code->Compile(BifConst::Pcap::snaplen, LinkType(), filter.c_str(), Netmask(), errbuf, sizeof(errbuf)) )
{
string msg = fmt("cannot compile BPF filter \"%s\"", filter.c_str());
std::string msg = fmt("cannot compile BPF filter \"%s\"", filter.c_str());
if ( *errbuf )
msg += ": " + string(errbuf);
msg += ": " + std::string(errbuf);
Error(msg);

View file

@ -308,7 +308,7 @@ void PcapSource::Statistics(Stats* s)
void PcapSource::PcapError(const char* where)
{
string location;
std::string location;
if ( where )
location = fmt(" (%s)", where);

View file

@ -26,6 +26,7 @@
#include <broker/endpoint_info.hh>
using namespace std;
using namespace logging;
struct Manager::Filter {

View file

@ -112,7 +112,7 @@ public:
* This methods corresponds directly to the internal BiF defined in
* logging.bif, which just forwards here.
*/
bool RemoveFilter(EnumVal* id, const string& name);
bool RemoveFilter(EnumVal* id, const std::string& name);
/**
* Write a record to a log stream.
@ -165,7 +165,7 @@ public:
* @param vals An array of log values to write, of size num_fields.
* The method takes ownership of the array.
*/
bool WriteFromRemote(EnumVal* stream, EnumVal* writer, const string& path,
bool WriteFromRemote(EnumVal* stream, EnumVal* writer, const std::string& path,
int num_fields, threading::Value** vals);
/**
@ -241,7 +241,7 @@ protected:
// Takes ownership of fields and info.
WriterFrontend* CreateWriter(EnumVal* id, EnumVal* writer, WriterBackend::WriterInfo* info,
int num_fields, const threading::Field* const* fields,
bool local, bool remote, bool from_remote, const string& instantiating_filter="");
bool local, bool remote, bool from_remote, const std::string& instantiating_filter="");
// Signals that a file has been rotated.
bool FinishedRotation(WriterFrontend* writer, const char* new_name, const char* old_name,
@ -256,7 +256,7 @@ private:
struct WriterInfo;
bool TraverseRecord(Stream* stream, Filter* filter, RecordType* rt,
TableVal* include, TableVal* exclude, const string& path, const list<int>& indices);
TableVal* include, TableVal* exclude, const std::string& path, const std::list<int>& indices);
threading::Value** RecordToFilterVals(Stream* stream, Filter* filter,
RecordVal* columns);
@ -270,7 +270,7 @@ private:
bool CompareFields(const Filter* filter, const WriterFrontend* writer);
bool CheckFilterWriterConflict(const WriterInfo* winfo, const Filter* filter);
vector<Stream *> streams; // Indexed by stream enum.
std::vector<Stream *> streams; // Indexed by stream enum.
int rotations_pending; // Number of rotations not yet finished.
};

View file

@ -10,6 +10,7 @@
#include "Ascii.h"
#include "ascii.bif.h"
using namespace std;
using namespace logging::writer;
using namespace threading;
using threading::Value;

View file

@ -17,7 +17,7 @@ public:
explicit Ascii(WriterFrontend* frontend);
~Ascii() override;
static string LogExt();
static std::string LogExt();
static WriterBackend* Instantiate(WriterFrontend* frontend)
{ return new Ascii(frontend); }
@ -35,11 +35,11 @@ protected:
bool DoHeartbeat(double network_time, double current_time) override;
private:
bool IsSpecial(const string &path) { return path.find("/dev/") == 0; }
bool WriteHeader(const string& path);
bool WriteHeaderField(const string& key, const string& value);
bool IsSpecial(const std::string &path) { return path.find("/dev/") == 0; }
bool WriteHeader(const std::string& path);
bool WriteHeaderField(const std::string& key, const std::string& value);
void CloseFile(double t);
string Timestamp(double t); // Uses current time if t is zero.
std::string Timestamp(double t); // Uses current time if t is zero.
void InitConfigOptions();
bool InitFilterOptions();
bool InitFormatter();
@ -48,7 +48,7 @@ private:
int fd;
gzFile gzfile;
string fname;
std::string fname;
ODesc desc;
bool ascii_done;
@ -57,17 +57,17 @@ private:
bool include_meta;
bool tsv;
string separator;
string set_separator;
string empty_field;
string unset_field;
string meta_prefix;
std::string separator;
std::string set_separator;
std::string empty_field;
std::string unset_field;
std::string meta_prefix;
int gzip_level; // level > 0 enables gzip compression
string gzip_file_extension;
std::string gzip_file_extension;
bool use_json;
bool enable_utf_8;
string json_timestamps;
std::string json_timestamps;
threading::formatter::Formatter* formatter;
bool init_options;
@ -75,4 +75,3 @@ private:
}
}

View file

@ -21,14 +21,14 @@ bool None::DoInit(const WriterInfo& info, int num_fields,
// Output the config sorted by keys.
std::vector<std::pair<string, string> > keys;
std::vector<std::pair<std::string, std::string> > keys;
for ( WriterInfo::config_map::const_iterator i = info.config.begin(); i != info.config.end(); i++ )
keys.push_back(std::make_pair(i->first, i->second));
std::sort(keys.begin(), keys.end());
for ( std::vector<std::pair<string,string> >::const_iterator i = keys.begin(); i != keys.end(); i++ )
for ( std::vector<std::pair<std::string, std::string> >::const_iterator i = keys.begin(); i != keys.end(); i++ )
std::cout << " config[" << (*i).first << "] = " << (*i).second << std::endl;
for ( int i = 0; i < num_fields; i++ )

View file

@ -11,6 +11,7 @@
#include "SQLite.h"
#include "sqlite.bif.h"
using namespace std;
using namespace logging;
using namespace writer;
using threading::Value;

View file

@ -37,7 +37,7 @@ private:
bool checkError(int code);
int AddParams(threading::Value* val, int pos);
string GetTableType(int, int);
std::string GetTableType(int, int);
const threading::Field* const * fields; // raw mapping
unsigned int num_fields;
@ -45,9 +45,9 @@ private:
sqlite3 *db;
sqlite3_stmt *st;
string set_separator;
string unset_field;
string empty_field;
std::string set_separator;
std::string unset_field;
std::string empty_field;
threading::formatter::Ascii* io;
};

View file

@ -137,8 +137,8 @@ const char* fmt_conn_id(const IPAddr& src_addr, uint32_t src_port,
static char buffer[512];
snprintf(buffer, sizeof(buffer), "%s:%d > %s:%d",
string(src_addr).c_str(), src_port,
string(dst_addr).c_str(), dst_port);
std::string(src_addr).c_str(), src_port,
std::string(dst_addr).c_str(), dst_port);
return buffer;
}

View file

@ -114,7 +114,7 @@ extern int brolex();
* Part of the module facility: while parsing, keep track of which
* module to put things in.
*/
string current_module = GLOBAL_MODULE_NAME;
std::string current_module = GLOBAL_MODULE_NAME;
bool is_export = false; // true if in an export {} block
/*
@ -196,7 +196,7 @@ static attr_list* copy_attr_list(attr_list* al)
static void extend_record(ID* id, type_decl_list* fields, attr_list* attrs)
{
set<BroType*> types = BroType::GetAliases(id->Name());
std::set<BroType*> types = BroType::GetAliases(id->Name());
if ( types.empty() )
{
@ -204,7 +204,7 @@ static void extend_record(ID* id, type_decl_list* fields, attr_list* attrs)
return;
}
for ( set<BroType*>::const_iterator it = types.begin(); it != types.end(); )
for ( std::set<BroType*>::const_iterator it = types.begin(); it != types.end(); )
{
RecordType* add_to = (*it)->AsRecordType();
const char* error = 0;

View file

@ -37,7 +37,7 @@ public:
* @param local_id The local part of the ID of the new enum type
* (e.g., "Tag").
*/
ComponentManager(const string& module, const string& local_id);
ComponentManager(const std::string& module, const std::string& local_id);
/**
* @return The script-layer module in which the component's "Tag" ID lives.
@ -47,7 +47,7 @@ public:
/**
* @return A list of all registered components.
*/
list<C*> GetComponents() const;
std::list<C*> GetComponents() const;
/**
* @return The enum type associated with the script-layer "Tag".
@ -77,7 +77,7 @@ public:
* @return The component's tag, or a tag representing an error if
* no such component assoicated with the name exists.
*/
T GetComponentTag(const string& name) const;
T GetComponentTag(const std::string& name) const;
/**
* Get a component tag from its enum value.
@ -97,14 +97,14 @@ public:
* value will be a concatenation of this prefix and the component's
* canonical name.
*/
void RegisterComponent(C* component, const string& prefix = "");
void RegisterComponent(C* component, const std::string& prefix = "");
/**
* @param name The canonical name of a component.
* @return The component associated with the name or a null pointer if no
* such component exists.
*/
C* Lookup(const string& name) const;
C* Lookup(const std::string& name) const;
/**
* @param name A component tag.
@ -121,15 +121,15 @@ public:
C* Lookup(EnumVal* val) const;
private:
string module; /**< Script layer module in which component tags live. */
std::string module; /**< Script layer module in which component tags live. */
IntrusivePtr<EnumType> tag_enum_type; /**< Enum type of component tags. */
map<string, C*> components_by_name;
map<T, C*> components_by_tag;
map<int, C*> components_by_val;
std::map<std::string, C*> components_by_name;
std::map<T, C*> components_by_tag;
std::map<int, C*> components_by_val;
};
template <class T, class C>
ComponentManager<T, C>::ComponentManager(const string& arg_module, const string& local_id)
ComponentManager<T, C>::ComponentManager(const std::string& arg_module, const std::string& local_id)
: module(arg_module),
tag_enum_type(make_intrusive<EnumType>(module + "::" + local_id))
{
@ -145,10 +145,10 @@ const std::string& ComponentManager<T, C>::GetModule() const
}
template <class T, class C>
list<C*> ComponentManager<T, C>::GetComponents() const
std::list<C*> ComponentManager<T, C>::GetComponents() const
{
list<C*> rval;
typename map<T, C*>::const_iterator i;
std::list<C*> rval;
typename std::map<T, C*>::const_iterator i;
for ( i = components_by_tag.begin(); i != components_by_tag.end(); ++i )
rval.push_back(i->second);
@ -187,7 +187,7 @@ const std::string& ComponentManager<T, C>::GetComponentName(Val* val) const
}
template <class T, class C>
T ComponentManager<T, C>::GetComponentTag(const string& name) const
T ComponentManager<T, C>::GetComponentTag(const std::string& name) const
{
C* c = Lookup(name);
return c ? c->Tag() : T();
@ -201,9 +201,9 @@ T ComponentManager<T, C>::GetComponentTag(Val* v) const
}
template <class T, class C>
C* ComponentManager<T, C>::Lookup(const string& name) const
C* ComponentManager<T, C>::Lookup(const std::string& name) const
{
typename map<string, C*>::const_iterator i =
typename std::map<std::string, C*>::const_iterator i =
components_by_name.find(to_upper(name));
return i != components_by_name.end() ? i->second : 0;
}
@ -211,21 +211,21 @@ C* ComponentManager<T, C>::Lookup(const string& name) const
template <class T, class C>
C* ComponentManager<T, C>::Lookup(const T& tag) const
{
typename map<T, C*>::const_iterator i = components_by_tag.find(tag);
typename std::map<T, C*>::const_iterator i = components_by_tag.find(tag);
return i != components_by_tag.end() ? i->second : 0;
}
template <class T, class C>
C* ComponentManager<T, C>::Lookup(EnumVal* val) const
{
typename map<int, C*>::const_iterator i =
typename std::map<int, C*>::const_iterator i =
components_by_val.find(val->InternalInt());
return i != components_by_val.end() ? i->second : 0;
}
template <class T, class C>
void ComponentManager<T, C>::RegisterComponent(C* component,
const string& prefix)
const std::string& prefix)
{
std::string cname = component->CanonicalName();
@ -242,7 +242,7 @@ void ComponentManager<T, C>::RegisterComponent(C* component,
component->Tag().AsEnumVal()->InternalInt(), component));
// Install an identfier for enum value
string id = fmt("%s%s", prefix.c_str(), cname.c_str());
std::string id = fmt("%s%s", prefix.c_str(), cname.c_str());
tag_enum_type->AddName(module, id.c_str(),
component->Tag().AsEnumVal()->InternalInt(), true,
nullptr);

View file

@ -17,6 +17,7 @@
#include "../util.h"
#include "../input.h"
using namespace std;
using namespace plugin;
Plugin* Manager::current_plugin = 0;

View file

@ -238,7 +238,7 @@ public:
* if a plugin took over the file but had trouble loading it; and -1 if
* no plugin was interested in the file at all.
*/
virtual int HookLoadFile(const Plugin::LoadType type, const string& file, const string& resolved);
virtual int HookLoadFile(const Plugin::LoadType type, const std::string& file, const std::string& resolved);
/**
* Hook that filters calls to a script function/event/hook.

View file

@ -254,7 +254,7 @@ CountingBloomFilter* CountingBloomFilter::Clone() const
return copy;
}
string CountingBloomFilter::InternalState() const
std::string CountingBloomFilter::InternalState() const
{
return fmt("%" PRIu64, cells->Hash());
}

View file

@ -173,7 +173,7 @@ bool CardinalityCounter::Merge(CardinalityCounter* c)
if ( m != c->GetM() )
return false;
const vector<uint8_t>& temp = c->GetBuckets();
const std::vector<uint8_t>& temp = c->GetBuckets();
V = 0;
@ -189,7 +189,7 @@ bool CardinalityCounter::Merge(CardinalityCounter* c)
return true;
}
const vector<uint8_t> &CardinalityCounter::GetBuckets() const
const std::vector<uint8_t> &CardinalityCounter::GetBuckets() const
{
return buckets;
}

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