Val: eliminate the "BroString.h" include

This commit is contained in:
Max Kellermann 2020-02-11 10:44:53 +01:00
parent 728184ea93
commit e98cf0a4a0
21 changed files with 48 additions and 6 deletions

View file

@ -3,6 +3,7 @@
#include "zeek-config.h"
#include "CompHash.h"
#include "BroString.h"
#include "Dict.h"
#include "Val.h"
#include "Reporter.h"

View file

@ -31,6 +31,7 @@
#include <algorithm>
#include "BroString.h"
#include "Event.h"
#include "Net.h"
#include "Val.h"

View file

@ -6,6 +6,7 @@
#include <algorithm>
#include "BroString.h"
#include "Net.h"
#include "Func.h"
#include "Var.h"

View file

@ -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;

View file

@ -7,6 +7,7 @@
#include "RuleAction.h"
#include "RuleCondition.h"
#include "BroString.h"
#include "ID.h"
#include "IntSet.h"
#include "IP.h"

View file

@ -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();

View file

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

View file

@ -7,6 +7,7 @@
#include "binpac.h"
#include "analyzer/protocol/pia/PIA.h"
#include "../BroString.h"
#include "../Event.h"
namespace analyzer {

View file

@ -9,6 +9,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include "BroString.h"
#include "NetVar.h"
#include "Sessions.h"
#include "Event.h"

View file

@ -5,6 +5,7 @@
#include <stdlib.h>
#include "BroString.h"
#include "NetVar.h"
#include "Event.h"
#include "Base64.h"

View file

@ -1,5 +1,6 @@
%extern{
#include "Sessions.h"
#include "BroString.h"
%}
%code{

View file

@ -4,6 +4,7 @@
#include <ctype.h>
#include "BroString.h"
#include "NetVar.h"
#include "Ident.h"
#include "Event.h"

View file

@ -6,6 +6,7 @@
#include <ctype.h>
#include <stdlib.h>
#include "BroString.h"
#include "NetVar.h"
#include "RE.h"
#include "Reporter.h"

View file

@ -5,6 +5,7 @@
#include <stdlib.h>
#include "BroString.h"
#include "NetVar.h"
#include "Event.h"
#include "Reporter.h"

View file

@ -5,6 +5,7 @@
#include <ctype.h>
#include "BroString.h"
#include "NetVar.h"
#include "Sessions.h"
#include "Event.h"

View file

@ -6,6 +6,7 @@
#include <algorithm>
#include <vector>
#include "BroString.h"
#include "NetVar.h"
#include "XDR.h"
#include "Event.h"

View file

@ -6,6 +6,7 @@
#include <utility>
#include <vector>
#include "BroString.h"
#include "NetVar.h"
#include "XDR.h"
#include "Event.h"

View file

@ -1,5 +1,9 @@
%include consts.pac
%extern{
#include "BroString.h"
%}
# Common constructs across SSH1 and SSH2
########################################

View file

@ -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"

View file

@ -5,6 +5,7 @@
#include "IP.h"
#include "Reporter.h"
#include "Sessions.h"
#include "BroString.h"
#include "events.bif.h"

View file

@ -13,6 +13,7 @@
#include <sstream>
#include "iosource/Manager.h"
#include "BroString.h"
#include "Dict.h"
#include "Reporter.h"
#include "Scope.h"