mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Val: eliminate the "BroString.h" include
This commit is contained in:
parent
728184ea93
commit
e98cf0a4a0
21 changed files with 48 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "zeek-config.h"
|
||||
|
||||
#include "CompHash.h"
|
||||
#include "BroString.h"
|
||||
#include "Dict.h"
|
||||
#include "Val.h"
|
||||
#include "Reporter.h"
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "Event.h"
|
||||
#include "Net.h"
|
||||
#include "Val.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "Net.h"
|
||||
#include "Func.h"
|
||||
#include "Var.h"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Type.h"
|
||||
#include "Val.h"
|
||||
#include "Var.h"
|
||||
#include "BroString.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
static RecordType* ip4_hdr_type = 0;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "RuleAction.h"
|
||||
#include "RuleCondition.h"
|
||||
#include "BroString.h"
|
||||
#include "ID.h"
|
||||
#include "IntSet.h"
|
||||
#include "IP.h"
|
||||
|
|
21
src/Val.cc
21
src/Val.cc
|
@ -14,6 +14,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "Attr.h"
|
||||
#include "BroString.h"
|
||||
#include "CompHash.h"
|
||||
#include "Dict.h"
|
||||
#include "Net.h"
|
||||
|
@ -998,6 +999,26 @@ StringVal::StringVal(const string& s) : Val(TYPE_STRING)
|
|||
val.string_val = new BroString(reinterpret_cast<const u_char*>(s.data()), s.length(), 1);
|
||||
}
|
||||
|
||||
Val* StringVal::SizeVal() const
|
||||
{
|
||||
return val_mgr->GetCount(val.string_val->Len());
|
||||
}
|
||||
|
||||
int StringVal::Len()
|
||||
{
|
||||
return AsString()->Len();
|
||||
}
|
||||
|
||||
const u_char* StringVal::Bytes()
|
||||
{
|
||||
return AsString()->Bytes();
|
||||
}
|
||||
|
||||
const char* StringVal::CheckString()
|
||||
{
|
||||
return AsString()->CheckString();
|
||||
}
|
||||
|
||||
string StringVal::ToStdString() const
|
||||
{
|
||||
auto* bs = AsString();
|
||||
|
|
11
src/Val.h
11
src/Val.h
|
@ -3,7 +3,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "Type.h"
|
||||
#include "BroString.h"
|
||||
#include "Timer.h"
|
||||
#include "Notifier.h"
|
||||
#include "RE.h"
|
||||
|
@ -33,6 +32,7 @@ template<typename T> class PDict;
|
|||
class IterCookie;
|
||||
|
||||
class Val;
|
||||
class BroString;
|
||||
class BroFunc;
|
||||
class Func;
|
||||
class BroFile;
|
||||
|
@ -546,12 +546,11 @@ public:
|
|||
explicit StringVal(const string& s);
|
||||
StringVal(int length, const char* s);
|
||||
|
||||
Val* SizeVal() const override
|
||||
{ return val_mgr->GetCount(val.string_val->Len()); }
|
||||
Val* SizeVal() const override;
|
||||
|
||||
int Len() { return AsString()->Len(); }
|
||||
const u_char* Bytes() { return AsString()->Bytes(); }
|
||||
const char* CheckString() { return AsString()->CheckString(); }
|
||||
int Len();
|
||||
const u_char* Bytes();
|
||||
const char* CheckString();
|
||||
|
||||
// Note that one needs to de-allocate the return value of
|
||||
// ExpandedString() to avoid a memory leak.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "binpac.h"
|
||||
|
||||
#include "analyzer/protocol/pia/PIA.h"
|
||||
#include "../BroString.h"
|
||||
#include "../Event.h"
|
||||
|
||||
namespace analyzer {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "NetVar.h"
|
||||
#include "Sessions.h"
|
||||
#include "Event.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "NetVar.h"
|
||||
#include "Event.h"
|
||||
#include "Base64.h"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
%extern{
|
||||
#include "Sessions.h"
|
||||
#include "BroString.h"
|
||||
%}
|
||||
|
||||
%code{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "NetVar.h"
|
||||
#include "Ident.h"
|
||||
#include "Event.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "NetVar.h"
|
||||
#include "RE.h"
|
||||
#include "Reporter.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "NetVar.h"
|
||||
#include "Event.h"
|
||||
#include "Reporter.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "NetVar.h"
|
||||
#include "Sessions.h"
|
||||
#include "Event.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "NetVar.h"
|
||||
#include "XDR.h"
|
||||
#include "Event.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "BroString.h"
|
||||
#include "NetVar.h"
|
||||
#include "XDR.h"
|
||||
#include "Event.h"
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
%include consts.pac
|
||||
|
||||
%extern{
|
||||
#include "BroString.h"
|
||||
%}
|
||||
|
||||
# Common constructs across SSH1 and SSH2
|
||||
########################################
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "File.h"
|
||||
#include "analyzer/Analyzer.h"
|
||||
#include "analyzer/protocol/tcp/TCP.h"
|
||||
#include "BroString.h"
|
||||
#include "Reporter.h"
|
||||
#include "RuleMatcher.h"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "IP.h"
|
||||
#include "Reporter.h"
|
||||
#include "Sessions.h"
|
||||
#include "BroString.h"
|
||||
|
||||
#include "events.bif.h"
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <sstream>
|
||||
|
||||
#include "iosource/Manager.h"
|
||||
#include "BroString.h"
|
||||
#include "Dict.h"
|
||||
#include "Reporter.h"
|
||||
#include "Scope.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue