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:
Robin Sommer 2011-07-01 09:22:33 -07:00
parent 93894eed9b
commit 66e2c3b623
123 changed files with 722 additions and 713 deletions

View file

@ -284,6 +284,7 @@ type entropy_test_result: record {
# Prototypes of Bro built-in functions. # Prototypes of Bro built-in functions.
@load strings.bif.bro @load strings.bif.bro
@load bro.bif.bro @load bro.bif.bro
@load reporter.bif.bro
@load logging # sic! Not logging.bif. @load logging # sic! Not logging.bif.
@load logging-ascii @load logging-ascii
@ -1558,17 +1559,17 @@ const skip_http_data = F &redef;
# UDP tunnels. See also: udp_tunnel_port, policy/udp-tunnel.bro. # UDP tunnels. See also: udp_tunnel_port, policy/udp-tunnel.bro.
const parse_udp_tunnels = F &redef; 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);
} }

View file

@ -46,7 +46,7 @@ event bro_init()
{ {
# Disable packet processing. # Disable packet processing.
install_src_net_filter(0.0.0.0/0, 0, 100); 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) event remote_connection_error(p: event_peer, reason: string)
@ -55,7 +55,7 @@ event remote_connection_error(p: event_peer, reason: string)
return; return;
# Seems that the other side in not running. # 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(); handover_start_processing();
} }
@ -72,7 +72,7 @@ event remote_connection_established(p: event_peer)
if ( ! is_handover_peer(p) ) if ( ! is_handover_peer(p) )
return; 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/); 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 the remote host is defined as a hand-over host in remote_peers.
if ( is_handover_peer(p) ) 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/); 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. # we will have to try again.
if ( ! send_state(p) ) 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) }; 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) ) if ( ! is_handover_peer(p) )
return; 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)); # p$host, p$p));
event handover_got_state(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)) ) if ( ! (is_remote_event() && is_it_us(p$host, p$p)) )
return; 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(); terminate();
} }

View file

@ -133,11 +133,6 @@ export {
global flush: function(id: ID): bool; global flush: function(id: ID): bool;
global add_default_filter: function(id: ID) : bool; global add_default_filter: function(id: ID) : bool;
global remove_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. # We keep a script-level copy of all filters so that we can manipulate them.

View file

@ -5,7 +5,7 @@
#include "ARP.h" #include "ARP.h"
#include "Event.h" #include "Event.h"
#include "Logger.h" #include "Reporter.h"
ARP_Analyzer::ARP_Analyzer() 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) void ARP_Analyzer::Corrupted(const char* msg)
{ {
bro_logger->Weird(msg); reporter->Weird(msg);
} }
void ARP_Analyzer::RREvent(EventHandlerPtr e, void ARP_Analyzer::RREvent(EventHandlerPtr e,

View file

@ -916,12 +916,12 @@ void TransportLayerAnalyzer::Done()
void TransportLayerAnalyzer::SetContentsFile(unsigned int /* direction */, void TransportLayerAnalyzer::SetContentsFile(unsigned int /* direction */,
BroFile* /* f */) 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 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; return 0;
} }

View file

@ -159,7 +159,7 @@ int AnonymizeIPAddr_A50::PreservePrefix(ipaddr32_t input, int num_bits)
if ( ! before_anonymization ) if ( ! before_anonymization )
{ {
bro_logger->Error("prefix perservation specified after anonymization begun"); reporter->Error("prefix perservation specified after anonymization begun");
return 0; return 0;
} }
@ -206,7 +206,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::new_node_block()
int block_size = 1024; int block_size = 1024;
Node* block = new Node[block_size]; Node* block = new Node[block_size];
if ( ! block ) if ( ! block )
bro_logger->InternalError("out of memory!"); reporter->InternalError("out of memory!");
blocks.push_back(block); 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) AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::make_peer(ipaddr32_t a, Node* n)
{ {
if ( a == 0 || a == 0xFFFFFFFFU ) 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. // Become a peer.
// Algorithm: create two nodes, the two peers. Leave orig node as // 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; return 0;
} }
@ -389,14 +389,14 @@ ipaddr32_t anonymize_ip(ipaddr32_t ip, enum ip_addr_anonymization_class_t cl)
new_ip = ip; new_ip = ip;
else if ( ! ip_anonymizer[method] ) else if ( ! ip_anonymizer[method] )
bro_logger->InternalError("IP anonymizer not initialized"); reporter->InternalError("IP anonymizer not initialized");
else else
new_ip = ip_anonymizer[method]->Anonymize(ip); new_ip = ip_anonymizer[method]->Anonymize(ip);
} }
else else
bro_logger->InternalError("invalid IP anonymization method"); reporter->InternalError("invalid IP anonymization method");
#ifdef LOG_ANONYMIZATION_MAPPING #ifdef LOG_ANONYMIZATION_MAPPING
log_anonymization_mapping(ip, new_ip); log_anonymization_mapping(ip, new_ip);

View file

@ -18,7 +18,7 @@
#include <map> #include <map>
using namespace std; using namespace std;
#include "Logger.h" #include "Reporter.h"
#include "net_util.h" #include "net_util.h"
// TODO: Anon.h may not be the right place to put these functions ... // TODO: Anon.h may not be the right place to put these functions ...
@ -53,7 +53,7 @@ public:
// Keep the specified prefix unchanged. // Keep the specified prefix unchanged.
virtual int PreservePrefix(ipaddr32_t /* input */, int /* num_bits */) 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; return 0;
} }

View file

@ -46,7 +46,7 @@ int Base64Decoder::Decode(int len, const char* data, int* pblen, char** pbuf)
char* buf; char* buf;
if ( ! pbuf ) if ( ! pbuf )
bro_logger->InternalError("nil pointer to decoding result buffer"); reporter->InternalError("nil pointer to decoding result buffer");
if ( *pbuf ) if ( *pbuf )
{ {

View file

@ -46,7 +46,7 @@ public:
if ( analyzer ) if ( analyzer )
analyzer->Weird("base64_illegal_encoding", msg); analyzer->Weird("base64_illegal_encoding", msg);
else else
bro_logger->Error(msg); reporter->Error(msg);
} }
protected: protected:

View file

@ -11,7 +11,7 @@
#include "BroString.h" #include "BroString.h"
#include "Var.h" #include "Var.h"
#include "Logger.h" #include "Reporter.h"
#ifdef DEBUG #ifdef DEBUG
#define DEBUG_STR(msg) DBG_LOG(DBG_STRING, msg) #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. // Either an embedded NUL, or no final NUL.
char* exp_s = Render(); char* exp_s = Render();
if ( b[n-1] != '\0' ) 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 else
bro_logger->Error("string with embedded NUL: \"%s\"", exp_s); reporter->Error("string with embedded NUL: \"%s\"", exp_s);
delete [] exp_s; delete [] exp_s;
return "<string-with-NUL>"; return "<string-with-NUL>";

View file

@ -137,6 +137,7 @@ set(BIF_SRCS
const.bif const.bif
types.bif types.bif
strings.bif strings.bif
reporter.bif
) )
foreach (bift ${BIF_SRCS}) foreach (bift ${BIF_SRCS})
@ -326,7 +327,7 @@ set(bro_SRCS
IOSource.cc IOSource.cc
IRC.cc IRC.cc
List.cc List.cc
Logger.cc Reporter.cc
LogMgr.cc LogMgr.cc
LogWriter.cc LogWriter.cc
LogWriterAscii.cc LogWriterAscii.cc

View file

@ -195,7 +195,7 @@ bool ChunkedIOFd::WriteChunk(Chunk* chunk, bool partial)
assert(chunk->len <= BUFFER_SIZE - sizeof(uint32) ); assert(chunk->len <= BUFFER_SIZE - sizeof(uint32) );
if ( chunk->len == 0 ) if ( chunk->len == 0 )
bro_logger->InternalError( "attempt to write 0 bytes chunk"); reporter->InternalError( "attempt to write 0 bytes chunk");
if ( partial ) if ( partial )
chunk->len |= FLAG_PARTIAL; chunk->len |= FLAG_PARTIAL;
@ -285,7 +285,7 @@ bool ChunkedIOFd::FlushWriteBuffer()
} }
if ( written == 0 ) if ( written == 0 )
bro_logger->InternalError("written==0"); reporter->InternalError("written==0");
// Short write. // Short write.
write_pos += written; write_pos += written;
@ -906,7 +906,7 @@ bool ChunkedIOSSL::WriteData(char* p, uint32 len, bool* error)
return false; return false;
} }
bro_logger->InternalError("can't be reached"); reporter->InternalError("can't be reached");
return false; return false;
} }
@ -1026,7 +1026,7 @@ bool ChunkedIOSSL::ReadData(char* p, uint32 len, bool* error)
} }
// Can't be reached. // Can't be reached.
bro_logger->InternalError("can't be reached"); reporter->InternalError("can't be reached");
return false; return false;
} }

View file

@ -6,7 +6,7 @@
#include "CompHash.h" #include "CompHash.h"
#include "Val.h" #include "Val.h"
#include "Logger.h" #include "Reporter.h"
CompositeHash::CompositeHash(TypeList* composite_type) CompositeHash::CompositeHash(TypeList* composite_type)
{ {
@ -192,7 +192,7 @@ char* CompositeHash::SingleValHash(int type_check, char* kp0,
} }
else else
{ {
bro_logger->InternalError("bad index type in CompositeHash::SingleValHash"); reporter->InternalError("bad index type in CompositeHash::SingleValHash");
return 0; return 0;
} }
} }
@ -315,7 +315,7 @@ HashKey* CompositeHash::ComputeSingletonHash(const Val* v, int type_check) const
if ( v->Type()->Tag() == TYPE_FUNC ) if ( v->Type()->Tag() == TYPE_FUNC )
return new HashKey(v); return new HashKey(v);
bro_logger->InternalError("bad index type in CompositeHash::ComputeSingletonHash"); reporter->InternalError("bad index type in CompositeHash::ComputeSingletonHash");
return 0; return 0;
case TYPE_INTERNAL_STRING: case TYPE_INTERNAL_STRING:
@ -325,7 +325,7 @@ HashKey* CompositeHash::ComputeSingletonHash(const Val* v, int type_check) const
return 0; return 0;
default: default:
bro_logger->InternalError("bad internal type in CompositeHash::ComputeSingletonHash"); reporter->InternalError("bad internal type in CompositeHash::ComputeSingletonHash");
return 0; return 0;
} }
} }
@ -400,7 +400,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
} }
else else
{ {
bro_logger->InternalError("bad index type in CompositeHash::CompositeHash"); reporter->InternalError("bad index type in CompositeHash::CompositeHash");
return 0; return 0;
} }
} }
@ -523,7 +523,7 @@ ListVal* CompositeHash::RecoverVals(const HashKey* k) const
} }
if ( kp != k_end ) 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; return l;
} }
@ -534,7 +534,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
{ {
// k->Size() == 0 for a single empty string. // k->Size() == 0 for a single empty string.
if ( kp0 >= k_end && k->Size() > 0 ) 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(); TypeTag tag = t->Tag();
InternalTypeTag it = t->InternalType(); InternalTypeTag it = t->InternalType();
@ -581,7 +581,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
break; break;
default: default:
bro_logger->InternalError("bad internal unsigned int in CompositeHash::RecoverOneVal()"); reporter->InternalError("bad internal unsigned int in CompositeHash::RecoverOneVal()");
pval = 0; pval = 0;
break; break;
} }
@ -620,7 +620,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
break; break;
default: default:
bro_logger->InternalError("bad internal address in CompositeHash::RecoverOneVal()"); reporter->InternalError("bad internal address in CompositeHash::RecoverOneVal()");
pval = 0; pval = 0;
break; break;
} }
@ -649,21 +649,21 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
Val* v = *kp; Val* v = *kp;
if ( ! v || ! v->Type() ) 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 && if ( t->Tag() != TYPE_FUNC &&
// ### Maybe fix later, but may be fundamentally // ### Maybe fix later, but may be fundamentally
// un-checkable --US // un-checkable --US
! same_type(v->Type(), t) ) ! 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. // ### A crude approximation for now.
if ( t->Tag() == TYPE_FUNC && if ( t->Tag() == TYPE_FUNC &&
v->Type()->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(); pval = v->Ref();
@ -688,7 +688,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
rt->FieldType(i), v, optional); rt->FieldType(i), v, optional);
if ( ! (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; pval = 0;
break; break;
} }
@ -708,7 +708,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
} }
else else
{ {
bro_logger->InternalError("bad index type in CompositeHash::DescribeKey"); reporter->InternalError("bad index type in CompositeHash::DescribeKey");
} }
} }
break; break;

View file

@ -34,7 +34,7 @@ protected:
// Recovers just one Val of possibly many; called from RecoverVals. // Recovers just one Val of possibly many; called from RecoverVals.
// Upon return, pval will point to the recovered Val of type t. // 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. // upon errors, so there is no return value for invalid input.
const char* RecoverOneVal(const HashKey* k, const char* RecoverOneVal(const HashKey* k,
const char* kp, const char* const k_end, const char* kp, const char* const k_end,

View file

@ -11,7 +11,7 @@
#include "Conn.h" #include "Conn.h"
#include "Event.h" #include "Event.h"
#include "Sessions.h" #include "Sessions.h"
#include "Logger.h" #include "Reporter.h"
#include "Timer.h" #include "Timer.h"
#include "PIA.h" #include "PIA.h"
#include "binpac.h" #include "binpac.h"
@ -54,7 +54,7 @@ void ConnectionTimer::Init(Connection* arg_conn, timer_func arg_timer,
ConnectionTimer::~ConnectionTimer() ConnectionTimer::~ConnectionTimer()
{ {
if ( conn->RefCnt() < 1 ) if ( conn->RefCnt() < 1 )
bro_logger->InternalError("reference count inconsistency in ~ConnectionTimer"); reporter->InternalError("reference count inconsistency in ~ConnectionTimer");
conn->RemoveTimer(this); conn->RemoveTimer(this);
Unref(conn); Unref(conn);
@ -72,7 +72,7 @@ void ConnectionTimer::Dispatch(double t, int is_expire)
(conn->*timer)(t); (conn->*timer)(t);
if ( conn->RefCnt() < 1 ) 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); IMPLEMENT_SERIAL(ConnectionTimer, SER_CONNECTION_TIMER);
@ -94,7 +94,7 @@ bool ConnectionTimer::DoSerialize(SerialInfo* info) const
else if ( timer == timer_func(&Connection::RemoveConnectionTimer) ) else if ( timer == timer_func(&Connection::RemoveConnectionTimer) )
type = 4; type = 4;
else 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); 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() Connection::~Connection()
{ {
if ( ! finished ) if ( ! finished )
bro_logger->InternalError("Done() not called before destruction of Connection"); reporter->InternalError("Done() not called before destruction of Connection");
CancelTimers(); CancelTimers();
@ -639,7 +639,7 @@ void Connection::ConnectionEvent(EventHandlerPtr f, Analyzer* a, val_list* vl)
void Connection::Weird(const char* name, const char* addl) void Connection::Weird(const char* name, const char* addl)
{ {
weird = 1; 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, void Connection::AddTimer(timer_func timer, double t, int do_expire,
@ -750,7 +750,7 @@ void Connection::Describe(ODesc* d) const
break; break;
case TRANSPORT_UNKNOWN: case TRANSPORT_UNKNOWN:
bro_logger->InternalError("unknown transport in Connction::Describe()"); reporter->InternalError("unknown transport in Connction::Describe()");
break; break;
} }

View file

@ -663,7 +663,7 @@ const IP_Hdr* ConnCompressor::PendingConnToPacket(const PendingConn* c)
// only an IPv4 address. // only an IPv4 address.
#ifdef BROv6 #ifdef BROv6
if ( ! is_v4_addr(c->key.ip1) || ! is_v4_addr(c->key.ip2) ) 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 #endif
*(uint32*) &ip->ip_src = *(uint32*) &ip->ip_src =
to_v4_addr(c->ip1_is_src ? c->key.ip1 : c->key.ip2); 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. // Special case to go through the logger.
const char* msg = arg->AsString()->CheckString(); const char* msg = arg->AsString()->CheckString();
bro_logger->Weird(conn_val->Ref(), msg); reporter->Weird(conn_val->Ref(), msg);
return; return;
} }

View file

@ -165,7 +165,7 @@ private:
void Weird(const PendingConn* pending, double t, const char* msg) 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. // that.
Event(pending, t, conn_weird, TCP_ENDPOINT_INACTIVE, 0, Event(pending, t, conn_weird, TCP_ENDPOINT_INACTIVE, 0,
TCP_ENDPOINT_INACTIVE, new StringVal(msg)); TCP_ENDPOINT_INACTIVE, new StringVal(msg));

View file

@ -103,7 +103,7 @@ void ContentLine_Analyzer::DeliverStream(int len, const u_char* data,
buf = tmp; buf = tmp;
if ( ! buf ) if ( ! buf )
bro_logger->InternalError("out of memory delivering endpoint line"); reporter->InternalError("out of memory delivering endpoint line");
} }
DoDeliver(len, data); DoDeliver(len, data);
@ -125,7 +125,7 @@ void ContentLine_Analyzer::EndpointEOF(bool is_orig)
void ContentLine_Analyzer::SetPlainDelivery(int64_t length) void ContentLine_Analyzer::SetPlainDelivery(int64_t length)
{ {
if ( length < 0 ) if ( length < 0 )
bro_logger->InternalError("negative length for plain delivery"); reporter->InternalError("negative length for plain delivery");
plain_delivery_length = length; plain_delivery_length = length;
} }

View file

@ -60,7 +60,7 @@ UUID::UUID(const u_char d[16])
UUID::UUID(const binpac::bytestring& uuid) UUID::UUID(const binpac::bytestring& uuid)
{ {
if ( uuid.length() != 16 ) if ( uuid.length() != 16 )
bro_logger->InternalError("UUID length error"); reporter->InternalError("UUID length error");
memcpy(data, uuid.begin(), 16); memcpy(data, uuid.begin(), 16);
s = uuid_to_string(data); s = uuid_to_string(data);
} }
@ -82,7 +82,7 @@ UUID::UUID(const char* str)
} }
if ( i != 16 ) 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; typedef map<UUID, BifEnum::dce_rpc_if_id> uuid_map_t;

View file

@ -35,7 +35,7 @@
#include "Event.h" #include "Event.h"
#include "Net.h" #include "Net.h"
#include "Var.h" #include "Var.h"
#include "Logger.h" #include "Reporter.h"
extern "C" { extern "C" {
extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); 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); nb_dns = nb_dns_init(err);
if ( ! nb_dns ) 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_valid = dns_mapping_unverified = dns_mapping_new_name =
dns_mapping_lost_name = dns_mapping_name_changed = dns_mapping_lost_name = dns_mapping_name_changed =
@ -440,7 +440,7 @@ TableVal* DNS_Mgr::LookupHost(const char* name)
return d->Addrs()->ConvertToSet(); return d->Addrs()->ConvertToSet();
else else
{ {
bro_logger->Warning("no such host:", name); reporter->Warning("no such host:", name);
return empty_addr_set(); return empty_addr_set();
} }
} }
@ -453,7 +453,7 @@ TableVal* DNS_Mgr::LookupHost(const char* name)
return empty_addr_set(); return empty_addr_set();
case DNS_FORCE: 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; return 0;
case DNS_DEFAULT: case DNS_DEFAULT:
@ -462,7 +462,7 @@ TableVal* DNS_Mgr::LookupHost(const char* name)
return LookupHost(name); return LookupHost(name);
default: default:
bro_logger->InternalError("bad mode in DNS_Mgr::LookupHost"); reporter->InternalError("bad mode in DNS_Mgr::LookupHost");
return 0; return 0;
} }
} }
@ -483,7 +483,7 @@ Val* DNS_Mgr::LookupAddr(uint32 addr)
return d->Host(); return d->Host();
else 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)); return new StringVal(dotted_addr(addr));
} }
} }
@ -496,7 +496,7 @@ Val* DNS_Mgr::LookupAddr(uint32 addr)
return new StringVal("<none>"); return new StringVal("<none>");
case DNS_FORCE: 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)); dotted_addr(addr));
return 0; return 0;
@ -506,7 +506,7 @@ Val* DNS_Mgr::LookupAddr(uint32 addr)
return LookupAddr(addr); return LookupAddr(addr);
default: default:
bro_logger->InternalError("bad mode in DNS_Mgr::LookupHost"); reporter->InternalError("bad mode in DNS_Mgr::LookupHost");
return 0; return 0;
} }
} }
@ -567,7 +567,7 @@ void DNS_Mgr::Resolve()
struct nb_dns_result r; struct nb_dns_result r;
status = nb_dns_activity(nb_dns, &r, err); status = nb_dns_activity(nb_dns, &r, err);
if ( status < 0 ) if ( status < 0 )
bro_logger->InternalError( reporter->InternalError(
"NB-DNS error in DNS_Mgr::WaitForReplies (%s)", "NB-DNS error in DNS_Mgr::WaitForReplies (%s)",
err); err);
else if ( status > 0 ) 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(); ListVal* new_a = new_dm->Addrs();
if ( ! prev_a || ! new_a ) 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* prev_delta = AddrListDelta(prev_a, new_a);
ListVal* new_delta = AddrListDelta(new_a, prev_a); ListVal* new_delta = AddrListDelta(new_a, prev_a);
@ -815,7 +815,7 @@ void DNS_Mgr::LoadCache(FILE* f)
} }
if ( ! m->NoMapping() ) if ( ! m->NoMapping() )
bro_logger->InternalError("DNS cache corrupted"); reporter->InternalError("DNS cache corrupted");
delete m; delete m;
fclose(f); fclose(f);
@ -935,7 +935,7 @@ void DNS_Mgr::IssueAsyncRequests()
if ( ! dr->MakeRequest(nb_dns) ) if ( ! dr->MakeRequest(nb_dns) )
{ {
bro_logger->Error("can't issue DNS request"); reporter->Error("can't issue DNS request");
req->Timeout(); req->Timeout();
continue; continue;
} }
@ -1048,7 +1048,7 @@ void DNS_Mgr::Process()
int status = nb_dns_activity(nb_dns, &r, err); int status = nb_dns_activity(nb_dns, &r, err);
if ( status < 0 ) 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 ) else if ( status > 0 )
{ {
@ -1072,7 +1072,7 @@ int DNS_Mgr::AnswerAvailable(int timeout)
{ {
int fd = nb_dns_fd(nb_dns); int fd = nb_dns_fd(nb_dns);
if ( fd < 0 ) 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; fd_set read_fds;
@ -1089,11 +1089,11 @@ int DNS_Mgr::AnswerAvailable(int timeout)
{ {
if ( errno == EINTR ) if ( errno == EINTR )
return -1; return -1;
bro_logger->InternalError("problem with DNS select"); reporter->InternalError("problem with DNS select");
} }
if ( status > 1 ) if ( status > 1 )
bro_logger->InternalError("strange return from DNS select"); reporter->InternalError("strange return from DNS select");
return status; return status;
} }

View file

@ -262,7 +262,7 @@ bool DPM::BuildInitialAnalyzerTree(TransportProto proto, Connection* conn,
} }
default: default:
bro_logger->InternalError("unknown protocol"); reporter->InternalError("unknown protocol");
} }
if ( ! root ) if ( ! root )

View file

@ -204,7 +204,7 @@ bool DbgBreakpoint::Reset()
break; break;
} }
bro_logger->InternalError("DbgBreakpoint::Reset function incomplete."); reporter->InternalError("DbgBreakpoint::Reset function incomplete.");
// Cannot be reached. // Cannot be reached.
return false; return false;
@ -295,7 +295,7 @@ BreakCode DbgBreakpoint::ShouldBreak(Stmt* s)
assert(false); assert(false);
default: 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, // 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) BreakCode DbgBreakpoint::ShouldBreak(double t)
{ {
if ( kind != BP_TIME ) 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 ) if ( t < at_time )
return bcNoHit; return bcNoHit;
@ -353,6 +353,6 @@ void DbgBreakpoint::PrintHitMsg()
assert(false); assert(false);
default: default:
bro_logger->InternalError("Missed a case in DbgBreakpoint::PrintHitMsg\n"); reporter->InternalError("Missed a case in DbgBreakpoint::PrintHitMsg\n");
} }
} }

View file

@ -4,17 +4,17 @@
#include "Debug.h" #include "Debug.h"
#include "DbgWatch.h" #include "DbgWatch.h"
#include "Logger.h" #include "Reporter.h"
// Support classes // Support classes
DbgWatch::DbgWatch(BroObj* var_to_watch) DbgWatch::DbgWatch(BroObj* var_to_watch)
{ {
bro_logger->InternalError("DbgWatch unimplemented"); reporter->InternalError("DbgWatch unimplemented");
} }
DbgWatch::DbgWatch(Expr* expr_to_watch) DbgWatch::DbgWatch(Expr* expr_to_watch)
{ {
bro_logger->InternalError("DbgWatch unimplemented"); reporter->InternalError("DbgWatch unimplemented");
} }
DbgWatch::~DbgWatch() DbgWatch::~DbgWatch()

View file

@ -54,7 +54,7 @@ DebuggerState::~DebuggerState()
bool StmtLocMapping::StartsAfter(const StmtLocMapping* m2) bool StmtLocMapping::StartsAfter(const StmtLocMapping* m2)
{ {
if ( ! 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 || return loc.first_line > m2->loc.first_line ||
(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); Filemap* map = g_dbgfilemaps.Lookup(loc_filename);
if ( ! map ) 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); loc_filename);
if ( plr.line > how_many_lines_in(loc_filename) ) if ( plr.line > how_many_lines_in(loc_filename) )
@ -603,7 +603,7 @@ int dbg_execute_command(const char* cmd)
#endif #endif
if ( int(cmd_code) >= num_debug_cmds() ) 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). // Dispatch to the op-specific handler (with args).
int retcode = dbg_dispatch_cmd(cmd_code, arguments); 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); const DebugCmdInfo* info = get_debug_cmd_info(cmd_code);
if ( ! info ) if ( ! info )
bro_logger->InternalError("Assertion failed: %s", "info"); reporter->InternalError("Assertion failed: %s", "info");
if ( ! info ) if ( ! info )
return -2; // ### yuck, why -2? return -2; // ### yuck, why -2?
@ -766,7 +766,7 @@ int dbg_handle_debug_input()
const Stmt* stmt = curr_frame->GetNextStmt(); const Stmt* stmt = curr_frame->GetNextStmt();
if ( ! stmt ) if ( ! stmt )
bro_logger->InternalError("Assertion failed: %s", "stmt != 0"); reporter->InternalError("Assertion failed: %s", "stmt != 0");
const Location loc = *stmt->GetLocationInfo(); 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); p = g_debugger_state.breakpoint_map.equal_range(stmt);
if ( p.first == p.second ) 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 ) 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; (g_frame_stack.size() - 1) - g_debugger_state.curr_frame_idx;
if ( ! (frame_idx >= 0 && (unsigned) frame_idx < g_frame_stack.size()) ) 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]; Frame* frame = g_frame_stack[frame_idx];
if ( ! (frame) ) if ( ! (frame) )
bro_logger->InternalError("Assertion failed: %s", "frame"); reporter->InternalError("Assertion failed: %s", "frame");
const BroFunc* func = frame->GetFunction(); const BroFunc* func = frame->GetFunction();
if ( func ) if ( func )

View file

@ -194,7 +194,7 @@ static int dbg_backtrace_internal(int start, int end)
if ( start < 0 || end < 0 || if ( start < 0 || end < 0 ||
(unsigned) start >= g_frame_stack.size() || (unsigned) start >= g_frame_stack.size() ||
(unsigned) end >= 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 ) if ( start < end )
{ {
@ -325,7 +325,7 @@ int dbg_cmd_frame(DebugCmd cmd, const vector<string>& args)
// for 'list', 'break', etc. // for 'list', 'break', etc.
const Stmt* stmt = g_frame_stack[user_frame_number]->GetNextStmt(); const Stmt* stmt = g_frame_stack[user_frame_number]->GetNextStmt();
if ( ! stmt ) if ( ! stmt )
bro_logger->InternalError("Assertion failed: %s", "stmt != 0"); reporter->InternalError("Assertion failed: %s", "stmt != 0");
const Location loc = *stmt->GetLocationInfo(); const Location loc = *stmt->GetLocationInfo();
g_debugger_state.last_loc = loc; 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(); Stmt* stmt = g_frame_stack[user_frame_number]->GetNextStmt();
if ( ! stmt ) if ( ! stmt )
bro_logger->InternalError("Assertion failed: %s", "stmt != 0"); reporter->InternalError("Assertion failed: %s", "stmt != 0");
DbgBreakpoint* bp = new DbgBreakpoint(); DbgBreakpoint* bp = new DbgBreakpoint();
bp->SetID(g_debugger_state.NextBPID()); bp->SetID(g_debugger_state.NextBPID());
@ -530,7 +530,7 @@ int dbg_cmd_break_set_state(DebugCmd cmd, const vector<string>& args)
break; break;
default: default:
bro_logger->InternalError("Invalid command in DbgCmdBreakSetState\n"); reporter->InternalError("Invalid command in DbgCmdBreakSetState\n");
} }
} }

View file

@ -28,7 +28,7 @@ DebugLogger::DebugLogger(const char* filename)
file = fopen(filename, "w"); file = fopen(filename, "w");
if ( ! file ) 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); setvbuf(file, NULL, _IOLBF, 0);
} }
@ -65,7 +65,7 @@ void DebugLogger::EnableStreams(const char* s)
if ( strcasecmp("verbose", tok) == 0 ) if ( strcasecmp("verbose", tok) == 0 )
verbose = true; verbose = true;
else else
bro_logger->InternalError("unknown debug stream %s\n", tok); reporter->InternalError("unknown debug stream %s\n", tok);
} }
tok = strtok(0, ","); tok = strtok(0, ",");

View file

@ -9,7 +9,7 @@
#include "Desc.h" #include "Desc.h"
#include "File.h" #include "File.h"
#include "Logger.h" #include "Reporter.h"
#define DEFAULT_SIZE 128 #define DEFAULT_SIZE 128
#define SLOP 10 #define SLOP 10
@ -73,14 +73,14 @@ void ODesc::PushIndent()
void ODesc::PopIndent() void ODesc::PopIndent()
{ {
if ( --indent_level < 0 ) if ( --indent_level < 0 )
bro_logger->InternalError("ODesc::PopIndent underflow"); reporter->InternalError("ODesc::PopIndent underflow");
NL(); NL();
} }
void ODesc::PopIndentNoNL() void ODesc::PopIndentNoNL()
{ {
if ( --indent_level < 0 ) if ( --indent_level < 0 )
bro_logger->InternalError("ODesc::PopIndent underflow"); reporter->InternalError("ODesc::PopIndent underflow");
} }
void ODesc::Add(const char* s, int do_indent) 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 ) if ( ! write_failed )
// Most likely it's a "disk full" so report // Most likely it's a "disk full" so report
// subsequent failures only once. // 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; write_failed = true;
return; return;
@ -325,5 +325,5 @@ void ODesc::Grow(unsigned int n)
void ODesc::OutOfMemory() void ODesc::OutOfMemory()
{ {
bro_logger->InternalError("out of memory"); reporter->InternalError("out of memory");
} }

View file

@ -9,7 +9,7 @@
#endif #endif
#include "Dict.h" #include "Dict.h"
#include "Logger.h" #include "Reporter.h"
// If the mean bucket length exceeds the following then Insert() will // If the mean bucket length exceeds the following then Insert() will
// increase the size of the hash table. // increase the size of the hash table.
@ -475,7 +475,7 @@ void Dictionary::StartChangeSize(int new_size)
return; return;
if ( tbl2 ) if ( tbl2 )
bro_logger->InternalError("Dictionary::StartChangeSize() tbl2 not NULL"); reporter->InternalError("Dictionary::StartChangeSize() tbl2 not NULL");
Init2(new_size); Init2(new_size);
@ -522,7 +522,7 @@ void Dictionary::FinishChangeSize()
{ {
// Cheap safety check. // Cheap safety check.
if ( num_entries != 0 ) if ( num_entries != 0 )
bro_logger->InternalError( reporter->InternalError(
"Dictionary::FinishChangeSize: num_entries is %d\n", "Dictionary::FinishChangeSize: num_entries is %d\n",
num_entries); num_entries);

View file

@ -93,7 +93,7 @@ void EventMgr::QueueEvent(Event* event)
void EventMgr::Dispatch() void EventMgr::Dispatch()
{ {
if ( ! head ) if ( ! head )
bro_logger->InternalError("EventMgr underflow"); reporter->InternalError("EventMgr underflow");
Event* current = head; Event* current = head;

View file

@ -91,7 +91,7 @@ void EventRegistry::SetGroup(const char* name, const char* group)
{ {
EventHandler* eh = Lookup(name); EventHandler* eh = Lookup(name);
if ( ! eh ) if ( ! eh )
bro_logger->InternalError("unknown event handler in SetGroup()"); reporter->InternalError("unknown event handler in SetGroup()");
eh->SetGroup(group); eh->SetGroup(group);
} }

View file

@ -383,7 +383,7 @@ bool NameExpr::DoUnserialize(UnserialInfo* info)
if ( id ) if ( id )
::Ref(id); ::Ref(id);
else else
bro_logger->Warning("unserialized unknown global name"); reporter->Warning("unserialized unknown global name");
delete [] name; delete [] name;
} }
@ -5623,7 +5623,7 @@ int same_expr(const Expr* e1, const Expr* e2)
} }
default: default:
bro_logger->InternalError("bad tag in same_expr()"); reporter->InternalError("bad tag in same_expr()");
} }
return 0; 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; case TYPE_INTERNAL_DOUBLE: v = new Val(double(d), t->Tag()); break;
default: default:
bro_logger->InternalError("bad type in make_constant()"); reporter->InternalError("bad type in make_constant()");
} }
return new ConstExpr(v); return new ConstExpr(v);

View file

@ -30,7 +30,7 @@
#include "Net.h" #include "Net.h"
#include "Serializer.h" #include "Serializer.h"
#include "Event.h" #include "Event.h"
#include "Logger.h" #include "Reporter.h"
// Timer which on dispatching rotates the file. // Timer which on dispatching rotates the file.
class RotateTimer : public Timer { class RotateTimer : public Timer {
@ -94,7 +94,7 @@ static int maximize_num_fds()
#else #else
struct rlimit rl; struct rlimit rl;
if ( getrlimit(RLIMIT_NOFILE, &rl) < 0 ) 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 ) if ( rl.rlim_max == RLIM_INFINITY )
{ {
@ -110,7 +110,7 @@ static int maximize_num_fds()
rl.rlim_cur = rl.rlim_max; rl.rlim_cur = rl.rlim_max;
if ( setrlimit(RLIMIT_NOFILE, &rl) < 0 ) 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; return rl.rlim_cur / 2;
#endif #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); t = arg_t ? arg_t : base_type(TYPE_STRING);
if ( ! Open() ) 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; is_open = 0;
okay_to_manage = 0; okay_to_manage = 0;
} }
@ -273,7 +273,7 @@ FILE* BroFile::File()
FILE* BroFile::BringIntoCache() FILE* BroFile::BringIntoCache()
{ {
if ( f ) 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 ) if ( num_files_in_cache >= max_files_in_cache )
PurgeCache(); PurgeCache();
@ -287,12 +287,12 @@ FILE* BroFile::BringIntoCache()
if ( ! f ) if ( ! f )
{ {
bro_logger->Error("can't open %s", this); reporter->Error("can't open %s", this);
f = fopen("/dev/null", "w"); f = fopen("/dev/null", "w");
if ( ! f ) if ( ! f )
bro_logger->InternalError("out of file descriptors"); reporter->InternalError("out of file descriptors");
okay_to_manage = 0; okay_to_manage = 0;
return f; return f;
@ -302,7 +302,7 @@ FILE* BroFile::BringIntoCache()
UpdateFileSize(); UpdateFileSize();
if ( fseek(f, position, SEEK_SET) < 0 ) if ( fseek(f, position, SEEK_SET) < 0 )
bro_logger->Error("reopen seek failed", this); reporter->Error("reopen seek failed", this);
InsertAtBeginning(); InsertAtBeginning();
@ -315,7 +315,7 @@ FILE* BroFile::Seek(long new_position)
return 0; return 0;
if ( fseek(f, new_position, SEEK_SET) < 0 ) if ( fseek(f, new_position, SEEK_SET) < 0 )
bro_logger->Error("seek failed", this); reporter->Error("seek failed", this);
return f; return f;
} }
@ -326,7 +326,7 @@ void BroFile::SetBuf(bool arg_buffered)
return; return;
if ( setvbuf(f, NULL, arg_buffered ? _IOFBF : _IOLBF, 0) != 0 ) if ( setvbuf(f, NULL, arg_buffered ? _IOFBF : _IOLBF, 0) != 0 )
bro_logger->Error("setvbuf failed", this); reporter->Error("setvbuf failed", this);
buffered = arg_buffered; buffered = arg_buffered;
} }
@ -377,18 +377,18 @@ int BroFile::Close()
void BroFile::Suspend() void BroFile::Suspend()
{ {
if ( ! is_in_cache ) 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 ) if ( ! is_open )
bro_logger->InternalError("BroFile::Suspend() called for non-open file"); reporter->InternalError("BroFile::Suspend() called for non-open file");
Unlink(); Unlink();
if ( ! f ) if ( ! f )
bro_logger->InternalError("BroFile::Suspend() called for nil file"); reporter->InternalError("BroFile::Suspend() called for nil file");
if ( (position = ftell(f)) < 0 ) if ( (position = ftell(f)) < 0 )
{ {
bro_logger->Error("ftell failed", this); reporter->Error("ftell failed", this);
position = 0; position = 0;
} }
@ -399,7 +399,7 @@ void BroFile::Suspend()
void BroFile::PurgeCache() void BroFile::PurgeCache()
{ {
if ( ! tail ) if ( ! tail )
bro_logger->InternalError("BroFile purge of empty cache"); reporter->InternalError("BroFile purge of empty cache");
tail->Suspend(); tail->Suspend();
} }
@ -419,13 +419,13 @@ void BroFile::Unlink()
Next()->SetPrev(prev); Next()->SetPrev(prev);
if ( (head || tail) && ! (head && tail) ) if ( (head || tail) && ! (head && tail) )
bro_logger->InternalError("BroFile link list botch"); reporter->InternalError("BroFile link list botch");
is_in_cache = 0; is_in_cache = 0;
prev = next = 0; prev = next = 0;
if ( --num_files_in_cache < 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 ) 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; is_in_cache = 1;
} }
@ -456,7 +456,7 @@ void BroFile::MoveToBeginning()
return; // already at the beginning return; // already at the beginning
if ( ! is_in_cache || ! prev ) if ( ! is_in_cache || ! prev )
bro_logger->InternalError("BroFile inconsistency in MoveToBeginning()"); reporter->InternalError("BroFile inconsistency in MoveToBeginning()");
Unlink(); Unlink();
InsertAtBeginning(); InsertAtBeginning();
@ -643,7 +643,7 @@ void BroFile::InitEncrypt(const char* keyfile)
if ( ! key ) 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(); Close();
return; return;
} }
@ -651,7 +651,7 @@ void BroFile::InitEncrypt(const char* keyfile)
pub_key = PEM_read_PUBKEY(key, 0, 0, 0); pub_key = PEM_read_PUBKEY(key, 0, 0, 0);
if ( ! pub_key ) 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))); ERR_error_string(ERR_get_error(), 0)));
Close(); Close();
return; return;
@ -673,7 +673,7 @@ void BroFile::InitEncrypt(const char* keyfile)
if ( ! EVP_SealInit(cipher_ctx, cipher_type, &psecret, if ( ! EVP_SealInit(cipher_ctx, cipher_type, &psecret,
(int*) &secret_len, iv, &pub_key, 1) ) (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))); ERR_error_string(ERR_get_error(), 0)));
Close(); Close();
return; return;
@ -686,7 +686,7 @@ void BroFile::InitEncrypt(const char* keyfile)
fwrite(secret, ntohl(secret_len), 1, f) && fwrite(secret, ntohl(secret_len), 1, f) &&
fwrite(iv, iv_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))); name, strerror(errno)));
Close(); Close();
return; return;
@ -711,7 +711,7 @@ void BroFile::FinishEncrypt()
if ( outl && ! fwrite(cipher_buffer, outl, 1, f) ) 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))); name, strerror(errno)));
return; return;
} }
@ -743,7 +743,7 @@ int BroFile::Write(const char* data, int len)
if ( ! EVP_SealUpdate(cipher_ctx, cipher_buffer, &outl, if ( ! EVP_SealUpdate(cipher_ctx, cipher_buffer, &outl,
(unsigned char*)data, inl) ) (unsigned char*)data, inl) )
{ {
bro_logger->Error(fmt("encryption error for %s: %s", reporter->Error(fmt("encryption error for %s: %s",
name, name,
ERR_error_string(ERR_get_error(), 0))); ERR_error_string(ERR_get_error(), 0)));
Close(); Close();
@ -752,7 +752,7 @@ int BroFile::Write(const char* data, int len)
if ( outl && ! fwrite(cipher_buffer, outl, 1, f) ) 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))); name, strerror(errno)));
Close(); Close();
return 0; return 0;
@ -800,7 +800,7 @@ void BroFile::UpdateFileSize()
struct stat s; struct stat s;
if ( fstat(fileno(f), &s) < 0 ) 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; current_size = 0;
return; return;
} }

View file

@ -3,7 +3,7 @@
#include <algorithm> #include <algorithm>
#include "FileAnalyzer.h" #include "FileAnalyzer.h"
#include "Logger.h" #include "Reporter.h"
#ifdef HAVE_LIBMAGIC #ifdef HAVE_LIBMAGIC
magic_t File_Analyzer::magic = 0; magic_t File_Analyzer::magic = 0;
@ -76,11 +76,11 @@ void File_Analyzer::InitMagic(magic_t* magic, int flags)
*magic = magic_open(flags); *magic = magic_open(flags);
if ( ! *magic ) 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 ) 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_close(*magic);
*magic = 0; *magic = 0;
} }

View file

@ -77,7 +77,7 @@ int FlowSocketSrc::ExtractNextPDU()
(struct sockaddr*) &from, &fromlen); (struct sockaddr*) &from, &fromlen);
if ( pdu_len < 0 ) if ( pdu_len < 0 )
{ {
bro_logger->Error("problem reading NetFlow data from socket"); reporter->Error("problem reading NetFlow data from socket");
data = 0; data = 0;
next_timestamp = -1.0; next_timestamp = -1.0;
closed = 1; closed = 1;
@ -86,7 +86,7 @@ int FlowSocketSrc::ExtractNextPDU()
if ( fromlen != sizeof(from) ) if ( fromlen != sizeof(from) )
{ {
bro_logger->Error("malformed NetFlow PDU"); reporter->Error("malformed NetFlow PDU");
return 0; return 0;
} }
@ -171,7 +171,7 @@ int FlowFileSrc::ExtractNextPDU()
if ( pdu_header.pdu_length > NF_MAX_PKT_SIZE ) 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. // Safely skip over the too-long PDU.
if ( lseek(selectable_fd, pdu_header.pdu_length, SEEK_CUR) < 0 ) if ( lseek(selectable_fd, pdu_header.pdu_length, SEEK_CUR) < 0 )

View file

@ -24,7 +24,7 @@ void FragTimer::Dispatch(double t, int /* is_expire */)
if ( f ) if ( f )
f->Expire(t); f->Expire(t);
else else
bro_logger->InternalError("fragment timer dispatched w/o reassembler"); reporter->InternalError("fragment timer dispatched w/o reassembler");
} }
FragReassembler::FragReassembler(NetSessions* arg_s, FragReassembler::FragReassembler(NetSessions* arg_s,
@ -209,7 +209,7 @@ void FragReassembler::BlockInserted(DataBlock* /* start_block */)
break; break;
if ( b->upper > n ) if ( b->upper > n )
bro_logger->InternalError("bad fragment reassembly"); reporter->InternalError("bad fragment reassembly");
memcpy((void*) &pkt[b->seq], (const void*) b->block, memcpy((void*) &pkt[b->seq], (const void*) b->block,
b->upper - b->seq); b->upper - b->seq);

View file

@ -48,7 +48,7 @@
#include "RemoteSerializer.h" #include "RemoteSerializer.h"
#include "Event.h" #include "Event.h"
#include "Traverse.h" #include "Traverse.h"
#include "Logger.h" #include "Reporter.h"
extern RETSIGTYPE sig_handler(int signo); 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 */ || (flow != FLOW_RETURN /* we fell off the end */ ||
! result /* explicit return with no result */) && ! result /* explicit return with no result */) &&
! f->HasDelayed() ) ! 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() ) 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); id = lookup_ID(name, GLOBAL_MODULE_NAME, false);
if ( ! id ) if ( ! id )
bro_logger->InternalError("built-in function %s missing", name); reporter->InternalError("built-in function %s missing", name);
if ( id->HasVal() ) 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)); id->SetVal(new Val(this));
} }
@ -505,15 +505,17 @@ void builtin_error(const char* msg, BroObj* arg)
if ( calling_expr ) if ( calling_expr )
calling_expr->Error(msg, arg); calling_expr->Error(msg, arg);
else else
bro_logger->Error(msg, arg); reporter->Error(msg, arg);
} }
#include "bro.bif.func_h" #include "bro.bif.func_h"
#include "logging.bif.func_h" #include "logging.bif.func_h"
#include "reporter.bif.func_h"
#include "strings.bif.func_h" #include "strings.bif.func_h"
#include "bro.bif.func_def" #include "bro.bif.func_def"
#include "logging.bif.func_def" #include "logging.bif.func_def"
#include "reporter.bif.func_def"
#include "strings.bif.func_def" #include "strings.bif.func_def"
void init_builtin_funcs() void init_builtin_funcs()
@ -526,6 +528,7 @@ void init_builtin_funcs()
#include "bro.bif.func_init" #include "bro.bif.func_init"
#include "logging.bif.func_init" #include "logging.bif.func_init"
#include "reporter.bif.func_init"
#include "strings.bif.func_init" #include "strings.bif.func_init"
did_builtin_init = true; did_builtin_init = true;

View file

@ -574,7 +574,7 @@ void HTTP_Message::SubmitData(int len, const char* buf)
{ {
if ( buf != (const char*) data_buffer->Bytes() + buffer_offset || if ( buf != (const char*) data_buffer->Bytes() + buffer_offset ||
buffer_offset + len > buffer_size ) buffer_offset + len > buffer_size )
bro_logger->InternalError("buffer misalignment"); reporter->InternalError("buffer misalignment");
buffer_offset += len; buffer_offset += len;
if ( buffer_offset >= buffer_size ) if ( buffer_offset >= buffer_size )
@ -622,7 +622,7 @@ void HTTP_Message::SubmitEvent(int event_type, const char* detail)
break; break;
default: default:
bro_logger->InternalError("unrecognized HTTP message event"); reporter->InternalError("unrecognized HTTP message event");
} }
MyHTTP_Analyzer()->HTTP_Event(category, detail); 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]); request_method = new StringVal(http_methods[i]);
if ( ! ParseRequest(rest, end_of_line) ) if ( ! ParseRequest(rest, end_of_line) )
bro_logger->InternalError("HTTP ParseRequest failed"); reporter->InternalError("HTTP ParseRequest failed");
Conn()->Match(Rule::HTTP_REQUEST, Conn()->Match(Rule::HTTP_REQUEST,
(const u_char*) unescaped_URI->AsString()->Bytes(), (const u_char*) unescaped_URI->AsString()->Bytes(),

View file

@ -448,7 +448,7 @@ ID* ID::Unserialize(UnserialInfo* info)
break; break;
default: 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) ) if ( installed_tmp && ! global_scope()->Remove(name) )
bro_logger->InternalError("tmp id missing"); reporter->InternalError("tmp id missing");
return true; return true;
} }

View file

@ -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(), true));
AddSupportAnalyzer(new ZIP_Analyzer(Conn(), false)); AddSupportAnalyzer(new ZIP_Analyzer(Conn(), false));
#else #else
bro_logger->Error("IRC analyzer lacking libz support"); reporter->Error("IRC analyzer lacking libz support");
Remove(); Remove();
#endif #endif
} }

View file

@ -273,7 +273,7 @@ bool LogVal::Read(SerializationFormat* fmt)
} }
default: 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; return false;
@ -374,7 +374,7 @@ bool LogVal::Write(SerializationFormat* fmt) const
} }
default: 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; return false;
@ -452,7 +452,7 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
if ( ! same_type(rtype, BifType::Record::Log::Stream, 0) ) 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; return false;
} }
@ -468,7 +468,7 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
if ( ! LogVal::IsCompatibleType(columns->FieldType(i)) ) 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)); columns->FieldName(i));
return false; return false;
@ -479,7 +479,7 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
if ( ! log_attr_present ) 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; return false;
} }
@ -493,7 +493,7 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
if ( ! etype->IsEvent() ) 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; return false;
} }
@ -501,13 +501,13 @@ bool LogMgr::CreateStream(EnumVal* id, RecordVal* sval)
if ( args->length() != 1 ) 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; return false;
} }
if ( ! same_type((*args)[0], columns) ) 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); return new Val(0, TYPE_BOOL);
} }
} }
@ -627,7 +627,7 @@ bool LogMgr::TraverseRecord(Stream* stream, Filter* filter, RecordType* rt,
else else
{ {
bro_logger->Error("unsupported field type for log column"); reporter->Error("unsupported field type for log column");
return false; return false;
} }
} }
@ -666,7 +666,7 @@ bool LogMgr::TraverseRecord(Stream* stream, Filter* filter, RecordType* rt,
if ( ! filter->fields ) if ( ! filter->fields )
{ {
bro_logger->Error("out of memory in add_filter"); reporter->Error("out of memory in add_filter");
return false; return false;
} }
@ -685,7 +685,7 @@ bool LogMgr::AddFilter(EnumVal* id, RecordVal* fval)
if ( ! same_type(rtype, BifType::Record::Log::Filter, 0) ) 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; return false;
} }
@ -835,7 +835,7 @@ bool LogMgr::Write(EnumVal* id, RecordVal* columns)
if ( ! columns ) if ( ! columns )
{ {
bro_logger->Error("incompatible log record type"); reporter->Error("incompatible log record type");
return false; return false;
} }
@ -877,7 +877,7 @@ bool LogMgr::Write(EnumVal* id, RecordVal* columns)
if ( ! v->Type()->Tag() == TYPE_STRING ) 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); Unref(v);
return false; return false;
} }
@ -1061,7 +1061,7 @@ LogVal* LogMgr::ValToLogVal(Val* val, BroType* ty)
} }
default: default:
bro_logger->InternalError("unsupported type for log_write"); reporter->InternalError("unsupported type for log_write");
} }
return lval; return lval;
@ -1126,7 +1126,7 @@ LogWriter* LogMgr::CreateWriter(EnumVal* id, EnumVal* writer, string path,
{ {
if ( ld->type == BifEnum::Log::WRITER_DEFAULT ) if ( ld->type == BifEnum::Log::WRITER_DEFAULT )
{ {
bro_logger->Error("unknow writer when creating writer"); reporter->Error("unknow writer when creating writer");
return 0; return 0;
} }
@ -1285,7 +1285,7 @@ bool LogMgr::Flush(EnumVal* id)
void LogMgr::Error(LogWriter* writer, const char* msg) 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)); writer->Path().c_str(), msg));
} }

View file

@ -115,7 +115,7 @@ void Login_Analyzer::NewLine(bool orig, char* line)
} }
if ( state != LOGIN_STATE_CONFUSED ) 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 // When we're in "confused", we feed each user input line to
// login_confused_text, but also scan the text in the // 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 char* Login_Analyzer::PeekUserText() const
{ {
if ( num_user_text <= 0 ) 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]; return user_text[user_text_first];
} }

View file

@ -5,7 +5,7 @@
#include "NetVar.h" #include "NetVar.h"
#include "MIME.h" #include "MIME.h"
#include "Event.h" #include "Event.h"
#include "Logger.h" #include "Reporter.h"
// Here are a few things to do: // Here are a few things to do:
// //
@ -269,7 +269,7 @@ void MIME_Entity::init()
MIME_Entity::~MIME_Entity() MIME_Entity::~MIME_Entity()
{ {
if ( ! end_of_data ) 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; delete current_header_line;
Unref(content_type_str); Unref(content_type_str);
@ -654,7 +654,7 @@ int MIME_Entity::CheckBoundaryDelimiter(int len, const char* data)
{ {
if ( ! multipart_boundary ) 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"); DEBUG_MSG("headers of the MIME entity for debug:\n");
DebugPrintHeaders(); DebugPrintHeaders();
return NOT_MULTIPART_BOUNDARY; return NOT_MULTIPART_BOUNDARY;
@ -800,7 +800,7 @@ void MIME_Entity::DecodeBase64(int len, const char* data)
char* prbuf = rbuf; char* prbuf = rbuf;
int decoded = base64_decoder->Decode(len, data, &rlen, &prbuf); int decoded = base64_decoder->Decode(len, data, &rlen, &prbuf);
if ( prbuf != rbuf ) if ( prbuf != rbuf )
bro_logger->InternalError("buffer pointer modified in base64 decoding"); reporter->InternalError("buffer pointer modified in base64 decoding");
DataOctets(rlen, rbuf); DataOctets(rlen, rbuf);
len -= decoded; data += decoded; len -= decoded; data += decoded;
} }
@ -809,7 +809,7 @@ void MIME_Entity::DecodeBase64(int len, const char* data)
void MIME_Entity::StartDecodeBase64() void MIME_Entity::StartDecodeBase64()
{ {
if ( base64_decoder ) if ( base64_decoder )
bro_logger->InternalError("previous Base64 decoder not released!"); reporter->InternalError("previous Base64 decoder not released!");
base64_decoder = new Base64Decoder(message->GetAnalyzer()); base64_decoder = new Base64Decoder(message->GetAnalyzer());
} }
@ -826,7 +826,7 @@ void MIME_Entity::FinishDecodeBase64()
if ( base64_decoder->Done(&rlen, &prbuf) ) if ( base64_decoder->Done(&rlen, &prbuf) )
{ // some remaining data { // some remaining data
if ( prbuf != rbuf ) if ( prbuf != rbuf )
bro_logger->InternalError("buffer pointer modified in base64 decoding"); reporter->InternalError("buffer pointer modified in base64 decoding");
if ( rlen > 0 ) if ( rlen > 0 )
DataOctets(rlen, rbuf); DataOctets(rlen, rbuf);
} }
@ -840,7 +840,7 @@ int MIME_Entity::GetDataBuffer()
int ret = message->RequestBuffer(&data_buf_length, &data_buf_data); int ret = message->RequestBuffer(&data_buf_length, &data_buf_data);
if ( ! ret || data_buf_length == 0 || data_buf_data == 0 ) 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; return 0;
} }
@ -1093,7 +1093,7 @@ void MIME_Mail::SubmitAllHeaders(MIME_HeaderList& hlist)
void MIME_Mail::SubmitData(int len, const char* buf) void MIME_Mail::SubmitData(int len, const char* buf)
{ {
if ( buf != (char*) data_buffer->Bytes() + buffer_start ) if ( buf != (char*) data_buffer->Bytes() + buffer_start )
bro_logger->InternalError("buffer misalignment"); reporter->InternalError("buffer misalignment");
if ( compute_content_hash ) if ( compute_content_hash )
{ {
@ -1181,7 +1181,7 @@ void MIME_Mail::SubmitEvent(int event_type, const char* detail)
break; break;
default: default:
bro_logger->InternalError("unrecognized MIME_Mail event"); reporter->InternalError("unrecognized MIME_Mail event");
} }
if ( mime_event ) if ( mime_event )

View file

@ -193,7 +193,7 @@ public:
virtual ~MIME_Message() virtual ~MIME_Message()
{ {
if ( ! finished ) if ( ! finished )
bro_logger->InternalError("Done() must be called before destruction"); reporter->InternalError("Done() must be called before destruction");
} }
virtual void Done() { finished = 1; } virtual void Done() { finished = 1; }

View file

@ -38,7 +38,7 @@ void TelnetOption::RecvOption(unsigned int type)
{ {
TelnetOption* peer = endp->FindPeerOption(code); TelnetOption* peer = endp->FindPeerOption(code);
if ( ! peer ) 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. // WILL/WONT/DO/DONT are messages we've *received* from our peer.
switch ( type ) { switch ( type ) {
@ -83,7 +83,7 @@ void TelnetOption::RecvOption(unsigned int type)
break; break;
default: 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); (TelnetEncryptOption*) endp->FindPeerOption(code);
if ( ! peer ) if ( ! peer )
bro_logger->InternalError("option peer missing in TelnetEncryptOption::RecvSubOption"); reporter->InternalError("option peer missing in TelnetEncryptOption::RecvSubOption");
if ( peer->DidRequest() || peer->DoingEncryption() || if ( peer->DidRequest() || peer->DoingEncryption() ||
peer->Endpoint()->AuthenticationHasBeenAccepted() ) peer->Endpoint()->AuthenticationHasBeenAccepted() )
@ -199,7 +199,7 @@ void TelnetAuthenticateOption::RecvSubOption(u_char* data, int len)
(TelnetAuthenticateOption*) endp->FindPeerOption(code); (TelnetAuthenticateOption*) endp->FindPeerOption(code);
if ( ! peer ) if ( ! peer )
bro_logger->InternalError("option peer missing in TelnetAuthenticateOption::RecvSubOption"); reporter->InternalError("option peer missing in TelnetAuthenticateOption::RecvSubOption");
if ( ! peer->DidRequestAuthentication() ) if ( ! peer->DidRequestAuthentication() )
InconsistentOption(0); InconsistentOption(0);

View file

@ -26,7 +26,7 @@
#include "Event.h" #include "Event.h"
#include "Timer.h" #include "Timer.h"
#include "Var.h" #include "Var.h"
#include "Logger.h" #include "Reporter.h"
#include "Net.h" #include "Net.h"
#include "Anon.h" #include "Anon.h"
#include "PacketSort.h" #include "PacketSort.h"
@ -119,7 +119,7 @@ RETSIGTYPE watchdog(int /* signo */)
pkt_dumper = new PktDumper("watchdog-pkt.pcap"); pkt_dumper = new PktDumper("watchdog-pkt.pcap");
if ( pkt_dumper->IsError() ) 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; pkt_dumper = 0;
} }
} }
@ -131,7 +131,7 @@ RETSIGTYPE watchdog(int /* signo */)
net_get_final_stats(); net_get_final_stats();
net_finish(0); net_finish(0);
bro_logger->FatalErrorWithCore( reporter->FatalErrorWithCore(
"**watchdog timer expired, t = %d.%06d, start = %d.%06d, dispatched = %d", "**watchdog timer expired, t = %d.%06d, start = %d.%06d, dispatched = %d",
int_ct, frac_ct, int_pst, frac_pst, int_ct, frac_ct, int_pst, frac_pst,
current_dispatched); current_dispatched);
@ -161,7 +161,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
PktFileSrc* ps = new PktFileSrc(readfiles[i], filter); PktFileSrc* ps = new PktFileSrc(readfiles[i], filter);
if ( ! ps->IsOpen() ) 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()); prog, readfiles[i], ps->ErrorMsg());
else else
{ {
@ -178,7 +178,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
TYPE_FILTER_SECONDARY); TYPE_FILTER_SECONDARY);
if ( ! ps->IsOpen() ) 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], prog, readfiles[i],
ps->ErrorMsg()); ps->ErrorMsg());
else else
@ -196,7 +196,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
FlowFileSrc* fs = new FlowFileSrc(flowfiles[i]); FlowFileSrc* fs = new FlowFileSrc(flowfiles[i]);
if ( ! fs->IsOpen() ) 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()); prog, flowfiles[i], fs->ErrorMsg());
else else
{ {
@ -216,7 +216,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
ps = new PktInterfaceSrc(interfaces[i], filter); ps = new PktInterfaceSrc(interfaces[i], filter);
if ( ! ps->IsOpen() ) 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()); prog, interfaces[i], ps->ErrorMsg());
else else
{ {
@ -231,7 +231,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
filter, TYPE_FILTER_SECONDARY); filter, TYPE_FILTER_SECONDARY);
if ( ! ps->IsOpen() ) 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], prog, interfaces[i],
ps->ErrorMsg()); ps->ErrorMsg());
else else
@ -249,7 +249,7 @@ void net_init(name_list& interfaces, name_list& readfiles,
FlowSocketSrc* fs = new FlowSocketSrc(netflows[i]); FlowSocketSrc* fs = new FlowSocketSrc(netflows[i]);
if ( ! fs->IsOpen() ) 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()); prog, netflows[i], fs->ErrorMsg());
else else
{ {
@ -272,12 +272,12 @@ void net_init(name_list& interfaces, name_list& readfiles,
// interfaces with different-lengthed media. // interfaces with different-lengthed media.
pkt_dumper = new PktDumper(writefile); pkt_dumper = new PktDumper(writefile);
if ( pkt_dumper->IsError() ) 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()); prog, writefile, pkt_dumper->ErrorMsg());
ID* id = global_scope()->Lookup("trace_output_file"); ID* id = global_scope()->Lookup("trace_output_file");
if ( ! id ) if ( ! id )
bro_logger->Error("trace_output_file not defined in bro.init"); reporter->Error("trace_output_file not defined in bro.init");
else else
id->SetVal(new StringVal(writefile)); id->SetVal(new StringVal(writefile));
} }
@ -344,7 +344,7 @@ void net_packet_dispatch(double t, const struct pcap_pkthdr* hdr,
// charged against this sample. // charged against this sample.
mgr.Drain(); mgr.Drain();
sample_logger = new SampleLogger(); sample_logger = new SampleReporter();
sp = new SegmentProfiler(sample_logger, "load-samp"); sp = new SegmentProfiler(sample_logger, "load-samp");
} }
} }
@ -537,7 +537,7 @@ void net_get_final_stats()
{ {
struct PktSrc::Stats s; struct PktSrc::Stats s;
ps->Statistics(&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); s.received, ps->Interface(), s.dropped);
} }
} }
@ -611,7 +611,7 @@ static double suspend_start = 0;
void net_suspend_processing() void net_suspend_processing()
{ {
if ( _processing_suspended == 0 ) if ( _processing_suspended == 0 )
bro_logger->Message("processing suspended"); reporter->Message("processing suspended");
++_processing_suspended; ++_processing_suspended;
} }
@ -620,7 +620,7 @@ void net_continue_processing()
{ {
if ( _processing_suspended == 1 ) if ( _processing_suspended == 1 )
{ {
bro_logger->Message("processing continued"); reporter->Message("processing continued");
loop_over_list(pkt_srcs, i) loop_over_list(pkt_srcs, i)
pkt_srcs[i]->ContinueAfterSuspend(); pkt_srcs[i]->ContinueAfterSuspend();
} }

View file

@ -259,6 +259,7 @@ StringVal* cmd_line_bpf_filter;
#include "types.bif.netvar_def" #include "types.bif.netvar_def"
#include "event.bif.netvar_def" #include "event.bif.netvar_def"
#include "logging.bif.netvar_def" #include "logging.bif.netvar_def"
#include "reporter.bif.netvar_def"
void init_event_handlers() void init_event_handlers()
{ {
@ -318,6 +319,7 @@ void init_net_var()
#include "const.bif.netvar_init" #include "const.bif.netvar_init"
#include "types.bif.netvar_init" #include "types.bif.netvar_init"
#include "logging.bif.netvar_init" #include "logging.bif.netvar_init"
#include "reporter.bif.netvar_init"
conn_id = internal_type("conn_id")->AsRecordType(); conn_id = internal_type("conn_id")->AsRecordType();
endpoint = internal_type("endpoint")->AsRecordType(); endpoint = internal_type("endpoint")->AsRecordType();

View file

@ -268,5 +268,6 @@ extern void init_net_var();
#include "types.bif.netvar_h" #include "types.bif.netvar_h"
#include "event.bif.netvar_h" #include "event.bif.netvar_h"
#include "logging.bif.netvar_h" #include "logging.bif.netvar_h"
#include "reporter.bif.netvar_h"
#endif #endif

View file

@ -87,7 +87,7 @@ void OSFingerprint::collide(uint32 id)
if (sig[id].ttl % 32 && sig[id].ttl != 255 && sig[id].ttl % 30) if (sig[id].ttl % 32 && sig[id].ttl != 255 && sig[id].ttl % 30)
{ {
problems=1; 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)); 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) && if (!strcmp(sig[i].os,sig[id].os) &&
!strcmp(sig[i].desc,sig[id].desc)) { !strcmp(sig[i].desc,sig[id].desc)) {
problems=1; 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)); 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; if (sig[id].opt[j] ^ sig[i].opt[j]) goto reloop;
problems=1; 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).", " is already covered by '%s %s' (line %d).",
sig[id].os,sig[id].desc,sig[id].line,sig[i].os,sig[i].desc, sig[id].os,sig[id].desc,sig[id].line,sig[i].os,sig[i].desc,
sig[i].line)); sig[i].line));

View file

@ -15,7 +15,7 @@
#include "util.h" #include "util.h"
#include "Dict.h" #include "Dict.h"
#include "Logger.h" #include "Reporter.h"
// Size limit for size wildcards. // Size limit for size wildcards.
#define PACKET_BIG 100 #define PACKET_BIG 100
@ -105,19 +105,19 @@ protected:
void Error(const char* msg) void Error(const char* msg)
{ {
bro_logger->Error(msg); reporter->Error(msg);
err = true; err = true;
} }
void Error(const char* msg, int n) void Error(const char* msg, int n)
{ {
bro_logger->Error(msg, n); reporter->Error(msg, n);
err = true; err = true;
} }
void Error(const char* msg, const char* s) void Error(const char* msg, const char* s)
{ {
bro_logger->Error(msg, s); reporter->Error(msg, s);
err = true; err = true;
} }

View file

@ -98,8 +98,8 @@ void BroObj::Warn(const char* msg, const BroObj* obj2, int pinpoint_only) const
{ {
ODesc d; ODesc d;
DoMsg(&d, msg, obj2, pinpoint_only); DoMsg(&d, msg, obj2, pinpoint_only);
bro_logger->Warning("%s", d.Description()); reporter->Warning("%s", d.Description());
bro_logger->PopLocation(); reporter->PopLocation();
} }
void BroObj::Error(const char* msg, const BroObj* obj2, int pinpoint_only) const 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; ODesc d;
DoMsg(&d, msg, obj2, pinpoint_only); DoMsg(&d, msg, obj2, pinpoint_only);
bro_logger->Error("%s", d.Description()); reporter->Error("%s", d.Description());
bro_logger->PopLocation(); reporter->PopLocation();
} }
void BroObj::BadTag(const char* msg, const char* t1, const char* t2) const 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; ODesc d;
DoMsg(&d, out); DoMsg(&d, out);
bro_logger->FatalError("%s", d.Description()); reporter->FatalError("%s", d.Description());
} }
void BroObj::Internal(const char* msg) const void BroObj::Internal(const char* msg) const
{ {
ODesc d; ODesc d;
DoMsg(&d, msg); DoMsg(&d, msg);
bro_logger->InternalError("%s", d.Description()); reporter->InternalError("%s", d.Description());
} }
void BroObj::InternalWarning(const char* msg) const void BroObj::InternalWarning(const char* msg) const
{ {
ODesc d; ODesc d;
DoMsg(&d, msg); DoMsg(&d, msg);
bro_logger->InternalWarning("%s", d.Description()); reporter->InternalWarning("%s", d.Description());
} }
void BroObj::AddLocation(ODesc* d) const void BroObj::AddLocation(ODesc* d) const
@ -197,7 +197,7 @@ void BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2,
*obj2->GetLocationInfo() != *GetLocationInfo() ) *obj2->GetLocationInfo() != *GetLocationInfo() )
loc2 = obj2->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 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) void bad_ref(int type)
{ {
bro_logger->InternalError("bad reference count [%d]", type); reporter->InternalError("bad reference count [%d]", type);
abort(); abort();
} }

View file

@ -153,7 +153,7 @@ void PIA_UDP::ActivateAnalyzer(AnalyzerTag::Tag tag, const Rule* rule)
void PIA_UDP::DeactivateAnalyzer(AnalyzerTag::Tag tag) 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 //// TCP PIA
@ -375,7 +375,7 @@ void PIA_TCP::ActivateAnalyzer(AnalyzerTag::Tag tag, const Rule* rule)
void PIA_TCP::DeactivateAnalyzer(AnalyzerTag::Tag tag) 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) void PIA_TCP::ReplayStreamBuffer(Analyzer* analyzer)

View file

@ -15,7 +15,7 @@
#include "POP3.h" #include "POP3.h"
#include "Event.h" #include "Event.h"
#include "NVT.h" #include "NVT.h"
#include "Logger.h" #include "Reporter.h"
#undef POP3_CMD_DEF #undef POP3_CMD_DEF
#define POP3_CMD_DEF(cmd) #cmd, #define POP3_CMD_DEF(cmd) #cmd,
@ -200,7 +200,7 @@ void POP3_Analyzer::ProcessRequest(int length, const char* line)
break; break;
default: default:
bro_logger->InternalError("unexpected authorization state"); reporter->InternalError("unexpected authorization state");
} }
delete decoded; delete decoded;
@ -556,7 +556,7 @@ void POP3_Analyzer::ProcessClientCmd()
break; break;
default: default:
bro_logger->InternalError("command not known"); reporter->InternalError("command not known");
} }
} }
@ -808,7 +808,7 @@ void POP3_Analyzer::BeginData()
void POP3_Analyzer::EndData() void POP3_Analyzer::EndData()
{ {
if ( ! mail ) if ( ! mail )
bro_logger->Warning("unmatched end of data"); reporter->Warning("unmatched end of data");
else else
{ {
mail->Done(); mail->Done();

View file

@ -18,7 +18,7 @@ PacketDumper::PacketDumper(pcap_dumper_t* arg_pkt_dump)
pkt_dump = arg_pkt_dump; pkt_dump = arg_pkt_dump;
if ( ! 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, 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; struct pcap_pkthdr h = *hdr;
h.caplen = len; h.caplen = len;
if ( h.caplen > hdr->caplen ) if ( h.caplen > hdr->caplen )
bro_logger->InternalError("bad modified caplen"); reporter->InternalError("bad modified caplen");
pcap_dump((u_char*) pkt_dump, &h, pkt); pcap_dump((u_char*) pkt_dump, &h, pkt);
} }

View file

@ -347,7 +347,7 @@ PacketSortElement* PacketSortGlobalPQ::RemoveMin(double timestamp)
PacketSortConnPQ* PacketSortGlobalPQ::FindConnPQ(PacketSortElement* e) PacketSortConnPQ* PacketSortGlobalPQ::FindConnPQ(PacketSortElement* e)
{ {
if ( ! e->is_tcp ) 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); PacketSortConnPQ* pq = (PacketSortConnPQ*) conn_pq_table.Lookup(e->key);
if ( ! pq ) if ( ! pq )

View file

@ -13,7 +13,7 @@
#include "RemoteSerializer.h" #include "RemoteSerializer.h"
#include "Conn.h" #include "Conn.h"
#include "Event.h" #include "Event.h"
#include "Logger.h" #include "Reporter.h"
#include "Net.h" #include "Net.h"
class IncrementalWriteTimer : public Timer { class IncrementalWriteTimer : public Timer {
@ -189,7 +189,7 @@ void PersistenceSerializer::RaiseFinishedSendState()
vl->append(new PortVal(remote_port)); vl->append(new PortVal(remote_port));
mgr.QueueEvent(finished_send_state, vl); mgr.QueueEvent(finished_send_state, vl);
bro_logger->Log("Serialization done."); reporter->Log("Serialization done.");
} }
#endif #endif
@ -213,7 +213,7 @@ void PersistenceSerializer::GotStateAccess(StateAccess* s)
void PersistenceSerializer::GotTimer(Timer* s) void PersistenceSerializer::GotTimer(Timer* s)
{ {
bro_logger->Error("PersistenceSerializer::GotTimer not implemented"); reporter->Error("PersistenceSerializer::GotTimer not implemented");
} }
void PersistenceSerializer::GotConnection(Connection* c) void PersistenceSerializer::GotConnection(Connection* c)
@ -228,7 +228,7 @@ void PersistenceSerializer::GotID(ID* id, Val* /* val */)
void PersistenceSerializer::GotPacket(Packet* p) void PersistenceSerializer::GotPacket(Packet* p)
{ {
bro_logger->Error("PersistenceSerializer::GotPacket not implemented"); reporter->Error("PersistenceSerializer::GotPacket not implemented");
} }
bool PersistenceSerializer::LogAccess(const StateAccess& s) bool PersistenceSerializer::LogAccess(const StateAccess& s)
@ -286,7 +286,7 @@ bool PersistenceSerializer::SendState(SourceID peer, bool may_suspend)
status->conns = &persistent_conns; status->conns = &persistent_conns;
status->peer = peer; status->peer = peer;
bro_logger->Message("Sending state..."); reporter->Message("Sending state...");
return RunSerialization(status); return RunSerialization(status);
} }
@ -301,7 +301,7 @@ bool PersistenceSerializer::SendConfig(SourceID peer, bool may_suspend)
status->ids = global_scope()->GetIDs(); status->ids = global_scope()->GetIDs();
status->peer = peer; status->peer = peer;
bro_logger->Message("Sending config..."); reporter->Message("Sending config...");
return RunSerialization(status); return RunSerialization(status);
} }
@ -319,7 +319,7 @@ bool PersistenceSerializer::RunSerialization(SerialStatus* status)
{ {
if ( running[i]->type == status->type ) 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; return false;
} }
} }
@ -381,14 +381,14 @@ bool PersistenceSerializer::RunSerialization(SerialStatus* status)
} }
else else
bro_logger->InternalError("unknown suspend state"); reporter->InternalError("unknown suspend state");
} }
else if ( cont->Resuming() ) else if ( cont->Resuming() )
cont->Resume(); cont->Resume();
else else
bro_logger->InternalError("unknown continuation state"); reporter->InternalError("unknown continuation state");
if ( status->id_cookie ) if ( status->id_cookie )
{ {
@ -504,7 +504,7 @@ bool PersistenceSerializer::DoIDSerialization(SerialStatus* status, ID* id)
break; break;
default: default:
bro_logger->InternalError("unknown serialization type"); reporter->InternalError("unknown serialization type");
} }
return success; return success;
@ -535,7 +535,7 @@ bool PersistenceSerializer::DoConnSerialization(SerialStatus* status,
break; break;
default: default:
bro_logger->InternalError("unknown serialization type"); reporter->InternalError("unknown serialization type");
} }
return success; return success;
@ -560,7 +560,7 @@ bool PersistenceSerializer::DoAccessSerialization(SerialStatus* status,
break; break;
default: default:
bro_logger->InternalError("unknown serialization type"); reporter->InternalError("unknown serialization type");
} }
return success; return success;

View file

@ -400,7 +400,7 @@ void PktSrc::Statistics(Stats* s)
else if ( pcap_stats(pd, &pstat) < 0 ) 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()); ErrorMsg());
s->received = s->dropped = s->link = 0; s->received = s->dropped = s->link = 0;
} }
@ -463,7 +463,7 @@ PktInterfaceSrc::PktInterfaceSrc(const char* arg_interface, const char* filter,
// ### This needs autoconf'ing. // ### This needs autoconf'ing.
#ifdef HAVE_PCAP_INT_H #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 #endif
#ifdef HAVE_LINUX #ifdef HAVE_LINUX
@ -486,7 +486,7 @@ PktInterfaceSrc::PktInterfaceSrc(const char* arg_interface, const char* filter,
// Couldn't get header size. // Couldn't get header size.
return; return;
bro_logger->Message("listening on %s\n", interface); reporter->Message("listening on %s\n", interface);
} }
else else
closed = true; closed = true;
@ -518,7 +518,7 @@ PktFileSrc::PktFileSrc(const char* arg_readfile, const char* filter,
selectable_fd = fileno(pcap_file(pd)); selectable_fd = fileno(pcap_file(pd));
if ( selectable_fd < 0 ) if ( selectable_fd < 0 )
bro_logger->InternalError("OS does not support selectable pcap fd"); reporter->InternalError("OS does not support selectable pcap fd");
} }
else else
closed = true; closed = true;

View file

@ -16,7 +16,7 @@ using namespace std;
#include "Debug.h" #include "Debug.h"
#include "util.h" #include "util.h"
#include "PolicyFile.h" #include "PolicyFile.h"
#include "Logger.h" #include "Reporter.h"
struct PolicyFile { struct PolicyFile {
PolicyFile () { filedata = 0; lmtime = 0; } PolicyFile () { filedata = 0; lmtime = 0; }
@ -33,7 +33,7 @@ static PolicyFileMap policy_files;
int how_many_lines_in(const char* policy_filename) int how_many_lines_in(const char* policy_filename)
{ {
if ( ! 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"); FILE* throwaway = fopen(policy_filename, "r");
if ( ! throwaway ) if ( ! throwaway )

View file

@ -1,7 +1,7 @@
// $Id: PrefixTable.cc 1016 2005-01-31 21:23:50Z vern $ // $Id: PrefixTable.cc 1016 2005-01-31 21:23:50Z vern $
#include "PrefixTable.h" #include "PrefixTable.h"
#include "Logger.h" #include "Reporter.h"
// IPv4 version. // IPv4 version.
inline static prefix_t* make_prefix(const uint32 addr, int width) 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); Deref_Prefix(prefix);
if ( ! node ) if ( ! node )
bro_logger->InternalError("Cannot create node in patricia tree"); reporter->InternalError("Cannot create node in patricia tree");
void* old = node->data; void* old = node->data;
@ -66,7 +66,7 @@ void* PrefixTable::Insert(const Val* value, void* data)
break; break;
default: default:
bro_logger->InternalError("Wrong index type for PrefixTable"); reporter->InternalError("Wrong index type for PrefixTable");
return 0; return 0;
} }
} }
@ -100,7 +100,7 @@ void* PrefixTable::Lookup(const Val* value, bool exact) const
break; break;
default: default:
bro_logger->InternalError("Wrong index type %d for PrefixTable", reporter->InternalError("Wrong index type %d for PrefixTable",
value->Type()->Tag()); value->Type()->Tag());
return 0; return 0;
} }
@ -138,7 +138,7 @@ void* PrefixTable::Remove(const Val* value)
break; break;
default: default:
bro_logger->InternalError("Wrong index type for PrefixTable"); reporter->InternalError("Wrong index type for PrefixTable");
return 0; return 0;
} }
} }

View file

@ -8,7 +8,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "PriorityQueue.h" #include "PriorityQueue.h"
#include "Logger.h" #include "Reporter.h"
#include "util.h" #include "util.h"
PriorityQueue::PriorityQueue(int initial_size) PriorityQueue::PriorityQueue(int initial_size)
@ -53,7 +53,7 @@ PQ_Element* PriorityQueue::Remove(PQ_Element* e)
PQ_Element* e2 = Remove(); PQ_Element* e2 = Remove();
if ( e != e2 ) if ( e != e2 )
bro_logger->InternalError("inconsistency in PriorityQueue::Remove"); reporter->InternalError("inconsistency in PriorityQueue::Remove");
return e2; return e2;
} }

View file

@ -114,7 +114,7 @@ int Specific_RE_Matcher::Compile(int lazy)
RE_set_input(pattern_text); RE_set_input(pattern_text);
if ( RE_parse() ) if ( RE_parse() )
{ {
bro_logger->Error("error compiling pattern /%s/", pattern_text); reporter->Error("error compiling pattern /%s/", pattern_text);
return 0; 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) int Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx)
{ {
if ( set.length() != idx.length() ) if ( set.length() != idx.length() )
bro_logger->InternalError("compileset: lengths of sets differ"); reporter->InternalError("compileset: lengths of sets differ");
rem = this; rem = this;
@ -145,7 +145,7 @@ int Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx)
RE_set_input(set[i]); RE_set_input(set[i]);
if ( RE_parse() ) if ( RE_parse() )
{ {
bro_logger->Error("error compiling pattern /%s/", set[i]); reporter->Error("error compiling pattern /%s/", set[i]);
return 0; return 0;
} }

View file

@ -263,7 +263,7 @@ int RPC_Interpreter::DeliverRPC(const u_char* buf, int n, int rpclen,
} }
else if ( n < 0 ) else if ( n < 0 )
bro_logger->InternalError("RPC underflow"); reporter->InternalError("RPC underflow");
return 1; return 1;
} }
@ -473,7 +473,7 @@ bool Contents_RPC::CheckResync(int& len, const u_char*& data, bool orig)
if ( resync_toskip != 0 ) if ( resync_toskip != 0 )
// Should never happen. // 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 // Now lets see whether data points to the beginning of a RPC
// frame. If the resync processs is successful, we should be // 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); marker_buf.Init(4,4);
if ( ! dummy_p ) if ( ! dummy_p )
bro_logger->InternalError("inconsistent RPC record marker extraction"); reporter->InternalError("inconsistent RPC record marker extraction");
last_frag = (marker & 0x80000000) != 0; last_frag = (marker & 0x80000000) != 0;
marker &= 0x7fffffff; marker &= 0x7fffffff;

View file

@ -127,7 +127,7 @@ void Contents_Rsh_Analyzer::DoDeliver(int len, const u_char* data)
break; break;
default: default:
bro_logger->InternalError("bad state in Contents_Rsh_Analyzer::DoDeliver"); reporter->InternalError("bad state in Contents_Rsh_Analyzer::DoDeliver");
break; break;
} }
} }
@ -179,7 +179,7 @@ void Rsh_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
void Rsh_Analyzer::ClientUserName(const char* s) void Rsh_Analyzer::ClientUserName(const char* s)
{ {
if ( client_name ) if ( client_name )
bro_logger->InternalError("multiple rsh client names"); reporter->InternalError("multiple rsh client names");
client_name = new StringVal(s); client_name = new StringVal(s);
} }
@ -187,7 +187,7 @@ void Rsh_Analyzer::ClientUserName(const char* s)
void Rsh_Analyzer::ServerUserName(const char* s) void Rsh_Analyzer::ServerUserName(const char* s)
{ {
if ( username ) if ( username )
bro_logger->InternalError("multiple rsh initial client names"); reporter->InternalError("multiple rsh initial client names");
username = new StringVal(s); username = new StringVal(s);
} }

View file

@ -24,7 +24,7 @@ DataBlock::DataBlock(const u_char* data, int size, int arg_seq,
block = new u_char[size]; block = new u_char[size];
if ( ! block ) if ( ! block )
bro_logger->InternalError("out of memory"); reporter->InternalError("out of memory");
memcpy((void*) block, (const void*) data, size); memcpy((void*) block, (const void*) data, size);

View file

@ -186,7 +186,7 @@
#include "File.h" #include "File.h"
#include "Conn.h" #include "Conn.h"
#include "LogMgr.h" #include "LogMgr.h"
#include "Logger.h" #include "Reporter.h"
extern "C" { extern "C" {
#include "setsignal.h" #include "setsignal.h"
@ -394,7 +394,7 @@ static bool sendToIO(ChunkedIO* io, ChunkedIO::Chunk* c)
{ {
if ( ! io->Write(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; return false;
} }
@ -406,7 +406,7 @@ static bool sendToIO(ChunkedIO* io, char msg_type, RemoteSerializer::PeerID id,
{ {
if ( ! sendCMsg(io, msg_type, 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; return false;
} }
@ -421,7 +421,7 @@ static bool sendToIO(ChunkedIO* io, char msg_type, RemoteSerializer::PeerID id,
{ {
if ( ! sendCMsg(io, msg_type, 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; return false;
} }
@ -664,7 +664,7 @@ void RemoteSerializer::Fork()
setpriority(PRIO_PROCESS, 0, 5); setpriority(PRIO_PROCESS, 0, 5);
child.Run(); 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; return true;
if ( ! initialized ) if ( ! initialized )
bro_logger->InternalError("remote serializer not initialized"); reporter->InternalError("remote serializer not initialized");
#ifdef BROv6 #ifdef BROv6
if ( ! is_v4_addr(ip) ) if ( ! is_v4_addr(ip) )
@ -736,13 +736,13 @@ bool RemoteSerializer::RequestSync(PeerID id, bool auth)
Peer* peer = LookupPeer(id, true); Peer* peer = LookupPeer(id, true);
if ( ! peer ) 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; return false;
} }
if ( peer->phase != Peer::HANDSHAKE ) 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)); peer->phase));
return false; return false;
} }
@ -763,13 +763,13 @@ bool RemoteSerializer::RequestLogs(PeerID id)
Peer* peer = LookupPeer(id, true); Peer* peer = LookupPeer(id, true);
if ( ! peer ) 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; return false;
} }
if ( peer->phase != Peer::HANDSHAKE ) 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)); peer->phase));
return false; return false;
} }
@ -788,13 +788,13 @@ bool RemoteSerializer::RequestEvents(PeerID id, RE_Matcher* pattern)
Peer* peer = LookupPeer(id, true); Peer* peer = LookupPeer(id, true);
if ( ! peer ) 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; return false;
} }
if ( peer->phase != Peer::HANDSHAKE ) 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)); peer->phase));
return false; return false;
} }
@ -855,7 +855,7 @@ bool RemoteSerializer::CompleteHandshake(PeerID id)
if ( p->phase != Peer::HANDSHAKE ) 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)); p->phase));
return false; return false;
} }
@ -1124,7 +1124,7 @@ bool RemoteSerializer::SendCaptureFilter(PeerID id, const char* filter)
if ( peer->phase != Peer::HANDSHAKE ) 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; return false;
} }
@ -1201,7 +1201,7 @@ bool RemoteSerializer::SendCapabilities(Peer* peer)
{ {
if ( peer->phase != Peer::HANDSHAKE ) 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)); peer->phase));
return false; return false;
} }
@ -1224,7 +1224,7 @@ bool RemoteSerializer::Listen(addr_type ip, uint16 port, bool expect_ssl)
return true; return true;
if ( ! initialized ) if ( ! initialized )
bro_logger->InternalError("remote serializer not initialized"); reporter->InternalError("remote serializer not initialized");
#ifdef BROv6 #ifdef BROv6
if ( ! is_v4_addr(ip) ) if ( ! is_v4_addr(ip) )
@ -1546,10 +1546,10 @@ bool RemoteSerializer::Poll(bool may_block)
} }
default: default:
bro_logger->InternalError("unknown msgstate"); reporter->InternalError("unknown msgstate");
} }
bro_logger->InternalError("cannot be reached"); reporter->InternalError("cannot be reached");
return false; return false;
} }
@ -1664,7 +1664,7 @@ bool RemoteSerializer::DoMessage()
return true; // keep going return true; // keep going
} }
bro_logger->InternalError("cannot be reached"); reporter->InternalError("cannot be reached");
return false; return false;
} }
@ -1955,7 +1955,7 @@ bool RemoteSerializer::ProcessConnected()
ID* descr = global_scope()->Lookup("peer_description"); ID* descr = global_scope()->Lookup("peer_description");
if ( ! descr ) if ( ! descr )
bro_logger->InternalError("peer_description not defined"); reporter->InternalError("peer_description not defined");
SerialInfo info(this); SerialInfo info(this);
SendID(&info, current_peer, *descr); SendID(&info, current_peer, *descr);
@ -2138,7 +2138,7 @@ bool RemoteSerializer::HandshakeDone(Peer* peer)
else if ( peer->sync_requested & Peer::WE ) else if ( peer->sync_requested & Peer::WE )
peer->send_state = false; peer->send_state = false;
else else
bro_logger->InternalError("illegal sync_requested value"); reporter->InternalError("illegal sync_requested value");
} }
else else
{ {
@ -2836,7 +2836,7 @@ void RemoteSerializer::GotStateAccess(StateAccess* s)
void RemoteSerializer::GotTimer(Timer* s) void RemoteSerializer::GotTimer(Timer* s)
{ {
bro_logger->Error("RemoteSerializer::GotTimer not implemented"); reporter->Error("RemoteSerializer::GotTimer not implemented");
} }
void RemoteSerializer::GotPacket(Packet* p) 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) ) 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())); msg_type, io->Error()));
return false; return false;
} }
@ -3013,7 +3013,7 @@ void RemoteSerializer::FatalError(const char* msg)
{ {
msg = fmt("fatal error, shutting down communication: %s", msg); msg = fmt("fatal error, shutting down communication: %s", msg);
Log(LogError, msg); Log(LogError, msg);
bro_logger->Error(msg); reporter->Error(msg);
closed = true; closed = true;
kill(child_pid, SIGQUIT); kill(child_pid, SIGQUIT);
@ -3054,7 +3054,7 @@ void RemoteSerializer::InternalCommError(const char* msg)
#ifdef DEBUG_COMMUNICATION #ifdef DEBUG_COMMUNICATION
DumpDebugData(); DumpDebugData();
#else #else
bro_logger->InternalError("%s", msg); reporter->InternalError("%s", msg);
#endif #endif
} }
@ -3075,7 +3075,7 @@ static ChunkedIO* openDump(const char* file)
if ( fd < 0 ) 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; return 0;
} }
@ -3092,7 +3092,7 @@ void RemoteSerializer::ReadDumpAsMessageType(const char* file)
if ( ! io->Read(&chunk, true ) ) 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; return;
} }
@ -3407,11 +3407,11 @@ bool SocketComm::ProcessParentMessage()
} }
default: default:
bro_logger->InternalError("unknown msg type %d", parent_msgtype); reporter->InternalError("unknown msg type %d", parent_msgtype);
return true; return true;
} }
bro_logger->InternalError("cannot be reached"); reporter->InternalError("cannot be reached");
} }
case ARGS: case ARGS:
@ -3434,10 +3434,10 @@ bool SocketComm::ProcessParentMessage()
} }
default: default:
bro_logger->InternalError("unknown msgstate"); reporter->InternalError("unknown msgstate");
} }
bro_logger->InternalError("cannot be reached"); reporter->InternalError("cannot be reached");
return false; return false;
} }
@ -3496,7 +3496,7 @@ bool SocketComm::DoParentMessage()
peers[j]->io->DumpDebugData(fmt("comm-dump.child.peer.%d", id), false); peers[j]->io->DumpDebugData(fmt("comm-dump.child.peer.%d", id), false);
} }
#else #else
bro_logger->InternalError("DEBUG_DUMP support not compiled in"); reporter->InternalError("DEBUG_DUMP support not compiled in");
#endif #endif
return true; return true;
} }
@ -3556,10 +3556,10 @@ bool SocketComm::DoParentMessage()
return ForwardChunkToPeer(); return ForwardChunkToPeer();
default: 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; return false;
} }
@ -3620,7 +3620,7 @@ bool SocketComm::ProcessListen()
bool SocketComm::ProcessParentCompress() bool SocketComm::ProcessParentCompress()
{ {
#ifndef HAVE_LIBZ #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; return false;
#else #else
@ -3740,7 +3740,7 @@ bool SocketComm::ProcessRemoteMessage(SocketComm::Peer* peer)
} }
default: default:
bro_logger->InternalError("ProcessRemoteMessage: unexpected state"); reporter->InternalError("ProcessRemoteMessage: unexpected state");
} }
assert(false); // Cannot be reached. assert(false); // Cannot be reached.

View file

@ -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. // See the file "COPYING" in the main distribution directory for copyright.
//
#include <syslog.h> #include <syslog.h>
#include "config.h" #include "config.h"
#include "Logger.h" #include "Reporter.h"
#include "Event.h" #include "Event.h"
#include "NetVar.h" #include "NetVar.h"
#include "Net.h" #include "Net.h"
@ -19,9 +19,9 @@ int closelog();
} }
#endif #endif
Logger* bro_logger = 0; Reporter* reporter = 0;
Logger::Logger() Reporter::Reporter()
{ {
errors = 0; errors = 0;
via_events = false; via_events = false;
@ -29,37 +29,37 @@ Logger::Logger()
openlog("bro", 0, LOG_LOCAL5); openlog("bro", 0, LOG_LOCAL5);
} }
Logger::~Logger() Reporter::~Reporter()
{ {
closelog(); closelog();
} }
void Logger::Message(const char* fmt, ...) void Reporter::Message(const char* fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); 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); va_end(ap);
} }
void Logger::Warning(const char* fmt, ...) void Reporter::Warning(const char* fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); 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); va_end(ap);
} }
void Logger::Error(const char* fmt, ...) void Reporter::Error(const char* fmt, ...)
{ {
++errors; ++errors;
va_list ap; va_list ap;
va_start(ap, fmt); 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); va_end(ap);
} }
void Logger::FatalError(const char* fmt, ...) void Reporter::FatalError(const char* fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -73,7 +73,7 @@ void Logger::FatalError(const char* fmt, ...)
exit(1); exit(1);
} }
void Logger::FatalErrorWithCore(const char* fmt, ...) void Reporter::FatalErrorWithCore(const char* fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -87,7 +87,7 @@ void Logger::FatalErrorWithCore(const char* fmt, ...)
abort(); abort();
} }
void Logger::InternalError(const char* fmt, ...) void Reporter::InternalError(const char* fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -101,15 +101,15 @@ void Logger::InternalError(const char* fmt, ...)
abort(); abort();
} }
void Logger::InternalWarning(const char* fmt, ...) void Reporter::InternalWarning(const char* fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); 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); va_end(ap);
} }
void Logger::Syslog(const char* fmt, ...) void Reporter::Syslog(const char* fmt, ...)
{ {
if ( reading_traces ) if ( reading_traces )
return; return;
@ -120,7 +120,7 @@ void Logger::Syslog(const char* fmt, ...)
va_end(ap); 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); val_list* vl = new val_list(1);
@ -138,7 +138,7 @@ void Logger::WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* name,
delete vl; 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); val_list* vl = new val_list(2);
vl->append(new AddrVal(orig)); vl->append(new AddrVal(orig));
@ -152,27 +152,27 @@ void Logger::WeirdFlowHelper(addr_type orig, addr_type resp, const char* name, .
delete vl; delete vl;
} }
void Logger::Weird(const char* name) void Reporter::Weird(const char* name)
{ {
WeirdHelper(net_weird, 0, name, 0); 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); 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); 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); 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]; 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); buffer = alloced = (char *)realloc(alloced, size);
if ( ! buffer ) if ( ! buffer )
FatalError("out of memory in logger"); FatalError("out of memory in Reporter");
} }
if ( event && via_events ) 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; val_list* vl = new val_list;
if ( time ) 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)); vl->append(new StringVal(buffer));
@ -277,7 +277,7 @@ void Logger::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connect
{ {
string s = ""; string s = "";
if ( network_time ) if ( bro_start_network_time != 0.0 )
{ {
char tmp[32]; char tmp[32];
snprintf(tmp, 32, "%.6f", network_time); snprintf(tmp, 32, "%.6f", network_time);

View file

@ -1,7 +1,7 @@
// See the file "COPYING" in the main distribution directory for copyright. // See the file "COPYING" in the main distribution directory for copyright.
#ifndef logger_h #ifndef REPORTER_H
#define logger_h #define REPORTER_H
#include <stdarg.h> #include <stdarg.h>
@ -15,10 +15,10 @@
class Connection; class Connection;
class Location; class Location;
class Logger { class Reporter {
public: public:
Logger(); Reporter();
~Logger(); ~Reporter();
// Report an informational message, nothing that needs specific // Report an informational message, nothing that needs specific
// attention. // attention.
@ -71,7 +71,7 @@ public:
// the location is popped. // the location is popped.
void PushLocation(const Location* location) void PushLocation(const Location* location)
{ locations.push_back(std::pair<const Location*, const Location*>(location, 0)); } { locations.push_back(std::pair<const Location*, const Location*>(location, 0)); }
void PushLocation(const Location* loc1, const Location* loc2) void PushLocation(const Location* loc1, const Location* loc2)
{ locations.push_back(std::pair<const Location*, const Location*>(loc1, loc2)); } { locations.push_back(std::pair<const Location*, const Location*>(loc1, loc2)); }
@ -91,7 +91,7 @@ private:
std::list<std::pair<const Location*, const Location*> > locations; std::list<std::pair<const Location*, const Location*> > locations;
}; };
extern Logger* bro_logger; extern Reporter* reporter;
#endif #endif

View file

@ -192,7 +192,7 @@ void Contents_Rlogin_Analyzer::DoDeliver(int len, const u_char* data)
break; break;
default: default:
bro_logger->InternalError("bad state in Contents_Rlogin_Analyzer::DoDeliver"); reporter->InternalError("bad state in Contents_Rlogin_Analyzer::DoDeliver");
break; break;
} }
} }
@ -223,7 +223,7 @@ Rlogin_Analyzer::Rlogin_Analyzer(Connection* conn)
void Rlogin_Analyzer::ClientUserName(const char* s) void Rlogin_Analyzer::ClientUserName(const char* s)
{ {
if ( client_name ) if ( client_name )
bro_logger->InternalError("multiple rlogin client names"); reporter->InternalError("multiple rlogin client names");
client_name = new StringVal(s); client_name = new StringVal(s);
} }

View file

@ -113,7 +113,7 @@ bool RuleConditionPayloadSize::DoMatch(Rule* rule, RuleEndpointState* state,
return payload_size >= val; return payload_size >= val;
default: default:
bro_logger->InternalError("unknown comparision type"); reporter->InternalError("unknown comparision type");
} }
// Should not be reached // Should not be reached
@ -135,7 +135,7 @@ bool RuleConditionEval::DoMatch(Rule* rule, RuleEndpointState* state,
{ {
if ( ! id->HasVal() ) if ( ! id->HasVal() )
{ {
bro_logger->Error("undefined value"); reporter->Error("undefined value");
return false; return false;
} }

View file

@ -10,7 +10,7 @@
#include "NetVar.h" #include "NetVar.h"
#include "Scope.h" #include "Scope.h"
#include "File.h" #include "File.h"
#include "Logger.h" #include "Reporter.h"
// FIXME: Things that are not fully implemented/working yet: // 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); rules_in = search_for_file( files[i], "sig", 0, false);
if ( ! rules_in ) if ( ! rules_in )
{ {
bro_logger->Error("Can't open signature file", files[i]); reporter->Error("Can't open signature file", files[i]);
return false; return false;
} }
@ -401,7 +401,7 @@ static inline uint32 getval(const u_char* data, int size)
return ntohl(*(uint32*) data); return ntohl(*(uint32*) data);
default: default:
bro_logger->InternalError("illegal HdrTest size"); reporter->InternalError("illegal HdrTest size");
} }
// Should not be reached. // Should not be reached.
@ -514,7 +514,7 @@ RuleEndpointState* RuleMatcher::InitEndpoint(Analyzer* analyzer,
default: default:
data = 0; data = 0;
bro_logger->InternalError("unknown protocol"); reporter->InternalError("unknown protocol");
} }
// ### data can be nil here if it's an // ### 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), >=); DO_MATCH_OR(*h->vals, getval(data + h->offset, h->size), >=);
default: default:
bro_logger->InternalError("unknown comparision type"); reporter->InternalError("unknown comparision type");
} }
no_match: no_match:
@ -570,7 +570,7 @@ void RuleMatcher::Match(RuleEndpointState* state, Rule::PatternType type,
{ {
if ( ! state ) if ( ! state )
{ {
bro_logger->Warning("RuleEndpointState not initialized yet."); reporter->Warning("RuleEndpointState not initialized yet.");
return; return;
} }

View file

@ -6,7 +6,7 @@
#include "SMB.h" #include "SMB.h"
#include "smb_pac.h" #include "smb_pac.h"
#include "Val.h" #include "Val.h"
#include "Logger.h" #include "Reporter.h"
namespace { namespace {
const bool DEBUG_smb_ipc = true; const bool DEBUG_smb_ipc = true;
@ -733,7 +733,7 @@ int SMB_Session::ParseTransaction(int is_orig, int cmd,
break; break;
default: default:
bro_logger->InternalError("command mismatch for ParseTransaction"); reporter->InternalError("command mismatch for ParseTransaction");
} }
int ret; int ret;

View file

@ -10,7 +10,7 @@
#include "SMTP.h" #include "SMTP.h"
#include "Event.h" #include "Event.h"
#include "ContentLine.h" #include "ContentLine.h"
#include "Logger.h" #include "Reporter.h"
#undef SMTP_CMD_DEF #undef SMTP_CMD_DEF
#define SMTP_CMD_DEF(cmd) #cmd, #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 skip_data = 0; // reset the flag at the beginning of the mail
if ( mail != 0 ) if ( mail != 0 )
{ {
bro_logger->Warning("nested mail transaction"); reporter->Warning("nested mail transaction");
mail->Done(); mail->Done();
delete mail; delete mail;
} }
@ -877,7 +877,7 @@ void SMTP_Analyzer::BeginData()
void SMTP_Analyzer::EndData() void SMTP_Analyzer::EndData()
{ {
if ( ! mail ) if ( ! mail )
bro_logger->Warning("Unmatched end of data"); reporter->Warning("Unmatched end of data");
else else
{ {
mail->Done(); mail->Done();

View file

@ -1,6 +1,6 @@
#include "SSL-binpac.h" #include "SSL-binpac.h"
#include "TCP_Reassembler.h" #include "TCP_Reassembler.h"
#include "Logger.h" #include "Reporter.h"
#include "util.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) 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() void SSL_Analyzer_binpac::generate_warnings()

View file

@ -287,7 +287,7 @@ void SSLv2_Interpreter::NewSSLRecord(SSL_InterpreterEndpoint* s,
break; break;
default: default:
bro_logger->InternalError("SSLv2: unknown state"); reporter->InternalError("SSLv2: unknown state");
break; break;
} }
} }

View file

@ -7,7 +7,7 @@
#include "ID.h" #include "ID.h"
#include "Val.h" #include "Val.h"
#include "Scope.h" #include "Scope.h"
#include "Logger.h" #include "Reporter.h"
static scope_list scopes; static scope_list scopes;
static Scope* top_scope; static Scope* top_scope;
@ -28,7 +28,7 @@ Scope::Scope(ID* id)
if ( id_type->Tag() == TYPE_ERROR ) if ( id_type->Tag() == TYPE_ERROR )
return; return;
else if ( id_type->Tag() != TYPE_FUNC ) else if ( id_type->Tag() != TYPE_FUNC )
bro_logger->InternalError("bad scope id"); reporter->InternalError("bad scope id");
Ref(id); Ref(id);
@ -129,7 +129,7 @@ ID* lookup_ID(const char* name, const char* curr_module, bool no_global,
if ( id ) if ( id )
{ {
if ( need_export && ! id->IsExport() && ! in_debug ) if ( need_export && ! id->IsExport() && ! in_debug )
bro_logger->Error("identifier is not exported:", reporter->Error("identifier is not exported:",
fullname.c_str()); fullname.c_str());
Ref(id); Ref(id);
@ -156,7 +156,7 @@ ID* install_ID(const char* name, const char* module_name,
bool is_global, bool is_export) bool is_global, bool is_export)
{ {
if ( scopes.length() == 0 && ! is_global ) if ( scopes.length() == 0 && ! is_global )
bro_logger->InternalError("local identifier in global scope"); reporter->InternalError("local identifier in global scope");
IDScope scope; IDScope scope;
if ( is_export || ! module_name || if ( is_export || ! module_name ||
@ -198,7 +198,7 @@ Scope* pop_scope()
{ {
int n = scopes.length() - 1; int n = scopes.length() - 1;
if ( n < 0 ) if ( n < 0 )
bro_logger->InternalError("scope underflow"); reporter->InternalError("scope underflow");
scopes.remove_nth(n); scopes.remove_nth(n);
Scope* old_top = top_scope; Scope* old_top = top_scope;

View file

@ -21,7 +21,7 @@ SerialObj* SerialObj::Instantiate(SerialType type)
return o; return o;
} }
bro_logger->Error(fmt("Unknown object type 0x%08x", type)); reporter->Error(fmt("Unknown object type 0x%08x", type));
return 0; return 0;
} }
@ -31,7 +31,7 @@ const char* SerialObj::ClassName(SerialType type)
if ( f != names->end() ) if ( f != names->end() )
return f->second; 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>"; return "<no-class-name>";
} }
@ -47,7 +47,7 @@ void SerialObj::Register(SerialType type, FactoryFunc f, const char* name)
FactoryMap::iterator i = factories->find(type); FactoryMap::iterator i = factories->find(type);
if ( i != factories->end() ) if ( i != factories->end() )
bro_logger->InternalError("SerialType 0x%08x registered twice", type); reporter->InternalError("SerialType 0x%08x registered twice", type);
(*factories)[type] = f; (*factories)[type] = f;
(*names)[type] = name; (*names)[type] = name;
@ -77,7 +77,7 @@ bool SerialObj::Serialize(SerialInfo* info) const
const TransientID* tid = GetTID(); const TransientID* tid = GetTID();
if ( ! tid ) if ( ! tid )
bro_logger->InternalError("no tid - missing DECLARE_SERIAL?"); reporter->InternalError("no tid - missing DECLARE_SERIAL?");
if ( info->cache ) if ( info->cache )
pid = info->s->Cache()->Lookup(*tid); pid = info->s->Cache()->Lookup(*tid);
@ -211,7 +211,7 @@ SerialObj* SerialObj::Unserialize(UnserialInfo* info, SerialType type)
const TransientID* tid = obj->GetTID(); const TransientID* tid = obj->GetTID();
if ( ! tid ) if ( ! tid )
bro_logger->InternalError("no tid - missing DECLARE_SERIAL?"); reporter->InternalError("no tid - missing DECLARE_SERIAL?");
if ( info->cache ) if ( info->cache )
info->s->Cache()->Register(obj, pid, info->new_cache_strategy); info->s->Cache()->Register(obj, pid, info->new_cache_strategy);

View file

@ -5,7 +5,7 @@
#include "net_util.h" #include "net_util.h"
#include "SerializationFormat.h" #include "SerializationFormat.h"
#include "Serializer.h" #include "Serializer.h"
#include "Logger.h" #include "Reporter.h"
SerializationFormat::SerializationFormat() SerializationFormat::SerializationFormat()
{ {
@ -59,7 +59,7 @@ bool SerializationFormat::ReadData(void* b, size_t count)
{ {
if ( input_pos + count > input_len ) 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(); abort();
return false; return false;
} }
@ -205,7 +205,7 @@ bool BinarySerializationFormat::Read(char** str, int* len, const char* tag)
for ( int i = 0; i < l; i++ ) for ( int i = 0; i < l; i++ )
if ( ! s[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] = '_'; s[i] = '_';
} }
} }
@ -333,61 +333,61 @@ XMLSerializationFormat::~XMLSerializationFormat()
bool XMLSerializationFormat::Read(int* v, const char* tag) bool XMLSerializationFormat::Read(int* v, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }
bool XMLSerializationFormat::Read(uint16* v, const char* tag) bool XMLSerializationFormat::Read(uint16* v, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }
bool XMLSerializationFormat::Read(uint32* v, const char* tag) bool XMLSerializationFormat::Read(uint32* v, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }
bool XMLSerializationFormat::Read(int64* v, const char* tag) bool XMLSerializationFormat::Read(int64* v, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }
bool XMLSerializationFormat::Read(uint64* v, const char* tag) bool XMLSerializationFormat::Read(uint64* v, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }
bool XMLSerializationFormat::Read(bool* v, const char* tag) bool XMLSerializationFormat::Read(bool* v, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }
bool XMLSerializationFormat::Read(double* d, const char* tag) bool XMLSerializationFormat::Read(double* d, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }
bool XMLSerializationFormat::Read(char* v, const char* tag) bool XMLSerializationFormat::Read(char* v, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }
bool XMLSerializationFormat::Read(char** str, int* len, const char* tag) 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; return false;
} }
bool XMLSerializationFormat::Read(string* s, const char* tag) bool XMLSerializationFormat::Read(string* s, const char* tag)
{ {
bro_logger->InternalError("no reading of xml"); reporter->InternalError("no reading of xml");
return false; return false;
} }

View file

@ -12,7 +12,7 @@
#include "Serializer.h" #include "Serializer.h"
#include "Scope.h" #include "Scope.h"
#include "Stmt.h" #include "Stmt.h"
#include "Logger.h" #include "Reporter.h"
#include "Func.h" #include "Func.h"
#include "Event.h" #include "Event.h"
#include "EventRegistry.h" #include "EventRegistry.h"
@ -911,7 +911,7 @@ bool FileSerializer::Read(UnserialInfo* info, const char* file, bool header)
void FileSerializer::ReportError(const char* str) void FileSerializer::ReportError(const char* str)
{ {
bro_logger->Error(str); reporter->Error(str);
} }
void FileSerializer::GotID(ID* id, Val* val) void FileSerializer::GotID(ID* id, Val* val)
@ -971,7 +971,7 @@ ConversionSerializer::~ConversionSerializer()
bool ConversionSerializer::Convert(const char* file_in, const char* file_out) 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) ) if ( ! serout->Open(file_out, true) )
return false; return false;
@ -1004,19 +1004,19 @@ void ConversionSerializer::GotFunctionCall(const char* name, double time,
void ConversionSerializer::GotID(ID* id, Val* val) void ConversionSerializer::GotID(ID* id, Val* val)
{ {
bro_logger->Warning("ConversionSerializer::GotID not implemented"); reporter->Warning("ConversionSerializer::GotID not implemented");
Unref(id); Unref(id);
} }
void ConversionSerializer::GotStateAccess(StateAccess* s) void ConversionSerializer::GotStateAccess(StateAccess* s)
{ {
bro_logger->Warning("ConversionSerializer::GotID not implemented"); reporter->Warning("ConversionSerializer::GotID not implemented");
delete s; delete s;
} }
void ConversionSerializer::GotPacket(Packet* p) void ConversionSerializer::GotPacket(Packet* p)
{ {
bro_logger->Warning("ConversionSerializer::GotPacket not implemented"); reporter->Warning("ConversionSerializer::GotPacket not implemented");
delete p; delete p;
} }

View file

@ -18,7 +18,7 @@
#include "IP.h" #include "IP.h"
#include "Timer.h" #include "Timer.h"
#include "IOSource.h" #include "IOSource.h"
#include "Logger.h" #include "Reporter.h"
class SerializationCache; class SerializationCache;
class SerialInfo; class SerialInfo;
@ -263,7 +263,7 @@ public:
virtual ~CloneSerializer() { } virtual ~CloneSerializer() { }
protected: 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 GotID(ID* id, Val* val) { }
virtual void GotEvent(const char* name, double time, virtual void GotEvent(const char* name, double time,
EventHandlerPtr event, val_list* args) { } EventHandlerPtr event, val_list* args) { }

View file

@ -15,7 +15,7 @@
#include "Timer.h" #include "Timer.h"
#include "NetVar.h" #include "NetVar.h"
#include "Sessions.h" #include "Sessions.h"
#include "Logger.h" #include "Reporter.h"
#include "OSFinger.h" #include "OSFinger.h"
#include "ICMP.h" #include "ICMP.h"
@ -572,7 +572,7 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
HashKey* h = id.BuildConnKey(); HashKey* h = id.BuildConnKey();
if ( ! h ) if ( ! h )
bro_logger->InternalError("hash computation failed"); reporter->InternalError("hash computation failed");
Connection* conn = 0; Connection* conn = 0;
@ -761,7 +761,7 @@ FragReassembler* NetSessions::NextFragment(double t, const IP_Hdr* ip,
HashKey* h = ch->ComputeHash(key, 1); HashKey* h = ch->ComputeHash(key, 1);
if ( ! h ) if ( ! h )
bro_logger->InternalError("hash computation failed"); reporter->InternalError("hash computation failed");
FragReassembler* f = fragments.Lookup(h); FragReassembler* f = fragments.Lookup(h);
if ( ! f ) if ( ! f )
@ -855,7 +855,7 @@ Connection* NetSessions::FindConnection(Val* v)
HashKey* h = id.BuildConnKey(); HashKey* h = id.BuildConnKey();
if ( ! h ) if ( ! h )
bro_logger->InternalError("hash computation failed"); reporter->InternalError("hash computation failed");
Dictionary* d; Dictionary* d;
@ -933,21 +933,21 @@ void NetSessions::Remove(Connection* c)
; ;
else if ( ! tcp_conns.RemoveEntry(k) ) else if ( ! tcp_conns.RemoveEntry(k) )
bro_logger->InternalError("connection missing"); reporter->InternalError("connection missing");
break; break;
case TRANSPORT_UDP: case TRANSPORT_UDP:
if ( ! udp_conns.RemoveEntry(k) ) if ( ! udp_conns.RemoveEntry(k) )
bro_logger->InternalError("connection missing"); reporter->InternalError("connection missing");
break; break;
case TRANSPORT_ICMP: case TRANSPORT_ICMP:
if ( ! icmp_conns.RemoveEntry(k) ) if ( ! icmp_conns.RemoveEntry(k) )
bro_logger->InternalError("connection missing"); reporter->InternalError("connection missing");
break; break;
case TRANSPORT_UNKNOWN: case TRANSPORT_UNKNOWN:
bro_logger->InternalError("unknown transport when removing connection"); reporter->InternalError("unknown transport when removing connection");
break; break;
} }
@ -960,10 +960,10 @@ void NetSessions::Remove(FragReassembler* f)
{ {
HashKey* k = f->Key(); HashKey* k = f->Key();
if ( ! k ) if ( ! k )
bro_logger->InternalError("fragment block not in dictionary"); reporter->InternalError("fragment block not in dictionary");
if ( ! fragments.RemoveEntry(k) ) if ( ! fragments.RemoveEntry(k) )
bro_logger->InternalError("fragment block missing"); reporter->InternalError("fragment block missing");
Unref(f); Unref(f);
} }
@ -999,7 +999,7 @@ void NetSessions::Insert(Connection* c)
break; break;
default: default:
bro_logger->InternalError("unknown connection type"); reporter->InternalError("unknown connection type");
} }
if ( old && old != c ) if ( old && old != c )
@ -1123,7 +1123,7 @@ Connection* NetSessions::NewConn(HashKey* k, double t, const ConnID* id,
tproto = TRANSPORT_UDP; tproto = TRANSPORT_UDP;
break; break;
default: default:
bro_logger->InternalError("unknown transport protocol"); reporter->InternalError("unknown transport protocol");
break; break;
}; };
@ -1310,7 +1310,7 @@ void NetSessions::DumpPacket(const struct pcap_pkthdr* hdr,
struct pcap_pkthdr h = *hdr; struct pcap_pkthdr h = *hdr;
h.caplen = len; h.caplen = len;
if ( h.caplen > hdr->caplen ) if ( h.caplen > hdr->caplen )
bro_logger->InternalError("bad modified caplen"); reporter->InternalError("bad modified caplen");
pkt_dumper->Dump(&h, pkt); pkt_dumper->Dump(&h, pkt);
} }
} }
@ -1319,7 +1319,7 @@ void NetSessions::Internal(const char* msg, const struct pcap_pkthdr* hdr,
const u_char* pkt) const u_char* pkt)
{ {
DumpPacket(hdr, pkt); DumpPacket(hdr, pkt);
bro_logger->InternalError("%s", msg); reporter->InternalError("%s", msg);
} }
void NetSessions::Weird(const char* name, void NetSessions::Weird(const char* name,
@ -1328,12 +1328,12 @@ void NetSessions::Weird(const char* name,
if ( hdr ) if ( hdr )
dump_this_packet = 1; dump_this_packet = 1;
bro_logger->Weird(name); reporter->Weird(name);
} }
void NetSessions::Weird(const char* name, const IP_Hdr* ip) 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() unsigned int NetSessions::ConnectionMemoryUsage()

View file

@ -10,7 +10,7 @@
#include "SmithWaterman.h" #include "SmithWaterman.h"
#include "Var.h" #include "Var.h"
#include "util.h" #include "util.h"
#include "Logger.h" #include "Reporter.h"
BroSubstring::BroSubstring(const BroSubstring& bst) BroSubstring::BroSubstring(const BroSubstring& bst)
: BroString((const BroString&) bst), _new(bst._new) : BroString((const BroString&) bst), _new(bst._new)
@ -186,7 +186,7 @@ bool BroSubstringCmp::operator()(const BroSubstring* bst1,
if ( _index >= bst1->GetNumAlignments() || if ( _index >= bst1->GetNumAlignments() ||
_index >= bst2->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; return false;
} }

View file

@ -235,7 +235,7 @@ bool StateAccess::MergeTables(TableVal* dst, Val* src)
{ {
if ( ! src->Type()->Tag() == TYPE_TABLE ) if ( ! src->Type()->Tag() == TYPE_TABLE )
{ {
bro_logger->Error("type mismatch while merging tables"); reporter->Error("type mismatch while merging tables");
return false; return false;
} }
@ -269,8 +269,8 @@ void StateAccess::Replay()
{ {
// FIXME: I think this warrants an internal error, // FIXME: I think this warrants an internal error,
// but let's check that first ... // but let's check that first ...
// bro_logger->InternalError("replay id lacking a value"); // reporter->InternalError("replay id lacking a value");
bro_logger->Error("replay id lacks a value"); reporter->Error("replay id lacks a value");
return; return;
} }
@ -352,7 +352,7 @@ void StateAccess::Replay()
v->AsRecordVal()->Assign(idx, op2 ? op2->Ref() : 0); v->AsRecordVal()->Assign(idx, op2 ? op2->Ref() : 0);
} }
else 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 ) else if ( t == TYPE_VECTOR )
@ -377,7 +377,7 @@ void StateAccess::Replay()
} }
else else
bro_logger->InternalError("unknown type in replaying index assign"); reporter->InternalError("unknown type in replaying index assign");
break; break;
@ -413,7 +413,7 @@ void StateAccess::Replay()
v->AsRecordVal()->Assign(idx, new_val, OP_INCR); v->AsRecordVal()->Assign(idx, new_val, OP_INCR);
} }
else 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 ) else if ( t == TYPE_VECTOR )
@ -427,7 +427,7 @@ void StateAccess::Replay()
} }
else else
bro_logger->InternalError("unknown type in replaying index increment"); reporter->InternalError("unknown type in replaying index increment");
break; break;
} }
@ -489,7 +489,7 @@ void StateAccess::Replay()
case OP_PRINT: case OP_PRINT:
assert(op1.val); assert(op1.val);
bro_logger->InternalError("access replay for print not implemented"); reporter->InternalError("access replay for print not implemented");
break; break;
case OP_READ_IDX: case OP_READ_IDX:
@ -518,11 +518,11 @@ void StateAccess::Replay()
} }
} }
else else
bro_logger->Error("read for non-table"); reporter->Error("read for non-table");
break; break;
default: default:
bro_logger->InternalError("access replay: unknown opcode for StateAccess"); reporter->InternalError("access replay: unknown opcode for StateAccess");
break; break;
} }
@ -630,7 +630,7 @@ bool StateAccess::DoSerialize(SerialInfo* info) const
break; break;
default: 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; break;
default: default:
bro_logger->InternalError("unknown opcode for StateAccess"); reporter->InternalError("unknown opcode for StateAccess");
break; break;
} }

View file

@ -21,7 +21,7 @@ uint32 tot_gap_bytes = 0;
class ProfileTimer : public Timer { class ProfileTimer : public Timer {
public: public:
ProfileTimer(double t, ProfileLogger* l, double i) ProfileTimer(double t, ProfileReporter* l, double i)
: Timer(t, TIMER_PROFILE) : Timer(t, TIMER_PROFILE)
{ {
logger = l; logger = l;
@ -32,7 +32,7 @@ public:
protected: protected:
double interval; double interval;
ProfileLogger* logger; ProfileReporter* logger;
}; };
void ProfileTimer::Dispatch(double t, int is_expire) 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() : SegmentStatsReporter()
{ {
file = arg_file; file = arg_file;
@ -54,12 +54,12 @@ ProfileLogger::ProfileLogger(BroFile* arg_file, double interval)
timer_mgr->Add(new ProfileTimer(1, this, interval)); timer_mgr->Add(new ProfileTimer(1, this, interval));
} }
ProfileLogger::~ProfileLogger() ProfileReporter::~ProfileReporter()
{ {
file->Close(); file->Close();
} }
void ProfileLogger::Log() void ProfileReporter::Log()
{ {
if ( terminating ) if ( terminating )
// Connections have been flushed already. // 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) double dtime, int dmem)
{ {
if ( name ) 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; static TableType* load_sample_info = 0;
@ -313,22 +313,22 @@ SampleLogger::SampleLogger()
load_samples = new TableVal(load_sample_info); load_samples = new TableVal(load_sample_info);
} }
SampleLogger::~SampleLogger() SampleReporter::~SampleReporter()
{ {
Unref(load_samples); Unref(load_samples);
} }
void SampleLogger::FunctionSeen(const Func* func) void SampleReporter::FunctionSeen(const Func* func)
{ {
load_samples->Assign(new StringVal(func->GetID()->Name()), 0); 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); load_samples->Assign(new StringVal(loc->filename), 0);
} }
void SampleLogger::SegmentProfile(const char* /* name */, void SampleReporter::SegmentProfile(const char* /* name */,
const Location* /* loc */, const Location* /* loc */,
double dtime, int dmem) double dtime, int dmem)
{ {

View file

@ -73,10 +73,10 @@ protected:
}; };
class ProfileLogger : public SegmentStatsReporter { class ProfileReporter : public SegmentStatsReporter {
public: public:
ProfileLogger(BroFile* file, double interval); ProfileReporter(BroFile* file, double interval);
~ProfileLogger(); ~ProfileReporter();
void Log(); void Log();
BroFile* File() { return file; } BroFile* File() { return file; }
@ -92,10 +92,10 @@ private:
// Generates load_sample() events. // Generates load_sample() events.
class SampleLogger : public SegmentStatsReporter { class SampleReporter : public SegmentStatsReporter {
public: public:
SampleLogger(); SampleReporter();
~SampleLogger(); ~SampleReporter();
// These are called to report that a given function or location // These are called to report that a given function or location
// has been seen during the sampling. // has been seen during the sampling.
@ -110,9 +110,9 @@ protected:
}; };
extern ProfileLogger* profiling_logger; extern ProfileReporter* profiling_logger;
extern ProfileLogger* segment_logger; extern ProfileReporter* segment_logger;
extern SampleLogger* sample_logger; extern SampleReporter* sample_logger;
// Connection statistics. // Connection statistics.
extern int killed_by_inactivity; extern int killed_by_inactivity;

View file

@ -8,7 +8,7 @@
#include "Event.h" #include "Event.h"
#include "Frame.h" #include "Frame.h"
#include "File.h" #include "File.h"
#include "Logger.h" #include "Reporter.h"
#include "NetVar.h" #include "NetVar.h"
#include "Stmt.h" #include "Stmt.h"
#include "Scope.h" #include "Scope.h"
@ -2060,7 +2060,7 @@ int same_stmt(const Stmt* s1, const Stmt* s2)
return 1; return 1;
default: default:
bro_logger->Error("bad tag in same_stmt()"); reporter->Error("bad tag in same_stmt()");
} }
return 0; return 0;

View file

@ -10,7 +10,7 @@
#include "BroList.h" #include "BroList.h"
#include "Obj.h" #include "Obj.h"
#include "Expr.h" #include "Expr.h"
#include "Logger.h" #include "Reporter.h"
#include "StmtEnums.h" #include "StmtEnums.h"
@ -63,7 +63,7 @@ public:
if ( breakpoint_count ) if ( breakpoint_count )
--breakpoint_count; --breakpoint_count;
else else
bro_logger->InternalError("breakpoint count decremented below 0"); reporter->InternalError("breakpoint count decremented below 0");
} }
virtual unsigned int BPCount() const { return breakpoint_count; } virtual unsigned int BPCount() const { return breakpoint_count; }

View file

@ -1589,7 +1589,7 @@ BroFile* TCP_Analyzer::GetContentsFile(unsigned int direction) const
default: default:
break; break;
} }
bro_logger->InternalError("inconsistency in TCP_Analyzer::GetContentsFile"); reporter->InternalError("inconsistency in TCP_Analyzer::GetContentsFile");
return 0; return 0;
} }

View file

@ -208,7 +208,7 @@ int TCP_Endpoint::DataSent(double t, int seq, int len, int caplen,
if ( fwrite(data, 1, len, f) < unsigned(len) ) if ( fwrite(data, 1, len, f) < unsigned(len) )
// ### this should really generate an event // ### this should really generate an event
bro_logger->InternalError("contents write failed"); reporter->InternalError("contents write failed");
} }
return status; return status;

View file

@ -104,7 +104,7 @@ void TCP_Reassembler::SetContentsFile(BroFile* f)
{ {
if ( ! f->IsOpen() ) if ( ! f->IsOpen() )
{ {
bro_logger->Error("no such file \"%s\"", f->Name()); reporter->Error("no such file \"%s\"", f->Name());
return; return;
} }
@ -173,7 +173,7 @@ void TCP_Reassembler::Undelivered(int up_to_seq)
if ( seq_delta(up_to_seq, last_reassem_seq) <= 0 ) if ( seq_delta(up_to_seq, last_reassem_seq) <= 0 )
// This should never happen. // 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 && if ( last_reassem_seq == 1 &&
(endpoint->FIN_cnt > 0 || endpoint->RST_cnt > 0 || (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(); unsigned int len = b->Size();
if ( ! f->Write((const char*) b->block, len) ) if ( ! f->Write((const char*) b->block, len) )
// ### this should really generate an event // ### 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) 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))) ) if ( ! f->Write(fmt("\n<<gap %d>>\n", seq_delta(upper_seq, start_seq))) )
// ### this should really generate an event // ### 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) 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 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. return false; // Cannot be reached.
} }
bool TCP_Reassembler::DoUnserialize(UnserialInfo* info) 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. return false; // Cannot be reached.
} }

View file

@ -127,7 +127,7 @@ void PQ_TimerMgr::Add(Timer* timer)
// multiple already-added timers are added, they'll still // multiple already-added timers are added, they'll still
// execute in sorted order. // execute in sorted order.
if ( ! q->Add(timer) ) if ( ! q->Add(timer) )
bro_logger->InternalError("out of memory"); reporter->InternalError("out of memory");
++current_timers[timer->Type()]; ++current_timers[timer->Type()];
} }
@ -173,7 +173,7 @@ int PQ_TimerMgr::DoAdvance(double new_t, int max_expire)
void PQ_TimerMgr::Remove(Timer* timer) void PQ_TimerMgr::Remove(Timer* timer)
{ {
if ( ! q->Remove(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()]; --current_timers[timer->Type()];
delete timer; delete timer;
@ -183,7 +183,7 @@ CQ_TimerMgr::CQ_TimerMgr(const Tag& tag) : TimerMgr(tag)
{ {
cq = cq_init(60.0, 1.0); cq = cq_init(60.0, 1.0);
if ( ! cq ) if ( ! cq )
bro_logger->InternalError("could not initialize calendar queue"); reporter->InternalError("could not initialize calendar queue");
} }
CQ_TimerMgr::~CQ_TimerMgr() CQ_TimerMgr::~CQ_TimerMgr()
@ -208,7 +208,7 @@ void CQ_TimerMgr::Add(Timer* timer)
t = network_time; t = network_time;
if ( cq_enqueue(cq, t, timer) < 0 ) if ( cq_enqueue(cq, t, timer) < 0 )
bro_logger->InternalError("problem queueing timer"); reporter->InternalError("problem queueing timer");
++current_timers[timer->Type()]; ++current_timers[timer->Type()];
} }

View file

@ -119,7 +119,7 @@ Trigger::Trigger(Expr* arg_cond, Stmt* arg_body, Stmt* arg_timeout_stmts,
Trigger* parent = frame->GetTrigger(); Trigger* parent = frame->GetTrigger();
if ( ! parent ) 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); Unref(this);
return; return;
} }

View file

@ -9,7 +9,7 @@
#include "Expr.h" #include "Expr.h"
#include "Scope.h" #include "Scope.h"
#include "Serializer.h" #include "Serializer.h"
#include "Logger.h" #include "Reporter.h"
#include <string> #include <string>
#include <list> #include <list>
@ -316,7 +316,7 @@ int TypeList::AllMatch(const BroType* t, int is_init) const
void TypeList::Append(BroType* t) void TypeList::Append(BroType* t)
{ {
if ( pure_type && ! same_type(t, pure_type) ) if ( pure_type && ! same_type(t, pure_type) )
bro_logger->InternalError("pure type-list violation"); reporter->InternalError("pure type-list violation");
types.append(t); types.append(t);
} }
@ -933,7 +933,7 @@ void RecordType::Init(TypeList* arg_base)
if ( fields->Lookup(tdij->id) ) if ( fields->Lookup(tdij->id) )
{ {
bro_logger->Error("duplicate field", tdij->id); reporter->Error("duplicate field", tdij->id);
continue; continue;
} }
@ -1024,7 +1024,7 @@ const TypeDecl* RecordType::FieldDecl(int field) const
{ {
RecordField* rf = fields->NthEntry(field); RecordField* rf = fields->NthEntry(field);
if ( ! rf ) if ( ! rf )
bro_logger->InternalError("missing field in RecordType::FieldDecl"); reporter->InternalError("missing field in RecordType::FieldDecl");
BroType* bt = (*base->Types())[rf->base]; BroType* bt = (*base->Types())[rf->base];
RecordType* rbt = bt->AsRecordType(); 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 // location in the error message, rather than the one where the type was
// originally defined. // originally defined.
void EnumType::AddName(const string& module_name, const char* name, bool is_export) 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 */ /* implicit, auto-increment */
if ( counter < 0) 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(); SetError();
return; return;
} }
@ -1362,7 +1362,7 @@ void EnumType::AddName(const string& module_name, const char* name, bro_int_t va
/* explicit value specified */ /* explicit value specified */
if ( counter > 0 ) 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(); SetError();
return; return;
} }
@ -1395,7 +1395,7 @@ void EnumType::AddNameInternal(const string& module_name, const char* name, bro_
ID *id; ID *id;
if ( Lookup(val) ) 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(); SetError();
return; return;
} }
@ -1409,7 +1409,7 @@ void EnumType::AddNameInternal(const string& module_name, const char* name, bro_
} }
else 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(); SetError();
return; return;
} }
@ -1776,7 +1776,7 @@ int same_type(const BroType* t1, const BroType* t2, int is_init)
return same_type(t1, t2, is_init); return same_type(t1, t2, is_init);
case TYPE_UNION: case TYPE_UNION:
bro_logger->Error("union type in same_type()"); reporter->Error("union type in same_type()");
} }
return 0; return 0;
} }
@ -1821,7 +1821,7 @@ const BroType* flatten_type(const BroType* t)
const type_list* types = tl->Types(); const type_list* types = tl->Types();
if ( types->length() == 0 ) 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]; const BroType* ft = (*types)[0];
if ( types->length() == 1 || tl->AllMatch(ft, 0) ) if ( types->length() == 1 || tl->AllMatch(ft, 0) )
@ -1870,7 +1870,7 @@ int is_assignable(BroType* t)
return 0; return 0;
case TYPE_UNION: case TYPE_UNION:
bro_logger->Error("union type in is_assignable()"); reporter->Error("union type in is_assignable()");
} }
return 0; return 0;
@ -1899,7 +1899,7 @@ TypeTag max_type(TypeTag t1, TypeTag t2)
} }
else else
{ {
bro_logger->InternalError("non-arithmetic tags in max_type()"); reporter->InternalError("non-arithmetic tags in max_type()");
return TYPE_ERROR; return TYPE_ERROR;
} }
} }
@ -1994,7 +1994,7 @@ BroType* merge_types(const BroType* t1, const BroType* t2)
return new TableType(tl3, y3); return new TableType(tl3, y3);
else else
{ {
bro_logger->InternalError("bad tag in merge_types"); reporter->InternalError("bad tag in merge_types");
return 0; return 0;
} }
} }
@ -2112,11 +2112,11 @@ BroType* merge_types(const BroType* t1, const BroType* t2)
return new FileType(merge_types(t1->YieldType(), t2->YieldType())); return new FileType(merge_types(t1->YieldType(), t2->YieldType()));
case TYPE_UNION: case TYPE_UNION:
bro_logger->InternalError("union type in merge_types()"); reporter->InternalError("union type in merge_types()");
return 0; return 0;
default: default:
bro_logger->InternalError("bad type in merge_types()"); reporter->InternalError("bad type in merge_types()");
return 0; return 0;
} }
} }
@ -2128,7 +2128,7 @@ BroType* merge_type_list(ListExpr* elements)
if ( tl->length() < 1 ) 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; return 0;
} }
@ -2145,7 +2145,7 @@ BroType* merge_type_list(ListExpr* elements)
} }
if ( ! t ) if ( ! t )
bro_logger->Error("inconsistent types in list"); reporter->Error("inconsistent types in list");
return t; return t;
} }

View file

@ -9,7 +9,7 @@
#include "Net.h" #include "Net.h"
#include "NetVar.h" #include "NetVar.h"
#include "UDP.h" #include "UDP.h"
#include "Logger.h" #include "Reporter.h"
UDP_Analyzer::UDP_Analyzer(Connection* conn) UDP_Analyzer::UDP_Analyzer(Connection* conn)
: TransportLayerAnalyzer(AnalyzerTag::UDP, 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; request_len += ulen;
#ifdef DEBUG #ifdef DEBUG
if ( request_len < 0 ) if ( request_len < 0 )
bro_logger->Warning("wrapping around for UDP request length"); reporter->Warning("wrapping around for UDP request length");
#endif #endif
} }
@ -154,7 +154,7 @@ void UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
reply_len += ulen; reply_len += ulen;
#ifdef DEBUG #ifdef DEBUG
if ( reply_len < 0 ) if ( reply_len < 0 )
bro_logger->Warning("wrapping around for UDP reply length"); reporter->Warning("wrapping around for UDP reply length");
#endif #endif
} }

View file

@ -26,7 +26,7 @@
#include "RemoteSerializer.h" #include "RemoteSerializer.h"
#include "PrefixTable.h" #include "PrefixTable.h"
#include "Conn.h" #include "Conn.h"
#include "Logger.h" #include "Reporter.h"
Val::Val(Func* f) Val::Val(Func* f)
@ -253,7 +253,7 @@ bool Val::DoSerialize(SerialInfo* info) const
return false; return false;
} }
bro_logger->InternalError("should not be reached"); reporter->InternalError("should not be reached");
return false; return false;
} }
@ -410,7 +410,7 @@ bool Val::DoUnserialize(UnserialInfo* info)
return false; return false;
} }
bro_logger->InternalError("should not be reached"); reporter->InternalError("should not be reached");
return false; return false;
} }
@ -616,7 +616,7 @@ void Val::ValDescribe(ODesc* d) const
default: default:
// Don't call Internal(), that'll loop! // 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 #ifdef BROv6
Init(dotted_to_addr6(text)); Init(dotted_to_addr6(text));
#else #else
bro_logger->Error("bro wasn't compiled with IPv6 support"); reporter->Error("bro wasn't compiled with IPv6 support");
Init(uint32(0)); Init(uint32(0));
#endif #endif
} }
@ -1085,13 +1085,13 @@ static uint32 parse_dotted(const char* text, int& dots)
} }
else else
bro_logger->InternalError("scanf failed in parse_dotted()"); reporter->InternalError("scanf failed in parse_dotted()");
for ( int i = 0; i <= dots; ++i ) for ( int i = 0; i <= dots; ++i )
{ {
if ( addr[i] < 0 || addr[i] > 255 ) if ( addr[i] < 0 || addr[i] > 255 )
{ {
bro_logger->Error("bad dotted address", text); reporter->Error("bad dotted address", text);
break; break;
} }
} }
@ -1105,7 +1105,7 @@ NetVal::NetVal(const char* text) : AddrVal(TYPE_NET)
uint32 a = parse_dotted(text, dots); uint32 a = parse_dotted(text, dots);
if ( addr_to_net(a) != a ) if ( addr_to_net(a) != a )
bro_logger->Error("bad net address", text); reporter->Error("bad net address", text);
Init(uint32(htonl(a))); Init(uint32(htonl(a)));
} }
@ -1998,7 +1998,7 @@ int TableVal::ExpandAndInit(Val* index, Val* new_val)
if ( iv->BaseTag() != TYPE_ANY ) if ( iv->BaseTag() != TYPE_ANY )
{ {
if ( table_type->Indices()->Types()->length() != 1 ) 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 ) for ( int i = 0; i < iv->Length(); ++i )
if ( ! ExpandAndInit(iv->Index(i), new_val ? new_val->Ref() : 0) ) 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; Val* va = v ? (v->Value() ? v->Value() : this->Ref()) : 0;
if ( subnets && ! subnets->Remove(index) ) if ( subnets && ! subnets->Remove(index) )
bro_logger->InternalError( "index not in prefix table" ); reporter->InternalError( "index not in prefix table" );
if ( LoggingAccess() ) if ( LoggingAccess() )
{ {
@ -2235,7 +2235,7 @@ Val* TableVal::Delete(const HashKey* k)
{ {
Val* index = table_hash->RecoverVals(k); Val* index = table_hash->RecoverVals(k);
if ( ! subnets->Remove(index) ) if ( ! subnets->Remove(index) )
bro_logger->InternalError( "index not in prefix table" ); reporter->InternalError( "index not in prefix table" );
Unref(index); Unref(index);
} }
@ -2316,7 +2316,7 @@ void TableVal::Describe(ODesc* d) const
TableEntryVal* v = tbl->NextEntry(k, c); TableEntryVal* v = tbl->NextEntry(k, c);
if ( ! v ) 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); ListVal* vl = table_hash->RecoverVals(k);
int dim = vl->Length(); int dim = vl->Length();
@ -2367,7 +2367,7 @@ void TableVal::Describe(ODesc* d) const
} }
if ( tbl->NextEntry(c) ) 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() ) if ( d->IsPortable() || d->IsReadable() )
{ {
@ -2489,7 +2489,7 @@ void TableVal::DoExpire(double t)
{ {
Val* index = RecoverIndex(k); Val* index = RecoverIndex(k);
if ( ! subnets->Remove(index) ) if ( ! subnets->Remove(index) )
bro_logger->InternalError( "index not in prefix table" ); reporter->InternalError( "index not in prefix table" );
Unref(index); Unref(index);
} }
@ -2610,7 +2610,7 @@ bool TableVal::DoSerialize(SerialInfo* info) const
state = (State*) info->cont.RestoreState(); state = (State*) info->cont.RestoreState();
} }
else else
bro_logger->InternalError("unknown continuation state"); reporter->InternalError("unknown continuation state");
HashKey* k; HashKey* k;
int count = 0; int count = 0;
@ -2695,7 +2695,7 @@ bool TableVal::DoSerialize(SerialInfo* info) const
{ {
info->cont.SaveState(state); info->cont.SaveState(state);
info->cont.Suspend(); info->cont.Suspend();
bro_logger->Message("TableVals serialization suspended right in the middle."); reporter->Message("TableVals serialization suspended right in the middle.");
return true; return true;
} }
} }
@ -3489,7 +3489,7 @@ Val* check_and_promote(Val* v, const BroType* t, int is_init)
break; break;
default: default:
bro_logger->InternalError("bad internal type in check_and_promote()"); reporter->InternalError("bad internal type in check_and_promote()");
Unref(v); Unref(v);
return 0; 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 */) int same_val(const Val* /* v1 */, const Val* /* v2 */)
{ {
bro_logger->InternalError("same_val not implemented"); reporter->InternalError("same_val not implemented");
return 0; return 0;
} }
@ -3551,7 +3551,7 @@ int same_atomic_val(const Val* v1, const Val* v2)
return subnet_eq(v1->AsSubNet(), v2->AsSubNet()); return subnet_eq(v1->AsSubNet(), v2->AsSubNet());
default: default:
bro_logger->InternalError("same_atomic_val called for non-atomic value"); reporter->InternalError("same_atomic_val called for non-atomic value");
return 0; return 0;
} }

View file

@ -404,7 +404,7 @@ Val* internal_val(const char* name)
{ {
ID* id = lookup_ID(name, GLOBAL_MODULE_NAME); ID* id = lookup_ID(name, GLOBAL_MODULE_NAME);
if ( ! id ) if ( ! id )
bro_logger->InternalError("internal variable %s missing", name); reporter->InternalError("internal variable %s missing", name);
return id->ID_Val(); return id->ID_Val();
} }
@ -413,10 +413,10 @@ Val* internal_const_val(const char* name)
{ {
ID* id = lookup_ID(name, GLOBAL_MODULE_NAME); ID* id = lookup_ID(name, GLOBAL_MODULE_NAME);
if ( ! id ) if ( ! id )
bro_logger->InternalError("internal variable %s missing", name); reporter->InternalError("internal variable %s missing", name);
if ( ! id->IsConst() ) 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(); return id->ID_Val();
} }
@ -477,7 +477,7 @@ ListVal* internal_list_val(const char* name)
} }
else else
bro_logger->InternalError("internal variable %s is not a list", name); reporter->InternalError("internal variable %s is not a list", name);
} }
return 0; return 0;
@ -487,7 +487,7 @@ BroType* internal_type(const char* name)
{ {
ID* id = lookup_ID(name, GLOBAL_MODULE_NAME); ID* id = lookup_ID(name, GLOBAL_MODULE_NAME);
if ( ! id ) if ( ! id )
bro_logger->InternalError("internal type %s missing", name); reporter->InternalError("internal type %s missing", name);
return id->Type(); return id->Type();
} }

View file

@ -80,7 +80,7 @@ int X509_Cert::init()
lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_hash_dir()); lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_hash_dir());
if ( ! lookup ) if ( ! lookup )
{ {
bro_logger->Error("X509_Cert::init(): initing lookup failed\n"); reporter->Error("X509_Cert::init(): initing lookup failed\n");
flag = 1; flag = 1;
} }
@ -89,7 +89,7 @@ int X509_Cert::init()
X509_FILETYPE_PEM); X509_FILETYPE_PEM);
if ( ! i ) 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; ret = 0;
} }
} }
@ -108,7 +108,7 @@ int X509_Cert::init()
if ( X509_load_crl_file(lookup, (const char*) rString->Bytes(), if ( X509_load_crl_file(lookup, (const char*) rString->Bytes(),
X509_FILETYPE_PEM) != 1 ) 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; ret = 1;
} }

View file

@ -10,7 +10,7 @@
#include <cmath> #include <cmath>
#include <sys/stat.h> #include <sys/stat.h>
#include "Logger.h" #include "Reporter.h"
using namespace std; using namespace std;
@ -792,7 +792,7 @@ EnumVal* map_conn_type(TransportProto tp)
break; break;
default: default:
bro_logger->InternalError("bad connection type in map_conn_type()"); reporter->InternalError("bad connection type in map_conn_type()");
} }
// Cannot be reached; // Cannot be reached;
@ -839,7 +839,7 @@ function sqrt%(x: double%): double
%{ %{
if ( x < 0 ) if ( x < 0 )
{ {
bro_logger->Error("negative sqrt argument"); reporter->Error("negative sqrt argument");
return new Val(-1.0, TYPE_DOUBLE); return new Val(-1.0, TYPE_DOUBLE);
} }
@ -1215,7 +1215,7 @@ function get_orig_seq%(cid: conn_id%): count
TYPE_COUNT); TYPE_COUNT);
else else
{ {
bro_logger->Error("connection does not have TCP analyzer"); reporter->Error("connection does not have TCP analyzer");
return new Val(0, TYPE_COUNT); return new Val(0, TYPE_COUNT);
} }
%} %}
@ -1235,7 +1235,7 @@ function get_resp_seq%(cid: conn_id%): count
TYPE_COUNT); TYPE_COUNT);
else else
{ {
bro_logger->Error("connection does not have TCP analyzer"); reporter->Error("connection does not have TCP analyzer");
return new Val(0, TYPE_COUNT); 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 ) if ( ha->GetTag() == AnalyzerTag::HTTP )
static_cast<HTTP_Analyzer*>(ha)->SkipEntityData(is_orig); static_cast<HTTP_Analyzer*>(ha)->SkipEntityData(is_orig);
else else
bro_logger->Error("non-HTTP analyzer associated with connection record"); reporter->Error("non-HTTP analyzer associated with connection record");
} }
else 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 else
bro_logger->Error("no analyzer associated with connection record"); reporter->Error("no analyzer associated with connection record");
return 0; return 0;
%} %}
@ -1480,7 +1480,7 @@ function resource_usage%(%): bro_resources
struct rusage r; struct rusage r;
if ( getrusage(RUSAGE_SELF, &r) < 0 ) 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; double elapsed_time = current_time() - bro_start_time;
@ -1839,7 +1839,7 @@ function decode_base64%(s: string%): string
return new StringVal(t); return new StringVal(t);
else else
{ {
bro_logger->Error("error in decoding string %s", @ARG@[0]); reporter->Error("error in decoding string %s", @ARG@[0]);
return new StringVal(""); return new StringVal("");
} }
%} %}
@ -1971,7 +1971,7 @@ function precompile_pcap_filter%(id: PcapFilterID, s: string%): bool
if ( ! pkt_srcs[i]->PrecompileFilter(id->ForceAsInt(), if ( ! pkt_srcs[i]->PrecompileFilter(id->ForceAsInt(),
s->CheckString()) ) s->CheckString()) )
{ {
bro_logger->Error( "precompile_pcap_filter: %s", reporter->Error( "precompile_pcap_filter: %s",
pkt_srcs[i]->ErrorMsg() ); pkt_srcs[i]->ErrorMsg() );
success = false; success = false;
} }
@ -1986,7 +1986,7 @@ function install_pcap_filter%(id: PcapFilterID%): bool
ID* user_filter = global_scope()->Lookup("cmd_line_bpf_filter"); ID* user_filter = global_scope()->Lookup("cmd_line_bpf_filter");
if ( ! user_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() ) if ( user_filter->ID_Val()->AsStringVal()->Len() )
// Don't allow the script-level to change the filter when // 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()); ID* i = global_scope()->Lookup(id->CheckString());
if ( ! i ) 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); return new Val(0, TYPE_BOOL);
} }
@ -2233,12 +2233,12 @@ function get_event_peer%(%) : event_peer
} }
if ( ! remote_serializer ) if ( ! remote_serializer )
bro_logger->InternalError("remote_serializer not initialized"); reporter->InternalError("remote_serializer not initialized");
Val* v = remote_serializer->GetPeerVal(src); Val* v = remote_serializer->GetPeerVal(src);
if ( ! v ) 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(); RecordVal* p = mgr.GetLocalPeerVal();
Ref(p); Ref(p);
return p; return p;
@ -2875,7 +2875,7 @@ function lookup_addr%(host: addr%) : string
static bool warned = false; static bool warned = false;
if ( ! warned ) if ( ! warned )
{ {
bro_logger->Warning("lookup_addr() only supports IPv4 addresses currently"); reporter->Warning("lookup_addr() only supports IPv4 addresses currently");
warned = true; warned = true;
} }
@ -2946,14 +2946,14 @@ function disable_analyzer%(cid: conn_id, aid: count%) : bool
Connection* c = sessions->FindConnection(cid); Connection* c = sessions->FindConnection(cid);
if ( ! c ) if ( ! c )
{ {
bro_logger->Error("cannot find connection"); reporter->Error("cannot find connection");
return new Val(0, TYPE_BOOL); return new Val(0, TYPE_BOOL);
} }
Analyzer* a = c->FindAnalyzer(aid); Analyzer* a = c->FindAnalyzer(aid);
if ( ! a ) 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); return new Val(0, TYPE_BOOL);
} }
@ -3233,13 +3233,13 @@ function identify_data%(data: string, return_mime: bool%): string
if ( ! *magic ) 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(""); return new StringVal("");
} }
if ( magic_load(*magic, 0) < 0 ) 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_close(*magic);
*magic = 0; *magic = 0;
return new StringVal(""); return new StringVal("");

View file

@ -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, "\tif ( %s->length() != %d )\n", arg_list_name, argc);
fprintf(fp_func_def, "\t\t{\n"); fprintf(fp_func_def, "\t\t{\n");
fprintf(fp_func_def, 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); decl.bro_fullname.c_str(), argc);
fprintf(fp_func_def, "\t\treturn 0;\n"); fprintf(fp_func_def, "\t\treturn 0;\n");
fprintf(fp_func_def, "\t\t}\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, "\tif ( %s->length() < %d )\n", arg_list_name, argc);
fprintf(fp_func_def, "\t\t{\n"); fprintf(fp_func_def, "\t\t{\n");
fprintf(fp_func_def, 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); decl.bro_fullname.c_str(), argc);
fprintf(fp_func_def, "\t\treturn 0;\n"); fprintf(fp_func_def, "\t\treturn 0;\n");
fprintf(fp_func_def, "\t\t}\n"); fprintf(fp_func_def, "\t\t}\n");

View file

@ -479,7 +479,7 @@ event rotate_size%(f: file%);
event netflow_v5_header%(h: nf_v5_header%); event netflow_v5_header%(h: nf_v5_header%);
event netflow_v5_record%(r: nf_v5_record%); event netflow_v5_record%(r: nf_v5_record%);
# Different types of log messages. # Different types of reporter messages.
event log_message%(t: time, msg: string, location: string%); event reporter_message%(t: time, msg: string, location: string%);
event log_warning%(t: time, msg: string, location: string%); event reporter_warning%(t: time, msg: string, location: string%);
event log_error%(t: time, msg: string, location: string%); event reporter_error%(t: time, msg: string, location: string%);

View file

@ -62,30 +62,6 @@ function Log::__flush%(id: Log::ID%): bool
return new Val(result, TYPE_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. # Options for the ASCII writer.
module LogAscii; module LogAscii;

View file

@ -30,7 +30,7 @@ extern "C" void OPENSSL_add_all_algorithms_conf(void);
#include "Scope.h" #include "Scope.h"
#include "Event.h" #include "Event.h"
#include "File.h" #include "File.h"
#include "Logger.h" #include "Reporter.h"
#include "LogMgr.h" #include "LogMgr.h"
#include "Net.h" #include "Net.h"
#include "NetVar.h" #include "NetVar.h"
@ -84,9 +84,9 @@ FileSerializer* state_serializer = 0;
RemoteSerializer* remote_serializer = 0; RemoteSerializer* remote_serializer = 0;
EventPlayer* event_player = 0; EventPlayer* event_player = 0;
EventRegistry* event_registry = 0; EventRegistry* event_registry = 0;
ProfileLogger* profiling_logger = 0; ProfileReporter* profiling_logger = 0;
ProfileLogger* segment_logger = 0; ProfileReporter* segment_logger = 0;
SampleLogger* sample_logger = 0; SampleReporter* sample_logger = 0;
int signal_val = 0; int signal_val = 0;
DPM* dpm = 0; DPM* dpm = 0;
int optimize = 0; int optimize = 0;
@ -292,7 +292,7 @@ void terminate_bro()
delete remote_serializer; delete remote_serializer;
delete dpm; delete dpm;
delete log_mgr; delete log_mgr;
delete bro_logger; delete reporter;
} }
void termination_signal() void termination_signal()
@ -300,7 +300,7 @@ void termination_signal()
set_processing_status("TERMINATING", "termination_signal"); set_processing_status("TERMINATING", "termination_signal");
Val sval(signal_val, TYPE_COUNT); Val sval(signal_val, TYPE_COUNT);
bro_logger->Message("received termination signal"); reporter->Message("received termination signal");
net_get_final_stats(); net_get_final_stats();
done_with_network(); done_with_network();
net_delete(); net_delete();
@ -652,7 +652,7 @@ int main(int argc, char** argv)
set_processing_status("INITIALIZING", "main"); set_processing_status("INITIALIZING", "main");
bro_start_time = current_time(true); bro_start_time = current_time(true);
bro_logger = new Logger(); reporter = new Reporter();
init_random_seed(seed, seed_load_file, seed_save_file); init_random_seed(seed, seed_load_file, seed_save_file);
// DEBUG_MSG("HMAC key: %s\n", md5_digest_print(shared_hmac_md5_key)); // 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; return 0;
} }
if ( bro_logger->Errors() > 0 ) if ( reporter->Errors() > 0 )
{ {
delete dns_mgr; delete dns_mgr;
exit(1); exit(1);
@ -766,7 +766,7 @@ int main(int argc, char** argv)
ID* id = global_scope()->Lookup("cmd_line_bpf_filter"); ID* id = global_scope()->Lookup("cmd_line_bpf_filter");
if ( ! id ) 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)); id->SetVal(new StringVal(user_pcap_filter));
} }
@ -848,7 +848,7 @@ int main(int argc, char** argv)
dns_mgr->Resolve(); dns_mgr->Resolve();
if ( ! dns_mgr->Save() ) if ( ! dns_mgr->Save() )
bro_logger->FatalError("can't update DNS cache"); reporter->FatalError("can't update DNS cache");
mgr.Drain(); mgr.Drain();
delete dns_mgr; delete dns_mgr;
@ -890,7 +890,7 @@ int main(int argc, char** argv)
ID* id = global_scope()->Lookup(id_name); ID* id = global_scope()->Lookup(id_name);
if ( ! id ) if ( ! id )
bro_logger->FatalError("No such ID: %s\n", id_name); reporter->FatalError("No such ID: %s\n", id_name);
ODesc desc; ODesc desc;
desc.SetQuotes(true); desc.SetQuotes(true);
@ -911,7 +911,7 @@ int main(int argc, char** argv)
if ( profiling_interval > 0 ) if ( profiling_interval > 0 )
{ {
profiling_logger = new ProfileLogger(profiling_file->AsFile(), profiling_logger = new ProfileReporter(profiling_file->AsFile(),
profiling_interval); profiling_interval);
if ( segment_profiling ) if ( segment_profiling )
@ -932,9 +932,9 @@ int main(int argc, char** argv)
if ( dead_handlers->length() > 0 && check_for_unused_event_handlers ) 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 ) 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; delete dead_handlers;
@ -944,9 +944,9 @@ int main(int argc, char** argv)
if ( alive_handlers->length() > 0 && dump_used_event_handlers ) 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 ) for ( int i = 0; i < alive_handlers->length(); ++i )
bro_logger->Message((*alive_handlers)[i]); reporter->Message((*alive_handlers)[i]);
} }
delete alive_handlers; delete alive_handlers;
@ -968,7 +968,7 @@ int main(int argc, char** argv)
dpm->PostScriptInit(); dpm->PostScriptInit();
bro_logger->ReportViaEvents(true); reporter->ReportViaEvents(true);
mgr.Drain(); mgr.Drain();

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