mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Renaming the Logger to Reporter.
Also changing output to not include timestamps when we haven't started processing packets yet.
This commit is contained in:
parent
93894eed9b
commit
66e2c3b623
123 changed files with 722 additions and 713 deletions
|
@ -284,6 +284,7 @@ type entropy_test_result: record {
|
|||
# Prototypes of Bro built-in functions.
|
||||
@load strings.bif.bro
|
||||
@load bro.bif.bro
|
||||
@load reporter.bif.bro
|
||||
|
||||
@load logging # sic! Not logging.bif.
|
||||
@load logging-ascii
|
||||
|
@ -1558,17 +1559,17 @@ const skip_http_data = F &redef;
|
|||
# UDP tunnels. See also: udp_tunnel_port, policy/udp-tunnel.bro.
|
||||
const parse_udp_tunnels = F &redef;
|
||||
|
||||
event log_message(t: time, msg: string, location: string)
|
||||
event reporter_message(t: time, msg: string, location: string)
|
||||
{
|
||||
print fmt("[script] log_message: %s [%s] [%.6f]", msg, location, t);
|
||||
print fmt("[script] reporter_message: %s [%s] [%.6f]", msg, location, t);
|
||||
}
|
||||
|
||||
event log_warning(t: time, msg: string, location: string)
|
||||
event reporter_warning(t: time, msg: string, location: string)
|
||||
{
|
||||
print fmt("[script] log_warning: %s [%s] [%.6f]", msg, location, t);
|
||||
print fmt("[script] reporter_warning: %s [%s] [%.6f]", msg, location, t);
|
||||
}
|
||||
|
||||
event log_error(t: time, msg: string, location: string)
|
||||
event reporter_error(t: time, msg: string, location: string)
|
||||
{
|
||||
print fmt("[script] log_error: %s [%s] [%.6f]", msg, location, t);
|
||||
print fmt("[script] reporter_error: %s [%s] [%.6f]", msg, location, t);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ event bro_init()
|
|||
{
|
||||
# Disable packet processing.
|
||||
install_src_net_filter(0.0.0.0/0, 0, 100);
|
||||
# Log::message("waiting for hand-over - packet processing disabled.");
|
||||
# Reporter::message("waiting for hand-over - packet processing disabled.");
|
||||
}
|
||||
|
||||
event remote_connection_error(p: event_peer, reason: string)
|
||||
|
@ -55,7 +55,7 @@ event remote_connection_error(p: event_peer, reason: string)
|
|||
return;
|
||||
|
||||
# Seems that the other side in not running.
|
||||
# Log::error("can't connect for hand-over - starting processing ...");
|
||||
# Reporter::error("can't connect for hand-over - starting processing ...");
|
||||
handover_start_processing();
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ event remote_connection_established(p: event_peer)
|
|||
if ( ! is_handover_peer(p) )
|
||||
return;
|
||||
|
||||
# Log::message(fmt("requesting hand-over from %s:%d", p$host, p$p));
|
||||
# Reporter::message(fmt("requesting hand-over from %s:%d", p$host, p$p));
|
||||
|
||||
request_remote_events(p, /handover_.*|finished_send_state/);
|
||||
|
||||
|
@ -85,7 +85,7 @@ event remote_connection_established(p: event_peer)
|
|||
# if the remote host is defined as a hand-over host in remote_peers.
|
||||
if ( is_handover_peer(p) )
|
||||
{
|
||||
# Log::message(fmt("allowing hand-over from %s:%d", p$host, p$p));
|
||||
# Reporter::message(fmt("allowing hand-over from %s:%d", p$host, p$p));
|
||||
request_remote_events(p, /handover_.*|finished_send_state/);
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ event handover_send_state(p: event_peer)
|
|||
# we will have to try again.
|
||||
if ( ! send_state(p) )
|
||||
{
|
||||
# Log::message("can't send state; serialization in progress");
|
||||
# Reporter::message("can't send state; serialization in progress");
|
||||
schedule 5 secs { handover_send_state(p$host, p$p) };
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ event finished_send_state(p: event_peer)
|
|||
if ( ! is_handover_peer(p) )
|
||||
return;
|
||||
|
||||
#Log::message(fmt("full state received from %s:%d - starting processing ...",
|
||||
#Reporter::message(fmt("full state received from %s:%d - starting processing ...",
|
||||
# p$host, p$p));
|
||||
|
||||
event handover_got_state(p);
|
||||
|
@ -139,6 +139,6 @@ event handover_got_state(p: event_peer)
|
|||
if ( ! (is_remote_event() && is_it_us(p$host, p$p)) )
|
||||
return;
|
||||
|
||||
# Log::message(fmt("%s:%d received our state - terminating", p$host, p$p));
|
||||
# Reporter::message(fmt("%s:%d received our state - terminating", p$host, p$p));
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -133,11 +133,6 @@ export {
|
|||
global flush: function(id: ID): bool;
|
||||
global add_default_filter: function(id: ID) : bool;
|
||||
global remove_default_filter: function(id: ID) : bool;
|
||||
|
||||
# Defined in logging.bif.
|
||||
# global message: function(msg: string) : bool;
|
||||
# global warning: function(msg: string) : bool;
|
||||
# global error: function(msg: string) : bool;
|
||||
}
|
||||
|
||||
# We keep a script-level copy of all filters so that we can manipulate them.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "ARP.h"
|
||||
#include "Event.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
|
||||
ARP_Analyzer::ARP_Analyzer()
|
||||
|
@ -219,7 +219,7 @@ void ARP_Analyzer::BadARP(const struct arp_pkthdr* hdr, const char* msg)
|
|||
|
||||
void ARP_Analyzer::Corrupted(const char* msg)
|
||||
{
|
||||
bro_logger->Weird(msg);
|
||||
reporter->Weird(msg);
|
||||
}
|
||||
|
||||
void ARP_Analyzer::RREvent(EventHandlerPtr e,
|
||||
|
|
|
@ -916,12 +916,12 @@ void TransportLayerAnalyzer::Done()
|
|||
void TransportLayerAnalyzer::SetContentsFile(unsigned int /* direction */,
|
||||
BroFile* /* f */)
|
||||
{
|
||||
bro_logger->Error("analyzer type does not support writing to a contents file");
|
||||
reporter->Error("analyzer type does not support writing to a contents file");
|
||||
}
|
||||
|
||||
BroFile* TransportLayerAnalyzer::GetContentsFile(unsigned int /* direction */) const
|
||||
{
|
||||
bro_logger->Error("analyzer type does not support writing to a contents file");
|
||||
reporter->Error("analyzer type does not support writing to a contents file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
12
src/Anon.cc
12
src/Anon.cc
|
@ -159,7 +159,7 @@ int AnonymizeIPAddr_A50::PreservePrefix(ipaddr32_t input, int num_bits)
|
|||
|
||||
if ( ! before_anonymization )
|
||||
{
|
||||
bro_logger->Error("prefix perservation specified after anonymization begun");
|
||||
reporter->Error("prefix perservation specified after anonymization begun");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::new_node_block()
|
|||
int block_size = 1024;
|
||||
Node* block = new Node[block_size];
|
||||
if ( ! block )
|
||||
bro_logger->InternalError("out of memory!");
|
||||
reporter->InternalError("out of memory!");
|
||||
|
||||
blocks.push_back(block);
|
||||
|
||||
|
@ -258,7 +258,7 @@ ipaddr32_t AnonymizeIPAddr_A50::make_output(ipaddr32_t old_output, int swivel) c
|
|||
AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::make_peer(ipaddr32_t a, Node* n)
|
||||
{
|
||||
if ( a == 0 || a == 0xFFFFFFFFU )
|
||||
bro_logger->InternalError("0.0.0.0 and 255.255.255.255 should never get into the tree");
|
||||
reporter->InternalError("0.0.0.0 and 255.255.255.255 should never get into the tree");
|
||||
|
||||
// Become a peer.
|
||||
// Algorithm: create two nodes, the two peers. Leave orig node as
|
||||
|
@ -341,7 +341,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::find_node(ipaddr32_t a)
|
|||
}
|
||||
}
|
||||
|
||||
bro_logger->InternalError("out of memory!");
|
||||
reporter->InternalError("out of memory!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -389,14 +389,14 @@ ipaddr32_t anonymize_ip(ipaddr32_t ip, enum ip_addr_anonymization_class_t cl)
|
|||
new_ip = ip;
|
||||
|
||||
else if ( ! ip_anonymizer[method] )
|
||||
bro_logger->InternalError("IP anonymizer not initialized");
|
||||
reporter->InternalError("IP anonymizer not initialized");
|
||||
|
||||
else
|
||||
new_ip = ip_anonymizer[method]->Anonymize(ip);
|
||||
}
|
||||
|
||||
else
|
||||
bro_logger->InternalError("invalid IP anonymization method");
|
||||
reporter->InternalError("invalid IP anonymization method");
|
||||
|
||||
#ifdef LOG_ANONYMIZATION_MAPPING
|
||||
log_anonymization_mapping(ip, new_ip);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "net_util.h"
|
||||
|
||||
// TODO: Anon.h may not be the right place to put these functions ...
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
// Keep the specified prefix unchanged.
|
||||
virtual int PreservePrefix(ipaddr32_t /* input */, int /* num_bits */)
|
||||
{
|
||||
bro_logger->InternalError("prefix preserving is not supported for the anonymizer");
|
||||
reporter->InternalError("prefix preserving is not supported for the anonymizer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ int Base64Decoder::Decode(int len, const char* data, int* pblen, char** pbuf)
|
|||
char* buf;
|
||||
|
||||
if ( ! pbuf )
|
||||
bro_logger->InternalError("nil pointer to decoding result buffer");
|
||||
reporter->InternalError("nil pointer to decoding result buffer");
|
||||
|
||||
if ( *pbuf )
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
if ( analyzer )
|
||||
analyzer->Weird("base64_illegal_encoding", msg);
|
||||
else
|
||||
bro_logger->Error(msg);
|
||||
reporter->Error(msg);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "BroString.h"
|
||||
#include "Var.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_STR(msg) DBG_LOG(DBG_STRING, msg)
|
||||
|
@ -176,9 +176,9 @@ const char* BroString::CheckString() const
|
|||
// Either an embedded NUL, or no final NUL.
|
||||
char* exp_s = Render();
|
||||
if ( b[n-1] != '\0' )
|
||||
bro_logger->Error("string without NUL terminator: \"%s\"", exp_s);
|
||||
reporter->Error("string without NUL terminator: \"%s\"", exp_s);
|
||||
else
|
||||
bro_logger->Error("string with embedded NUL: \"%s\"", exp_s);
|
||||
reporter->Error("string with embedded NUL: \"%s\"", exp_s);
|
||||
|
||||
delete [] exp_s;
|
||||
return "<string-with-NUL>";
|
||||
|
|
|
@ -137,6 +137,7 @@ set(BIF_SRCS
|
|||
const.bif
|
||||
types.bif
|
||||
strings.bif
|
||||
reporter.bif
|
||||
)
|
||||
|
||||
foreach (bift ${BIF_SRCS})
|
||||
|
@ -326,7 +327,7 @@ set(bro_SRCS
|
|||
IOSource.cc
|
||||
IRC.cc
|
||||
List.cc
|
||||
Logger.cc
|
||||
Reporter.cc
|
||||
LogMgr.cc
|
||||
LogWriter.cc
|
||||
LogWriterAscii.cc
|
||||
|
|
|
@ -195,7 +195,7 @@ bool ChunkedIOFd::WriteChunk(Chunk* chunk, bool partial)
|
|||
assert(chunk->len <= BUFFER_SIZE - sizeof(uint32) );
|
||||
|
||||
if ( chunk->len == 0 )
|
||||
bro_logger->InternalError( "attempt to write 0 bytes chunk");
|
||||
reporter->InternalError( "attempt to write 0 bytes chunk");
|
||||
|
||||
if ( partial )
|
||||
chunk->len |= FLAG_PARTIAL;
|
||||
|
@ -285,7 +285,7 @@ bool ChunkedIOFd::FlushWriteBuffer()
|
|||
}
|
||||
|
||||
if ( written == 0 )
|
||||
bro_logger->InternalError("written==0");
|
||||
reporter->InternalError("written==0");
|
||||
|
||||
// Short write.
|
||||
write_pos += written;
|
||||
|
@ -906,7 +906,7 @@ bool ChunkedIOSSL::WriteData(char* p, uint32 len, bool* error)
|
|||
return false;
|
||||
}
|
||||
|
||||
bro_logger->InternalError("can't be reached");
|
||||
reporter->InternalError("can't be reached");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ bool ChunkedIOSSL::ReadData(char* p, uint32 len, bool* error)
|
|||
}
|
||||
|
||||
// Can't be reached.
|
||||
bro_logger->InternalError("can't be reached");
|
||||
reporter->InternalError("can't be reached");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "CompHash.h"
|
||||
#include "Val.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
CompositeHash::CompositeHash(TypeList* composite_type)
|
||||
{
|
||||
|
@ -192,7 +192,7 @@ char* CompositeHash::SingleValHash(int type_check, char* kp0,
|
|||
}
|
||||
else
|
||||
{
|
||||
bro_logger->InternalError("bad index type in CompositeHash::SingleValHash");
|
||||
reporter->InternalError("bad index type in CompositeHash::SingleValHash");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ HashKey* CompositeHash::ComputeSingletonHash(const Val* v, int type_check) const
|
|||
if ( v->Type()->Tag() == TYPE_FUNC )
|
||||
return new HashKey(v);
|
||||
|
||||
bro_logger->InternalError("bad index type in CompositeHash::ComputeSingletonHash");
|
||||
reporter->InternalError("bad index type in CompositeHash::ComputeSingletonHash");
|
||||
return 0;
|
||||
|
||||
case TYPE_INTERNAL_STRING:
|
||||
|
@ -325,7 +325,7 @@ HashKey* CompositeHash::ComputeSingletonHash(const Val* v, int type_check) const
|
|||
return 0;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad internal type in CompositeHash::ComputeSingletonHash");
|
||||
reporter->InternalError("bad internal type in CompositeHash::ComputeSingletonHash");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
|
|||
}
|
||||
else
|
||||
{
|
||||
bro_logger->InternalError("bad index type in CompositeHash::CompositeHash");
|
||||
reporter->InternalError("bad index type in CompositeHash::CompositeHash");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ ListVal* CompositeHash::RecoverVals(const HashKey* k) const
|
|||
}
|
||||
|
||||
if ( kp != k_end )
|
||||
bro_logger->InternalError("under-ran key in CompositeHash::DescribeKey %ld", k_end - kp);
|
||||
reporter->InternalError("under-ran key in CompositeHash::DescribeKey %ld", k_end - kp);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
{
|
||||
// k->Size() == 0 for a single empty string.
|
||||
if ( kp0 >= k_end && k->Size() > 0 )
|
||||
bro_logger->InternalError("over-ran key in CompositeHash::RecoverVals");
|
||||
reporter->InternalError("over-ran key in CompositeHash::RecoverVals");
|
||||
|
||||
TypeTag tag = t->Tag();
|
||||
InternalTypeTag it = t->InternalType();
|
||||
|
@ -581,7 +581,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad internal unsigned int in CompositeHash::RecoverOneVal()");
|
||||
reporter->InternalError("bad internal unsigned int in CompositeHash::RecoverOneVal()");
|
||||
pval = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad internal address in CompositeHash::RecoverOneVal()");
|
||||
reporter->InternalError("bad internal address in CompositeHash::RecoverOneVal()");
|
||||
pval = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -649,21 +649,21 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
Val* v = *kp;
|
||||
|
||||
if ( ! v || ! v->Type() )
|
||||
bro_logger->InternalError("bad aggregate Val in CompositeHash::RecoverOneVal()");
|
||||
reporter->InternalError("bad aggregate Val in CompositeHash::RecoverOneVal()");
|
||||
|
||||
if ( t->Tag() != TYPE_FUNC &&
|
||||
// ### Maybe fix later, but may be fundamentally
|
||||
// un-checkable --US
|
||||
! same_type(v->Type(), t) )
|
||||
{
|
||||
bro_logger->InternalError("inconsistent aggregate Val in CompositeHash::RecoverOneVal()");
|
||||
reporter->InternalError("inconsistent aggregate Val in CompositeHash::RecoverOneVal()");
|
||||
}
|
||||
|
||||
// ### A crude approximation for now.
|
||||
if ( t->Tag() == TYPE_FUNC &&
|
||||
v->Type()->Tag() != TYPE_FUNC )
|
||||
{
|
||||
bro_logger->InternalError("inconsistent aggregate Val in CompositeHash::RecoverOneVal()");
|
||||
reporter->InternalError("inconsistent aggregate Val in CompositeHash::RecoverOneVal()");
|
||||
}
|
||||
|
||||
pval = v->Ref();
|
||||
|
@ -688,7 +688,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
rt->FieldType(i), v, optional);
|
||||
if ( ! (v || optional) )
|
||||
{
|
||||
bro_logger->InternalError("didn't recover expected number of fields from HashKey");
|
||||
reporter->InternalError("didn't recover expected number of fields from HashKey");
|
||||
pval = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
}
|
||||
else
|
||||
{
|
||||
bro_logger->InternalError("bad index type in CompositeHash::DescribeKey");
|
||||
reporter->InternalError("bad index type in CompositeHash::DescribeKey");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -34,7 +34,7 @@ protected:
|
|||
|
||||
// Recovers just one Val of possibly many; called from RecoverVals.
|
||||
// Upon return, pval will point to the recovered Val of type t.
|
||||
// Returns and updated kp for the next Val. Calls bro_logger->InternalError()
|
||||
// Returns and updated kp for the next Val. Calls reporter->InternalError()
|
||||
// upon errors, so there is no return value for invalid input.
|
||||
const char* RecoverOneVal(const HashKey* k,
|
||||
const char* kp, const char* const k_end,
|
||||
|
|
14
src/Conn.cc
14
src/Conn.cc
|
@ -11,7 +11,7 @@
|
|||
#include "Conn.h"
|
||||
#include "Event.h"
|
||||
#include "Sessions.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "Timer.h"
|
||||
#include "PIA.h"
|
||||
#include "binpac.h"
|
||||
|
@ -54,7 +54,7 @@ void ConnectionTimer::Init(Connection* arg_conn, timer_func arg_timer,
|
|||
ConnectionTimer::~ConnectionTimer()
|
||||
{
|
||||
if ( conn->RefCnt() < 1 )
|
||||
bro_logger->InternalError("reference count inconsistency in ~ConnectionTimer");
|
||||
reporter->InternalError("reference count inconsistency in ~ConnectionTimer");
|
||||
|
||||
conn->RemoveTimer(this);
|
||||
Unref(conn);
|
||||
|
@ -72,7 +72,7 @@ void ConnectionTimer::Dispatch(double t, int is_expire)
|
|||
(conn->*timer)(t);
|
||||
|
||||
if ( conn->RefCnt() < 1 )
|
||||
bro_logger->InternalError("reference count inconsistency in ConnectionTimer::Dispatch");
|
||||
reporter->InternalError("reference count inconsistency in ConnectionTimer::Dispatch");
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIAL(ConnectionTimer, SER_CONNECTION_TIMER);
|
||||
|
@ -94,7 +94,7 @@ bool ConnectionTimer::DoSerialize(SerialInfo* info) const
|
|||
else if ( timer == timer_func(&Connection::RemoveConnectionTimer) )
|
||||
type = 4;
|
||||
else
|
||||
bro_logger->InternalError("unknown function in ConnectionTimer::DoSerialize()");
|
||||
reporter->InternalError("unknown function in ConnectionTimer::DoSerialize()");
|
||||
|
||||
return conn->Serialize(info) && SERIALIZE(type) && SERIALIZE(do_expire);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ Connection::Connection(NetSessions* s, HashKey* k, double t, const ConnID* id)
|
|||
Connection::~Connection()
|
||||
{
|
||||
if ( ! finished )
|
||||
bro_logger->InternalError("Done() not called before destruction of Connection");
|
||||
reporter->InternalError("Done() not called before destruction of Connection");
|
||||
|
||||
CancelTimers();
|
||||
|
||||
|
@ -639,7 +639,7 @@ void Connection::ConnectionEvent(EventHandlerPtr f, Analyzer* a, val_list* vl)
|
|||
void Connection::Weird(const char* name, const char* addl)
|
||||
{
|
||||
weird = 1;
|
||||
bro_logger->Weird(this, name, addl ? addl : "");
|
||||
reporter->Weird(this, name, addl ? addl : "");
|
||||
}
|
||||
|
||||
void Connection::AddTimer(timer_func timer, double t, int do_expire,
|
||||
|
@ -750,7 +750,7 @@ void Connection::Describe(ODesc* d) const
|
|||
break;
|
||||
|
||||
case TRANSPORT_UNKNOWN:
|
||||
bro_logger->InternalError("unknown transport in Connction::Describe()");
|
||||
reporter->InternalError("unknown transport in Connction::Describe()");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -663,7 +663,7 @@ const IP_Hdr* ConnCompressor::PendingConnToPacket(const PendingConn* c)
|
|||
// only an IPv4 address.
|
||||
#ifdef BROv6
|
||||
if ( ! is_v4_addr(c->key.ip1) || ! is_v4_addr(c->key.ip2) )
|
||||
bro_logger->InternalError("IPv6 snuck into connection compressor");
|
||||
reporter->InternalError("IPv6 snuck into connection compressor");
|
||||
#endif
|
||||
*(uint32*) &ip->ip_src =
|
||||
to_v4_addr(c->ip1_is_src ? c->key.ip1 : c->key.ip2);
|
||||
|
@ -933,7 +933,7 @@ void ConnCompressor::Event(const PendingConn* pending, double t,
|
|||
{
|
||||
// Special case to go through the logger.
|
||||
const char* msg = arg->AsString()->CheckString();
|
||||
bro_logger->Weird(conn_val->Ref(), msg);
|
||||
reporter->Weird(conn_val->Ref(), msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ private:
|
|||
|
||||
void Weird(const PendingConn* pending, double t, const char* msg)
|
||||
{
|
||||
// This will actually go through the Logger; Event() takes care of
|
||||
// This will actually go through the Reporter; Event() takes care of
|
||||
// that.
|
||||
Event(pending, t, conn_weird, TCP_ENDPOINT_INACTIVE, 0,
|
||||
TCP_ENDPOINT_INACTIVE, new StringVal(msg));
|
||||
|
|
|
@ -103,7 +103,7 @@ void ContentLine_Analyzer::DeliverStream(int len, const u_char* data,
|
|||
buf = tmp;
|
||||
|
||||
if ( ! buf )
|
||||
bro_logger->InternalError("out of memory delivering endpoint line");
|
||||
reporter->InternalError("out of memory delivering endpoint line");
|
||||
}
|
||||
|
||||
DoDeliver(len, data);
|
||||
|
@ -125,7 +125,7 @@ void ContentLine_Analyzer::EndpointEOF(bool is_orig)
|
|||
void ContentLine_Analyzer::SetPlainDelivery(int64_t length)
|
||||
{
|
||||
if ( length < 0 )
|
||||
bro_logger->InternalError("negative length for plain delivery");
|
||||
reporter->InternalError("negative length for plain delivery");
|
||||
|
||||
plain_delivery_length = length;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ UUID::UUID(const u_char d[16])
|
|||
UUID::UUID(const binpac::bytestring& uuid)
|
||||
{
|
||||
if ( uuid.length() != 16 )
|
||||
bro_logger->InternalError("UUID length error");
|
||||
reporter->InternalError("UUID length error");
|
||||
memcpy(data, uuid.begin(), 16);
|
||||
s = uuid_to_string(data);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ UUID::UUID(const char* str)
|
|||
}
|
||||
|
||||
if ( i != 16 )
|
||||
bro_logger->InternalError("invalid UUID string: %s", str);
|
||||
reporter->InternalError("invalid UUID string: %s", str);
|
||||
}
|
||||
|
||||
typedef map<UUID, BifEnum::dce_rpc_if_id> uuid_map_t;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "Event.h"
|
||||
#include "Net.h"
|
||||
#include "Var.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
extern "C" {
|
||||
extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
|
@ -353,7 +353,7 @@ DNS_Mgr::DNS_Mgr(DNS_MgrMode arg_mode)
|
|||
nb_dns = nb_dns_init(err);
|
||||
|
||||
if ( ! nb_dns )
|
||||
bro_logger->Warning(fmt("problem initializing NB-DNS: %s", err));
|
||||
reporter->Warning(fmt("problem initializing NB-DNS: %s", err));
|
||||
|
||||
dns_mapping_valid = dns_mapping_unverified = dns_mapping_new_name =
|
||||
dns_mapping_lost_name = dns_mapping_name_changed =
|
||||
|
@ -440,7 +440,7 @@ TableVal* DNS_Mgr::LookupHost(const char* name)
|
|||
return d->Addrs()->ConvertToSet();
|
||||
else
|
||||
{
|
||||
bro_logger->Warning("no such host:", name);
|
||||
reporter->Warning("no such host:", name);
|
||||
return empty_addr_set();
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ TableVal* DNS_Mgr::LookupHost(const char* name)
|
|||
return empty_addr_set();
|
||||
|
||||
case DNS_FORCE:
|
||||
bro_logger->InternalError("can't find DNS entry for %s in cache", name);
|
||||
reporter->InternalError("can't find DNS entry for %s in cache", name);
|
||||
return 0;
|
||||
|
||||
case DNS_DEFAULT:
|
||||
|
@ -462,7 +462,7 @@ TableVal* DNS_Mgr::LookupHost(const char* name)
|
|||
return LookupHost(name);
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad mode in DNS_Mgr::LookupHost");
|
||||
reporter->InternalError("bad mode in DNS_Mgr::LookupHost");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ Val* DNS_Mgr::LookupAddr(uint32 addr)
|
|||
return d->Host();
|
||||
else
|
||||
{
|
||||
bro_logger->Warning("can't resolve IP address:", dotted_addr(addr));
|
||||
reporter->Warning("can't resolve IP address:", dotted_addr(addr));
|
||||
return new StringVal(dotted_addr(addr));
|
||||
}
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ Val* DNS_Mgr::LookupAddr(uint32 addr)
|
|||
return new StringVal("<none>");
|
||||
|
||||
case DNS_FORCE:
|
||||
bro_logger->InternalError("can't find DNS entry for %s in cache",
|
||||
reporter->InternalError("can't find DNS entry for %s in cache",
|
||||
dotted_addr(addr));
|
||||
return 0;
|
||||
|
||||
|
@ -506,7 +506,7 @@ Val* DNS_Mgr::LookupAddr(uint32 addr)
|
|||
return LookupAddr(addr);
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad mode in DNS_Mgr::LookupHost");
|
||||
reporter->InternalError("bad mode in DNS_Mgr::LookupHost");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ void DNS_Mgr::Resolve()
|
|||
struct nb_dns_result r;
|
||||
status = nb_dns_activity(nb_dns, &r, err);
|
||||
if ( status < 0 )
|
||||
bro_logger->InternalError(
|
||||
reporter->InternalError(
|
||||
"NB-DNS error in DNS_Mgr::WaitForReplies (%s)",
|
||||
err);
|
||||
else if ( status > 0 )
|
||||
|
@ -745,7 +745,7 @@ void DNS_Mgr::CompareMappings(DNS_Mapping* prev_dm, DNS_Mapping* new_dm)
|
|||
ListVal* new_a = new_dm->Addrs();
|
||||
|
||||
if ( ! prev_a || ! new_a )
|
||||
bro_logger->InternalError("confused in DNS_Mgr::CompareMappings");
|
||||
reporter->InternalError("confused in DNS_Mgr::CompareMappings");
|
||||
|
||||
ListVal* prev_delta = AddrListDelta(prev_a, new_a);
|
||||
ListVal* new_delta = AddrListDelta(new_a, prev_a);
|
||||
|
@ -815,7 +815,7 @@ void DNS_Mgr::LoadCache(FILE* f)
|
|||
}
|
||||
|
||||
if ( ! m->NoMapping() )
|
||||
bro_logger->InternalError("DNS cache corrupted");
|
||||
reporter->InternalError("DNS cache corrupted");
|
||||
|
||||
delete m;
|
||||
fclose(f);
|
||||
|
@ -935,7 +935,7 @@ void DNS_Mgr::IssueAsyncRequests()
|
|||
|
||||
if ( ! dr->MakeRequest(nb_dns) )
|
||||
{
|
||||
bro_logger->Error("can't issue DNS request");
|
||||
reporter->Error("can't issue DNS request");
|
||||
req->Timeout();
|
||||
continue;
|
||||
}
|
||||
|
@ -1048,7 +1048,7 @@ void DNS_Mgr::Process()
|
|||
int status = nb_dns_activity(nb_dns, &r, err);
|
||||
|
||||
if ( status < 0 )
|
||||
bro_logger->InternalError("NB-DNS error in DNS_Mgr::Process (%s)", err);
|
||||
reporter->InternalError("NB-DNS error in DNS_Mgr::Process (%s)", err);
|
||||
|
||||
else if ( status > 0 )
|
||||
{
|
||||
|
@ -1072,7 +1072,7 @@ int DNS_Mgr::AnswerAvailable(int timeout)
|
|||
{
|
||||
int fd = nb_dns_fd(nb_dns);
|
||||
if ( fd < 0 )
|
||||
bro_logger->InternalError("nb_dns_fd() failed in DNS_Mgr::WaitForReplies");
|
||||
reporter->InternalError("nb_dns_fd() failed in DNS_Mgr::WaitForReplies");
|
||||
|
||||
fd_set read_fds;
|
||||
|
||||
|
@ -1089,11 +1089,11 @@ int DNS_Mgr::AnswerAvailable(int timeout)
|
|||
{
|
||||
if ( errno == EINTR )
|
||||
return -1;
|
||||
bro_logger->InternalError("problem with DNS select");
|
||||
reporter->InternalError("problem with DNS select");
|
||||
}
|
||||
|
||||
if ( status > 1 )
|
||||
bro_logger->InternalError("strange return from DNS select");
|
||||
reporter->InternalError("strange return from DNS select");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ bool DPM::BuildInitialAnalyzerTree(TransportProto proto, Connection* conn,
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown protocol");
|
||||
reporter->InternalError("unknown protocol");
|
||||
}
|
||||
|
||||
if ( ! root )
|
||||
|
|
|
@ -204,7 +204,7 @@ bool DbgBreakpoint::Reset()
|
|||
break;
|
||||
}
|
||||
|
||||
bro_logger->InternalError("DbgBreakpoint::Reset function incomplete.");
|
||||
reporter->InternalError("DbgBreakpoint::Reset function incomplete.");
|
||||
|
||||
// Cannot be reached.
|
||||
return false;
|
||||
|
@ -295,7 +295,7 @@ BreakCode DbgBreakpoint::ShouldBreak(Stmt* s)
|
|||
assert(false);
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("Invalid breakpoint type in DbgBreakpoint::ShouldBreak");
|
||||
reporter->InternalError("Invalid breakpoint type in DbgBreakpoint::ShouldBreak");
|
||||
}
|
||||
|
||||
// If we got here, that means that the breakpoint could hit,
|
||||
|
@ -312,7 +312,7 @@ BreakCode DbgBreakpoint::ShouldBreak(Stmt* s)
|
|||
BreakCode DbgBreakpoint::ShouldBreak(double t)
|
||||
{
|
||||
if ( kind != BP_TIME )
|
||||
bro_logger->InternalError("Calling ShouldBreak(time) on a non-time breakpoint");
|
||||
reporter->InternalError("Calling ShouldBreak(time) on a non-time breakpoint");
|
||||
|
||||
if ( t < at_time )
|
||||
return bcNoHit;
|
||||
|
@ -353,6 +353,6 @@ void DbgBreakpoint::PrintHitMsg()
|
|||
assert(false);
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("Missed a case in DbgBreakpoint::PrintHitMsg\n");
|
||||
reporter->InternalError("Missed a case in DbgBreakpoint::PrintHitMsg\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
|
||||
#include "Debug.h"
|
||||
#include "DbgWatch.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
// Support classes
|
||||
DbgWatch::DbgWatch(BroObj* var_to_watch)
|
||||
{
|
||||
bro_logger->InternalError("DbgWatch unimplemented");
|
||||
reporter->InternalError("DbgWatch unimplemented");
|
||||
}
|
||||
|
||||
DbgWatch::DbgWatch(Expr* expr_to_watch)
|
||||
{
|
||||
bro_logger->InternalError("DbgWatch unimplemented");
|
||||
reporter->InternalError("DbgWatch unimplemented");
|
||||
}
|
||||
|
||||
DbgWatch::~DbgWatch()
|
||||
|
|
16
src/Debug.cc
16
src/Debug.cc
|
@ -54,7 +54,7 @@ DebuggerState::~DebuggerState()
|
|||
bool StmtLocMapping::StartsAfter(const StmtLocMapping* m2)
|
||||
{
|
||||
if ( ! m2 )
|
||||
bro_logger->InternalError("Assertion failed: %s", "m2 != 0");
|
||||
reporter->InternalError("Assertion failed: %s", "m2 != 0");
|
||||
|
||||
return loc.first_line > m2->loc.first_line ||
|
||||
(loc.first_line == m2->loc.first_line &&
|
||||
|
@ -362,7 +362,7 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
|||
{
|
||||
Filemap* map = g_dbgfilemaps.Lookup(loc_filename);
|
||||
if ( ! map )
|
||||
bro_logger->InternalError("Policy file %s should have been loaded\n",
|
||||
reporter->InternalError("Policy file %s should have been loaded\n",
|
||||
loc_filename);
|
||||
|
||||
if ( plr.line > how_many_lines_in(loc_filename) )
|
||||
|
@ -603,7 +603,7 @@ int dbg_execute_command(const char* cmd)
|
|||
#endif
|
||||
|
||||
if ( int(cmd_code) >= num_debug_cmds() )
|
||||
bro_logger->InternalError("Assertion failed: %s", "int(cmd_code) < num_debug_cmds()");
|
||||
reporter->InternalError("Assertion failed: %s", "int(cmd_code) < num_debug_cmds()");
|
||||
|
||||
// Dispatch to the op-specific handler (with args).
|
||||
int retcode = dbg_dispatch_cmd(cmd_code, arguments);
|
||||
|
@ -612,7 +612,7 @@ int dbg_execute_command(const char* cmd)
|
|||
|
||||
const DebugCmdInfo* info = get_debug_cmd_info(cmd_code);
|
||||
if ( ! info )
|
||||
bro_logger->InternalError("Assertion failed: %s", "info");
|
||||
reporter->InternalError("Assertion failed: %s", "info");
|
||||
|
||||
if ( ! info )
|
||||
return -2; // ### yuck, why -2?
|
||||
|
@ -766,7 +766,7 @@ int dbg_handle_debug_input()
|
|||
|
||||
const Stmt* stmt = curr_frame->GetNextStmt();
|
||||
if ( ! stmt )
|
||||
bro_logger->InternalError("Assertion failed: %s", "stmt != 0");
|
||||
reporter->InternalError("Assertion failed: %s", "stmt != 0");
|
||||
|
||||
const Location loc = *stmt->GetLocationInfo();
|
||||
|
||||
|
@ -872,7 +872,7 @@ bool pre_execute_stmt(Stmt* stmt, Frame* f)
|
|||
p = g_debugger_state.breakpoint_map.equal_range(stmt);
|
||||
|
||||
if ( p.first == p.second )
|
||||
bro_logger->InternalError("Breakpoint count nonzero, but no matching breakpoints");
|
||||
reporter->InternalError("Breakpoint count nonzero, but no matching breakpoints");
|
||||
|
||||
for ( BPMapType::iterator i = p.first; i != p.second; ++i )
|
||||
{
|
||||
|
@ -943,11 +943,11 @@ Val* dbg_eval_expr(const char* expr)
|
|||
(g_frame_stack.size() - 1) - g_debugger_state.curr_frame_idx;
|
||||
|
||||
if ( ! (frame_idx >= 0 && (unsigned) frame_idx < g_frame_stack.size()) )
|
||||
bro_logger->InternalError("Assertion failed: %s", "frame_idx >= 0 && (unsigned) frame_idx < g_frame_stack.size()");
|
||||
reporter->InternalError("Assertion failed: %s", "frame_idx >= 0 && (unsigned) frame_idx < g_frame_stack.size()");
|
||||
|
||||
Frame* frame = g_frame_stack[frame_idx];
|
||||
if ( ! (frame) )
|
||||
bro_logger->InternalError("Assertion failed: %s", "frame");
|
||||
reporter->InternalError("Assertion failed: %s", "frame");
|
||||
|
||||
const BroFunc* func = frame->GetFunction();
|
||||
if ( func )
|
||||
|
|
|
@ -194,7 +194,7 @@ static int dbg_backtrace_internal(int start, int end)
|
|||
if ( start < 0 || end < 0 ||
|
||||
(unsigned) start >= g_frame_stack.size() ||
|
||||
(unsigned) end >= g_frame_stack.size() )
|
||||
bro_logger->InternalError("Invalid stack frame index in DbgBacktraceInternal\n");
|
||||
reporter->InternalError("Invalid stack frame index in DbgBacktraceInternal\n");
|
||||
|
||||
if ( start < end )
|
||||
{
|
||||
|
@ -325,7 +325,7 @@ int dbg_cmd_frame(DebugCmd cmd, const vector<string>& args)
|
|||
// for 'list', 'break', etc.
|
||||
const Stmt* stmt = g_frame_stack[user_frame_number]->GetNextStmt();
|
||||
if ( ! stmt )
|
||||
bro_logger->InternalError("Assertion failed: %s", "stmt != 0");
|
||||
reporter->InternalError("Assertion failed: %s", "stmt != 0");
|
||||
|
||||
const Location loc = *stmt->GetLocationInfo();
|
||||
g_debugger_state.last_loc = loc;
|
||||
|
@ -365,7 +365,7 @@ int dbg_cmd_break(DebugCmd cmd, const vector<string>& args)
|
|||
|
||||
Stmt* stmt = g_frame_stack[user_frame_number]->GetNextStmt();
|
||||
if ( ! stmt )
|
||||
bro_logger->InternalError("Assertion failed: %s", "stmt != 0");
|
||||
reporter->InternalError("Assertion failed: %s", "stmt != 0");
|
||||
|
||||
DbgBreakpoint* bp = new DbgBreakpoint();
|
||||
bp->SetID(g_debugger_state.NextBPID());
|
||||
|
@ -530,7 +530,7 @@ int dbg_cmd_break_set_state(DebugCmd cmd, const vector<string>& args)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("Invalid command in DbgCmdBreakSetState\n");
|
||||
reporter->InternalError("Invalid command in DbgCmdBreakSetState\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ DebugLogger::DebugLogger(const char* filename)
|
|||
|
||||
file = fopen(filename, "w");
|
||||
if ( ! file )
|
||||
bro_logger->FatalError("can't open '%s' for debugging output.", filename);
|
||||
reporter->FatalError("can't open '%s' for debugging output.", filename);
|
||||
|
||||
setvbuf(file, NULL, _IOLBF, 0);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void DebugLogger::EnableStreams(const char* s)
|
|||
if ( strcasecmp("verbose", tok) == 0 )
|
||||
verbose = true;
|
||||
else
|
||||
bro_logger->InternalError("unknown debug stream %s\n", tok);
|
||||
reporter->InternalError("unknown debug stream %s\n", tok);
|
||||
}
|
||||
|
||||
tok = strtok(0, ",");
|
||||
|
|
10
src/Desc.cc
10
src/Desc.cc
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "Desc.h"
|
||||
#include "File.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
#define DEFAULT_SIZE 128
|
||||
#define SLOP 10
|
||||
|
@ -73,14 +73,14 @@ void ODesc::PushIndent()
|
|||
void ODesc::PopIndent()
|
||||
{
|
||||
if ( --indent_level < 0 )
|
||||
bro_logger->InternalError("ODesc::PopIndent underflow");
|
||||
reporter->InternalError("ODesc::PopIndent underflow");
|
||||
NL();
|
||||
}
|
||||
|
||||
void ODesc::PopIndentNoNL()
|
||||
{
|
||||
if ( --indent_level < 0 )
|
||||
bro_logger->InternalError("ODesc::PopIndent underflow");
|
||||
reporter->InternalError("ODesc::PopIndent underflow");
|
||||
}
|
||||
|
||||
void ODesc::Add(const char* s, int do_indent)
|
||||
|
@ -289,7 +289,7 @@ void ODesc::AddBytesRaw(const void* bytes, unsigned int n)
|
|||
if ( ! write_failed )
|
||||
// Most likely it's a "disk full" so report
|
||||
// subsequent failures only once.
|
||||
bro_logger->Error(fmt("error writing to %s: %s", f->Name(), strerror(errno)));
|
||||
reporter->Error(fmt("error writing to %s: %s", f->Name(), strerror(errno)));
|
||||
|
||||
write_failed = true;
|
||||
return;
|
||||
|
@ -325,5 +325,5 @@ void ODesc::Grow(unsigned int n)
|
|||
|
||||
void ODesc::OutOfMemory()
|
||||
{
|
||||
bro_logger->InternalError("out of memory");
|
||||
reporter->InternalError("out of memory");
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#endif
|
||||
|
||||
#include "Dict.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
// If the mean bucket length exceeds the following then Insert() will
|
||||
// increase the size of the hash table.
|
||||
|
@ -475,7 +475,7 @@ void Dictionary::StartChangeSize(int new_size)
|
|||
return;
|
||||
|
||||
if ( tbl2 )
|
||||
bro_logger->InternalError("Dictionary::StartChangeSize() tbl2 not NULL");
|
||||
reporter->InternalError("Dictionary::StartChangeSize() tbl2 not NULL");
|
||||
|
||||
Init2(new_size);
|
||||
|
||||
|
@ -522,7 +522,7 @@ void Dictionary::FinishChangeSize()
|
|||
{
|
||||
// Cheap safety check.
|
||||
if ( num_entries != 0 )
|
||||
bro_logger->InternalError(
|
||||
reporter->InternalError(
|
||||
"Dictionary::FinishChangeSize: num_entries is %d\n",
|
||||
num_entries);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ void EventMgr::QueueEvent(Event* event)
|
|||
void EventMgr::Dispatch()
|
||||
{
|
||||
if ( ! head )
|
||||
bro_logger->InternalError("EventMgr underflow");
|
||||
reporter->InternalError("EventMgr underflow");
|
||||
|
||||
Event* current = head;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ void EventRegistry::SetGroup(const char* name, const char* group)
|
|||
{
|
||||
EventHandler* eh = Lookup(name);
|
||||
if ( ! eh )
|
||||
bro_logger->InternalError("unknown event handler in SetGroup()");
|
||||
reporter->InternalError("unknown event handler in SetGroup()");
|
||||
|
||||
eh->SetGroup(group);
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ bool NameExpr::DoUnserialize(UnserialInfo* info)
|
|||
if ( id )
|
||||
::Ref(id);
|
||||
else
|
||||
bro_logger->Warning("unserialized unknown global name");
|
||||
reporter->Warning("unserialized unknown global name");
|
||||
|
||||
delete [] name;
|
||||
}
|
||||
|
@ -5623,7 +5623,7 @@ int same_expr(const Expr* e1, const Expr* e2)
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad tag in same_expr()");
|
||||
reporter->InternalError("bad tag in same_expr()");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -5643,7 +5643,7 @@ static Expr* make_constant(BroType* t, double d)
|
|||
case TYPE_INTERNAL_DOUBLE: v = new Val(double(d), t->Tag()); break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad type in make_constant()");
|
||||
reporter->InternalError("bad type in make_constant()");
|
||||
}
|
||||
|
||||
return new ConstExpr(v);
|
||||
|
|
54
src/File.cc
54
src/File.cc
|
@ -30,7 +30,7 @@
|
|||
#include "Net.h"
|
||||
#include "Serializer.h"
|
||||
#include "Event.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
// Timer which on dispatching rotates the file.
|
||||
class RotateTimer : public Timer {
|
||||
|
@ -94,7 +94,7 @@ static int maximize_num_fds()
|
|||
#else
|
||||
struct rlimit rl;
|
||||
if ( getrlimit(RLIMIT_NOFILE, &rl) < 0 )
|
||||
bro_logger->InternalError("maximize_num_fds(): getrlimit failed");
|
||||
reporter->InternalError("maximize_num_fds(): getrlimit failed");
|
||||
|
||||
if ( rl.rlim_max == RLIM_INFINITY )
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ static int maximize_num_fds()
|
|||
rl.rlim_cur = rl.rlim_max;
|
||||
|
||||
if ( setrlimit(RLIMIT_NOFILE, &rl) < 0 )
|
||||
bro_logger->InternalError("maximize_num_fds(): setrlimit failed");
|
||||
reporter->InternalError("maximize_num_fds(): setrlimit failed");
|
||||
|
||||
return rl.rlim_cur / 2;
|
||||
#endif
|
||||
|
@ -151,7 +151,7 @@ BroFile::BroFile(const char* arg_name, const char* arg_access, BroType* arg_t)
|
|||
t = arg_t ? arg_t : base_type(TYPE_STRING);
|
||||
if ( ! Open() )
|
||||
{
|
||||
bro_logger->Error(fmt("cannot open %s: %s", name, strerror(errno)));
|
||||
reporter->Error(fmt("cannot open %s: %s", name, strerror(errno)));
|
||||
is_open = 0;
|
||||
okay_to_manage = 0;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ FILE* BroFile::File()
|
|||
FILE* BroFile::BringIntoCache()
|
||||
{
|
||||
if ( f )
|
||||
bro_logger->InternalError("BroFile non-nil non-open file");
|
||||
reporter->InternalError("BroFile non-nil non-open file");
|
||||
|
||||
if ( num_files_in_cache >= max_files_in_cache )
|
||||
PurgeCache();
|
||||
|
@ -287,12 +287,12 @@ FILE* BroFile::BringIntoCache()
|
|||
|
||||
if ( ! f )
|
||||
{
|
||||
bro_logger->Error("can't open %s", this);
|
||||
reporter->Error("can't open %s", this);
|
||||
|
||||
f = fopen("/dev/null", "w");
|
||||
|
||||
if ( ! f )
|
||||
bro_logger->InternalError("out of file descriptors");
|
||||
reporter->InternalError("out of file descriptors");
|
||||
|
||||
okay_to_manage = 0;
|
||||
return f;
|
||||
|
@ -302,7 +302,7 @@ FILE* BroFile::BringIntoCache()
|
|||
UpdateFileSize();
|
||||
|
||||
if ( fseek(f, position, SEEK_SET) < 0 )
|
||||
bro_logger->Error("reopen seek failed", this);
|
||||
reporter->Error("reopen seek failed", this);
|
||||
|
||||
InsertAtBeginning();
|
||||
|
||||
|
@ -315,7 +315,7 @@ FILE* BroFile::Seek(long new_position)
|
|||
return 0;
|
||||
|
||||
if ( fseek(f, new_position, SEEK_SET) < 0 )
|
||||
bro_logger->Error("seek failed", this);
|
||||
reporter->Error("seek failed", this);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ void BroFile::SetBuf(bool arg_buffered)
|
|||
return;
|
||||
|
||||
if ( setvbuf(f, NULL, arg_buffered ? _IOFBF : _IOLBF, 0) != 0 )
|
||||
bro_logger->Error("setvbuf failed", this);
|
||||
reporter->Error("setvbuf failed", this);
|
||||
|
||||
buffered = arg_buffered;
|
||||
}
|
||||
|
@ -377,18 +377,18 @@ int BroFile::Close()
|
|||
void BroFile::Suspend()
|
||||
{
|
||||
if ( ! is_in_cache )
|
||||
bro_logger->InternalError("BroFile::Suspend() called for non-cached file");
|
||||
reporter->InternalError("BroFile::Suspend() called for non-cached file");
|
||||
if ( ! is_open )
|
||||
bro_logger->InternalError("BroFile::Suspend() called for non-open file");
|
||||
reporter->InternalError("BroFile::Suspend() called for non-open file");
|
||||
|
||||
Unlink();
|
||||
|
||||
if ( ! f )
|
||||
bro_logger->InternalError("BroFile::Suspend() called for nil file");
|
||||
reporter->InternalError("BroFile::Suspend() called for nil file");
|
||||
|
||||
if ( (position = ftell(f)) < 0 )
|
||||
{
|
||||
bro_logger->Error("ftell failed", this);
|
||||
reporter->Error("ftell failed", this);
|
||||
position = 0;
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ void BroFile::Suspend()
|
|||
void BroFile::PurgeCache()
|
||||
{
|
||||
if ( ! tail )
|
||||
bro_logger->InternalError("BroFile purge of empty cache");
|
||||
reporter->InternalError("BroFile purge of empty cache");
|
||||
|
||||
tail->Suspend();
|
||||
}
|
||||
|
@ -419,13 +419,13 @@ void BroFile::Unlink()
|
|||
Next()->SetPrev(prev);
|
||||
|
||||
if ( (head || tail) && ! (head && tail) )
|
||||
bro_logger->InternalError("BroFile link list botch");
|
||||
reporter->InternalError("BroFile link list botch");
|
||||
|
||||
is_in_cache = 0;
|
||||
prev = next = 0;
|
||||
|
||||
if ( --num_files_in_cache < 0 )
|
||||
bro_logger->InternalError("BroFile underflow of file cache");
|
||||
reporter->InternalError("BroFile underflow of file cache");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ void BroFile::InsertAtBeginning()
|
|||
}
|
||||
|
||||
if ( ++num_files_in_cache > max_files_in_cache )
|
||||
bro_logger->InternalError("BroFile overflow of file cache");
|
||||
reporter->InternalError("BroFile overflow of file cache");
|
||||
|
||||
is_in_cache = 1;
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ void BroFile::MoveToBeginning()
|
|||
return; // already at the beginning
|
||||
|
||||
if ( ! is_in_cache || ! prev )
|
||||
bro_logger->InternalError("BroFile inconsistency in MoveToBeginning()");
|
||||
reporter->InternalError("BroFile inconsistency in MoveToBeginning()");
|
||||
|
||||
Unlink();
|
||||
InsertAtBeginning();
|
||||
|
@ -643,7 +643,7 @@ void BroFile::InitEncrypt(const char* keyfile)
|
|||
|
||||
if ( ! key )
|
||||
{
|
||||
bro_logger->Error(fmt("can't open key file %s: %s", keyfile, strerror(errno)));
|
||||
reporter->Error(fmt("can't open key file %s: %s", keyfile, strerror(errno)));
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ void BroFile::InitEncrypt(const char* keyfile)
|
|||
pub_key = PEM_read_PUBKEY(key, 0, 0, 0);
|
||||
if ( ! pub_key )
|
||||
{
|
||||
bro_logger->Error(fmt("can't read key from %s: %s", keyfile,
|
||||
reporter->Error(fmt("can't read key from %s: %s", keyfile,
|
||||
ERR_error_string(ERR_get_error(), 0)));
|
||||
Close();
|
||||
return;
|
||||
|
@ -673,7 +673,7 @@ void BroFile::InitEncrypt(const char* keyfile)
|
|||
if ( ! EVP_SealInit(cipher_ctx, cipher_type, &psecret,
|
||||
(int*) &secret_len, iv, &pub_key, 1) )
|
||||
{
|
||||
bro_logger->Error(fmt("can't init cipher context for %s: %s", keyfile,
|
||||
reporter->Error(fmt("can't init cipher context for %s: %s", keyfile,
|
||||
ERR_error_string(ERR_get_error(), 0)));
|
||||
Close();
|
||||
return;
|
||||
|
@ -686,7 +686,7 @@ void BroFile::InitEncrypt(const char* keyfile)
|
|||
fwrite(secret, ntohl(secret_len), 1, f) &&
|
||||
fwrite(iv, iv_len, 1, f)) )
|
||||
{
|
||||
bro_logger->Error(fmt("can't write header to log file %s: %s",
|
||||
reporter->Error(fmt("can't write header to log file %s: %s",
|
||||
name, strerror(errno)));
|
||||
Close();
|
||||
return;
|
||||
|
@ -711,7 +711,7 @@ void BroFile::FinishEncrypt()
|
|||
|
||||
if ( outl && ! fwrite(cipher_buffer, outl, 1, f) )
|
||||
{
|
||||
bro_logger->Error(fmt("write error for %s: %s",
|
||||
reporter->Error(fmt("write error for %s: %s",
|
||||
name, strerror(errno)));
|
||||
return;
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ int BroFile::Write(const char* data, int len)
|
|||
if ( ! EVP_SealUpdate(cipher_ctx, cipher_buffer, &outl,
|
||||
(unsigned char*)data, inl) )
|
||||
{
|
||||
bro_logger->Error(fmt("encryption error for %s: %s",
|
||||
reporter->Error(fmt("encryption error for %s: %s",
|
||||
name,
|
||||
ERR_error_string(ERR_get_error(), 0)));
|
||||
Close();
|
||||
|
@ -752,7 +752,7 @@ int BroFile::Write(const char* data, int len)
|
|||
|
||||
if ( outl && ! fwrite(cipher_buffer, outl, 1, f) )
|
||||
{
|
||||
bro_logger->Error(fmt("write error for %s: %s",
|
||||
reporter->Error(fmt("write error for %s: %s",
|
||||
name, strerror(errno)));
|
||||
Close();
|
||||
return 0;
|
||||
|
@ -800,7 +800,7 @@ void BroFile::UpdateFileSize()
|
|||
struct stat s;
|
||||
if ( fstat(fileno(f), &s) < 0 )
|
||||
{
|
||||
bro_logger->Error(fmt("can't stat fd for %s: %s", name, strerror(errno)));
|
||||
reporter->Error(fmt("can't stat fd for %s: %s", name, strerror(errno)));
|
||||
current_size = 0;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include "FileAnalyzer.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
magic_t File_Analyzer::magic = 0;
|
||||
|
@ -76,11 +76,11 @@ void File_Analyzer::InitMagic(magic_t* magic, int flags)
|
|||
*magic = magic_open(flags);
|
||||
|
||||
if ( ! *magic )
|
||||
bro_logger->Error(fmt("can't init libmagic: %s", magic_error(*magic)));
|
||||
reporter->Error(fmt("can't init libmagic: %s", magic_error(*magic)));
|
||||
|
||||
else if ( magic_load(*magic, 0) < 0 )
|
||||
{
|
||||
bro_logger->Error(fmt("can't load magic file: %s", magic_error(*magic)));
|
||||
reporter->Error(fmt("can't load magic file: %s", magic_error(*magic)));
|
||||
magic_close(*magic);
|
||||
*magic = 0;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ int FlowSocketSrc::ExtractNextPDU()
|
|||
(struct sockaddr*) &from, &fromlen);
|
||||
if ( pdu_len < 0 )
|
||||
{
|
||||
bro_logger->Error("problem reading NetFlow data from socket");
|
||||
reporter->Error("problem reading NetFlow data from socket");
|
||||
data = 0;
|
||||
next_timestamp = -1.0;
|
||||
closed = 1;
|
||||
|
@ -86,7 +86,7 @@ int FlowSocketSrc::ExtractNextPDU()
|
|||
|
||||
if ( fromlen != sizeof(from) )
|
||||
{
|
||||
bro_logger->Error("malformed NetFlow PDU");
|
||||
reporter->Error("malformed NetFlow PDU");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ int FlowFileSrc::ExtractNextPDU()
|
|||
|
||||
if ( pdu_header.pdu_length > NF_MAX_PKT_SIZE )
|
||||
{
|
||||
bro_logger->Error("NetFlow packet too long");
|
||||
reporter->Error("NetFlow packet too long");
|
||||
|
||||
// Safely skip over the too-long PDU.
|
||||
if ( lseek(selectable_fd, pdu_header.pdu_length, SEEK_CUR) < 0 )
|
||||
|
|
|
@ -24,7 +24,7 @@ void FragTimer::Dispatch(double t, int /* is_expire */)
|
|||
if ( f )
|
||||
f->Expire(t);
|
||||
else
|
||||
bro_logger->InternalError("fragment timer dispatched w/o reassembler");
|
||||
reporter->InternalError("fragment timer dispatched w/o reassembler");
|
||||
}
|
||||
|
||||
FragReassembler::FragReassembler(NetSessions* arg_s,
|
||||
|
@ -209,7 +209,7 @@ void FragReassembler::BlockInserted(DataBlock* /* start_block */)
|
|||
break;
|
||||
|
||||
if ( b->upper > n )
|
||||
bro_logger->InternalError("bad fragment reassembly");
|
||||
reporter->InternalError("bad fragment reassembly");
|
||||
|
||||
memcpy((void*) &pkt[b->seq], (const void*) b->block,
|
||||
b->upper - b->seq);
|
||||
|
|
13
src/Func.cc
13
src/Func.cc
|
@ -48,7 +48,7 @@
|
|||
#include "RemoteSerializer.h"
|
||||
#include "Event.h"
|
||||
#include "Traverse.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
extern RETSIGTYPE sig_handler(int signo);
|
||||
|
||||
|
@ -334,7 +334,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
|
|||
(flow != FLOW_RETURN /* we fell off the end */ ||
|
||||
! result /* explicit return with no result */) &&
|
||||
! f->HasDelayed() )
|
||||
bro_logger->Warning("non-void function returns without a value:", id->Name());
|
||||
reporter->Warning("non-void function returns without a value:", id->Name());
|
||||
|
||||
if ( result && g_trace_state.DoTrace() )
|
||||
{
|
||||
|
@ -426,9 +426,9 @@ BuiltinFunc::BuiltinFunc(built_in_func arg_func, const char* arg_name,
|
|||
|
||||
id = lookup_ID(name, GLOBAL_MODULE_NAME, false);
|
||||
if ( ! id )
|
||||
bro_logger->InternalError("built-in function %s missing", name);
|
||||
reporter->InternalError("built-in function %s missing", name);
|
||||
if ( id->HasVal() )
|
||||
bro_logger->InternalError("built-in function %s multiply defined", name);
|
||||
reporter->InternalError("built-in function %s multiply defined", name);
|
||||
|
||||
id->SetVal(new Val(this));
|
||||
}
|
||||
|
@ -505,15 +505,17 @@ void builtin_error(const char* msg, BroObj* arg)
|
|||
if ( calling_expr )
|
||||
calling_expr->Error(msg, arg);
|
||||
else
|
||||
bro_logger->Error(msg, arg);
|
||||
reporter->Error(msg, arg);
|
||||
}
|
||||
|
||||
#include "bro.bif.func_h"
|
||||
#include "logging.bif.func_h"
|
||||
#include "reporter.bif.func_h"
|
||||
#include "strings.bif.func_h"
|
||||
|
||||
#include "bro.bif.func_def"
|
||||
#include "logging.bif.func_def"
|
||||
#include "reporter.bif.func_def"
|
||||
#include "strings.bif.func_def"
|
||||
|
||||
void init_builtin_funcs()
|
||||
|
@ -526,6 +528,7 @@ void init_builtin_funcs()
|
|||
|
||||
#include "bro.bif.func_init"
|
||||
#include "logging.bif.func_init"
|
||||
#include "reporter.bif.func_init"
|
||||
#include "strings.bif.func_init"
|
||||
|
||||
did_builtin_init = true;
|
||||
|
|
|
@ -574,7 +574,7 @@ void HTTP_Message::SubmitData(int len, const char* buf)
|
|||
{
|
||||
if ( buf != (const char*) data_buffer->Bytes() + buffer_offset ||
|
||||
buffer_offset + len > buffer_size )
|
||||
bro_logger->InternalError("buffer misalignment");
|
||||
reporter->InternalError("buffer misalignment");
|
||||
|
||||
buffer_offset += len;
|
||||
if ( buffer_offset >= buffer_size )
|
||||
|
@ -622,7 +622,7 @@ void HTTP_Message::SubmitEvent(int event_type, const char* detail)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unrecognized HTTP message event");
|
||||
reporter->InternalError("unrecognized HTTP message event");
|
||||
}
|
||||
|
||||
MyHTTP_Analyzer()->HTTP_Event(category, detail);
|
||||
|
@ -1095,7 +1095,7 @@ int HTTP_Analyzer::HTTP_RequestLine(const char* line, const char* end_of_line)
|
|||
request_method = new StringVal(http_methods[i]);
|
||||
|
||||
if ( ! ParseRequest(rest, end_of_line) )
|
||||
bro_logger->InternalError("HTTP ParseRequest failed");
|
||||
reporter->InternalError("HTTP ParseRequest failed");
|
||||
|
||||
Conn()->Match(Rule::HTTP_REQUEST,
|
||||
(const u_char*) unescaped_URI->AsString()->Bytes(),
|
||||
|
|
|
@ -448,7 +448,7 @@ ID* ID::Unserialize(UnserialInfo* info)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown type for UnserialInfo::id_policy");
|
||||
reporter->InternalError("unknown type for UnserialInfo::id_policy");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ bool ID::DoUnserialize(UnserialInfo* info)
|
|||
}
|
||||
|
||||
if ( installed_tmp && ! global_scope()->Remove(name) )
|
||||
bro_logger->InternalError("tmp id missing");
|
||||
reporter->InternalError("tmp id missing");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1178,7 +1178,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
AddSupportAnalyzer(new ZIP_Analyzer(Conn(), true));
|
||||
AddSupportAnalyzer(new ZIP_Analyzer(Conn(), false));
|
||||
#else
|
||||
bro_logger->Error("IRC analyzer lacking libz support");
|
||||
reporter->Error("IRC analyzer lacking libz support");
|
||||
Remove();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ bool LogVal::Read(SerializationFormat* fmt)
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unsupported type %s in LogVal::Write", type_name(type));
|
||||
reporter->InternalError("unsupported type %s in LogVal::Write", type_name(type));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -374,7 +374,7 @@ bool LogVal::Write(SerializationFormat* fmt) const
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unsupported type %s in LogVal::REad", type_name(type));
|
||||
reporter->InternalError("unsupported type %s in LogVal::REad", type_name(type));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -452,7 +452,7 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
|
||||
if ( ! same_type(rtype, BifType::Record::Log::Stream, 0) )
|
||||
{
|
||||
bro_logger->Error("sval argument not of right type");
|
||||
reporter->Error("sval argument not of right type");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
|
||||
if ( ! LogVal::IsCompatibleType(columns->FieldType(i)) )
|
||||
{
|
||||
bro_logger->Error("type of field '%s' is not support for logging output",
|
||||
reporter->Error("type of field '%s' is not support for logging output",
|
||||
columns->FieldName(i));
|
||||
|
||||
return false;
|
||||
|
@ -479,7 +479,7 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
|
||||
if ( ! log_attr_present )
|
||||
{
|
||||
bro_logger->Error("logged record type does not have any &log attributes");
|
||||
reporter->Error("logged record type does not have any &log attributes");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
|
||||
if ( ! etype->IsEvent() )
|
||||
{
|
||||
bro_logger->Error("stream event is a function, not an event");
|
||||
reporter->Error("stream event is a function, not an event");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -501,13 +501,13 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
|
||||
if ( args->length() != 1 )
|
||||
{
|
||||
bro_logger->Error("stream event must take a single argument");
|
||||
reporter->Error("stream event must take a single argument");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! same_type((*args)[0], columns) )
|
||||
{
|
||||
bro_logger->Error("stream event's argument type does not match column record type");
|
||||
reporter->Error("stream event's argument type does not match column record type");
|
||||
return new Val(0, TYPE_BOOL);
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ bool LogMgr::TraverseRecord(Stream* stream, Filter* filter, RecordType* rt,
|
|||
|
||||
else
|
||||
{
|
||||
bro_logger->Error("unsupported field type for log column");
|
||||
reporter->Error("unsupported field type for log column");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ bool LogMgr::TraverseRecord(Stream* stream, Filter* filter, RecordType* rt,
|
|||
|
||||
if ( ! filter->fields )
|
||||
{
|
||||
bro_logger->Error("out of memory in add_filter");
|
||||
reporter->Error("out of memory in add_filter");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -685,7 +685,7 @@ bool LogMgr::AddFilter(EnumVal* id, RecordVal* fval)
|
|||
|
||||
if ( ! same_type(rtype, BifType::Record::Log::Filter, 0) )
|
||||
{
|
||||
bro_logger->Error("filter argument not of right type");
|
||||
reporter->Error("filter argument not of right type");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -835,7 +835,7 @@ bool LogMgr::Write(EnumVal* id, RecordVal* columns)
|
|||
|
||||
if ( ! columns )
|
||||
{
|
||||
bro_logger->Error("incompatible log record type");
|
||||
reporter->Error("incompatible log record type");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -877,7 +877,7 @@ bool LogMgr::Write(EnumVal* id, RecordVal* columns)
|
|||
|
||||
if ( ! v->Type()->Tag() == TYPE_STRING )
|
||||
{
|
||||
bro_logger->Error("path_func did not return string");
|
||||
reporter->Error("path_func did not return string");
|
||||
Unref(v);
|
||||
return false;
|
||||
}
|
||||
|
@ -1061,7 +1061,7 @@ LogVal* LogMgr::ValToLogVal(Val* val, BroType* ty)
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unsupported type for log_write");
|
||||
reporter->InternalError("unsupported type for log_write");
|
||||
}
|
||||
|
||||
return lval;
|
||||
|
@ -1126,7 +1126,7 @@ LogWriter* LogMgr::CreateWriter(EnumVal* id, EnumVal* writer, string path,
|
|||
{
|
||||
if ( ld->type == BifEnum::Log::WRITER_DEFAULT )
|
||||
{
|
||||
bro_logger->Error("unknow writer when creating writer");
|
||||
reporter->Error("unknow writer when creating writer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ bool LogMgr::Flush(EnumVal* id)
|
|||
|
||||
void LogMgr::Error(LogWriter* writer, const char* msg)
|
||||
{
|
||||
bro_logger->Error(fmt("error with writer for %s: %s",
|
||||
reporter->Error(fmt("error with writer for %s: %s",
|
||||
writer->Path().c_str(), msg));
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ void Login_Analyzer::NewLine(bool orig, char* line)
|
|||
}
|
||||
|
||||
if ( state != LOGIN_STATE_CONFUSED )
|
||||
bro_logger->InternalError("bad state in Login_Analyzer::NewLine");
|
||||
reporter->InternalError("bad state in Login_Analyzer::NewLine");
|
||||
|
||||
// When we're in "confused", we feed each user input line to
|
||||
// login_confused_text, but also scan the text in the
|
||||
|
@ -572,7 +572,7 @@ void Login_Analyzer::AddUserText(const char* line)
|
|||
char* Login_Analyzer::PeekUserText() const
|
||||
{
|
||||
if ( num_user_text <= 0 )
|
||||
bro_logger->InternalError("underflow in Login_Analyzer::PeekUserText()");
|
||||
reporter->InternalError("underflow in Login_Analyzer::PeekUserText()");
|
||||
|
||||
return user_text[user_text_first];
|
||||
}
|
||||
|
|
18
src/MIME.cc
18
src/MIME.cc
|
@ -5,7 +5,7 @@
|
|||
#include "NetVar.h"
|
||||
#include "MIME.h"
|
||||
#include "Event.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
// Here are a few things to do:
|
||||
//
|
||||
|
@ -269,7 +269,7 @@ void MIME_Entity::init()
|
|||
MIME_Entity::~MIME_Entity()
|
||||
{
|
||||
if ( ! end_of_data )
|
||||
bro_logger->InternalError("EndOfData must be called before delete a MIME_Entity");
|
||||
reporter->InternalError("EndOfData must be called before delete a MIME_Entity");
|
||||
|
||||
delete current_header_line;
|
||||
Unref(content_type_str);
|
||||
|
@ -654,7 +654,7 @@ int MIME_Entity::CheckBoundaryDelimiter(int len, const char* data)
|
|||
{
|
||||
if ( ! multipart_boundary )
|
||||
{
|
||||
bro_logger->Warning("boundary delimiter was not specified for a multipart message\n");
|
||||
reporter->Warning("boundary delimiter was not specified for a multipart message\n");
|
||||
DEBUG_MSG("headers of the MIME entity for debug:\n");
|
||||
DebugPrintHeaders();
|
||||
return NOT_MULTIPART_BOUNDARY;
|
||||
|
@ -800,7 +800,7 @@ void MIME_Entity::DecodeBase64(int len, const char* data)
|
|||
char* prbuf = rbuf;
|
||||
int decoded = base64_decoder->Decode(len, data, &rlen, &prbuf);
|
||||
if ( prbuf != rbuf )
|
||||
bro_logger->InternalError("buffer pointer modified in base64 decoding");
|
||||
reporter->InternalError("buffer pointer modified in base64 decoding");
|
||||
DataOctets(rlen, rbuf);
|
||||
len -= decoded; data += decoded;
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ void MIME_Entity::DecodeBase64(int len, const char* data)
|
|||
void MIME_Entity::StartDecodeBase64()
|
||||
{
|
||||
if ( base64_decoder )
|
||||
bro_logger->InternalError("previous Base64 decoder not released!");
|
||||
reporter->InternalError("previous Base64 decoder not released!");
|
||||
|
||||
base64_decoder = new Base64Decoder(message->GetAnalyzer());
|
||||
}
|
||||
|
@ -826,7 +826,7 @@ void MIME_Entity::FinishDecodeBase64()
|
|||
if ( base64_decoder->Done(&rlen, &prbuf) )
|
||||
{ // some remaining data
|
||||
if ( prbuf != rbuf )
|
||||
bro_logger->InternalError("buffer pointer modified in base64 decoding");
|
||||
reporter->InternalError("buffer pointer modified in base64 decoding");
|
||||
if ( rlen > 0 )
|
||||
DataOctets(rlen, rbuf);
|
||||
}
|
||||
|
@ -840,7 +840,7 @@ int MIME_Entity::GetDataBuffer()
|
|||
int ret = message->RequestBuffer(&data_buf_length, &data_buf_data);
|
||||
if ( ! ret || data_buf_length == 0 || data_buf_data == 0 )
|
||||
{
|
||||
// bro_logger->InternalError("cannot get data buffer from MIME_Message", "");
|
||||
// reporter->InternalError("cannot get data buffer from MIME_Message", "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ void MIME_Mail::SubmitAllHeaders(MIME_HeaderList& hlist)
|
|||
void MIME_Mail::SubmitData(int len, const char* buf)
|
||||
{
|
||||
if ( buf != (char*) data_buffer->Bytes() + buffer_start )
|
||||
bro_logger->InternalError("buffer misalignment");
|
||||
reporter->InternalError("buffer misalignment");
|
||||
|
||||
if ( compute_content_hash )
|
||||
{
|
||||
|
@ -1181,7 +1181,7 @@ void MIME_Mail::SubmitEvent(int event_type, const char* detail)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unrecognized MIME_Mail event");
|
||||
reporter->InternalError("unrecognized MIME_Mail event");
|
||||
}
|
||||
|
||||
if ( mime_event )
|
||||
|
|
|
@ -193,7 +193,7 @@ public:
|
|||
virtual ~MIME_Message()
|
||||
{
|
||||
if ( ! finished )
|
||||
bro_logger->InternalError("Done() must be called before destruction");
|
||||
reporter->InternalError("Done() must be called before destruction");
|
||||
}
|
||||
|
||||
virtual void Done() { finished = 1; }
|
||||
|
|
|
@ -38,7 +38,7 @@ void TelnetOption::RecvOption(unsigned int type)
|
|||
{
|
||||
TelnetOption* peer = endp->FindPeerOption(code);
|
||||
if ( ! peer )
|
||||
bro_logger->InternalError("option peer missing in TelnetOption::RecvOption");
|
||||
reporter->InternalError("option peer missing in TelnetOption::RecvOption");
|
||||
|
||||
// WILL/WONT/DO/DONT are messages we've *received* from our peer.
|
||||
switch ( type ) {
|
||||
|
@ -83,7 +83,7 @@ void TelnetOption::RecvOption(unsigned int type)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad option type in TelnetOption::RecvOption");
|
||||
reporter->InternalError("bad option type in TelnetOption::RecvOption");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ void TelnetEncryptOption::RecvSubOption(u_char* data, int len)
|
|||
(TelnetEncryptOption*) endp->FindPeerOption(code);
|
||||
|
||||
if ( ! peer )
|
||||
bro_logger->InternalError("option peer missing in TelnetEncryptOption::RecvSubOption");
|
||||
reporter->InternalError("option peer missing in TelnetEncryptOption::RecvSubOption");
|
||||
|
||||
if ( peer->DidRequest() || peer->DoingEncryption() ||
|
||||
peer->Endpoint()->AuthenticationHasBeenAccepted() )
|
||||
|
@ -199,7 +199,7 @@ void TelnetAuthenticateOption::RecvSubOption(u_char* data, int len)
|
|||
(TelnetAuthenticateOption*) endp->FindPeerOption(code);
|
||||
|
||||
if ( ! peer )
|
||||
bro_logger->InternalError("option peer missing in TelnetAuthenticateOption::RecvSubOption");
|
||||
reporter->InternalError("option peer missing in TelnetAuthenticateOption::RecvSubOption");
|
||||
|
||||
if ( ! peer->DidRequestAuthentication() )
|
||||
InconsistentOption(0);
|
||||
|
|
30
src/Net.cc
30
src/Net.cc
|
@ -26,7 +26,7 @@
|
|||
#include "Event.h"
|
||||
#include "Timer.h"
|
||||
#include "Var.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "Net.h"
|
||||
#include "Anon.h"
|
||||
#include "PacketSort.h"
|
||||
|
@ -119,7 +119,7 @@ RETSIGTYPE watchdog(int /* signo */)
|
|||
pkt_dumper = new PktDumper("watchdog-pkt.pcap");
|
||||
if ( pkt_dumper->IsError() )
|
||||
{
|
||||
bro_logger->Error("watchdog: can't open watchdog-pkt.pcap for writing\n");
|
||||
reporter->Error("watchdog: can't open watchdog-pkt.pcap for writing\n");
|
||||
pkt_dumper = 0;
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ RETSIGTYPE watchdog(int /* signo */)
|
|||
net_get_final_stats();
|
||||
net_finish(0);
|
||||
|
||||
bro_logger->FatalErrorWithCore(
|
||||
reporter->FatalErrorWithCore(
|
||||
"**watchdog timer expired, t = %d.%06d, start = %d.%06d, dispatched = %d",
|
||||
int_ct, frac_ct, int_pst, frac_pst,
|
||||
current_dispatched);
|
||||
|
@ -161,7 +161,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
|
|||
PktFileSrc* ps = new PktFileSrc(readfiles[i], filter);
|
||||
|
||||
if ( ! ps->IsOpen() )
|
||||
bro_logger->FatalError("%s: problem with trace file %s - %s\n",
|
||||
reporter->FatalError("%s: problem with trace file %s - %s\n",
|
||||
prog, readfiles[i], ps->ErrorMsg());
|
||||
else
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
|
|||
TYPE_FILTER_SECONDARY);
|
||||
|
||||
if ( ! ps->IsOpen() )
|
||||
bro_logger->FatalError("%s: problem with trace file %s - %s\n",
|
||||
reporter->FatalError("%s: problem with trace file %s - %s\n",
|
||||
prog, readfiles[i],
|
||||
ps->ErrorMsg());
|
||||
else
|
||||
|
@ -196,7 +196,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
|
|||
FlowFileSrc* fs = new FlowFileSrc(flowfiles[i]);
|
||||
|
||||
if ( ! fs->IsOpen() )
|
||||
bro_logger->FatalError("%s: problem with netflow file %s - %s\n",
|
||||
reporter->FatalError("%s: problem with netflow file %s - %s\n",
|
||||
prog, flowfiles[i], fs->ErrorMsg());
|
||||
else
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
|
|||
ps = new PktInterfaceSrc(interfaces[i], filter);
|
||||
|
||||
if ( ! ps->IsOpen() )
|
||||
bro_logger->FatalError("%s: problem with interface %s - %s\n",
|
||||
reporter->FatalError("%s: problem with interface %s - %s\n",
|
||||
prog, interfaces[i], ps->ErrorMsg());
|
||||
else
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
|
|||
filter, TYPE_FILTER_SECONDARY);
|
||||
|
||||
if ( ! ps->IsOpen() )
|
||||
bro_logger->Error("%s: problem with interface %s - %s\n",
|
||||
reporter->Error("%s: problem with interface %s - %s\n",
|
||||
prog, interfaces[i],
|
||||
ps->ErrorMsg());
|
||||
else
|
||||
|
@ -249,7 +249,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
|
|||
FlowSocketSrc* fs = new FlowSocketSrc(netflows[i]);
|
||||
|
||||
if ( ! fs->IsOpen() )
|
||||
bro_logger->Error("%s: problem with netflow socket %s - %s\n",
|
||||
reporter->Error("%s: problem with netflow socket %s - %s\n",
|
||||
prog, netflows[i], fs->ErrorMsg());
|
||||
else
|
||||
{
|
||||
|
@ -272,12 +272,12 @@ void net_init(name_list& interfaces, name_list& readfiles,
|
|||
// interfaces with different-lengthed media.
|
||||
pkt_dumper = new PktDumper(writefile);
|
||||
if ( pkt_dumper->IsError() )
|
||||
bro_logger->FatalError("%s: can't open write file \"%s\" - %s\n",
|
||||
reporter->FatalError("%s: can't open write file \"%s\" - %s\n",
|
||||
prog, writefile, pkt_dumper->ErrorMsg());
|
||||
|
||||
ID* id = global_scope()->Lookup("trace_output_file");
|
||||
if ( ! id )
|
||||
bro_logger->Error("trace_output_file not defined in bro.init");
|
||||
reporter->Error("trace_output_file not defined in bro.init");
|
||||
else
|
||||
id->SetVal(new StringVal(writefile));
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ void net_packet_dispatch(double t, const struct pcap_pkthdr* hdr,
|
|||
// charged against this sample.
|
||||
mgr.Drain();
|
||||
|
||||
sample_logger = new SampleLogger();
|
||||
sample_logger = new SampleReporter();
|
||||
sp = new SegmentProfiler(sample_logger, "load-samp");
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ void net_get_final_stats()
|
|||
{
|
||||
struct PktSrc::Stats s;
|
||||
ps->Statistics(&s);
|
||||
bro_logger->Message("%d packets received on interface %s, %d dropped\n",
|
||||
reporter->Message("%d packets received on interface %s, %d dropped\n",
|
||||
s.received, ps->Interface(), s.dropped);
|
||||
}
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ static double suspend_start = 0;
|
|||
void net_suspend_processing()
|
||||
{
|
||||
if ( _processing_suspended == 0 )
|
||||
bro_logger->Message("processing suspended");
|
||||
reporter->Message("processing suspended");
|
||||
|
||||
++_processing_suspended;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ void net_continue_processing()
|
|||
{
|
||||
if ( _processing_suspended == 1 )
|
||||
{
|
||||
bro_logger->Message("processing continued");
|
||||
reporter->Message("processing continued");
|
||||
loop_over_list(pkt_srcs, i)
|
||||
pkt_srcs[i]->ContinueAfterSuspend();
|
||||
}
|
||||
|
|
|
@ -259,6 +259,7 @@ StringVal* cmd_line_bpf_filter;
|
|||
#include "types.bif.netvar_def"
|
||||
#include "event.bif.netvar_def"
|
||||
#include "logging.bif.netvar_def"
|
||||
#include "reporter.bif.netvar_def"
|
||||
|
||||
void init_event_handlers()
|
||||
{
|
||||
|
@ -318,6 +319,7 @@ void init_net_var()
|
|||
#include "const.bif.netvar_init"
|
||||
#include "types.bif.netvar_init"
|
||||
#include "logging.bif.netvar_init"
|
||||
#include "reporter.bif.netvar_init"
|
||||
|
||||
conn_id = internal_type("conn_id")->AsRecordType();
|
||||
endpoint = internal_type("endpoint")->AsRecordType();
|
||||
|
|
|
@ -268,5 +268,6 @@ extern void init_net_var();
|
|||
#include "types.bif.netvar_h"
|
||||
#include "event.bif.netvar_h"
|
||||
#include "logging.bif.netvar_h"
|
||||
#include "reporter.bif.netvar_h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -87,7 +87,7 @@ void OSFingerprint::collide(uint32 id)
|
|||
if (sig[id].ttl % 32 && sig[id].ttl != 255 && sig[id].ttl % 30)
|
||||
{
|
||||
problems=1;
|
||||
bro_logger->Warning(fmt("OS fingerprinting: [!] Unusual TTL (%d) for signature '%s %s' (line %d).",
|
||||
reporter->Warning(fmt("OS fingerprinting: [!] Unusual TTL (%d) for signature '%s %s' (line %d).",
|
||||
sig[id].ttl,sig[id].os,sig[id].desc,sig[id].line));
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ void OSFingerprint::collide(uint32 id)
|
|||
if (!strcmp(sig[i].os,sig[id].os) &&
|
||||
!strcmp(sig[i].desc,sig[id].desc)) {
|
||||
problems=1;
|
||||
bro_logger->Warning(fmt("OS fingerprinting: [!] Duplicate signature name: '%s %s' (line %d and %d).",
|
||||
reporter->Warning(fmt("OS fingerprinting: [!] Duplicate signature name: '%s %s' (line %d and %d).",
|
||||
sig[i].os,sig[i].desc,sig[i].line,sig[id].line));
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ do_const:
|
|||
if (sig[id].opt[j] ^ sig[i].opt[j]) goto reloop;
|
||||
|
||||
problems=1;
|
||||
bro_logger->Warning(fmt("OS fingerprinting: [!] Signature '%s %s' (line %d)\n"
|
||||
reporter->Warning(fmt("OS fingerprinting: [!] Signature '%s %s' (line %d)\n"
|
||||
" is already covered by '%s %s' (line %d).",
|
||||
sig[id].os,sig[id].desc,sig[id].line,sig[i].os,sig[i].desc,
|
||||
sig[i].line));
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "util.h"
|
||||
#include "Dict.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
// Size limit for size wildcards.
|
||||
#define PACKET_BIG 100
|
||||
|
@ -105,19 +105,19 @@ protected:
|
|||
|
||||
void Error(const char* msg)
|
||||
{
|
||||
bro_logger->Error(msg);
|
||||
reporter->Error(msg);
|
||||
err = true;
|
||||
}
|
||||
|
||||
void Error(const char* msg, int n)
|
||||
{
|
||||
bro_logger->Error(msg, n);
|
||||
reporter->Error(msg, n);
|
||||
err = true;
|
||||
}
|
||||
|
||||
void Error(const char* msg, const char* s)
|
||||
{
|
||||
bro_logger->Error(msg, s);
|
||||
reporter->Error(msg, s);
|
||||
err = true;
|
||||
}
|
||||
|
||||
|
|
18
src/Obj.cc
18
src/Obj.cc
|
@ -98,8 +98,8 @@ void BroObj::Warn(const char* msg, const BroObj* obj2, int pinpoint_only) const
|
|||
{
|
||||
ODesc d;
|
||||
DoMsg(&d, msg, obj2, pinpoint_only);
|
||||
bro_logger->Warning("%s", d.Description());
|
||||
bro_logger->PopLocation();
|
||||
reporter->Warning("%s", d.Description());
|
||||
reporter->PopLocation();
|
||||
}
|
||||
|
||||
void BroObj::Error(const char* msg, const BroObj* obj2, int pinpoint_only) const
|
||||
|
@ -109,8 +109,8 @@ void BroObj::Error(const char* msg, const BroObj* obj2, int pinpoint_only) const
|
|||
|
||||
ODesc d;
|
||||
DoMsg(&d, msg, obj2, pinpoint_only);
|
||||
bro_logger->Error("%s", d.Description());
|
||||
bro_logger->PopLocation();
|
||||
reporter->Error("%s", d.Description());
|
||||
reporter->PopLocation();
|
||||
}
|
||||
|
||||
void BroObj::BadTag(const char* msg, const char* t1, const char* t2) const
|
||||
|
@ -126,21 +126,21 @@ void BroObj::BadTag(const char* msg, const char* t1, const char* t2) const
|
|||
|
||||
ODesc d;
|
||||
DoMsg(&d, out);
|
||||
bro_logger->FatalError("%s", d.Description());
|
||||
reporter->FatalError("%s", d.Description());
|
||||
}
|
||||
|
||||
void BroObj::Internal(const char* msg) const
|
||||
{
|
||||
ODesc d;
|
||||
DoMsg(&d, msg);
|
||||
bro_logger->InternalError("%s", d.Description());
|
||||
reporter->InternalError("%s", d.Description());
|
||||
}
|
||||
|
||||
void BroObj::InternalWarning(const char* msg) const
|
||||
{
|
||||
ODesc d;
|
||||
DoMsg(&d, msg);
|
||||
bro_logger->InternalWarning("%s", d.Description());
|
||||
reporter->InternalWarning("%s", d.Description());
|
||||
}
|
||||
|
||||
void BroObj::AddLocation(ODesc* d) const
|
||||
|
@ -197,7 +197,7 @@ void BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2,
|
|||
*obj2->GetLocationInfo() != *GetLocationInfo() )
|
||||
loc2 = obj2->GetLocationInfo();
|
||||
|
||||
bro_logger->PushLocation(GetLocationInfo(), loc2);
|
||||
reporter->PushLocation(GetLocationInfo(), loc2);
|
||||
}
|
||||
|
||||
void BroObj::PinPoint(ODesc* d, const BroObj* obj2, int pinpoint_only) const
|
||||
|
@ -244,7 +244,7 @@ void print(const BroObj* obj)
|
|||
|
||||
void bad_ref(int type)
|
||||
{
|
||||
bro_logger->InternalError("bad reference count [%d]", type);
|
||||
reporter->InternalError("bad reference count [%d]", type);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ void PIA_UDP::ActivateAnalyzer(AnalyzerTag::Tag tag, const Rule* rule)
|
|||
|
||||
void PIA_UDP::DeactivateAnalyzer(AnalyzerTag::Tag tag)
|
||||
{
|
||||
bro_logger->InternalError("PIA_UDP::Deact not implemented yet");
|
||||
reporter->InternalError("PIA_UDP::Deact not implemented yet");
|
||||
}
|
||||
|
||||
//// TCP PIA
|
||||
|
@ -375,7 +375,7 @@ void PIA_TCP::ActivateAnalyzer(AnalyzerTag::Tag tag, const Rule* rule)
|
|||
|
||||
void PIA_TCP::DeactivateAnalyzer(AnalyzerTag::Tag tag)
|
||||
{
|
||||
bro_logger->InternalError("PIA_TCP::Deact not implemented yet");
|
||||
reporter->InternalError("PIA_TCP::Deact not implemented yet");
|
||||
}
|
||||
|
||||
void PIA_TCP::ReplayStreamBuffer(Analyzer* analyzer)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "POP3.h"
|
||||
#include "Event.h"
|
||||
#include "NVT.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
#undef POP3_CMD_DEF
|
||||
#define POP3_CMD_DEF(cmd) #cmd,
|
||||
|
@ -200,7 +200,7 @@ void POP3_Analyzer::ProcessRequest(int length, const char* line)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unexpected authorization state");
|
||||
reporter->InternalError("unexpected authorization state");
|
||||
}
|
||||
|
||||
delete decoded;
|
||||
|
@ -556,7 +556,7 @@ void POP3_Analyzer::ProcessClientCmd()
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("command not known");
|
||||
reporter->InternalError("command not known");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -808,7 +808,7 @@ void POP3_Analyzer::BeginData()
|
|||
void POP3_Analyzer::EndData()
|
||||
{
|
||||
if ( ! mail )
|
||||
bro_logger->Warning("unmatched end of data");
|
||||
reporter->Warning("unmatched end of data");
|
||||
else
|
||||
{
|
||||
mail->Done();
|
||||
|
|
|
@ -18,7 +18,7 @@ PacketDumper::PacketDumper(pcap_dumper_t* arg_pkt_dump)
|
|||
|
||||
pkt_dump = arg_pkt_dump;
|
||||
if ( ! pkt_dump )
|
||||
bro_logger->InternalError("PacketDumper: nil dump file");
|
||||
reporter->InternalError("PacketDumper: nil dump file");
|
||||
}
|
||||
|
||||
void PacketDumper::DumpPacket(const struct pcap_pkthdr* hdr,
|
||||
|
@ -29,7 +29,7 @@ void PacketDumper::DumpPacket(const struct pcap_pkthdr* hdr,
|
|||
struct pcap_pkthdr h = *hdr;
|
||||
h.caplen = len;
|
||||
if ( h.caplen > hdr->caplen )
|
||||
bro_logger->InternalError("bad modified caplen");
|
||||
reporter->InternalError("bad modified caplen");
|
||||
|
||||
pcap_dump((u_char*) pkt_dump, &h, pkt);
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ PacketSortElement* PacketSortGlobalPQ::RemoveMin(double timestamp)
|
|||
PacketSortConnPQ* PacketSortGlobalPQ::FindConnPQ(PacketSortElement* e)
|
||||
{
|
||||
if ( ! e->is_tcp )
|
||||
bro_logger->InternalError("cannot find a connection for an invalid id");
|
||||
reporter->InternalError("cannot find a connection for an invalid id");
|
||||
|
||||
PacketSortConnPQ* pq = (PacketSortConnPQ*) conn_pq_table.Lookup(e->key);
|
||||
if ( ! pq )
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "RemoteSerializer.h"
|
||||
#include "Conn.h"
|
||||
#include "Event.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "Net.h"
|
||||
|
||||
class IncrementalWriteTimer : public Timer {
|
||||
|
@ -189,7 +189,7 @@ void PersistenceSerializer::RaiseFinishedSendState()
|
|||
vl->append(new PortVal(remote_port));
|
||||
|
||||
mgr.QueueEvent(finished_send_state, vl);
|
||||
bro_logger->Log("Serialization done.");
|
||||
reporter->Log("Serialization done.");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -213,7 +213,7 @@ void PersistenceSerializer::GotStateAccess(StateAccess* s)
|
|||
|
||||
void PersistenceSerializer::GotTimer(Timer* s)
|
||||
{
|
||||
bro_logger->Error("PersistenceSerializer::GotTimer not implemented");
|
||||
reporter->Error("PersistenceSerializer::GotTimer not implemented");
|
||||
}
|
||||
|
||||
void PersistenceSerializer::GotConnection(Connection* c)
|
||||
|
@ -228,7 +228,7 @@ void PersistenceSerializer::GotID(ID* id, Val* /* val */)
|
|||
|
||||
void PersistenceSerializer::GotPacket(Packet* p)
|
||||
{
|
||||
bro_logger->Error("PersistenceSerializer::GotPacket not implemented");
|
||||
reporter->Error("PersistenceSerializer::GotPacket not implemented");
|
||||
}
|
||||
|
||||
bool PersistenceSerializer::LogAccess(const StateAccess& s)
|
||||
|
@ -286,7 +286,7 @@ bool PersistenceSerializer::SendState(SourceID peer, bool may_suspend)
|
|||
status->conns = &persistent_conns;
|
||||
status->peer = peer;
|
||||
|
||||
bro_logger->Message("Sending state...");
|
||||
reporter->Message("Sending state...");
|
||||
|
||||
return RunSerialization(status);
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ bool PersistenceSerializer::SendConfig(SourceID peer, bool may_suspend)
|
|||
status->ids = global_scope()->GetIDs();
|
||||
status->peer = peer;
|
||||
|
||||
bro_logger->Message("Sending config...");
|
||||
reporter->Message("Sending config...");
|
||||
|
||||
return RunSerialization(status);
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ bool PersistenceSerializer::RunSerialization(SerialStatus* status)
|
|||
{
|
||||
if ( running[i]->type == status->type )
|
||||
{
|
||||
bro_logger->Warning("Serialization of type %d already running.", status->type);
|
||||
reporter->Warning("Serialization of type %d already running.", status->type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -381,14 +381,14 @@ bool PersistenceSerializer::RunSerialization(SerialStatus* status)
|
|||
}
|
||||
|
||||
else
|
||||
bro_logger->InternalError("unknown suspend state");
|
||||
reporter->InternalError("unknown suspend state");
|
||||
}
|
||||
|
||||
else if ( cont->Resuming() )
|
||||
cont->Resume();
|
||||
|
||||
else
|
||||
bro_logger->InternalError("unknown continuation state");
|
||||
reporter->InternalError("unknown continuation state");
|
||||
|
||||
if ( status->id_cookie )
|
||||
{
|
||||
|
@ -504,7 +504,7 @@ bool PersistenceSerializer::DoIDSerialization(SerialStatus* status, ID* id)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown serialization type");
|
||||
reporter->InternalError("unknown serialization type");
|
||||
}
|
||||
|
||||
return success;
|
||||
|
@ -535,7 +535,7 @@ bool PersistenceSerializer::DoConnSerialization(SerialStatus* status,
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown serialization type");
|
||||
reporter->InternalError("unknown serialization type");
|
||||
}
|
||||
|
||||
return success;
|
||||
|
@ -560,7 +560,7 @@ bool PersistenceSerializer::DoAccessSerialization(SerialStatus* status,
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown serialization type");
|
||||
reporter->InternalError("unknown serialization type");
|
||||
}
|
||||
|
||||
return success;
|
||||
|
|
|
@ -400,7 +400,7 @@ void PktSrc::Statistics(Stats* s)
|
|||
|
||||
else if ( pcap_stats(pd, &pstat) < 0 )
|
||||
{
|
||||
bro_logger->Error("problem getting packet filter statistics: %s",
|
||||
reporter->Error("problem getting packet filter statistics: %s",
|
||||
ErrorMsg());
|
||||
s->received = s->dropped = s->link = 0;
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ PktInterfaceSrc::PktInterfaceSrc(const char* arg_interface, const char* filter,
|
|||
|
||||
// ### This needs autoconf'ing.
|
||||
#ifdef HAVE_PCAP_INT_H
|
||||
bro_logger->Message("pcap bufsize = %d\n", ((struct pcap *) pd)->bufsize);
|
||||
reporter->Message("pcap bufsize = %d\n", ((struct pcap *) pd)->bufsize);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LINUX
|
||||
|
@ -486,7 +486,7 @@ PktInterfaceSrc::PktInterfaceSrc(const char* arg_interface, const char* filter,
|
|||
// Couldn't get header size.
|
||||
return;
|
||||
|
||||
bro_logger->Message("listening on %s\n", interface);
|
||||
reporter->Message("listening on %s\n", interface);
|
||||
}
|
||||
else
|
||||
closed = true;
|
||||
|
@ -518,7 +518,7 @@ PktFileSrc::PktFileSrc(const char* arg_readfile, const char* filter,
|
|||
selectable_fd = fileno(pcap_file(pd));
|
||||
|
||||
if ( selectable_fd < 0 )
|
||||
bro_logger->InternalError("OS does not support selectable pcap fd");
|
||||
reporter->InternalError("OS does not support selectable pcap fd");
|
||||
}
|
||||
else
|
||||
closed = true;
|
||||
|
|
|
@ -16,7 +16,7 @@ using namespace std;
|
|||
#include "Debug.h"
|
||||
#include "util.h"
|
||||
#include "PolicyFile.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
struct PolicyFile {
|
||||
PolicyFile () { filedata = 0; lmtime = 0; }
|
||||
|
@ -33,7 +33,7 @@ static PolicyFileMap policy_files;
|
|||
int how_many_lines_in(const char* policy_filename)
|
||||
{
|
||||
if ( ! policy_filename )
|
||||
bro_logger->InternalError("NULL value passed to how_many_lines_in\n");
|
||||
reporter->InternalError("NULL value passed to how_many_lines_in\n");
|
||||
|
||||
FILE* throwaway = fopen(policy_filename, "r");
|
||||
if ( ! throwaway )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// $Id: PrefixTable.cc 1016 2005-01-31 21:23:50Z vern $
|
||||
|
||||
#include "PrefixTable.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
// IPv4 version.
|
||||
inline static prefix_t* make_prefix(const uint32 addr, int width)
|
||||
|
@ -37,7 +37,7 @@ void* PrefixTable::Insert(const_addr_type addr, int width, void* data)
|
|||
Deref_Prefix(prefix);
|
||||
|
||||
if ( ! node )
|
||||
bro_logger->InternalError("Cannot create node in patricia tree");
|
||||
reporter->InternalError("Cannot create node in patricia tree");
|
||||
|
||||
void* old = node->data;
|
||||
|
||||
|
@ -66,7 +66,7 @@ void* PrefixTable::Insert(const Val* value, void* data)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("Wrong index type for PrefixTable");
|
||||
reporter->InternalError("Wrong index type for PrefixTable");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void* PrefixTable::Lookup(const Val* value, bool exact) const
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("Wrong index type %d for PrefixTable",
|
||||
reporter->InternalError("Wrong index type %d for PrefixTable",
|
||||
value->Type()->Tag());
|
||||
return 0;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ void* PrefixTable::Remove(const Val* value)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("Wrong index type for PrefixTable");
|
||||
reporter->InternalError("Wrong index type for PrefixTable");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "PriorityQueue.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "util.h"
|
||||
|
||||
PriorityQueue::PriorityQueue(int initial_size)
|
||||
|
@ -53,7 +53,7 @@ PQ_Element* PriorityQueue::Remove(PQ_Element* e)
|
|||
PQ_Element* e2 = Remove();
|
||||
|
||||
if ( e != e2 )
|
||||
bro_logger->InternalError("inconsistency in PriorityQueue::Remove");
|
||||
reporter->InternalError("inconsistency in PriorityQueue::Remove");
|
||||
|
||||
return e2;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ int Specific_RE_Matcher::Compile(int lazy)
|
|||
RE_set_input(pattern_text);
|
||||
if ( RE_parse() )
|
||||
{
|
||||
bro_logger->Error("error compiling pattern /%s/", pattern_text);
|
||||
reporter->Error("error compiling pattern /%s/", pattern_text);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ int Specific_RE_Matcher::Compile(int lazy)
|
|||
int Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx)
|
||||
{
|
||||
if ( set.length() != idx.length() )
|
||||
bro_logger->InternalError("compileset: lengths of sets differ");
|
||||
reporter->InternalError("compileset: lengths of sets differ");
|
||||
|
||||
rem = this;
|
||||
|
||||
|
@ -145,7 +145,7 @@ int Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx)
|
|||
RE_set_input(set[i]);
|
||||
if ( RE_parse() )
|
||||
{
|
||||
bro_logger->Error("error compiling pattern /%s/", set[i]);
|
||||
reporter->Error("error compiling pattern /%s/", set[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ int RPC_Interpreter::DeliverRPC(const u_char* buf, int n, int rpclen,
|
|||
}
|
||||
|
||||
else if ( n < 0 )
|
||||
bro_logger->InternalError("RPC underflow");
|
||||
reporter->InternalError("RPC underflow");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ bool Contents_RPC::CheckResync(int& len, const u_char*& data, bool orig)
|
|||
|
||||
if ( resync_toskip != 0 )
|
||||
// Should never happen.
|
||||
bro_logger->InternalError("RPC resync: skipping over data failed");
|
||||
reporter->InternalError("RPC resync: skipping over data failed");
|
||||
|
||||
// Now lets see whether data points to the beginning of a RPC
|
||||
// frame. If the resync processs is successful, we should be
|
||||
|
@ -623,7 +623,7 @@ void Contents_RPC::DeliverStream(int len, const u_char* data, bool orig)
|
|||
marker_buf.Init(4,4);
|
||||
|
||||
if ( ! dummy_p )
|
||||
bro_logger->InternalError("inconsistent RPC record marker extraction");
|
||||
reporter->InternalError("inconsistent RPC record marker extraction");
|
||||
|
||||
last_frag = (marker & 0x80000000) != 0;
|
||||
marker &= 0x7fffffff;
|
||||
|
|
|
@ -127,7 +127,7 @@ void Contents_Rsh_Analyzer::DoDeliver(int len, const u_char* data)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad state in Contents_Rsh_Analyzer::DoDeliver");
|
||||
reporter->InternalError("bad state in Contents_Rsh_Analyzer::DoDeliver");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ void Rsh_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
|||
void Rsh_Analyzer::ClientUserName(const char* s)
|
||||
{
|
||||
if ( client_name )
|
||||
bro_logger->InternalError("multiple rsh client names");
|
||||
reporter->InternalError("multiple rsh client names");
|
||||
|
||||
client_name = new StringVal(s);
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void Rsh_Analyzer::ClientUserName(const char* s)
|
|||
void Rsh_Analyzer::ServerUserName(const char* s)
|
||||
{
|
||||
if ( username )
|
||||
bro_logger->InternalError("multiple rsh initial client names");
|
||||
reporter->InternalError("multiple rsh initial client names");
|
||||
|
||||
username = new StringVal(s);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ DataBlock::DataBlock(const u_char* data, int size, int arg_seq,
|
|||
|
||||
block = new u_char[size];
|
||||
if ( ! block )
|
||||
bro_logger->InternalError("out of memory");
|
||||
reporter->InternalError("out of memory");
|
||||
|
||||
memcpy((void*) block, (const void*) data, size);
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@
|
|||
#include "File.h"
|
||||
#include "Conn.h"
|
||||
#include "LogMgr.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
extern "C" {
|
||||
#include "setsignal.h"
|
||||
|
@ -394,7 +394,7 @@ static bool sendToIO(ChunkedIO* io, ChunkedIO::Chunk* c)
|
|||
{
|
||||
if ( ! io->Write(c) )
|
||||
{
|
||||
bro_logger->Warning(fmt("can't send chunk: %s", io->Error()));
|
||||
reporter->Warning(fmt("can't send chunk: %s", io->Error()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ static bool sendToIO(ChunkedIO* io, char msg_type, RemoteSerializer::PeerID id,
|
|||
{
|
||||
if ( ! sendCMsg(io, msg_type, id) )
|
||||
{
|
||||
bro_logger->Warning(fmt("can't send message of type %d: %s", msg_type, io->Error()));
|
||||
reporter->Warning(fmt("can't send message of type %d: %s", msg_type, io->Error()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ static bool sendToIO(ChunkedIO* io, char msg_type, RemoteSerializer::PeerID id,
|
|||
{
|
||||
if ( ! sendCMsg(io, msg_type, id) )
|
||||
{
|
||||
bro_logger->Warning(fmt("can't send message of type %d: %s", msg_type, io->Error()));
|
||||
reporter->Warning(fmt("can't send message of type %d: %s", msg_type, io->Error()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@ void RemoteSerializer::Fork()
|
|||
setpriority(PRIO_PROCESS, 0, 5);
|
||||
|
||||
child.Run();
|
||||
bro_logger->InternalError("cannot be reached");
|
||||
reporter->InternalError("cannot be reached");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -675,7 +675,7 @@ RemoteSerializer::PeerID RemoteSerializer::Connect(addr_type ip, uint16 port,
|
|||
return true;
|
||||
|
||||
if ( ! initialized )
|
||||
bro_logger->InternalError("remote serializer not initialized");
|
||||
reporter->InternalError("remote serializer not initialized");
|
||||
|
||||
#ifdef BROv6
|
||||
if ( ! is_v4_addr(ip) )
|
||||
|
@ -736,13 +736,13 @@ bool RemoteSerializer::RequestSync(PeerID id, bool auth)
|
|||
Peer* peer = LookupPeer(id, true);
|
||||
if ( ! peer )
|
||||
{
|
||||
bro_logger->Error(fmt("unknown peer id %d for request sync", int(id)));
|
||||
reporter->Error(fmt("unknown peer id %d for request sync", int(id)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( peer->phase != Peer::HANDSHAKE )
|
||||
{
|
||||
bro_logger->Error(fmt("can't request sync from peer; wrong phase %d",
|
||||
reporter->Error(fmt("can't request sync from peer; wrong phase %d",
|
||||
peer->phase));
|
||||
return false;
|
||||
}
|
||||
|
@ -763,13 +763,13 @@ bool RemoteSerializer::RequestLogs(PeerID id)
|
|||
Peer* peer = LookupPeer(id, true);
|
||||
if ( ! peer )
|
||||
{
|
||||
bro_logger->Error(fmt("unknown peer id %d for request logs", int(id)));
|
||||
reporter->Error(fmt("unknown peer id %d for request logs", int(id)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( peer->phase != Peer::HANDSHAKE )
|
||||
{
|
||||
bro_logger->Error(fmt("can't request logs from peer; wrong phase %d",
|
||||
reporter->Error(fmt("can't request logs from peer; wrong phase %d",
|
||||
peer->phase));
|
||||
return false;
|
||||
}
|
||||
|
@ -788,13 +788,13 @@ bool RemoteSerializer::RequestEvents(PeerID id, RE_Matcher* pattern)
|
|||
Peer* peer = LookupPeer(id, true);
|
||||
if ( ! peer )
|
||||
{
|
||||
bro_logger->Error(fmt("unknown peer id %d for request sync", int(id)));
|
||||
reporter->Error(fmt("unknown peer id %d for request sync", int(id)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( peer->phase != Peer::HANDSHAKE )
|
||||
{
|
||||
bro_logger->Error(fmt("can't request events from peer; wrong phase %d",
|
||||
reporter->Error(fmt("can't request events from peer; wrong phase %d",
|
||||
peer->phase));
|
||||
return false;
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ bool RemoteSerializer::CompleteHandshake(PeerID id)
|
|||
|
||||
if ( p->phase != Peer::HANDSHAKE )
|
||||
{
|
||||
bro_logger->Error(fmt("can't complete handshake; wrong phase %d",
|
||||
reporter->Error(fmt("can't complete handshake; wrong phase %d",
|
||||
p->phase));
|
||||
return false;
|
||||
}
|
||||
|
@ -1124,7 +1124,7 @@ bool RemoteSerializer::SendCaptureFilter(PeerID id, const char* filter)
|
|||
|
||||
if ( peer->phase != Peer::HANDSHAKE )
|
||||
{
|
||||
bro_logger->Error(fmt("can't sent capture filter to peer; wrong phase %d", peer->phase));
|
||||
reporter->Error(fmt("can't sent capture filter to peer; wrong phase %d", peer->phase));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1201,7 +1201,7 @@ bool RemoteSerializer::SendCapabilities(Peer* peer)
|
|||
{
|
||||
if ( peer->phase != Peer::HANDSHAKE )
|
||||
{
|
||||
bro_logger->Error(fmt("can't sent capabilties to peer; wrong phase %d",
|
||||
reporter->Error(fmt("can't sent capabilties to peer; wrong phase %d",
|
||||
peer->phase));
|
||||
return false;
|
||||
}
|
||||
|
@ -1224,7 +1224,7 @@ bool RemoteSerializer::Listen(addr_type ip, uint16 port, bool expect_ssl)
|
|||
return true;
|
||||
|
||||
if ( ! initialized )
|
||||
bro_logger->InternalError("remote serializer not initialized");
|
||||
reporter->InternalError("remote serializer not initialized");
|
||||
|
||||
#ifdef BROv6
|
||||
if ( ! is_v4_addr(ip) )
|
||||
|
@ -1546,10 +1546,10 @@ bool RemoteSerializer::Poll(bool may_block)
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown msgstate");
|
||||
reporter->InternalError("unknown msgstate");
|
||||
}
|
||||
|
||||
bro_logger->InternalError("cannot be reached");
|
||||
reporter->InternalError("cannot be reached");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1664,7 +1664,7 @@ bool RemoteSerializer::DoMessage()
|
|||
return true; // keep going
|
||||
}
|
||||
|
||||
bro_logger->InternalError("cannot be reached");
|
||||
reporter->InternalError("cannot be reached");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1955,7 +1955,7 @@ bool RemoteSerializer::ProcessConnected()
|
|||
|
||||
ID* descr = global_scope()->Lookup("peer_description");
|
||||
if ( ! descr )
|
||||
bro_logger->InternalError("peer_description not defined");
|
||||
reporter->InternalError("peer_description not defined");
|
||||
|
||||
SerialInfo info(this);
|
||||
SendID(&info, current_peer, *descr);
|
||||
|
@ -2138,7 +2138,7 @@ bool RemoteSerializer::HandshakeDone(Peer* peer)
|
|||
else if ( peer->sync_requested & Peer::WE )
|
||||
peer->send_state = false;
|
||||
else
|
||||
bro_logger->InternalError("illegal sync_requested value");
|
||||
reporter->InternalError("illegal sync_requested value");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2836,7 +2836,7 @@ void RemoteSerializer::GotStateAccess(StateAccess* s)
|
|||
|
||||
void RemoteSerializer::GotTimer(Timer* s)
|
||||
{
|
||||
bro_logger->Error("RemoteSerializer::GotTimer not implemented");
|
||||
reporter->Error("RemoteSerializer::GotTimer not implemented");
|
||||
}
|
||||
|
||||
void RemoteSerializer::GotPacket(Packet* p)
|
||||
|
@ -2940,7 +2940,7 @@ bool RemoteSerializer::SendCMsgToChild(char msg_type, Peer* peer)
|
|||
{
|
||||
if ( ! sendCMsg(io, msg_type, peer ? peer->id : PEER_NONE) )
|
||||
{
|
||||
bro_logger->Warning(fmt("can't send message of type %d: %s",
|
||||
reporter->Warning(fmt("can't send message of type %d: %s",
|
||||
msg_type, io->Error()));
|
||||
return false;
|
||||
}
|
||||
|
@ -3013,7 +3013,7 @@ void RemoteSerializer::FatalError(const char* msg)
|
|||
{
|
||||
msg = fmt("fatal error, shutting down communication: %s", msg);
|
||||
Log(LogError, msg);
|
||||
bro_logger->Error(msg);
|
||||
reporter->Error(msg);
|
||||
|
||||
closed = true;
|
||||
kill(child_pid, SIGQUIT);
|
||||
|
@ -3054,7 +3054,7 @@ void RemoteSerializer::InternalCommError(const char* msg)
|
|||
#ifdef DEBUG_COMMUNICATION
|
||||
DumpDebugData();
|
||||
#else
|
||||
bro_logger->InternalError("%s", msg);
|
||||
reporter->InternalError("%s", msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3075,7 +3075,7 @@ static ChunkedIO* openDump(const char* file)
|
|||
|
||||
if ( fd < 0 )
|
||||
{
|
||||
bro_logger->Error("cannot open %s: %s\n", file, strerror(errno));
|
||||
reporter->Error("cannot open %s: %s\n", file, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3092,7 +3092,7 @@ void RemoteSerializer::ReadDumpAsMessageType(const char* file)
|
|||
|
||||
if ( ! io->Read(&chunk, true ) )
|
||||
{
|
||||
bro_logger->Error("cannot read %s: %s\n", file, strerror(errno));
|
||||
reporter->Error("cannot read %s: %s\n", file, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3407,11 +3407,11 @@ bool SocketComm::ProcessParentMessage()
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown msg type %d", parent_msgtype);
|
||||
reporter->InternalError("unknown msg type %d", parent_msgtype);
|
||||
return true;
|
||||
}
|
||||
|
||||
bro_logger->InternalError("cannot be reached");
|
||||
reporter->InternalError("cannot be reached");
|
||||
}
|
||||
|
||||
case ARGS:
|
||||
|
@ -3434,10 +3434,10 @@ bool SocketComm::ProcessParentMessage()
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown msgstate");
|
||||
reporter->InternalError("unknown msgstate");
|
||||
}
|
||||
|
||||
bro_logger->InternalError("cannot be reached");
|
||||
reporter->InternalError("cannot be reached");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3496,7 +3496,7 @@ bool SocketComm::DoParentMessage()
|
|||
peers[j]->io->DumpDebugData(fmt("comm-dump.child.peer.%d", id), false);
|
||||
}
|
||||
#else
|
||||
bro_logger->InternalError("DEBUG_DUMP support not compiled in");
|
||||
reporter->InternalError("DEBUG_DUMP support not compiled in");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -3556,10 +3556,10 @@ bool SocketComm::DoParentMessage()
|
|||
return ForwardChunkToPeer();
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("ProcessParentMessage: unexpected state");
|
||||
reporter->InternalError("ProcessParentMessage: unexpected state");
|
||||
}
|
||||
|
||||
bro_logger->InternalError("cannot be reached");
|
||||
reporter->InternalError("cannot be reached");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3620,7 +3620,7 @@ bool SocketComm::ProcessListen()
|
|||
bool SocketComm::ProcessParentCompress()
|
||||
{
|
||||
#ifndef HAVE_LIBZ
|
||||
bro_logger->InternalError("supposed to enable compression but don't have zlib");
|
||||
reporter->InternalError("supposed to enable compression but don't have zlib");
|
||||
return false;
|
||||
#else
|
||||
|
||||
|
@ -3740,7 +3740,7 @@ bool SocketComm::ProcessRemoteMessage(SocketComm::Peer* peer)
|
|||
}
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("ProcessRemoteMessage: unexpected state");
|
||||
reporter->InternalError("ProcessRemoteMessage: unexpected state");
|
||||
}
|
||||
|
||||
assert(false); // Cannot be reached.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// $Id: Logger.cc 6916 2009-09-24 20:48:36Z vern $
|
||||
//
|
||||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
//
|
||||
|
||||
#include <syslog.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "Event.h"
|
||||
#include "NetVar.h"
|
||||
#include "Net.h"
|
||||
|
@ -19,9 +19,9 @@ int closelog();
|
|||
}
|
||||
#endif
|
||||
|
||||
Logger* bro_logger = 0;
|
||||
Reporter* reporter = 0;
|
||||
|
||||
Logger::Logger()
|
||||
Reporter::Reporter()
|
||||
{
|
||||
errors = 0;
|
||||
via_events = false;
|
||||
|
@ -29,37 +29,37 @@ Logger::Logger()
|
|||
openlog("bro", 0, LOG_LOCAL5);
|
||||
}
|
||||
|
||||
Logger::~Logger()
|
||||
Reporter::~Reporter()
|
||||
{
|
||||
closelog();
|
||||
}
|
||||
|
||||
void Logger::Message(const char* fmt, ...)
|
||||
void Reporter::Message(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
DoLog("", log_message, stdout, 0, 0, true, true, fmt, ap);
|
||||
DoLog("", reporter_message, stdout, 0, 0, true, true, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void Logger::Warning(const char* fmt, ...)
|
||||
void Reporter::Warning(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
DoLog("warning", log_warning, stdout, 0, 0, true, true, fmt, ap);
|
||||
DoLog("warning", reporter_warning, stdout, 0, 0, true, true, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void Logger::Error(const char* fmt, ...)
|
||||
void Reporter::Error(const char* fmt, ...)
|
||||
{
|
||||
++errors;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
DoLog("error", log_error, stdout, 0, 0, true, true, fmt, ap);
|
||||
DoLog("error", reporter_error, stdout, 0, 0, true, true, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void Logger::FatalError(const char* fmt, ...)
|
||||
void Reporter::FatalError(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -73,7 +73,7 @@ void Logger::FatalError(const char* fmt, ...)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
void Logger::FatalErrorWithCore(const char* fmt, ...)
|
||||
void Reporter::FatalErrorWithCore(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -87,7 +87,7 @@ void Logger::FatalErrorWithCore(const char* fmt, ...)
|
|||
abort();
|
||||
}
|
||||
|
||||
void Logger::InternalError(const char* fmt, ...)
|
||||
void Reporter::InternalError(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -101,15 +101,15 @@ void Logger::InternalError(const char* fmt, ...)
|
|||
abort();
|
||||
}
|
||||
|
||||
void Logger::InternalWarning(const char* fmt, ...)
|
||||
void Reporter::InternalWarning(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
DoLog("internal warning", log_warning, stdout, 0, 0, true, true, fmt, ap);
|
||||
DoLog("internal warning", reporter_warning, stdout, 0, 0, true, true, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void Logger::Syslog(const char* fmt, ...)
|
||||
void Reporter::Syslog(const char* fmt, ...)
|
||||
{
|
||||
if ( reading_traces )
|
||||
return;
|
||||
|
@ -120,7 +120,7 @@ void Logger::Syslog(const char* fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
void Logger::WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* name, const char* addl, ...)
|
||||
void Reporter::WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* name, const char* addl, ...)
|
||||
{
|
||||
val_list* vl = new val_list(1);
|
||||
|
||||
|
@ -138,7 +138,7 @@ void Logger::WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* name,
|
|||
delete vl;
|
||||
}
|
||||
|
||||
void Logger::WeirdFlowHelper(addr_type orig, addr_type resp, const char* name, ...)
|
||||
void Reporter::WeirdFlowHelper(addr_type orig, addr_type resp, const char* name, ...)
|
||||
{
|
||||
val_list* vl = new val_list(2);
|
||||
vl->append(new AddrVal(orig));
|
||||
|
@ -152,27 +152,27 @@ void Logger::WeirdFlowHelper(addr_type orig, addr_type resp, const char* name, .
|
|||
delete vl;
|
||||
}
|
||||
|
||||
void Logger::Weird(const char* name)
|
||||
void Reporter::Weird(const char* name)
|
||||
{
|
||||
WeirdHelper(net_weird, 0, name, 0);
|
||||
}
|
||||
|
||||
void Logger::Weird(Connection* conn, const char* name, const char* addl)
|
||||
void Reporter::Weird(Connection* conn, const char* name, const char* addl)
|
||||
{
|
||||
WeirdHelper(conn_weird, conn->BuildConnVal(), name, addl);
|
||||
}
|
||||
|
||||
void Logger::Weird(Val* conn_val, const char* name, const char* addl)
|
||||
void Reporter::Weird(Val* conn_val, const char* name, const char* addl)
|
||||
{
|
||||
WeirdHelper(conn_weird, conn_val, name, addl);
|
||||
}
|
||||
|
||||
void Logger::Weird(addr_type orig, addr_type resp, const char* name)
|
||||
void Reporter::Weird(addr_type orig, addr_type resp, const char* name)
|
||||
{
|
||||
WeirdFlowHelper(orig, resp, name);
|
||||
}
|
||||
|
||||
void Logger::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connection* conn, val_list* addl, bool location, bool time, const char* fmt, va_list ap)
|
||||
void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connection* conn, val_list* addl, bool location, bool time, const char* fmt, va_list ap)
|
||||
{
|
||||
static char tmp[512];
|
||||
|
||||
|
@ -243,7 +243,7 @@ void Logger::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connect
|
|||
buffer = alloced = (char *)realloc(alloced, size);
|
||||
|
||||
if ( ! buffer )
|
||||
FatalError("out of memory in logger");
|
||||
FatalError("out of memory in Reporter");
|
||||
}
|
||||
|
||||
if ( event && via_events )
|
||||
|
@ -251,7 +251,7 @@ void Logger::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connect
|
|||
val_list* vl = new val_list;
|
||||
|
||||
if ( time )
|
||||
vl->append(new Val(network_time, TYPE_TIME));
|
||||
vl->append(new Val((bro_start_network_time != 0.0) ? network_time : 0, TYPE_TIME));
|
||||
|
||||
vl->append(new StringVal(buffer));
|
||||
|
||||
|
@ -277,7 +277,7 @@ void Logger::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connect
|
|||
{
|
||||
string s = "";
|
||||
|
||||
if ( network_time )
|
||||
if ( bro_start_network_time != 0.0 )
|
||||
{
|
||||
char tmp[32];
|
||||
snprintf(tmp, 32, "%.6f", network_time);
|
|
@ -1,7 +1,7 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#ifndef logger_h
|
||||
#define logger_h
|
||||
#ifndef REPORTER_H
|
||||
#define REPORTER_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
@ -15,10 +15,10 @@
|
|||
class Connection;
|
||||
class Location;
|
||||
|
||||
class Logger {
|
||||
class Reporter {
|
||||
public:
|
||||
Logger();
|
||||
~Logger();
|
||||
Reporter();
|
||||
~Reporter();
|
||||
|
||||
// Report an informational message, nothing that needs specific
|
||||
// attention.
|
||||
|
@ -91,7 +91,7 @@ private:
|
|||
std::list<std::pair<const Location*, const Location*> > locations;
|
||||
};
|
||||
|
||||
extern Logger* bro_logger;
|
||||
extern Reporter* reporter;
|
||||
|
||||
#endif
|
||||
|
|
@ -192,7 +192,7 @@ void Contents_Rlogin_Analyzer::DoDeliver(int len, const u_char* data)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad state in Contents_Rlogin_Analyzer::DoDeliver");
|
||||
reporter->InternalError("bad state in Contents_Rlogin_Analyzer::DoDeliver");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ Rlogin_Analyzer::Rlogin_Analyzer(Connection* conn)
|
|||
void Rlogin_Analyzer::ClientUserName(const char* s)
|
||||
{
|
||||
if ( client_name )
|
||||
bro_logger->InternalError("multiple rlogin client names");
|
||||
reporter->InternalError("multiple rlogin client names");
|
||||
|
||||
client_name = new StringVal(s);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ bool RuleConditionPayloadSize::DoMatch(Rule* rule, RuleEndpointState* state,
|
|||
return payload_size >= val;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown comparision type");
|
||||
reporter->InternalError("unknown comparision type");
|
||||
}
|
||||
|
||||
// Should not be reached
|
||||
|
@ -135,7 +135,7 @@ bool RuleConditionEval::DoMatch(Rule* rule, RuleEndpointState* state,
|
|||
{
|
||||
if ( ! id->HasVal() )
|
||||
{
|
||||
bro_logger->Error("undefined value");
|
||||
reporter->Error("undefined value");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "NetVar.h"
|
||||
#include "Scope.h"
|
||||
#include "File.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
// FIXME: Things that are not fully implemented/working yet:
|
||||
//
|
||||
|
@ -201,7 +201,7 @@ bool RuleMatcher::ReadFiles(const name_list& files)
|
|||
rules_in = search_for_file( files[i], "sig", 0, false);
|
||||
if ( ! rules_in )
|
||||
{
|
||||
bro_logger->Error("Can't open signature file", files[i]);
|
||||
reporter->Error("Can't open signature file", files[i]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ static inline uint32 getval(const u_char* data, int size)
|
|||
return ntohl(*(uint32*) data);
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("illegal HdrTest size");
|
||||
reporter->InternalError("illegal HdrTest size");
|
||||
}
|
||||
|
||||
// Should not be reached.
|
||||
|
@ -514,7 +514,7 @@ RuleEndpointState* RuleMatcher::InitEndpoint(Analyzer* analyzer,
|
|||
|
||||
default:
|
||||
data = 0;
|
||||
bro_logger->InternalError("unknown protocol");
|
||||
reporter->InternalError("unknown protocol");
|
||||
}
|
||||
|
||||
// ### data can be nil here if it's an
|
||||
|
@ -543,7 +543,7 @@ RuleEndpointState* RuleMatcher::InitEndpoint(Analyzer* analyzer,
|
|||
DO_MATCH_OR(*h->vals, getval(data + h->offset, h->size), >=);
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown comparision type");
|
||||
reporter->InternalError("unknown comparision type");
|
||||
}
|
||||
|
||||
no_match:
|
||||
|
@ -570,7 +570,7 @@ void RuleMatcher::Match(RuleEndpointState* state, Rule::PatternType type,
|
|||
{
|
||||
if ( ! state )
|
||||
{
|
||||
bro_logger->Warning("RuleEndpointState not initialized yet.");
|
||||
reporter->Warning("RuleEndpointState not initialized yet.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "SMB.h"
|
||||
#include "smb_pac.h"
|
||||
#include "Val.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
namespace {
|
||||
const bool DEBUG_smb_ipc = true;
|
||||
|
@ -733,7 +733,7 @@ int SMB_Session::ParseTransaction(int is_orig, int cmd,
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("command mismatch for ParseTransaction");
|
||||
reporter->InternalError("command mismatch for ParseTransaction");
|
||||
}
|
||||
|
||||
int ret;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "SMTP.h"
|
||||
#include "Event.h"
|
||||
#include "ContentLine.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
#undef SMTP_CMD_DEF
|
||||
#define SMTP_CMD_DEF(cmd) #cmd,
|
||||
|
@ -866,7 +866,7 @@ void SMTP_Analyzer::BeginData()
|
|||
skip_data = 0; // reset the flag at the beginning of the mail
|
||||
if ( mail != 0 )
|
||||
{
|
||||
bro_logger->Warning("nested mail transaction");
|
||||
reporter->Warning("nested mail transaction");
|
||||
mail->Done();
|
||||
delete mail;
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ void SMTP_Analyzer::BeginData()
|
|||
void SMTP_Analyzer::EndData()
|
||||
{
|
||||
if ( ! mail )
|
||||
bro_logger->Warning("Unmatched end of data");
|
||||
reporter->Warning("Unmatched end of data");
|
||||
else
|
||||
{
|
||||
mail->Done();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "SSL-binpac.h"
|
||||
#include "TCP_Reassembler.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ void SSL_Analyzer_binpac::Undelivered(int seq, int len, bool orig)
|
|||
|
||||
void SSL_Analyzer_binpac::warn_(const char* msg)
|
||||
{
|
||||
bro_logger->Warning("SSL_Analyzer_binpac: ", msg);
|
||||
reporter->Warning("SSL_Analyzer_binpac: ", msg);
|
||||
}
|
||||
|
||||
void SSL_Analyzer_binpac::generate_warnings()
|
||||
|
|
|
@ -287,7 +287,7 @@ void SSLv2_Interpreter::NewSSLRecord(SSL_InterpreterEndpoint* s,
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("SSLv2: unknown state");
|
||||
reporter->InternalError("SSLv2: unknown state");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
10
src/Scope.cc
10
src/Scope.cc
|
@ -7,7 +7,7 @@
|
|||
#include "ID.h"
|
||||
#include "Val.h"
|
||||
#include "Scope.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
static scope_list scopes;
|
||||
static Scope* top_scope;
|
||||
|
@ -28,7 +28,7 @@ Scope::Scope(ID* id)
|
|||
if ( id_type->Tag() == TYPE_ERROR )
|
||||
return;
|
||||
else if ( id_type->Tag() != TYPE_FUNC )
|
||||
bro_logger->InternalError("bad scope id");
|
||||
reporter->InternalError("bad scope id");
|
||||
|
||||
Ref(id);
|
||||
|
||||
|
@ -129,7 +129,7 @@ ID* lookup_ID(const char* name, const char* curr_module, bool no_global,
|
|||
if ( id )
|
||||
{
|
||||
if ( need_export && ! id->IsExport() && ! in_debug )
|
||||
bro_logger->Error("identifier is not exported:",
|
||||
reporter->Error("identifier is not exported:",
|
||||
fullname.c_str());
|
||||
|
||||
Ref(id);
|
||||
|
@ -156,7 +156,7 @@ ID* install_ID(const char* name, const char* module_name,
|
|||
bool is_global, bool is_export)
|
||||
{
|
||||
if ( scopes.length() == 0 && ! is_global )
|
||||
bro_logger->InternalError("local identifier in global scope");
|
||||
reporter->InternalError("local identifier in global scope");
|
||||
|
||||
IDScope scope;
|
||||
if ( is_export || ! module_name ||
|
||||
|
@ -198,7 +198,7 @@ Scope* pop_scope()
|
|||
{
|
||||
int n = scopes.length() - 1;
|
||||
if ( n < 0 )
|
||||
bro_logger->InternalError("scope underflow");
|
||||
reporter->InternalError("scope underflow");
|
||||
scopes.remove_nth(n);
|
||||
|
||||
Scope* old_top = top_scope;
|
||||
|
|
|
@ -21,7 +21,7 @@ SerialObj* SerialObj::Instantiate(SerialType type)
|
|||
return o;
|
||||
}
|
||||
|
||||
bro_logger->Error(fmt("Unknown object type 0x%08x", type));
|
||||
reporter->Error(fmt("Unknown object type 0x%08x", type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ const char* SerialObj::ClassName(SerialType type)
|
|||
if ( f != names->end() )
|
||||
return f->second;
|
||||
|
||||
bro_logger->Error(fmt("Unknown object type 0x%08x", type));
|
||||
reporter->Error(fmt("Unknown object type 0x%08x", type));
|
||||
return "<no-class-name>";
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ void SerialObj::Register(SerialType type, FactoryFunc f, const char* name)
|
|||
|
||||
FactoryMap::iterator i = factories->find(type);
|
||||
if ( i != factories->end() )
|
||||
bro_logger->InternalError("SerialType 0x%08x registered twice", type);
|
||||
reporter->InternalError("SerialType 0x%08x registered twice", type);
|
||||
|
||||
(*factories)[type] = f;
|
||||
(*names)[type] = name;
|
||||
|
@ -77,7 +77,7 @@ bool SerialObj::Serialize(SerialInfo* info) const
|
|||
const TransientID* tid = GetTID();
|
||||
|
||||
if ( ! tid )
|
||||
bro_logger->InternalError("no tid - missing DECLARE_SERIAL?");
|
||||
reporter->InternalError("no tid - missing DECLARE_SERIAL?");
|
||||
|
||||
if ( info->cache )
|
||||
pid = info->s->Cache()->Lookup(*tid);
|
||||
|
@ -211,7 +211,7 @@ SerialObj* SerialObj::Unserialize(UnserialInfo* info, SerialType type)
|
|||
|
||||
const TransientID* tid = obj->GetTID();
|
||||
if ( ! tid )
|
||||
bro_logger->InternalError("no tid - missing DECLARE_SERIAL?");
|
||||
reporter->InternalError("no tid - missing DECLARE_SERIAL?");
|
||||
|
||||
if ( info->cache )
|
||||
info->s->Cache()->Register(obj, pid, info->new_cache_strategy);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "net_util.h"
|
||||
#include "SerializationFormat.h"
|
||||
#include "Serializer.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
SerializationFormat::SerializationFormat()
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ bool SerializationFormat::ReadData(void* b, size_t count)
|
|||
{
|
||||
if ( input_pos + count > input_len )
|
||||
{
|
||||
bro_logger->Error("data underflow during read in binary format");
|
||||
reporter->Error("data underflow during read in binary format");
|
||||
abort();
|
||||
return false;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ bool BinarySerializationFormat::Read(char** str, int* len, const char* tag)
|
|||
for ( int i = 0; i < l; i++ )
|
||||
if ( ! s[i] )
|
||||
{
|
||||
bro_logger->Error("binary Format: string contains null; replaced by '_'");
|
||||
reporter->Error("binary Format: string contains null; replaced by '_'");
|
||||
s[i] = '_';
|
||||
}
|
||||
}
|
||||
|
@ -333,61 +333,61 @@ XMLSerializationFormat::~XMLSerializationFormat()
|
|||
|
||||
bool XMLSerializationFormat::Read(int* v, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(uint16* v, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(uint32* v, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(int64* v, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(uint64* v, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(bool* v, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(double* d, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(char* v, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(char** str, int* len, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Read(string* s, const char* tag)
|
||||
{
|
||||
bro_logger->InternalError("no reading of xml");
|
||||
reporter->InternalError("no reading of xml");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "Serializer.h"
|
||||
#include "Scope.h"
|
||||
#include "Stmt.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "Func.h"
|
||||
#include "Event.h"
|
||||
#include "EventRegistry.h"
|
||||
|
@ -911,7 +911,7 @@ bool FileSerializer::Read(UnserialInfo* info, const char* file, bool header)
|
|||
|
||||
void FileSerializer::ReportError(const char* str)
|
||||
{
|
||||
bro_logger->Error(str);
|
||||
reporter->Error(str);
|
||||
}
|
||||
|
||||
void FileSerializer::GotID(ID* id, Val* val)
|
||||
|
@ -971,7 +971,7 @@ ConversionSerializer::~ConversionSerializer()
|
|||
|
||||
bool ConversionSerializer::Convert(const char* file_in, const char* file_out)
|
||||
{
|
||||
bro_logger->InternalError("Error: Printing as XML is broken.");
|
||||
reporter->InternalError("Error: Printing as XML is broken.");
|
||||
|
||||
if ( ! serout->Open(file_out, true) )
|
||||
return false;
|
||||
|
@ -1004,19 +1004,19 @@ void ConversionSerializer::GotFunctionCall(const char* name, double time,
|
|||
|
||||
void ConversionSerializer::GotID(ID* id, Val* val)
|
||||
{
|
||||
bro_logger->Warning("ConversionSerializer::GotID not implemented");
|
||||
reporter->Warning("ConversionSerializer::GotID not implemented");
|
||||
Unref(id);
|
||||
}
|
||||
|
||||
void ConversionSerializer::GotStateAccess(StateAccess* s)
|
||||
{
|
||||
bro_logger->Warning("ConversionSerializer::GotID not implemented");
|
||||
reporter->Warning("ConversionSerializer::GotID not implemented");
|
||||
delete s;
|
||||
}
|
||||
|
||||
void ConversionSerializer::GotPacket(Packet* p)
|
||||
{
|
||||
bro_logger->Warning("ConversionSerializer::GotPacket not implemented");
|
||||
reporter->Warning("ConversionSerializer::GotPacket not implemented");
|
||||
delete p;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "IP.h"
|
||||
#include "Timer.h"
|
||||
#include "IOSource.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
class SerializationCache;
|
||||
class SerialInfo;
|
||||
|
@ -263,7 +263,7 @@ public:
|
|||
virtual ~CloneSerializer() { }
|
||||
|
||||
protected:
|
||||
virtual void ReportError(const char* msg) { bro_logger->Error(msg); }
|
||||
virtual void ReportError(const char* msg) { reporter->Error(msg); }
|
||||
virtual void GotID(ID* id, Val* val) { }
|
||||
virtual void GotEvent(const char* name, double time,
|
||||
EventHandlerPtr event, val_list* args) { }
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "Timer.h"
|
||||
#include "NetVar.h"
|
||||
#include "Sessions.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "OSFinger.h"
|
||||
|
||||
#include "ICMP.h"
|
||||
|
@ -572,7 +572,7 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
|||
|
||||
HashKey* h = id.BuildConnKey();
|
||||
if ( ! h )
|
||||
bro_logger->InternalError("hash computation failed");
|
||||
reporter->InternalError("hash computation failed");
|
||||
|
||||
Connection* conn = 0;
|
||||
|
||||
|
@ -761,7 +761,7 @@ FragReassembler* NetSessions::NextFragment(double t, const IP_Hdr* ip,
|
|||
|
||||
HashKey* h = ch->ComputeHash(key, 1);
|
||||
if ( ! h )
|
||||
bro_logger->InternalError("hash computation failed");
|
||||
reporter->InternalError("hash computation failed");
|
||||
|
||||
FragReassembler* f = fragments.Lookup(h);
|
||||
if ( ! f )
|
||||
|
@ -855,7 +855,7 @@ Connection* NetSessions::FindConnection(Val* v)
|
|||
|
||||
HashKey* h = id.BuildConnKey();
|
||||
if ( ! h )
|
||||
bro_logger->InternalError("hash computation failed");
|
||||
reporter->InternalError("hash computation failed");
|
||||
|
||||
Dictionary* d;
|
||||
|
||||
|
@ -933,21 +933,21 @@ void NetSessions::Remove(Connection* c)
|
|||
;
|
||||
|
||||
else if ( ! tcp_conns.RemoveEntry(k) )
|
||||
bro_logger->InternalError("connection missing");
|
||||
reporter->InternalError("connection missing");
|
||||
break;
|
||||
|
||||
case TRANSPORT_UDP:
|
||||
if ( ! udp_conns.RemoveEntry(k) )
|
||||
bro_logger->InternalError("connection missing");
|
||||
reporter->InternalError("connection missing");
|
||||
break;
|
||||
|
||||
case TRANSPORT_ICMP:
|
||||
if ( ! icmp_conns.RemoveEntry(k) )
|
||||
bro_logger->InternalError("connection missing");
|
||||
reporter->InternalError("connection missing");
|
||||
break;
|
||||
|
||||
case TRANSPORT_UNKNOWN:
|
||||
bro_logger->InternalError("unknown transport when removing connection");
|
||||
reporter->InternalError("unknown transport when removing connection");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -960,10 +960,10 @@ void NetSessions::Remove(FragReassembler* f)
|
|||
{
|
||||
HashKey* k = f->Key();
|
||||
if ( ! k )
|
||||
bro_logger->InternalError("fragment block not in dictionary");
|
||||
reporter->InternalError("fragment block not in dictionary");
|
||||
|
||||
if ( ! fragments.RemoveEntry(k) )
|
||||
bro_logger->InternalError("fragment block missing");
|
||||
reporter->InternalError("fragment block missing");
|
||||
|
||||
Unref(f);
|
||||
}
|
||||
|
@ -999,7 +999,7 @@ void NetSessions::Insert(Connection* c)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown connection type");
|
||||
reporter->InternalError("unknown connection type");
|
||||
}
|
||||
|
||||
if ( old && old != c )
|
||||
|
@ -1123,7 +1123,7 @@ Connection* NetSessions::NewConn(HashKey* k, double t, const ConnID* id,
|
|||
tproto = TRANSPORT_UDP;
|
||||
break;
|
||||
default:
|
||||
bro_logger->InternalError("unknown transport protocol");
|
||||
reporter->InternalError("unknown transport protocol");
|
||||
break;
|
||||
};
|
||||
|
||||
|
@ -1310,7 +1310,7 @@ void NetSessions::DumpPacket(const struct pcap_pkthdr* hdr,
|
|||
struct pcap_pkthdr h = *hdr;
|
||||
h.caplen = len;
|
||||
if ( h.caplen > hdr->caplen )
|
||||
bro_logger->InternalError("bad modified caplen");
|
||||
reporter->InternalError("bad modified caplen");
|
||||
pkt_dumper->Dump(&h, pkt);
|
||||
}
|
||||
}
|
||||
|
@ -1319,7 +1319,7 @@ void NetSessions::Internal(const char* msg, const struct pcap_pkthdr* hdr,
|
|||
const u_char* pkt)
|
||||
{
|
||||
DumpPacket(hdr, pkt);
|
||||
bro_logger->InternalError("%s", msg);
|
||||
reporter->InternalError("%s", msg);
|
||||
}
|
||||
|
||||
void NetSessions::Weird(const char* name,
|
||||
|
@ -1328,12 +1328,12 @@ void NetSessions::Weird(const char* name,
|
|||
if ( hdr )
|
||||
dump_this_packet = 1;
|
||||
|
||||
bro_logger->Weird(name);
|
||||
reporter->Weird(name);
|
||||
}
|
||||
|
||||
void NetSessions::Weird(const char* name, const IP_Hdr* ip)
|
||||
{
|
||||
bro_logger->Weird(ip->SrcAddr4(), ip->DstAddr4(), name);
|
||||
reporter->Weird(ip->SrcAddr4(), ip->DstAddr4(), name);
|
||||
}
|
||||
|
||||
unsigned int NetSessions::ConnectionMemoryUsage()
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "SmithWaterman.h"
|
||||
#include "Var.h"
|
||||
#include "util.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
BroSubstring::BroSubstring(const BroSubstring& bst)
|
||||
: BroString((const BroString&) bst), _new(bst._new)
|
||||
|
@ -186,7 +186,7 @@ bool BroSubstringCmp::operator()(const BroSubstring* bst1,
|
|||
if ( _index >= bst1->GetNumAlignments() ||
|
||||
_index >= bst2->GetNumAlignments() )
|
||||
{
|
||||
bro_logger->Warning("BroSubstringCmp::operator(): invalid index for input strings.\n");
|
||||
reporter->Warning("BroSubstringCmp::operator(): invalid index for input strings.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ bool StateAccess::MergeTables(TableVal* dst, Val* src)
|
|||
{
|
||||
if ( ! src->Type()->Tag() == TYPE_TABLE )
|
||||
{
|
||||
bro_logger->Error("type mismatch while merging tables");
|
||||
reporter->Error("type mismatch while merging tables");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -269,8 +269,8 @@ void StateAccess::Replay()
|
|||
{
|
||||
// FIXME: I think this warrants an internal error,
|
||||
// but let's check that first ...
|
||||
// bro_logger->InternalError("replay id lacking a value");
|
||||
bro_logger->Error("replay id lacks a value");
|
||||
// reporter->InternalError("replay id lacking a value");
|
||||
reporter->Error("replay id lacks a value");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ void StateAccess::Replay()
|
|||
v->AsRecordVal()->Assign(idx, op2 ? op2->Ref() : 0);
|
||||
}
|
||||
else
|
||||
bro_logger->Error(fmt("access replay: unknown record field %s for assign", field));
|
||||
reporter->Error(fmt("access replay: unknown record field %s for assign", field));
|
||||
}
|
||||
|
||||
else if ( t == TYPE_VECTOR )
|
||||
|
@ -377,7 +377,7 @@ void StateAccess::Replay()
|
|||
}
|
||||
|
||||
else
|
||||
bro_logger->InternalError("unknown type in replaying index assign");
|
||||
reporter->InternalError("unknown type in replaying index assign");
|
||||
|
||||
break;
|
||||
|
||||
|
@ -413,7 +413,7 @@ void StateAccess::Replay()
|
|||
v->AsRecordVal()->Assign(idx, new_val, OP_INCR);
|
||||
}
|
||||
else
|
||||
bro_logger->Error(fmt("access replay: unknown record field %s for assign", field));
|
||||
reporter->Error(fmt("access replay: unknown record field %s for assign", field));
|
||||
}
|
||||
|
||||
else if ( t == TYPE_VECTOR )
|
||||
|
@ -427,7 +427,7 @@ void StateAccess::Replay()
|
|||
}
|
||||
|
||||
else
|
||||
bro_logger->InternalError("unknown type in replaying index increment");
|
||||
reporter->InternalError("unknown type in replaying index increment");
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ void StateAccess::Replay()
|
|||
|
||||
case OP_PRINT:
|
||||
assert(op1.val);
|
||||
bro_logger->InternalError("access replay for print not implemented");
|
||||
reporter->InternalError("access replay for print not implemented");
|
||||
break;
|
||||
|
||||
case OP_READ_IDX:
|
||||
|
@ -518,11 +518,11 @@ void StateAccess::Replay()
|
|||
}
|
||||
}
|
||||
else
|
||||
bro_logger->Error("read for non-table");
|
||||
reporter->Error("read for non-table");
|
||||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("access replay: unknown opcode for StateAccess");
|
||||
reporter->InternalError("access replay: unknown opcode for StateAccess");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ bool StateAccess::DoSerialize(SerialInfo* info) const
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("StateAccess::DoSerialize: unknown opcode");
|
||||
reporter->InternalError("StateAccess::DoSerialize: unknown opcode");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -854,7 +854,7 @@ void StateAccess::Describe(ODesc* d) const
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("unknown opcode for StateAccess");
|
||||
reporter->InternalError("unknown opcode for StateAccess");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
22
src/Stats.cc
22
src/Stats.cc
|
@ -21,7 +21,7 @@ uint32 tot_gap_bytes = 0;
|
|||
|
||||
class ProfileTimer : public Timer {
|
||||
public:
|
||||
ProfileTimer(double t, ProfileLogger* l, double i)
|
||||
ProfileTimer(double t, ProfileReporter* l, double i)
|
||||
: Timer(t, TIMER_PROFILE)
|
||||
{
|
||||
logger = l;
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
protected:
|
||||
double interval;
|
||||
ProfileLogger* logger;
|
||||
ProfileReporter* logger;
|
||||
};
|
||||
|
||||
void ProfileTimer::Dispatch(double t, int is_expire)
|
||||
|
@ -46,7 +46,7 @@ void ProfileTimer::Dispatch(double t, int is_expire)
|
|||
}
|
||||
|
||||
|
||||
ProfileLogger::ProfileLogger(BroFile* arg_file, double interval)
|
||||
ProfileReporter::ProfileReporter(BroFile* arg_file, double interval)
|
||||
: SegmentStatsReporter()
|
||||
{
|
||||
file = arg_file;
|
||||
|
@ -54,12 +54,12 @@ ProfileLogger::ProfileLogger(BroFile* arg_file, double interval)
|
|||
timer_mgr->Add(new ProfileTimer(1, this, interval));
|
||||
}
|
||||
|
||||
ProfileLogger::~ProfileLogger()
|
||||
ProfileReporter::~ProfileReporter()
|
||||
{
|
||||
file->Close();
|
||||
}
|
||||
|
||||
void ProfileLogger::Log()
|
||||
void ProfileReporter::Log()
|
||||
{
|
||||
if ( terminating )
|
||||
// Connections have been flushed already.
|
||||
|
@ -285,7 +285,7 @@ void ProfileLogger::Log()
|
|||
}
|
||||
}
|
||||
|
||||
void ProfileLogger::SegmentProfile(const char* name, const Location* loc,
|
||||
void ProfileReporter::SegmentProfile(const char* name, const Location* loc,
|
||||
double dtime, int dmem)
|
||||
{
|
||||
if ( name )
|
||||
|
@ -303,7 +303,7 @@ void ProfileLogger::SegmentProfile(const char* name, const Location* loc,
|
|||
}
|
||||
|
||||
|
||||
SampleLogger::SampleLogger()
|
||||
SampleReporter::SampleReporter()
|
||||
{
|
||||
static TableType* load_sample_info = 0;
|
||||
|
||||
|
@ -313,22 +313,22 @@ SampleLogger::SampleLogger()
|
|||
load_samples = new TableVal(load_sample_info);
|
||||
}
|
||||
|
||||
SampleLogger::~SampleLogger()
|
||||
SampleReporter::~SampleReporter()
|
||||
{
|
||||
Unref(load_samples);
|
||||
}
|
||||
|
||||
void SampleLogger::FunctionSeen(const Func* func)
|
||||
void SampleReporter::FunctionSeen(const Func* func)
|
||||
{
|
||||
load_samples->Assign(new StringVal(func->GetID()->Name()), 0);
|
||||
}
|
||||
|
||||
void SampleLogger::LocationSeen(const Location* loc)
|
||||
void SampleReporter::LocationSeen(const Location* loc)
|
||||
{
|
||||
load_samples->Assign(new StringVal(loc->filename), 0);
|
||||
}
|
||||
|
||||
void SampleLogger::SegmentProfile(const char* /* name */,
|
||||
void SampleReporter::SegmentProfile(const char* /* name */,
|
||||
const Location* /* loc */,
|
||||
double dtime, int dmem)
|
||||
{
|
||||
|
|
18
src/Stats.h
18
src/Stats.h
|
@ -73,10 +73,10 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
class ProfileLogger : public SegmentStatsReporter {
|
||||
class ProfileReporter : public SegmentStatsReporter {
|
||||
public:
|
||||
ProfileLogger(BroFile* file, double interval);
|
||||
~ProfileLogger();
|
||||
ProfileReporter(BroFile* file, double interval);
|
||||
~ProfileReporter();
|
||||
|
||||
void Log();
|
||||
BroFile* File() { return file; }
|
||||
|
@ -92,10 +92,10 @@ private:
|
|||
|
||||
|
||||
// Generates load_sample() events.
|
||||
class SampleLogger : public SegmentStatsReporter {
|
||||
class SampleReporter : public SegmentStatsReporter {
|
||||
public:
|
||||
SampleLogger();
|
||||
~SampleLogger();
|
||||
SampleReporter();
|
||||
~SampleReporter();
|
||||
|
||||
// These are called to report that a given function or location
|
||||
// has been seen during the sampling.
|
||||
|
@ -110,9 +110,9 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
extern ProfileLogger* profiling_logger;
|
||||
extern ProfileLogger* segment_logger;
|
||||
extern SampleLogger* sample_logger;
|
||||
extern ProfileReporter* profiling_logger;
|
||||
extern ProfileReporter* segment_logger;
|
||||
extern SampleReporter* sample_logger;
|
||||
|
||||
// Connection statistics.
|
||||
extern int killed_by_inactivity;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "Event.h"
|
||||
#include "Frame.h"
|
||||
#include "File.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "NetVar.h"
|
||||
#include "Stmt.h"
|
||||
#include "Scope.h"
|
||||
|
@ -2060,7 +2060,7 @@ int same_stmt(const Stmt* s1, const Stmt* s2)
|
|||
return 1;
|
||||
|
||||
default:
|
||||
bro_logger->Error("bad tag in same_stmt()");
|
||||
reporter->Error("bad tag in same_stmt()");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "BroList.h"
|
||||
#include "Obj.h"
|
||||
#include "Expr.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
#include "StmtEnums.h"
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
if ( breakpoint_count )
|
||||
--breakpoint_count;
|
||||
else
|
||||
bro_logger->InternalError("breakpoint count decremented below 0");
|
||||
reporter->InternalError("breakpoint count decremented below 0");
|
||||
}
|
||||
|
||||
virtual unsigned int BPCount() const { return breakpoint_count; }
|
||||
|
|
|
@ -1589,7 +1589,7 @@ BroFile* TCP_Analyzer::GetContentsFile(unsigned int direction) const
|
|||
default:
|
||||
break;
|
||||
}
|
||||
bro_logger->InternalError("inconsistency in TCP_Analyzer::GetContentsFile");
|
||||
reporter->InternalError("inconsistency in TCP_Analyzer::GetContentsFile");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ int TCP_Endpoint::DataSent(double t, int seq, int len, int caplen,
|
|||
|
||||
if ( fwrite(data, 1, len, f) < unsigned(len) )
|
||||
// ### this should really generate an event
|
||||
bro_logger->InternalError("contents write failed");
|
||||
reporter->InternalError("contents write failed");
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
|
@ -104,7 +104,7 @@ void TCP_Reassembler::SetContentsFile(BroFile* f)
|
|||
{
|
||||
if ( ! f->IsOpen() )
|
||||
{
|
||||
bro_logger->Error("no such file \"%s\"", f->Name());
|
||||
reporter->Error("no such file \"%s\"", f->Name());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ void TCP_Reassembler::Undelivered(int up_to_seq)
|
|||
|
||||
if ( seq_delta(up_to_seq, last_reassem_seq) <= 0 )
|
||||
// This should never happen.
|
||||
bro_logger->InternalError("Calling Undelivered for data that has already been delivered (or has already been marked as undelivered");
|
||||
reporter->InternalError("Calling Undelivered for data that has already been delivered (or has already been marked as undelivered");
|
||||
|
||||
if ( last_reassem_seq == 1 &&
|
||||
(endpoint->FIN_cnt > 0 || endpoint->RST_cnt > 0 ||
|
||||
|
@ -323,14 +323,14 @@ void TCP_Reassembler::RecordBlock(DataBlock* b, BroFile* f)
|
|||
unsigned int len = b->Size();
|
||||
if ( ! f->Write((const char*) b->block, len) )
|
||||
// ### this should really generate an event
|
||||
bro_logger->InternalError("contents write failed");
|
||||
reporter->InternalError("contents write failed");
|
||||
}
|
||||
|
||||
void TCP_Reassembler::RecordGap(int start_seq, int upper_seq, BroFile* f)
|
||||
{
|
||||
if ( ! f->Write(fmt("\n<<gap %d>>\n", seq_delta(upper_seq, start_seq))) )
|
||||
// ### this should really generate an event
|
||||
bro_logger->InternalError("contents gap write failed");
|
||||
reporter->InternalError("contents gap write failed");
|
||||
}
|
||||
|
||||
void TCP_Reassembler::BlockInserted(DataBlock* start_block)
|
||||
|
@ -407,13 +407,13 @@ IMPLEMENT_SERIAL(TCP_Reassembler, SER_TCP_REASSEMBLER);
|
|||
|
||||
bool TCP_Reassembler::DoSerialize(SerialInfo* info) const
|
||||
{
|
||||
bro_logger->InternalError("TCP_Reassembler::DoSerialize not implemented");
|
||||
reporter->InternalError("TCP_Reassembler::DoSerialize not implemented");
|
||||
return false; // Cannot be reached.
|
||||
}
|
||||
|
||||
bool TCP_Reassembler::DoUnserialize(UnserialInfo* info)
|
||||
{
|
||||
bro_logger->InternalError("TCP_Reassembler::DoUnserialize not implemented");
|
||||
reporter->InternalError("TCP_Reassembler::DoUnserialize not implemented");
|
||||
return false; // Cannot be reached.
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ void PQ_TimerMgr::Add(Timer* timer)
|
|||
// multiple already-added timers are added, they'll still
|
||||
// execute in sorted order.
|
||||
if ( ! q->Add(timer) )
|
||||
bro_logger->InternalError("out of memory");
|
||||
reporter->InternalError("out of memory");
|
||||
|
||||
++current_timers[timer->Type()];
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ int PQ_TimerMgr::DoAdvance(double new_t, int max_expire)
|
|||
void PQ_TimerMgr::Remove(Timer* timer)
|
||||
{
|
||||
if ( ! q->Remove(timer) )
|
||||
bro_logger->InternalError("asked to remove a missing timer");
|
||||
reporter->InternalError("asked to remove a missing timer");
|
||||
|
||||
--current_timers[timer->Type()];
|
||||
delete timer;
|
||||
|
@ -183,7 +183,7 @@ CQ_TimerMgr::CQ_TimerMgr(const Tag& tag) : TimerMgr(tag)
|
|||
{
|
||||
cq = cq_init(60.0, 1.0);
|
||||
if ( ! cq )
|
||||
bro_logger->InternalError("could not initialize calendar queue");
|
||||
reporter->InternalError("could not initialize calendar queue");
|
||||
}
|
||||
|
||||
CQ_TimerMgr::~CQ_TimerMgr()
|
||||
|
@ -208,7 +208,7 @@ void CQ_TimerMgr::Add(Timer* timer)
|
|||
t = network_time;
|
||||
|
||||
if ( cq_enqueue(cq, t, timer) < 0 )
|
||||
bro_logger->InternalError("problem queueing timer");
|
||||
reporter->InternalError("problem queueing timer");
|
||||
|
||||
++current_timers[timer->Type()];
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ Trigger::Trigger(Expr* arg_cond, Stmt* arg_body, Stmt* arg_timeout_stmts,
|
|||
Trigger* parent = frame->GetTrigger();
|
||||
if ( ! parent )
|
||||
{
|
||||
bro_logger->Error("return trigger in context which does not allow delaying result");
|
||||
reporter->Error("return trigger in context which does not allow delaying result");
|
||||
Unref(this);
|
||||
return;
|
||||
}
|
||||
|
|
36
src/Type.cc
36
src/Type.cc
|
@ -9,7 +9,7 @@
|
|||
#include "Expr.h"
|
||||
#include "Scope.h"
|
||||
#include "Serializer.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
@ -316,7 +316,7 @@ int TypeList::AllMatch(const BroType* t, int is_init) const
|
|||
void TypeList::Append(BroType* t)
|
||||
{
|
||||
if ( pure_type && ! same_type(t, pure_type) )
|
||||
bro_logger->InternalError("pure type-list violation");
|
||||
reporter->InternalError("pure type-list violation");
|
||||
|
||||
types.append(t);
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ void RecordType::Init(TypeList* arg_base)
|
|||
|
||||
if ( fields->Lookup(tdij->id) )
|
||||
{
|
||||
bro_logger->Error("duplicate field", tdij->id);
|
||||
reporter->Error("duplicate field", tdij->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1024,7 +1024,7 @@ const TypeDecl* RecordType::FieldDecl(int field) const
|
|||
{
|
||||
RecordField* rf = fields->NthEntry(field);
|
||||
if ( ! rf )
|
||||
bro_logger->InternalError("missing field in RecordType::FieldDecl");
|
||||
reporter->InternalError("missing field in RecordType::FieldDecl");
|
||||
|
||||
BroType* bt = (*base->Types())[rf->base];
|
||||
RecordType* rbt = bt->AsRecordType();
|
||||
|
@ -1341,7 +1341,7 @@ CommentedEnumType::~CommentedEnumType()
|
|||
}
|
||||
}
|
||||
|
||||
// Note, we use bro_logger->Error() here (not Error()) to include the current script
|
||||
// Note, we use reporter->Error() here (not Error()) to include the current script
|
||||
// location in the error message, rather than the one where the type was
|
||||
// originally defined.
|
||||
void EnumType::AddName(const string& module_name, const char* name, bool is_export)
|
||||
|
@ -1349,7 +1349,7 @@ void EnumType::AddName(const string& module_name, const char* name, bool is_expo
|
|||
/* implicit, auto-increment */
|
||||
if ( counter < 0)
|
||||
{
|
||||
bro_logger->Error("cannot mix explicit enumerator assignment and implicit auto-increment");
|
||||
reporter->Error("cannot mix explicit enumerator assignment and implicit auto-increment");
|
||||
SetError();
|
||||
return;
|
||||
}
|
||||
|
@ -1362,7 +1362,7 @@ void EnumType::AddName(const string& module_name, const char* name, bro_int_t va
|
|||
/* explicit value specified */
|
||||
if ( counter > 0 )
|
||||
{
|
||||
bro_logger->Error("cannot mix explicit enumerator assignment and implicit auto-increment");
|
||||
reporter->Error("cannot mix explicit enumerator assignment and implicit auto-increment");
|
||||
SetError();
|
||||
return;
|
||||
}
|
||||
|
@ -1395,7 +1395,7 @@ void EnumType::AddNameInternal(const string& module_name, const char* name, bro_
|
|||
ID *id;
|
||||
if ( Lookup(val) )
|
||||
{
|
||||
bro_logger->Error("enumerator value in enumerated type definition already exists");
|
||||
reporter->Error("enumerator value in enumerated type definition already exists");
|
||||
SetError();
|
||||
return;
|
||||
}
|
||||
|
@ -1409,7 +1409,7 @@ void EnumType::AddNameInternal(const string& module_name, const char* name, bro_
|
|||
}
|
||||
else
|
||||
{
|
||||
bro_logger->Error("identifier or enumerator value in enumerated type definition already exists");
|
||||
reporter->Error("identifier or enumerator value in enumerated type definition already exists");
|
||||
SetError();
|
||||
return;
|
||||
}
|
||||
|
@ -1776,7 +1776,7 @@ int same_type(const BroType* t1, const BroType* t2, int is_init)
|
|||
return same_type(t1, t2, is_init);
|
||||
|
||||
case TYPE_UNION:
|
||||
bro_logger->Error("union type in same_type()");
|
||||
reporter->Error("union type in same_type()");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1821,7 +1821,7 @@ const BroType* flatten_type(const BroType* t)
|
|||
const type_list* types = tl->Types();
|
||||
|
||||
if ( types->length() == 0 )
|
||||
bro_logger->InternalError("empty type list in flatten_type");
|
||||
reporter->InternalError("empty type list in flatten_type");
|
||||
|
||||
const BroType* ft = (*types)[0];
|
||||
if ( types->length() == 1 || tl->AllMatch(ft, 0) )
|
||||
|
@ -1870,7 +1870,7 @@ int is_assignable(BroType* t)
|
|||
return 0;
|
||||
|
||||
case TYPE_UNION:
|
||||
bro_logger->Error("union type in is_assignable()");
|
||||
reporter->Error("union type in is_assignable()");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1899,7 +1899,7 @@ TypeTag max_type(TypeTag t1, TypeTag t2)
|
|||
}
|
||||
else
|
||||
{
|
||||
bro_logger->InternalError("non-arithmetic tags in max_type()");
|
||||
reporter->InternalError("non-arithmetic tags in max_type()");
|
||||
return TYPE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -1994,7 +1994,7 @@ BroType* merge_types(const BroType* t1, const BroType* t2)
|
|||
return new TableType(tl3, y3);
|
||||
else
|
||||
{
|
||||
bro_logger->InternalError("bad tag in merge_types");
|
||||
reporter->InternalError("bad tag in merge_types");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2112,11 +2112,11 @@ BroType* merge_types(const BroType* t1, const BroType* t2)
|
|||
return new FileType(merge_types(t1->YieldType(), t2->YieldType()));
|
||||
|
||||
case TYPE_UNION:
|
||||
bro_logger->InternalError("union type in merge_types()");
|
||||
reporter->InternalError("union type in merge_types()");
|
||||
return 0;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad type in merge_types()");
|
||||
reporter->InternalError("bad type in merge_types()");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2128,7 +2128,7 @@ BroType* merge_type_list(ListExpr* elements)
|
|||
|
||||
if ( tl->length() < 1 )
|
||||
{
|
||||
bro_logger->Error("no type can be inferred for empty list");
|
||||
reporter->Error("no type can be inferred for empty list");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2145,7 +2145,7 @@ BroType* merge_type_list(ListExpr* elements)
|
|||
}
|
||||
|
||||
if ( ! t )
|
||||
bro_logger->Error("inconsistent types in list");
|
||||
reporter->Error("inconsistent types in list");
|
||||
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "Net.h"
|
||||
#include "NetVar.h"
|
||||
#include "UDP.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
UDP_Analyzer::UDP_Analyzer(Connection* conn)
|
||||
: TransportLayerAnalyzer(AnalyzerTag::UDP, conn)
|
||||
|
@ -136,7 +136,7 @@ void UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
|
|||
request_len += ulen;
|
||||
#ifdef DEBUG
|
||||
if ( request_len < 0 )
|
||||
bro_logger->Warning("wrapping around for UDP request length");
|
||||
reporter->Warning("wrapping around for UDP request length");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ void UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
|
|||
reply_len += ulen;
|
||||
#ifdef DEBUG
|
||||
if ( reply_len < 0 )
|
||||
bro_logger->Warning("wrapping around for UDP reply length");
|
||||
reporter->Warning("wrapping around for UDP reply length");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
38
src/Val.cc
38
src/Val.cc
|
@ -26,7 +26,7 @@
|
|||
#include "RemoteSerializer.h"
|
||||
#include "PrefixTable.h"
|
||||
#include "Conn.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
|
||||
Val::Val(Func* f)
|
||||
|
@ -253,7 +253,7 @@ bool Val::DoSerialize(SerialInfo* info) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bro_logger->InternalError("should not be reached");
|
||||
reporter->InternalError("should not be reached");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ bool Val::DoUnserialize(UnserialInfo* info)
|
|||
return false;
|
||||
}
|
||||
|
||||
bro_logger->InternalError("should not be reached");
|
||||
reporter->InternalError("should not be reached");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ void Val::ValDescribe(ODesc* d) const
|
|||
|
||||
default:
|
||||
// Don't call Internal(), that'll loop!
|
||||
bro_logger->InternalError("Val description unavailable");
|
||||
reporter->InternalError("Val description unavailable");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -964,7 +964,7 @@ AddrVal::AddrVal(const char* text) : Val(TYPE_ADDR)
|
|||
#ifdef BROv6
|
||||
Init(dotted_to_addr6(text));
|
||||
#else
|
||||
bro_logger->Error("bro wasn't compiled with IPv6 support");
|
||||
reporter->Error("bro wasn't compiled with IPv6 support");
|
||||
Init(uint32(0));
|
||||
#endif
|
||||
}
|
||||
|
@ -1085,13 +1085,13 @@ static uint32 parse_dotted(const char* text, int& dots)
|
|||
}
|
||||
|
||||
else
|
||||
bro_logger->InternalError("scanf failed in parse_dotted()");
|
||||
reporter->InternalError("scanf failed in parse_dotted()");
|
||||
|
||||
for ( int i = 0; i <= dots; ++i )
|
||||
{
|
||||
if ( addr[i] < 0 || addr[i] > 255 )
|
||||
{
|
||||
bro_logger->Error("bad dotted address", text);
|
||||
reporter->Error("bad dotted address", text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1105,7 +1105,7 @@ NetVal::NetVal(const char* text) : AddrVal(TYPE_NET)
|
|||
uint32 a = parse_dotted(text, dots);
|
||||
|
||||
if ( addr_to_net(a) != a )
|
||||
bro_logger->Error("bad net address", text);
|
||||
reporter->Error("bad net address", text);
|
||||
|
||||
Init(uint32(htonl(a)));
|
||||
}
|
||||
|
@ -1998,7 +1998,7 @@ int TableVal::ExpandAndInit(Val* index, Val* new_val)
|
|||
if ( iv->BaseTag() != TYPE_ANY )
|
||||
{
|
||||
if ( table_type->Indices()->Types()->length() != 1 )
|
||||
bro_logger->InternalError("bad singleton list index");
|
||||
reporter->InternalError("bad singleton list index");
|
||||
|
||||
for ( int i = 0; i < iv->Length(); ++i )
|
||||
if ( ! ExpandAndInit(iv->Index(i), new_val ? new_val->Ref() : 0) )
|
||||
|
@ -2193,7 +2193,7 @@ Val* TableVal::Delete(const Val* index)
|
|||
Val* va = v ? (v->Value() ? v->Value() : this->Ref()) : 0;
|
||||
|
||||
if ( subnets && ! subnets->Remove(index) )
|
||||
bro_logger->InternalError( "index not in prefix table" );
|
||||
reporter->InternalError( "index not in prefix table" );
|
||||
|
||||
if ( LoggingAccess() )
|
||||
{
|
||||
|
@ -2235,7 +2235,7 @@ Val* TableVal::Delete(const HashKey* k)
|
|||
{
|
||||
Val* index = table_hash->RecoverVals(k);
|
||||
if ( ! subnets->Remove(index) )
|
||||
bro_logger->InternalError( "index not in prefix table" );
|
||||
reporter->InternalError( "index not in prefix table" );
|
||||
Unref(index);
|
||||
}
|
||||
|
||||
|
@ -2316,7 +2316,7 @@ void TableVal::Describe(ODesc* d) const
|
|||
TableEntryVal* v = tbl->NextEntry(k, c);
|
||||
|
||||
if ( ! v )
|
||||
bro_logger->InternalError("hash table underflow in TableVal::Describe");
|
||||
reporter->InternalError("hash table underflow in TableVal::Describe");
|
||||
|
||||
ListVal* vl = table_hash->RecoverVals(k);
|
||||
int dim = vl->Length();
|
||||
|
@ -2367,7 +2367,7 @@ void TableVal::Describe(ODesc* d) const
|
|||
}
|
||||
|
||||
if ( tbl->NextEntry(c) )
|
||||
bro_logger->InternalError("hash table overflow in TableVal::Describe");
|
||||
reporter->InternalError("hash table overflow in TableVal::Describe");
|
||||
|
||||
if ( d->IsPortable() || d->IsReadable() )
|
||||
{
|
||||
|
@ -2489,7 +2489,7 @@ void TableVal::DoExpire(double t)
|
|||
{
|
||||
Val* index = RecoverIndex(k);
|
||||
if ( ! subnets->Remove(index) )
|
||||
bro_logger->InternalError( "index not in prefix table" );
|
||||
reporter->InternalError( "index not in prefix table" );
|
||||
Unref(index);
|
||||
}
|
||||
|
||||
|
@ -2610,7 +2610,7 @@ bool TableVal::DoSerialize(SerialInfo* info) const
|
|||
state = (State*) info->cont.RestoreState();
|
||||
}
|
||||
else
|
||||
bro_logger->InternalError("unknown continuation state");
|
||||
reporter->InternalError("unknown continuation state");
|
||||
|
||||
HashKey* k;
|
||||
int count = 0;
|
||||
|
@ -2695,7 +2695,7 @@ bool TableVal::DoSerialize(SerialInfo* info) const
|
|||
{
|
||||
info->cont.SaveState(state);
|
||||
info->cont.Suspend();
|
||||
bro_logger->Message("TableVals serialization suspended right in the middle.");
|
||||
reporter->Message("TableVals serialization suspended right in the middle.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3489,7 +3489,7 @@ Val* check_and_promote(Val* v, const BroType* t, int is_init)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad internal type in check_and_promote()");
|
||||
reporter->InternalError("bad internal type in check_and_promote()");
|
||||
Unref(v);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3500,7 +3500,7 @@ Val* check_and_promote(Val* v, const BroType* t, int is_init)
|
|||
|
||||
int same_val(const Val* /* v1 */, const Val* /* v2 */)
|
||||
{
|
||||
bro_logger->InternalError("same_val not implemented");
|
||||
reporter->InternalError("same_val not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3551,7 +3551,7 @@ int same_atomic_val(const Val* v1, const Val* v2)
|
|||
return subnet_eq(v1->AsSubNet(), v2->AsSubNet());
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("same_atomic_val called for non-atomic value");
|
||||
reporter->InternalError("same_atomic_val called for non-atomic value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
10
src/Var.cc
10
src/Var.cc
|
@ -404,7 +404,7 @@ Val* internal_val(const char* name)
|
|||
{
|
||||
ID* id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id )
|
||||
bro_logger->InternalError("internal variable %s missing", name);
|
||||
reporter->InternalError("internal variable %s missing", name);
|
||||
|
||||
return id->ID_Val();
|
||||
}
|
||||
|
@ -413,10 +413,10 @@ Val* internal_const_val(const char* name)
|
|||
{
|
||||
ID* id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id )
|
||||
bro_logger->InternalError("internal variable %s missing", name);
|
||||
reporter->InternalError("internal variable %s missing", name);
|
||||
|
||||
if ( ! id->IsConst() )
|
||||
bro_logger->InternalError("internal variable %s is not constant", name);
|
||||
reporter->InternalError("internal variable %s is not constant", name);
|
||||
|
||||
return id->ID_Val();
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ ListVal* internal_list_val(const char* name)
|
|||
}
|
||||
|
||||
else
|
||||
bro_logger->InternalError("internal variable %s is not a list", name);
|
||||
reporter->InternalError("internal variable %s is not a list", name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -487,7 +487,7 @@ BroType* internal_type(const char* name)
|
|||
{
|
||||
ID* id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id )
|
||||
bro_logger->InternalError("internal type %s missing", name);
|
||||
reporter->InternalError("internal type %s missing", name);
|
||||
|
||||
return id->Type();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ int X509_Cert::init()
|
|||
lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_hash_dir());
|
||||
if ( ! lookup )
|
||||
{
|
||||
bro_logger->Error("X509_Cert::init(): initing lookup failed\n");
|
||||
reporter->Error("X509_Cert::init(): initing lookup failed\n");
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ int X509_Cert::init()
|
|||
X509_FILETYPE_PEM);
|
||||
if ( ! i )
|
||||
{
|
||||
bro_logger->Error("X509_Cert::init(): error adding lookup directory\n");
|
||||
reporter->Error("X509_Cert::init(): error adding lookup directory\n");
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ int X509_Cert::init()
|
|||
if ( X509_load_crl_file(lookup, (const char*) rString->Bytes(),
|
||||
X509_FILETYPE_PEM) != 1 )
|
||||
{
|
||||
bro_logger->Error("X509_Cert::init(): error reading CRL file\n");
|
||||
reporter->Error("X509_Cert::init(): error reading CRL file\n");
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
|
|
40
src/bro.bif
40
src/bro.bif
|
@ -10,7 +10,7 @@
|
|||
#include <cmath>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -792,7 +792,7 @@ EnumVal* map_conn_type(TransportProto tp)
|
|||
break;
|
||||
|
||||
default:
|
||||
bro_logger->InternalError("bad connection type in map_conn_type()");
|
||||
reporter->InternalError("bad connection type in map_conn_type()");
|
||||
}
|
||||
|
||||
// Cannot be reached;
|
||||
|
@ -839,7 +839,7 @@ function sqrt%(x: double%): double
|
|||
%{
|
||||
if ( x < 0 )
|
||||
{
|
||||
bro_logger->Error("negative sqrt argument");
|
||||
reporter->Error("negative sqrt argument");
|
||||
return new Val(-1.0, TYPE_DOUBLE);
|
||||
}
|
||||
|
||||
|
@ -1215,7 +1215,7 @@ function get_orig_seq%(cid: conn_id%): count
|
|||
TYPE_COUNT);
|
||||
else
|
||||
{
|
||||
bro_logger->Error("connection does not have TCP analyzer");
|
||||
reporter->Error("connection does not have TCP analyzer");
|
||||
return new Val(0, TYPE_COUNT);
|
||||
}
|
||||
%}
|
||||
|
@ -1235,7 +1235,7 @@ function get_resp_seq%(cid: conn_id%): count
|
|||
TYPE_COUNT);
|
||||
else
|
||||
{
|
||||
bro_logger->Error("connection does not have TCP analyzer");
|
||||
reporter->Error("connection does not have TCP analyzer");
|
||||
return new Val(0, TYPE_COUNT);
|
||||
}
|
||||
%}
|
||||
|
@ -1414,14 +1414,14 @@ function skip_http_entity_data%(c: connection, is_orig: bool%): any
|
|||
if ( ha->GetTag() == AnalyzerTag::HTTP )
|
||||
static_cast<HTTP_Analyzer*>(ha)->SkipEntityData(is_orig);
|
||||
else
|
||||
bro_logger->Error("non-HTTP analyzer associated with connection record");
|
||||
reporter->Error("non-HTTP analyzer associated with connection record");
|
||||
}
|
||||
else
|
||||
bro_logger->Error("could not find analyzer for skip_http_entity_data");
|
||||
reporter->Error("could not find analyzer for skip_http_entity_data");
|
||||
|
||||
}
|
||||
else
|
||||
bro_logger->Error("no analyzer associated with connection record");
|
||||
reporter->Error("no analyzer associated with connection record");
|
||||
|
||||
return 0;
|
||||
%}
|
||||
|
@ -1480,7 +1480,7 @@ function resource_usage%(%): bro_resources
|
|||
struct rusage r;
|
||||
|
||||
if ( getrusage(RUSAGE_SELF, &r) < 0 )
|
||||
bro_logger->InternalError("getrusage() failed in bro_resource_usage()");
|
||||
reporter->InternalError("getrusage() failed in bro_resource_usage()");
|
||||
|
||||
double elapsed_time = current_time() - bro_start_time;
|
||||
|
||||
|
@ -1839,7 +1839,7 @@ function decode_base64%(s: string%): string
|
|||
return new StringVal(t);
|
||||
else
|
||||
{
|
||||
bro_logger->Error("error in decoding string %s", @ARG@[0]);
|
||||
reporter->Error("error in decoding string %s", @ARG@[0]);
|
||||
return new StringVal("");
|
||||
}
|
||||
%}
|
||||
|
@ -1971,7 +1971,7 @@ function precompile_pcap_filter%(id: PcapFilterID, s: string%): bool
|
|||
if ( ! pkt_srcs[i]->PrecompileFilter(id->ForceAsInt(),
|
||||
s->CheckString()) )
|
||||
{
|
||||
bro_logger->Error( "precompile_pcap_filter: %s",
|
||||
reporter->Error( "precompile_pcap_filter: %s",
|
||||
pkt_srcs[i]->ErrorMsg() );
|
||||
success = false;
|
||||
}
|
||||
|
@ -1986,7 +1986,7 @@ function install_pcap_filter%(id: PcapFilterID%): bool
|
|||
ID* user_filter = global_scope()->Lookup("cmd_line_bpf_filter");
|
||||
|
||||
if ( ! user_filter )
|
||||
bro_logger->InternalError("global cmd_line_bpf_filter not defined");
|
||||
reporter->InternalError("global cmd_line_bpf_filter not defined");
|
||||
|
||||
if ( user_filter->ID_Val()->AsStringVal()->Len() )
|
||||
// Don't allow the script-level to change the filter when
|
||||
|
@ -2169,7 +2169,7 @@ function send_id%(p: event_peer, id: string%) : bool
|
|||
ID* i = global_scope()->Lookup(id->CheckString());
|
||||
if ( ! i )
|
||||
{
|
||||
bro_logger->Error(fmt("send_id: no global id %s", id->CheckString()));
|
||||
reporter->Error(fmt("send_id: no global id %s", id->CheckString()));
|
||||
return new Val(0, TYPE_BOOL);
|
||||
}
|
||||
|
||||
|
@ -2233,12 +2233,12 @@ function get_event_peer%(%) : event_peer
|
|||
}
|
||||
|
||||
if ( ! remote_serializer )
|
||||
bro_logger->InternalError("remote_serializer not initialized");
|
||||
reporter->InternalError("remote_serializer not initialized");
|
||||
|
||||
Val* v = remote_serializer->GetPeerVal(src);
|
||||
if ( ! v )
|
||||
{
|
||||
bro_logger->Error(fmt("peer %d does not exist anymore", int(src)));
|
||||
reporter->Error(fmt("peer %d does not exist anymore", int(src)));
|
||||
RecordVal* p = mgr.GetLocalPeerVal();
|
||||
Ref(p);
|
||||
return p;
|
||||
|
@ -2875,7 +2875,7 @@ function lookup_addr%(host: addr%) : string
|
|||
static bool warned = false;
|
||||
if ( ! warned )
|
||||
{
|
||||
bro_logger->Warning("lookup_addr() only supports IPv4 addresses currently");
|
||||
reporter->Warning("lookup_addr() only supports IPv4 addresses currently");
|
||||
warned = true;
|
||||
}
|
||||
|
||||
|
@ -2946,14 +2946,14 @@ function disable_analyzer%(cid: conn_id, aid: count%) : bool
|
|||
Connection* c = sessions->FindConnection(cid);
|
||||
if ( ! c )
|
||||
{
|
||||
bro_logger->Error("cannot find connection");
|
||||
reporter->Error("cannot find connection");
|
||||
return new Val(0, TYPE_BOOL);
|
||||
}
|
||||
|
||||
Analyzer* a = c->FindAnalyzer(aid);
|
||||
if ( ! a )
|
||||
{
|
||||
bro_logger->Error("connection does not have analyzer specified to disable");
|
||||
reporter->Error("connection does not have analyzer specified to disable");
|
||||
return new Val(0, TYPE_BOOL);
|
||||
}
|
||||
|
||||
|
@ -3233,13 +3233,13 @@ function identify_data%(data: string, return_mime: bool%): string
|
|||
|
||||
if ( ! *magic )
|
||||
{
|
||||
bro_logger->Error(fmt("can't init libmagic: %s", magic_error(*magic)));
|
||||
reporter->Error(fmt("can't init libmagic: %s", magic_error(*magic)));
|
||||
return new StringVal("");
|
||||
}
|
||||
|
||||
if ( magic_load(*magic, 0) < 0 )
|
||||
{
|
||||
bro_logger->Error(fmt("can't load magic file: %s", magic_error(*magic)));
|
||||
reporter->Error(fmt("can't load magic file: %s", magic_error(*magic)));
|
||||
magic_close(*magic);
|
||||
*magic = 0;
|
||||
return new StringVal("");
|
||||
|
|
|
@ -635,7 +635,7 @@ body_start: TOK_LPB c_code_begin
|
|||
fprintf(fp_func_def, "\tif ( %s->length() != %d )\n", arg_list_name, argc);
|
||||
fprintf(fp_func_def, "\t\t{\n");
|
||||
fprintf(fp_func_def,
|
||||
"\t\tbro_logger->Error(\"%s() takes exactly %d argument(s)\");\n",
|
||||
"\t\treporter->Error(\"%s() takes exactly %d argument(s)\");\n",
|
||||
decl.bro_fullname.c_str(), argc);
|
||||
fprintf(fp_func_def, "\t\treturn 0;\n");
|
||||
fprintf(fp_func_def, "\t\t}\n");
|
||||
|
@ -645,7 +645,7 @@ body_start: TOK_LPB c_code_begin
|
|||
fprintf(fp_func_def, "\tif ( %s->length() < %d )\n", arg_list_name, argc);
|
||||
fprintf(fp_func_def, "\t\t{\n");
|
||||
fprintf(fp_func_def,
|
||||
"\t\tbro_logger->Error(\"%s() takes at least %d argument(s)\");\n",
|
||||
"\t\treporter->Error(\"%s() takes at least %d argument(s)\");\n",
|
||||
decl.bro_fullname.c_str(), argc);
|
||||
fprintf(fp_func_def, "\t\treturn 0;\n");
|
||||
fprintf(fp_func_def, "\t\t}\n");
|
||||
|
|
|
@ -479,7 +479,7 @@ event rotate_size%(f: file%);
|
|||
event netflow_v5_header%(h: nf_v5_header%);
|
||||
event netflow_v5_record%(r: nf_v5_record%);
|
||||
|
||||
# Different types of log messages.
|
||||
event log_message%(t: time, msg: string, location: string%);
|
||||
event log_warning%(t: time, msg: string, location: string%);
|
||||
event log_error%(t: time, msg: string, location: string%);
|
||||
# Different types of reporter messages.
|
||||
event reporter_message%(t: time, msg: string, location: string%);
|
||||
event reporter_warning%(t: time, msg: string, location: string%);
|
||||
event reporter_error%(t: time, msg: string, location: string%);
|
||||
|
|
|
@ -62,30 +62,6 @@ function Log::__flush%(id: Log::ID%): bool
|
|||
return new Val(result, TYPE_BOOL);
|
||||
%}
|
||||
|
||||
function Log::message%(msg: string%): bool
|
||||
%{
|
||||
bro_logger->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||
bro_logger->Message("%s", msg->CheckString());
|
||||
bro_logger->PopLocation();
|
||||
return new Val(1, TYPE_BOOL);
|
||||
%}
|
||||
|
||||
function Log::warning%(msg: string%): bool
|
||||
%{
|
||||
bro_logger->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||
bro_logger->Warning("%s", msg->CheckString());
|
||||
bro_logger->PopLocation();
|
||||
return new Val(1, TYPE_BOOL);
|
||||
%}
|
||||
|
||||
function Log::error%(msg: string%): bool
|
||||
%{
|
||||
bro_logger->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||
bro_logger->Error("%s", msg->CheckString());
|
||||
bro_logger->PopLocation();
|
||||
return new Val(1, TYPE_BOOL);
|
||||
%}
|
||||
|
||||
# Options for the ASCII writer.
|
||||
|
||||
module LogAscii;
|
||||
|
|
34
src/main.cc
34
src/main.cc
|
@ -30,7 +30,7 @@ extern "C" void OPENSSL_add_all_algorithms_conf(void);
|
|||
#include "Scope.h"
|
||||
#include "Event.h"
|
||||
#include "File.h"
|
||||
#include "Logger.h"
|
||||
#include "Reporter.h"
|
||||
#include "LogMgr.h"
|
||||
#include "Net.h"
|
||||
#include "NetVar.h"
|
||||
|
@ -84,9 +84,9 @@ FileSerializer* state_serializer = 0;
|
|||
RemoteSerializer* remote_serializer = 0;
|
||||
EventPlayer* event_player = 0;
|
||||
EventRegistry* event_registry = 0;
|
||||
ProfileLogger* profiling_logger = 0;
|
||||
ProfileLogger* segment_logger = 0;
|
||||
SampleLogger* sample_logger = 0;
|
||||
ProfileReporter* profiling_logger = 0;
|
||||
ProfileReporter* segment_logger = 0;
|
||||
SampleReporter* sample_logger = 0;
|
||||
int signal_val = 0;
|
||||
DPM* dpm = 0;
|
||||
int optimize = 0;
|
||||
|
@ -292,7 +292,7 @@ void terminate_bro()
|
|||
delete remote_serializer;
|
||||
delete dpm;
|
||||
delete log_mgr;
|
||||
delete bro_logger;
|
||||
delete reporter;
|
||||
}
|
||||
|
||||
void termination_signal()
|
||||
|
@ -300,7 +300,7 @@ void termination_signal()
|
|||
set_processing_status("TERMINATING", "termination_signal");
|
||||
|
||||
Val sval(signal_val, TYPE_COUNT);
|
||||
bro_logger->Message("received termination signal");
|
||||
reporter->Message("received termination signal");
|
||||
net_get_final_stats();
|
||||
done_with_network();
|
||||
net_delete();
|
||||
|
@ -652,7 +652,7 @@ int main(int argc, char** argv)
|
|||
set_processing_status("INITIALIZING", "main");
|
||||
|
||||
bro_start_time = current_time(true);
|
||||
bro_logger = new Logger();
|
||||
reporter = new Reporter();
|
||||
|
||||
init_random_seed(seed, seed_load_file, seed_save_file);
|
||||
// DEBUG_MSG("HMAC key: %s\n", md5_digest_print(shared_hmac_md5_key));
|
||||
|
@ -753,7 +753,7 @@ int main(int argc, char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if ( bro_logger->Errors() > 0 )
|
||||
if ( reporter->Errors() > 0 )
|
||||
{
|
||||
delete dns_mgr;
|
||||
exit(1);
|
||||
|
@ -766,7 +766,7 @@ int main(int argc, char** argv)
|
|||
ID* id = global_scope()->Lookup("cmd_line_bpf_filter");
|
||||
|
||||
if ( ! id )
|
||||
bro_logger->InternalError("global cmd_line_bpf_filter not defined");
|
||||
reporter->InternalError("global cmd_line_bpf_filter not defined");
|
||||
|
||||
id->SetVal(new StringVal(user_pcap_filter));
|
||||
}
|
||||
|
@ -848,7 +848,7 @@ int main(int argc, char** argv)
|
|||
dns_mgr->Resolve();
|
||||
|
||||
if ( ! dns_mgr->Save() )
|
||||
bro_logger->FatalError("can't update DNS cache");
|
||||
reporter->FatalError("can't update DNS cache");
|
||||
|
||||
mgr.Drain();
|
||||
delete dns_mgr;
|
||||
|
@ -890,7 +890,7 @@ int main(int argc, char** argv)
|
|||
|
||||
ID* id = global_scope()->Lookup(id_name);
|
||||
if ( ! id )
|
||||
bro_logger->FatalError("No such ID: %s\n", id_name);
|
||||
reporter->FatalError("No such ID: %s\n", id_name);
|
||||
|
||||
ODesc desc;
|
||||
desc.SetQuotes(true);
|
||||
|
@ -911,7 +911,7 @@ int main(int argc, char** argv)
|
|||
|
||||
if ( profiling_interval > 0 )
|
||||
{
|
||||
profiling_logger = new ProfileLogger(profiling_file->AsFile(),
|
||||
profiling_logger = new ProfileReporter(profiling_file->AsFile(),
|
||||
profiling_interval);
|
||||
|
||||
if ( segment_profiling )
|
||||
|
@ -932,9 +932,9 @@ int main(int argc, char** argv)
|
|||
|
||||
if ( dead_handlers->length() > 0 && check_for_unused_event_handlers )
|
||||
{
|
||||
bro_logger->Warning("event handlers never invoked:");
|
||||
reporter->Warning("event handlers never invoked:");
|
||||
for ( int i = 0; i < dead_handlers->length(); ++i )
|
||||
bro_logger->Warning("\t", (*dead_handlers)[i]);
|
||||
reporter->Warning("\t", (*dead_handlers)[i]);
|
||||
}
|
||||
|
||||
delete dead_handlers;
|
||||
|
@ -944,9 +944,9 @@ int main(int argc, char** argv)
|
|||
|
||||
if ( alive_handlers->length() > 0 && dump_used_event_handlers )
|
||||
{
|
||||
bro_logger->Message("invoked event handlers:");
|
||||
reporter->Message("invoked event handlers:");
|
||||
for ( int i = 0; i < alive_handlers->length(); ++i )
|
||||
bro_logger->Message((*alive_handlers)[i]);
|
||||
reporter->Message((*alive_handlers)[i]);
|
||||
}
|
||||
|
||||
delete alive_handlers;
|
||||
|
@ -968,7 +968,7 @@ int main(int argc, char** argv)
|
|||
|
||||
dpm->PostScriptInit();
|
||||
|
||||
bro_logger->ReportViaEvents(true);
|
||||
reporter->ReportViaEvents(true);
|
||||
|
||||
mgr.Drain();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue