mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Remove "using namespace std" from header files
This commit is contained in:
parent
13a431f9fb
commit
62161dcc34
18 changed files with 78 additions and 85 deletions
|
@ -13,7 +13,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
#include "net_util.h"
|
#include "net_util.h"
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
@ -20,23 +19,23 @@ class VectorVal;
|
||||||
|
|
||||||
class BroString {
|
class BroString {
|
||||||
public:
|
public:
|
||||||
typedef vector<BroString*> Vec;
|
typedef std::vector<BroString*> Vec;
|
||||||
typedef Vec::iterator VecIt;
|
typedef Vec::iterator VecIt;
|
||||||
typedef Vec::const_iterator VecCIt;
|
typedef Vec::const_iterator VecCIt;
|
||||||
|
|
||||||
typedef vector<const BroString*> CVec;
|
typedef std::vector<const BroString*> CVec;
|
||||||
typedef Vec::iterator CVecIt;
|
typedef Vec::iterator CVecIt;
|
||||||
typedef Vec::const_iterator CVecCIt;
|
typedef Vec::const_iterator CVecCIt;
|
||||||
|
|
||||||
// IdxVecs are vectors of indices of characters in a string.
|
// IdxVecs are vectors of indices of characters in a string.
|
||||||
typedef vector<int> IdxVec;
|
typedef std::vector<int> IdxVec;
|
||||||
typedef IdxVec::iterator IdxVecIt;
|
typedef IdxVec::iterator IdxVecIt;
|
||||||
typedef IdxVec::const_iterator IdxVecCIt;
|
typedef IdxVec::const_iterator IdxVecCIt;
|
||||||
|
|
||||||
// Constructors creating internal copies of the data passed in.
|
// Constructors creating internal copies of the data passed in.
|
||||||
BroString(const u_char* str, int arg_n, int add_NUL);
|
BroString(const u_char* str, int arg_n, int add_NUL);
|
||||||
explicit BroString(const char* str);
|
explicit BroString(const char* str);
|
||||||
explicit BroString(const string& str);
|
explicit BroString(const std::string& str);
|
||||||
BroString(const BroString& bs);
|
BroString(const BroString& bs);
|
||||||
|
|
||||||
// Constructor that takes owernship of the vector passed in.
|
// Constructor that takes owernship of the vector passed in.
|
||||||
|
@ -64,7 +63,7 @@ public:
|
||||||
//
|
//
|
||||||
void Set(const u_char* str, int len, int add_NUL=1);
|
void Set(const u_char* str, int len, int add_NUL=1);
|
||||||
void Set(const char* str);
|
void Set(const char* str);
|
||||||
void Set(const string& str);
|
void Set(const std::string& str);
|
||||||
void Set(const BroString &str);
|
void Set(const BroString &str);
|
||||||
|
|
||||||
void SetUseFreeToDelete(int use_it)
|
void SetUseFreeToDelete(int use_it)
|
||||||
|
@ -103,13 +102,13 @@ public:
|
||||||
// Also more useful for debugging purposes since no deallocation
|
// Also more useful for debugging purposes since no deallocation
|
||||||
// is required on your part here.
|
// is required on your part here.
|
||||||
//
|
//
|
||||||
ostream& Render(ostream& os, int format = ESC_SER) const;
|
std::ostream& Render(std::ostream& os, int format = ESC_SER) const;
|
||||||
|
|
||||||
// Reads a string from an input stream. Unless you use a render
|
// Reads a string from an input stream. Unless you use a render
|
||||||
// style combination that uses ESC_SER, note that the streams
|
// style combination that uses ESC_SER, note that the streams
|
||||||
// will consider whitespace as a field delimiter.
|
// will consider whitespace as a field delimiter.
|
||||||
//
|
//
|
||||||
istream& Read(istream& is, int format = ESC_SER);
|
std::istream& Read(std::istream& is, int format = ESC_SER);
|
||||||
|
|
||||||
// XXX Fix redundancy: strings.bif implements both to_lower
|
// XXX Fix redundancy: strings.bif implements both to_lower
|
||||||
// XXX and to_upper; the latter doesn't use BroString::ToUpper().
|
// XXX and to_upper; the latter doesn't use BroString::ToUpper().
|
||||||
|
@ -165,7 +164,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Default output stream operator, using rendering mode EXPANDED_STRING.
|
// Default output stream operator, using rendering mode EXPANDED_STRING.
|
||||||
ostream& operator<<(ostream& os, const BroString& bs);
|
std::ostream& operator<<(std::ostream& os, const BroString& bs);
|
||||||
|
|
||||||
extern int Bstr_eq(const BroString* s1, const BroString* s2);
|
extern int Bstr_eq(const BroString* s1, const BroString* s2);
|
||||||
extern int Bstr_cmp(const BroString* s1, const BroString* s2);
|
extern int Bstr_cmp(const BroString* s1, const BroString* s2);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class DFA_State;
|
class DFA_State;
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ protected:
|
||||||
static unsigned int transition_counter; // see Xtion()
|
static unsigned int transition_counter; // see Xtion()
|
||||||
};
|
};
|
||||||
|
|
||||||
using DigestStr = basic_string<u_char>;
|
using DigestStr = std::basic_string<u_char>;
|
||||||
|
|
||||||
class DFA_State_Cache {
|
class DFA_State_Cache {
|
||||||
public:
|
public:
|
||||||
|
|
18
src/Debug.h
18
src/Debug.h
|
@ -5,8 +5,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
class Stmt;
|
class Stmt;
|
||||||
|
|
||||||
|
@ -35,10 +33,10 @@ class DbgWatch;
|
||||||
class DbgDisplay;
|
class DbgDisplay;
|
||||||
class StmtHashFn;
|
class StmtHashFn;
|
||||||
|
|
||||||
typedef map<int, DbgBreakpoint*> BPIDMapType;
|
typedef std::map<int, DbgBreakpoint*> BPIDMapType;
|
||||||
typedef multimap<const Stmt*, DbgBreakpoint*> BPMapType;
|
typedef std::multimap<const Stmt*, DbgBreakpoint*> BPMapType;
|
||||||
|
|
||||||
extern string current_module;
|
extern std::string current_module;
|
||||||
|
|
||||||
class TraceState {
|
class TraceState {
|
||||||
public:
|
public:
|
||||||
|
@ -88,8 +86,8 @@ public:
|
||||||
Location last_loc; // used by 'list'; the last location listed
|
Location last_loc; // used by 'list'; the last location listed
|
||||||
|
|
||||||
BPIDMapType breakpoints; // BPID -> Breakpoint
|
BPIDMapType breakpoints; // BPID -> Breakpoint
|
||||||
vector<DbgWatch*> watches;
|
std::vector<DbgWatch*> watches;
|
||||||
vector<DbgDisplay*> displays;
|
std::vector<DbgDisplay*> displays;
|
||||||
BPMapType breakpoint_map; // maps Stmt -> Breakpoints on it
|
BPMapType breakpoint_map; // maps Stmt -> Breakpoints on it
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -135,7 +133,7 @@ extern DebuggerState g_debugger_state;
|
||||||
// Multiple results can be returned depending on the input, but always
|
// Multiple results can be returned depending on the input, but always
|
||||||
// at least 1.
|
// at least 1.
|
||||||
|
|
||||||
vector<ParseLocationRec> parse_location_string(const string& s);
|
std::vector<ParseLocationRec> parse_location_string(const std::string& s);
|
||||||
|
|
||||||
// ### TODO: Add a bunch of hook functions for various events
|
// ### TODO: Add a bunch of hook functions for various events
|
||||||
// e.g. variable changed, breakpoint hit, etc.
|
// e.g. variable changed, breakpoint hit, etc.
|
||||||
|
@ -171,11 +169,11 @@ Val* dbg_eval_expr(const char* expr);
|
||||||
int dbg_read_internal_state();
|
int dbg_read_internal_state();
|
||||||
|
|
||||||
// Get line that looks like "In FnFoo(arg = val) at File:Line".
|
// Get line that looks like "In FnFoo(arg = val) at File:Line".
|
||||||
string get_context_description(const Stmt* stmt, const Frame* frame);
|
std::string get_context_description(const Stmt* stmt, const Frame* frame);
|
||||||
|
|
||||||
extern Frame* g_dbg_locals; // variables created within debugger context
|
extern Frame* g_dbg_locals; // variables created within debugger context
|
||||||
|
|
||||||
extern std::map<string, Filemap*> g_dbgfilemaps; // filename => filemap
|
extern std::map<std::string, Filemap*> g_dbgfilemaps; // filename => filemap
|
||||||
|
|
||||||
// Perhaps add a code/priority argument to do selective output.
|
// Perhaps add a code/priority argument to do selective output.
|
||||||
int debug_msg(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
int debug_msg(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "Queue.h"
|
#include "Queue.h"
|
||||||
#include "DebugCmdConstants.h"
|
#include "DebugCmdConstants.h"
|
||||||
|
@ -23,7 +22,7 @@ public:
|
||||||
|
|
||||||
int Cmd() const { return cmd; }
|
int Cmd() const { return cmd; }
|
||||||
int NumNames() const { return num_names; }
|
int NumNames() const { return num_names; }
|
||||||
const vector<const char *>& Names() const { return names; }
|
const std::vector<const char *>& Names() const { return names; }
|
||||||
bool ResumeExecution() const { return resume_execution; }
|
bool ResumeExecution() const { return resume_execution; }
|
||||||
const char* Helpstring() const { return helpstring; }
|
const char* Helpstring() const { return helpstring; }
|
||||||
bool Repeatable() const { return repeatable; }
|
bool Repeatable() const { return repeatable; }
|
||||||
|
@ -32,7 +31,7 @@ protected:
|
||||||
DebugCmd cmd;
|
DebugCmd cmd;
|
||||||
|
|
||||||
int num_names;
|
int num_names;
|
||||||
vector<const char*> names;
|
std::vector<const char*> names;
|
||||||
|
|
||||||
// Whether executing this should restart execution of the script.
|
// Whether executing this should restart execution of the script.
|
||||||
bool resume_execution;
|
bool resume_execution;
|
||||||
|
@ -57,14 +56,14 @@ const DebugCmdInfo* get_debug_cmd_info(DebugCmd cmd);
|
||||||
// on whether or not the prefix supplied matches a name (DebugCmdString)
|
// on whether or not the prefix supplied matches a name (DebugCmdString)
|
||||||
// of the corresponding DebugCmd. The size of the array should be at
|
// of the corresponding DebugCmd. The size of the array should be at
|
||||||
// least NUM_DEBUG_CMDS. The total number of matches is returned.
|
// least NUM_DEBUG_CMDS. The total number of matches is returned.
|
||||||
int find_all_matching_cmds(const string& prefix, const char* array_of_matches[]);
|
int find_all_matching_cmds(const std::string& prefix, const char* array_of_matches[]);
|
||||||
|
|
||||||
// Implementation of debugging commands.
|
// Implementation of debugging commands.
|
||||||
//
|
//
|
||||||
// These functions return <= 0 if failure, > 0 for success.
|
// These functions return <= 0 if failure, > 0 for success.
|
||||||
// More particular return values are command-specific: see comments w/function.
|
// More particular return values are command-specific: see comments w/function.
|
||||||
|
|
||||||
typedef int DbgCmdFn(DebugCmd cmd, const vector<string>& args);
|
typedef int DbgCmdFn(DebugCmd cmd, const std::vector<std::string>& args);
|
||||||
|
|
||||||
DbgCmdFn dbg_cmd_backtrace;
|
DbgCmdFn dbg_cmd_backtrace;
|
||||||
DbgCmdFn dbg_cmd_frame;
|
DbgCmdFn dbg_cmd_frame;
|
||||||
|
|
17
src/Desc.h
17
src/Desc.h
|
@ -5,6 +5,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "BroString.h"
|
#include "BroString.h"
|
||||||
|
|
||||||
|
@ -56,13 +57,13 @@ public:
|
||||||
void EnableUTF8();
|
void EnableUTF8();
|
||||||
void AddEscapeSequence(const char* s) { escape_sequences.insert(s); }
|
void AddEscapeSequence(const char* s) { escape_sequences.insert(s); }
|
||||||
void AddEscapeSequence(const char* s, size_t n)
|
void AddEscapeSequence(const char* s, size_t n)
|
||||||
{ escape_sequences.insert(string(s, n)); }
|
{ escape_sequences.insert(std::string(s, n)); }
|
||||||
void AddEscapeSequence(const string & s)
|
void AddEscapeSequence(const std::string & s)
|
||||||
{ escape_sequences.insert(s); }
|
{ escape_sequences.insert(s); }
|
||||||
void RemoveEscapeSequence(const char* s) { escape_sequences.erase(s); }
|
void RemoveEscapeSequence(const char* s) { escape_sequences.erase(s); }
|
||||||
void RemoveEscapeSequence(const char* s, size_t n)
|
void RemoveEscapeSequence(const char* s, size_t n)
|
||||||
{ escape_sequences.erase(string(s, n)); }
|
{ escape_sequences.erase(std::string(s, n)); }
|
||||||
void RemoveEscapeSequence(const string & s)
|
void RemoveEscapeSequence(const std::string & s)
|
||||||
{ escape_sequences.erase(s); }
|
{ escape_sequences.erase(s); }
|
||||||
|
|
||||||
void PushIndent();
|
void PushIndent();
|
||||||
|
@ -76,7 +77,7 @@ public:
|
||||||
|
|
||||||
void Add(const char* s, int do_indent=1);
|
void Add(const char* s, int do_indent=1);
|
||||||
void AddN(const char* s, int len) { AddBytes(s, len); }
|
void AddN(const char* s, int len) { AddBytes(s, len); }
|
||||||
void Add(const string& s) { AddBytes(s.data(), s.size()); }
|
void Add(const std::string& s) { AddBytes(s.data(), s.size()); }
|
||||||
void Add(int i);
|
void Add(int i);
|
||||||
void Add(uint32_t u);
|
void Add(uint32_t u);
|
||||||
void Add(int64_t i);
|
void Add(int64_t i);
|
||||||
|
@ -119,7 +120,7 @@ public:
|
||||||
|
|
||||||
// Bypasses the escaping enabled via SetEscape().
|
// Bypasses the escaping enabled via SetEscape().
|
||||||
void AddRaw(const char* s, int len) { AddBytesRaw(s, len); }
|
void AddRaw(const char* s, int len) { AddBytesRaw(s, len); }
|
||||||
void AddRaw(const string &s) { AddBytesRaw(s.data(), s.size()); }
|
void AddRaw(const std::string &s) { AddBytesRaw(s.data(), s.size()); }
|
||||||
|
|
||||||
// Returns the description as a string.
|
// Returns the description as a string.
|
||||||
const char* Description() const { return (const char*) base; }
|
const char* Description() const { return (const char*) base; }
|
||||||
|
@ -167,7 +168,7 @@ protected:
|
||||||
* second element. The first element may be 0 if nothing is
|
* second element. The first element may be 0 if nothing is
|
||||||
* to be escaped.
|
* to be escaped.
|
||||||
*/
|
*/
|
||||||
pair<const char*, size_t> FirstEscapeLoc(const char* bytes, size_t n);
|
std::pair<const char*, size_t> FirstEscapeLoc(const char* bytes, size_t n);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param start start of string to check for starting with an espace
|
* @param start start of string to check for starting with an espace
|
||||||
|
@ -187,7 +188,7 @@ protected:
|
||||||
|
|
||||||
bool utf8; // whether valid utf-8 sequences may pass through unescaped
|
bool utf8; // whether valid utf-8 sequences may pass through unescaped
|
||||||
bool escape; // escape unprintable characters in output?
|
bool escape; // escape unprintable characters in output?
|
||||||
typedef set<string> escape_set;
|
typedef std::set<std::string> escape_set;
|
||||||
escape_set escape_sequences; // additional sequences of chars to escape
|
escape_set escape_sequences; // additional sequences of chars to escape
|
||||||
|
|
||||||
BroFile* f; // or the file we're using.
|
BroFile* f; // or the file we're using.
|
||||||
|
|
6
src/ID.h
6
src/ID.h
|
@ -27,7 +27,7 @@ public:
|
||||||
bool IsExport() const { return is_export; }
|
bool IsExport() const { return is_export; }
|
||||||
void SetExport() { is_export = true; }
|
void SetExport() { is_export = true; }
|
||||||
|
|
||||||
string ModuleName() const;
|
std::string ModuleName() const;
|
||||||
|
|
||||||
void SetType(BroType* t) { Unref(type); type = t; }
|
void SetType(BroType* t) { Unref(type); type = t; }
|
||||||
BroType* Type() { return type; }
|
BroType* Type() { return type; }
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
|
|
||||||
void MakeDeprecated(Expr* deprecation);
|
void MakeDeprecated(Expr* deprecation);
|
||||||
|
|
||||||
string GetDeprecationWarning() const;
|
std::string GetDeprecationWarning() const;
|
||||||
|
|
||||||
void Error(const char* msg, const BroObj* o2 = 0);
|
void Error(const char* msg, const BroObj* o2 = 0);
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public:
|
||||||
|
|
||||||
// Takes ownership of callback.
|
// Takes ownership of callback.
|
||||||
void AddOptionHandler(Func* callback, int priority);
|
void AddOptionHandler(Func* callback, int priority);
|
||||||
vector<Func*> GetOptionHandlers() const;
|
std::vector<Func*> GetOptionHandlers() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ID() { name = 0; type = 0; val = 0; attrs = 0; }
|
ID() { name = 0; type = 0; val = 0; attrs = 0; }
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
@ -35,5 +33,5 @@ struct ltipid {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef set<IP_ID, ltipid> IP_IDSet;
|
typedef std::set<IP_ID, ltipid> IP_IDSet;
|
||||||
uint16_t NextIP_ID(const uint32_t src_addr, const uint16_t id);
|
uint16_t NextIP_ID(const uint32_t src_addr, const uint16_t id);
|
||||||
|
|
9
src/RE.h
9
src/RE.h
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
typedef int (*cce_func)(int);
|
typedef int (*cce_func)(int);
|
||||||
|
@ -60,7 +61,7 @@ public:
|
||||||
// functionality.
|
// functionality.
|
||||||
std::string LookupDef(const std::string& def);
|
std::string LookupDef(const std::string& def);
|
||||||
|
|
||||||
void InsertCCL(const char* txt, CCL* ccl) { ccl_dict[string(txt)] = ccl; }
|
void InsertCCL(const char* txt, CCL* ccl) { ccl_dict[std::string(txt)] = ccl; }
|
||||||
int InsertCCL(CCL* ccl)
|
int InsertCCL(CCL* ccl)
|
||||||
{
|
{
|
||||||
ccl_list.push_back(ccl);
|
ccl_list.push_back(ccl);
|
||||||
|
@ -68,7 +69,7 @@ public:
|
||||||
}
|
}
|
||||||
CCL* LookupCCL(const char* txt)
|
CCL* LookupCCL(const char* txt)
|
||||||
{
|
{
|
||||||
const auto& iter = ccl_dict.find(string(txt));
|
const auto& iter = ccl_dict.find(std::string(txt));
|
||||||
if ( iter != ccl_dict.end() )
|
if ( iter != ccl_dict.end() )
|
||||||
return iter->second;
|
return iter->second;
|
||||||
|
|
||||||
|
@ -125,8 +126,8 @@ protected:
|
||||||
int multiline;
|
int multiline;
|
||||||
char* pattern_text;
|
char* pattern_text;
|
||||||
|
|
||||||
std::map<string, string> defs;
|
std::map<std::string, std::string> defs;
|
||||||
std::map<string, CCL*> ccl_dict;
|
std::map<std::string, CCL*> ccl_dict;
|
||||||
PList<CCL> ccl_list;
|
PList<CCL> ccl_list;
|
||||||
EquivClass equiv_class;
|
EquivClass equiv_class;
|
||||||
int* ecs;
|
int* ecs;
|
||||||
|
|
|
@ -15,7 +15,7 @@ class RuleHdrTest;
|
||||||
class Rule;
|
class Rule;
|
||||||
|
|
||||||
typedef PList<Rule> rule_list;
|
typedef PList<Rule> rule_list;
|
||||||
typedef std::map<string, Rule*> rule_dict;
|
typedef std::map<std::string, Rule*> rule_dict;
|
||||||
|
|
||||||
class Rule {
|
class Rule {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
BroType* ReturnType() const { return return_type; }
|
BroType* ReturnType() const { return return_type; }
|
||||||
|
|
||||||
size_t Length() const { return local.size(); }
|
size_t Length() const { return local.size(); }
|
||||||
std::map<string, ID*>& Vars() { return local; }
|
std::map<std::string, ID*>& Vars() { return local; }
|
||||||
|
|
||||||
ID* GenerateTemporary(const char* name);
|
ID* GenerateTemporary(const char* name);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ protected:
|
||||||
ID* scope_id;
|
ID* scope_id;
|
||||||
attr_list* attrs;
|
attr_list* attrs;
|
||||||
BroType* return_type;
|
BroType* return_type;
|
||||||
std::map<string, ID*> local;
|
std::map<std::string, ID*> local;
|
||||||
id_list* inits;
|
id_list* inits;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,4 +90,4 @@ extern Scope* current_scope();
|
||||||
extern Scope* global_scope();
|
extern Scope* global_scope();
|
||||||
|
|
||||||
// Current module (identified by its name).
|
// Current module (identified by its name).
|
||||||
extern string current_module;
|
extern std::string current_module;
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
class IPAddr;
|
class IPAddr;
|
||||||
|
@ -29,7 +27,7 @@ public:
|
||||||
virtual bool Read(char* v, const char* tag) = 0;
|
virtual bool Read(char* v, const char* tag) = 0;
|
||||||
virtual bool Read(bool* v, const char* tag) = 0;
|
virtual bool Read(bool* v, const char* tag) = 0;
|
||||||
virtual bool Read(double* d, const char* tag) = 0;
|
virtual bool Read(double* d, const char* tag) = 0;
|
||||||
virtual bool Read(string* s, const char* tag) = 0;
|
virtual bool Read(std::string* s, const char* tag) = 0;
|
||||||
virtual bool Read(IPAddr* addr, const char* tag) = 0;
|
virtual bool Read(IPAddr* addr, const char* tag) = 0;
|
||||||
virtual bool Read(IPPrefix* prefix, const char* tag) = 0;
|
virtual bool Read(IPPrefix* prefix, const char* tag) = 0;
|
||||||
virtual bool Read(struct in_addr* addr, const char* tag) = 0;
|
virtual bool Read(struct in_addr* addr, const char* tag) = 0;
|
||||||
|
@ -63,7 +61,7 @@ public:
|
||||||
virtual bool Write(double d, const char* tag) = 0;
|
virtual bool Write(double d, const char* tag) = 0;
|
||||||
virtual bool Write(const char* s, const char* tag) = 0;
|
virtual bool Write(const char* s, const char* tag) = 0;
|
||||||
virtual bool Write(const char* buf, int len, const char* tag) = 0;
|
virtual bool Write(const char* buf, int len, const char* tag) = 0;
|
||||||
virtual bool Write(const string& s, const char* tag) = 0;
|
virtual bool Write(const std::string& s, const char* tag) = 0;
|
||||||
virtual bool Write(const IPAddr& addr, const char* tag) = 0;
|
virtual bool Write(const IPAddr& addr, const char* tag) = 0;
|
||||||
virtual bool Write(const IPPrefix& prefix, const char* tag) = 0;
|
virtual bool Write(const IPPrefix& prefix, const char* tag) = 0;
|
||||||
virtual bool Write(const struct in_addr& addr, const char* tag) = 0;
|
virtual bool Write(const struct in_addr& addr, const char* tag) = 0;
|
||||||
|
@ -108,7 +106,7 @@ public:
|
||||||
bool Read(bool* v, const char* tag) override;
|
bool Read(bool* v, const char* tag) override;
|
||||||
bool Read(double* d, const char* tag) override;
|
bool Read(double* d, const char* tag) override;
|
||||||
bool Read(char** str, int* len, const char* tag) override;
|
bool Read(char** str, int* len, const char* tag) override;
|
||||||
bool Read(string* s, const char* tag) override;
|
bool Read(std::string* s, const char* tag) override;
|
||||||
bool Read(IPAddr* addr, const char* tag) override;
|
bool Read(IPAddr* addr, const char* tag) override;
|
||||||
bool Read(IPPrefix* prefix, const char* tag) override;
|
bool Read(IPPrefix* prefix, const char* tag) override;
|
||||||
bool Read(struct in_addr* addr, const char* tag) override;
|
bool Read(struct in_addr* addr, const char* tag) override;
|
||||||
|
@ -123,7 +121,7 @@ public:
|
||||||
bool Write(double d, const char* tag) override;
|
bool Write(double d, const char* tag) override;
|
||||||
bool Write(const char* s, const char* tag) override;
|
bool Write(const char* s, const char* tag) override;
|
||||||
bool Write(const char* buf, int len, const char* tag) override;
|
bool Write(const char* buf, int len, const char* tag) override;
|
||||||
bool Write(const string& s, const char* tag) override;
|
bool Write(const std::string& s, const char* tag) override;
|
||||||
bool Write(const IPAddr& addr, const char* tag) override;
|
bool Write(const IPAddr& addr, const char* tag) override;
|
||||||
bool Write(const IPPrefix& prefix, const char* tag) override;
|
bool Write(const IPPrefix& prefix, const char* tag) override;
|
||||||
bool Write(const struct in_addr& addr, const char* tag) override;
|
bool Write(const struct in_addr& addr, const char* tag) override;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "BroString.h"
|
#include "BroString.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
// BroSubstrings are essentially BroStrings, augmented with indexing
|
// BroSubstrings are essentially BroStrings, augmented with indexing
|
||||||
// information required for the Smith-Waterman algorithm. Each substring
|
// information required for the Smith-Waterman algorithm. Each substring
|
||||||
|
@ -15,7 +14,7 @@ using namespace std;
|
||||||
class BroSubstring : public BroString {
|
class BroSubstring : public BroString {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef vector<BroSubstring*> Vec;
|
typedef std::vector<BroSubstring*> Vec;
|
||||||
typedef Vec::iterator VecIt;
|
typedef Vec::iterator VecIt;
|
||||||
typedef Vec::const_iterator VecCIt;
|
typedef Vec::const_iterator VecCIt;
|
||||||
|
|
||||||
|
@ -36,11 +35,11 @@ public:
|
||||||
int index;
|
int index;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef vector<BSSAlign> BSSAlignVec;
|
typedef std::vector<BSSAlign> BSSAlignVec;
|
||||||
typedef BSSAlignVec::iterator BSSAlignVecIt;
|
typedef BSSAlignVec::iterator BSSAlignVecIt;
|
||||||
typedef BSSAlignVec::const_iterator BSSAlignVecCIt;
|
typedef BSSAlignVec::const_iterator BSSAlignVecCIt;
|
||||||
|
|
||||||
explicit BroSubstring(const string& string)
|
explicit BroSubstring(const std::string& string)
|
||||||
: BroString(string), _num(), _new(false) { }
|
: BroString(string), _num(), _new(false) { }
|
||||||
|
|
||||||
explicit BroSubstring(const BroString& string)
|
explicit BroSubstring(const BroString& string)
|
||||||
|
@ -76,7 +75,7 @@ public:
|
||||||
unsigned int index);
|
unsigned int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef map<string, void*> DataMap;
|
typedef std::map<std::string, void*> DataMap;
|
||||||
typedef DataMap::iterator DataMapIt;
|
typedef DataMap::iterator DataMapIt;
|
||||||
|
|
||||||
BroSubstring();
|
BroSubstring();
|
||||||
|
|
30
src/Type.h
30
src/Type.h
|
@ -262,8 +262,8 @@ public:
|
||||||
|
|
||||||
virtual unsigned MemoryAllocation() const;
|
virtual unsigned MemoryAllocation() const;
|
||||||
|
|
||||||
void SetName(const string& arg_name) { name = arg_name; }
|
void SetName(const std::string& arg_name) { name = arg_name; }
|
||||||
const string& GetName() const { return name; }
|
const std::string& GetName() const { return name; }
|
||||||
|
|
||||||
typedef std::map<std::string, std::set<BroType*> > TypeAliasMap;
|
typedef std::map<std::string, std::set<BroType*> > TypeAliasMap;
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ private:
|
||||||
InternalTypeTag internal_tag;
|
InternalTypeTag internal_tag;
|
||||||
bool is_network_order;
|
bool is_network_order;
|
||||||
bool base_type;
|
bool base_type;
|
||||||
string name;
|
std::string name;
|
||||||
|
|
||||||
static TypeAliasMap type_aliases;
|
static TypeAliasMap type_aliases;
|
||||||
};
|
};
|
||||||
|
@ -402,7 +402,7 @@ public:
|
||||||
const BroType* YieldType() const override;
|
const BroType* YieldType() const override;
|
||||||
void SetYieldType(BroType* arg_yield) { yield = arg_yield; }
|
void SetYieldType(BroType* arg_yield) { yield = arg_yield; }
|
||||||
function_flavor Flavor() const { return flavor; }
|
function_flavor Flavor() const { return flavor; }
|
||||||
string FlavorString() const;
|
std::string FlavorString() const;
|
||||||
|
|
||||||
// Used to convert a function type to an event or hook type.
|
// Used to convert a function type to an event or hook type.
|
||||||
void ClearYieldType(function_flavor arg_flav)
|
void ClearYieldType(function_flavor arg_flav)
|
||||||
|
@ -504,7 +504,7 @@ public:
|
||||||
return decl && decl->FindAttr(at) != 0;
|
return decl && decl->FindAttr(at) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string GetFieldDeprecationWarning(int field, bool has_check) const;
|
std::string GetFieldDeprecationWarning(int field, bool has_check) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RecordType() { types = 0; }
|
RecordType() { types = 0; }
|
||||||
|
@ -537,11 +537,11 @@ protected:
|
||||||
|
|
||||||
class OpaqueType : public BroType {
|
class OpaqueType : public BroType {
|
||||||
public:
|
public:
|
||||||
explicit OpaqueType(const string& name);
|
explicit OpaqueType(const std::string& name);
|
||||||
OpaqueType* ShallowClone() override { return new OpaqueType(name); }
|
OpaqueType* ShallowClone() override { return new OpaqueType(name); }
|
||||||
~OpaqueType() override { };
|
~OpaqueType() override { };
|
||||||
|
|
||||||
const string& Name() const { return name; }
|
const std::string& Name() const { return name; }
|
||||||
|
|
||||||
void Describe(ODesc* d) const override;
|
void Describe(ODesc* d) const override;
|
||||||
void DescribeReST(ODesc* d, bool roles_only = false) const override;
|
void DescribeReST(ODesc* d, bool roles_only = false) const override;
|
||||||
|
@ -549,29 +549,29 @@ public:
|
||||||
protected:
|
protected:
|
||||||
OpaqueType() { }
|
OpaqueType() { }
|
||||||
|
|
||||||
string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnumType : public BroType {
|
class EnumType : public BroType {
|
||||||
public:
|
public:
|
||||||
typedef std::list<std::pair<string, bro_int_t> > enum_name_list;
|
typedef std::list<std::pair<std::string, bro_int_t> > enum_name_list;
|
||||||
|
|
||||||
explicit EnumType(const EnumType* e);
|
explicit EnumType(const EnumType* e);
|
||||||
explicit EnumType(const string& arg_name);
|
explicit EnumType(const std::string& arg_name);
|
||||||
EnumType* ShallowClone() override;
|
EnumType* ShallowClone() override;
|
||||||
~EnumType() override;
|
~EnumType() override;
|
||||||
|
|
||||||
// The value of this name is next internal counter value, starting
|
// The value of this name is next internal counter value, starting
|
||||||
// with zero. The internal counter is incremented.
|
// with zero. The internal counter is incremented.
|
||||||
void AddName(const string& module_name, const char* name, bool is_export, Expr* deprecation = nullptr);
|
void AddName(const std::string& module_name, const char* name, bool is_export, Expr* deprecation = nullptr);
|
||||||
|
|
||||||
// The value of this name is set to val. Once a value has been
|
// The value of this name is set to val. Once a value has been
|
||||||
// explicitly assigned using this method, no further names can be
|
// explicitly assigned using this method, no further names can be
|
||||||
// added that aren't likewise explicitly initalized.
|
// added that aren't likewise explicitly initalized.
|
||||||
void AddName(const string& module_name, const char* name, bro_int_t val, bool is_export, Expr* deprecation = nullptr);
|
void AddName(const std::string& module_name, const char* name, bro_int_t val, bool is_export, Expr* deprecation = nullptr);
|
||||||
|
|
||||||
// -1 indicates not found.
|
// -1 indicates not found.
|
||||||
bro_int_t Lookup(const string& module_name, const char* name) const;
|
bro_int_t Lookup(const std::string& module_name, const char* name) const;
|
||||||
const char* Lookup(bro_int_t value) const; // Returns 0 if not found
|
const char* Lookup(bro_int_t value) const; // Returns 0 if not found
|
||||||
|
|
||||||
// Returns the list of defined names with their values. The names
|
// Returns the list of defined names with their values. The names
|
||||||
|
@ -585,10 +585,10 @@ public:
|
||||||
protected:
|
protected:
|
||||||
EnumType() { counter = 0; }
|
EnumType() { counter = 0; }
|
||||||
|
|
||||||
void AddNameInternal(const string& module_name,
|
void AddNameInternal(const std::string& module_name,
|
||||||
const char* name, bro_int_t val, bool is_export);
|
const char* name, bro_int_t val, bool is_export);
|
||||||
|
|
||||||
void CheckAndAddName(const string& module_name,
|
void CheckAndAddName(const std::string& module_name,
|
||||||
const char* name, bro_int_t val, bool is_export,
|
const char* name, bro_int_t val, bool is_export,
|
||||||
Expr* deprecation = nullptr);
|
Expr* deprecation = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "BroList.h"
|
#include "BroList.h"
|
||||||
|
|
||||||
|
@ -40,7 +39,7 @@ extern const char* prog;
|
||||||
|
|
||||||
extern name_list prefixes; // -p flag
|
extern name_list prefixes; // -p flag
|
||||||
extern char* command_line_policy; // -e flag
|
extern char* command_line_policy; // -e flag
|
||||||
extern vector<string> params;
|
extern std::vector<std::string> params;
|
||||||
|
|
||||||
class Stmt;
|
class Stmt;
|
||||||
extern Stmt* stmts; // global statements
|
extern Stmt* stmts; // global statements
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "module_util.h"
|
#include "module_util.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
static int streq(const char* s1, const char* s2)
|
static int streq(const char* s1, const char* s2)
|
||||||
{
|
{
|
||||||
return ! strcmp(s1, s2);
|
return ! strcmp(s1, s2);
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
static const char* GLOBAL_MODULE_NAME = "GLOBAL";
|
static const char* GLOBAL_MODULE_NAME = "GLOBAL";
|
||||||
|
|
||||||
extern string extract_module_name(const char* name);
|
extern std::string extract_module_name(const char* name);
|
||||||
extern string extract_var_name(const char* name);
|
extern std::string extract_var_name(const char* name);
|
||||||
extern string normalized_module_name(const char* module_name); // w/o ::
|
extern std::string normalized_module_name(const char* module_name); // w/o ::
|
||||||
|
|
||||||
// Concatenates module_name::var_name unless var_name is already fully
|
// Concatenates module_name::var_name unless var_name is already fully
|
||||||
// qualified, in which case it is returned unmodified.
|
// qualified, in which case it is returned unmodified.
|
||||||
extern string make_full_var_name(const char* module_name, const char* var_name);
|
extern std::string make_full_var_name(const char* module_name, const char* var_name);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <broker/data.hh>
|
#include <broker/data.hh>
|
||||||
#include <broker/expected.hh>
|
#include <broker/expected.hh>
|
||||||
|
@ -75,7 +76,7 @@ public:
|
||||||
* Returns a string with a representation of the Bloom filter's
|
* Returns a string with a representation of the Bloom filter's
|
||||||
* internal state. This is for debugging/testing purposes only.
|
* internal state. This is for debugging/testing purposes only.
|
||||||
*/
|
*/
|
||||||
virtual string InternalState() const = 0;
|
virtual std::string InternalState() const = 0;
|
||||||
|
|
||||||
broker::expected<broker::data> Serialize() const;
|
broker::expected<broker::data> Serialize() const;
|
||||||
static std::unique_ptr<BloomFilter> Unserialize(const broker::data& data);
|
static std::unique_ptr<BloomFilter> Unserialize(const broker::data& data);
|
||||||
|
@ -154,7 +155,7 @@ public:
|
||||||
void Clear() override;
|
void Clear() override;
|
||||||
bool Merge(const BloomFilter* other) override;
|
bool Merge(const BloomFilter* other) override;
|
||||||
BasicBloomFilter* Clone() const override;
|
BasicBloomFilter* Clone() const override;
|
||||||
string InternalState() const override;
|
std::string InternalState() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class BloomFilter;
|
friend class BloomFilter;
|
||||||
|
@ -203,7 +204,7 @@ public:
|
||||||
void Clear() override;
|
void Clear() override;
|
||||||
bool Merge(const BloomFilter* other) override;
|
bool Merge(const BloomFilter* other) override;
|
||||||
CountingBloomFilter* Clone() const override;
|
CountingBloomFilter* Clone() const override;
|
||||||
string InternalState() const override;
|
std::string InternalState() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class BloomFilter;
|
friend class BloomFilter;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue