Fix some minor issues.

From Daniel, thanks!
This commit is contained in:
Robin Sommer 2017-02-23 17:18:43 -08:00
parent 524002eefa
commit 5cf7803e68
14 changed files with 36 additions and 38 deletions

@ -1 +1 @@
Subproject commit a0990e61ad4a3705bda4cc5a20059af2d1bda4c3 Subproject commit 0f1ecfa97236635fb93e013404e6b30d6c506ddd

@ -1 +1 @@
Subproject commit 7660b5f4c5be40aa5f3a7c8746fdcf68331f9b93 Subproject commit b1e75f6a212250b1730a438f27fc778618b67ec3

@ -1 +1 @@
Subproject commit 765eab50f7796fdb3c308fe9232cd7891f098c67 Subproject commit ed52e3414b31b05ec9abed627b4153c8e2243441

@ -1 +1 @@
Subproject commit f6d451520eaaaae97aab6df2bb4e0aecb6b63e66 Subproject commit 73dbc79ac24cdfef07d8574a4da5d43056ba5fa5

@ -1 +1 @@
Subproject commit 68a36ed81480ba935268bcaf7b6f2249d23436da Subproject commit 23def70c44128d19138029615dd154359286e111

@ -1 +1 @@
Subproject commit 32e582514ae044befa8e0511083bf11a51408a1d Subproject commit 2fb0e089b37cc62b4616c8d4309ee80fb7fc6a27

@ -1 +1 @@
Subproject commit 0a2f0215270e6ceaf9c1312f705b95d2cce1b530 Subproject commit 2322840bcdbd618ae7bd24e22d874fb30ab89bbb

View file

@ -776,7 +776,6 @@ static broker::util::optional<broker::data> threading_val_to_data_internal(TypeT
auto s = broker::address(reinterpret_cast<const uint32_t*>(&tmp), auto s = broker::address(reinterpret_cast<const uint32_t*>(&tmp),
broker::address::family::ipv6, broker::address::family::ipv6,
broker::address::byte_order::network); broker::address::byte_order::network);
fprintf(stderr, "%d\n", val.subnet_val.length);
return {broker::subnet(s, length)}; return {broker::subnet(s, length)};
} }
@ -863,7 +862,7 @@ struct threading_val_converter {
using result_type = bool; using result_type = bool;
TypeTag type; TypeTag type;
threading::Value::_val& val; threading::Value::_val& val;
result_type operator()(bool a) result_type operator()(bool a)
{ {
@ -1053,9 +1052,9 @@ struct threading_val_converter {
if ( type == TYPE_VECTOR ) if ( type == TYPE_VECTOR )
{ {
val.vector_val.size = a.size(); val.vector_val.size = a.size();
val.vector_val.vals = new threading::Value* [val.set_val.size]; val.vector_val.vals = new threading::Value* [val.vector_val.size];
auto p = val.set_val.vals; auto p = val.vector_val.vals;
for ( auto& i : a ) for ( auto& i : a )
*p++ = bro_broker::data_to_threading_val(move(i)); *p++ = bro_broker::data_to_threading_val(move(i));
@ -1079,8 +1078,8 @@ threading::Value* bro_broker::data_to_threading_val(broker::data d)
if ( ! r ) if ( ! r )
return nullptr; return nullptr;
auto type = broker::get<uint64_t>(*r->get(0));; auto type = broker::get<uint64_t>(*r->get(0));
auto present = broker::get<bool>(*r->get(1));; auto present = broker::get<bool>(*r->get(1));
auto data = *r->get(2); auto data = *r->get(2);
if ( ! (type && present) ) if ( ! (type && present) )

View file

@ -70,7 +70,7 @@ broker::util::optional<broker::data> threading_val_to_data(const threading::Valu
/** /**
* Convert a Bro threading::Field to a Broker data value. * Convert a Bro threading::Field to a Broker data value.
* @param v a Bro threading::Field. * @param f a Bro threading::Field.
* @return a Broker data value if the Bro threading::Field could be converted to one. * @return a Broker data value if the Bro threading::Field could be converted to one.
*/ */
broker::data threading_field_to_data(const threading::Field* f); broker::data threading_field_to_data(const threading::Field* f);

View file

@ -214,9 +214,10 @@ bool bro_broker::Manager::Event(std::string topic, broker::message msg, int flag
return true; return true;
} }
bool bro_broker::Manager::CreateLog(EnumVal* stream, EnumVal* writer, const logging::WriterBackend::WriterInfo& info, bool bro_broker::Manager::CreateLog(EnumVal* stream, EnumVal* writer,
int num_fields, const threading::Field* const * fields, int flags, const logging::WriterBackend::WriterInfo& info,
const string& peer) int num_fields, const threading::Field* const * fields,
int flags, const string& peer)
{ {
if ( ! Enabled() ) if ( ! Enabled() )
return false; return false;
@ -1003,7 +1004,7 @@ bool bro_broker::Manager::ProcessCreateLog(broker::message msg)
if ( ! broker::get<broker::enum_value>(msg[idx]) ) if ( ! broker::get<broker::enum_value>(msg[idx]) )
{ {
reporter->Warning("got remote log create w/o stream id: %d", reporter->Warning("got remote log create w/o stream id: %d",
static_cast<int>(broker::which(msg[idx]))); static_cast<int>(broker::which(msg[idx])));
return false; return false;
} }
@ -1023,7 +1024,7 @@ bool bro_broker::Manager::ProcessCreateLog(broker::message msg)
if ( ! broker::get<broker::enum_value>(msg[idx]) ) if ( ! broker::get<broker::enum_value>(msg[idx]) )
{ {
reporter->Warning("got remote log w/o writer id: %d", reporter->Warning("got remote log create w/o writer id: %d",
static_cast<int>(broker::which(msg[idx]))); static_cast<int>(broker::which(msg[idx])));
return false; return false;
} }

View file

@ -169,20 +169,20 @@ public:
const threading::Value* const * vals, int flags); const threading::Value* const * vals, int flags);
/** /**
* Send a message to create a log stream to any interested peers. * Send a message to create a log stream to any interested peers.
* The log stream may or may not already exist on the receiving side. * The log stream may or may not already exist on the receiving side.
* The topic name used is implicitly "bro/log/<stream-name>". * The topic name used is implicitly "bro/log/<stream-name>".
* @param stream the stream to which the log entry belongs. * @param stream the stream to which the log entry belongs.
* @param writer the writer to use for outputting this log entry. * @param writer the writer to use for outputting this log entry.
* @param info backend initialization information for the writer. * @param info backend initialization information for the writer.
* @param num_fields the number of fields the log has. * @param num_fields the number of fields the log has.
* @param fields the log's fields of size num_fields. * @param fields the log's fields, of size num_fields.
* @param flags tune the behavior of how the message is send. * @param flags tune the behavior of how the message is send.
* See the Broker::SendFlags record type. * See the Broker::SendFlags record type.
* @param peer If given, send the message only to this peer. * @param peer If given, send the message only to this peer.
* @return true if the message is sent successfully. * @return true if the message is sent successfully.
*/ */
bool CreateLog(EnumVal* id, EnumVal* writer, const logging::WriterBackend::WriterInfo& info, bool CreateLog(EnumVal* stream, EnumVal* writer, const logging::WriterBackend::WriterInfo& info,
int num_fields, const threading::Field* const * fields, int flags, const string& peer = ""); int num_fields, const threading::Field* const * fields, int flags, const string& peer = "");
/** /**

View file

@ -133,9 +133,9 @@ public:
* Create a new log writer frontend. This is exposed so that the * Create a new log writer frontend. This is exposed so that the
* communication system can recreate remote log streams locally. * communication system can recreate remote log streams locally.
* *
* @param stream The enum value corresponding the log stream. * @param id The enum value corresponding to the log stream.
* *
* @param writer The enum value corresponding the desired log writer. * @param writer The enum value corresponding to the desired log writer.
* *
* @param info A fully initialized object defining the * @param info A fully initialized object defining the
* characteristics of the backend writer instance. The method takes * characteristics of the backend writer instance. The method takes
@ -143,8 +143,8 @@ public:
* *
* @param num_fields The number of log fields to write. * @param num_fields The number of log fields to write.
* *
* @param vals An arry of log fields to write, of size num_fields. * @param vals An array of log fields to write, of size num_fields.
* The method takes ownership of the arry. * The method takes ownership of the array.
* *
* @return Returns true if the writer was successfully created. * @return Returns true if the writer was successfully created.
*/ */
@ -154,18 +154,18 @@ public:
/** /**
* Writes out log entries that have already passed through all * Writes out log entries that have already passed through all
* filters (and have raised any events). This is meant called for logs * filters (and have raised any events). This is meant called for logs
* received alrready processed from remote. * received already processed from remote.
* *
* @param stream The enum value corresponding the log stream. * @param stream The enum value corresponding to the log stream.
* *
* @param writer The enum value corresponding the desired log writer. * @param writer The enum value corresponding to the desired log writer.
* *
* @param path The path of the target log stream to write to. * @param path The path of the target log stream to write to.
* *
* @param num_fields The number of log values to write. * @param num_fields The number of log values to write.
* *
* @param vals An arry of log values to write, of size num_fields. * @param vals An array of log values to write, of size num_fields.
* The method takes ownership of the arry. * The method takes ownership of the array.
*/ */
bool WriteFromRemote(EnumVal* stream, EnumVal* writer, string path, bool WriteFromRemote(EnumVal* stream, EnumVal* writer, string path,
int num_fields, threading::Value** vals); int num_fields, threading::Value** vals);

View file

@ -130,11 +130,11 @@ broker::data WriterBackend::WriterInfo::ToBroker() const
auto t = broker::table(); auto t = broker::table();
for ( config_map::const_iterator i = config.begin(); i != config.end(); ++i ) for ( config_map::const_iterator i = config.begin(); i != config.end(); ++i )
{ {
auto key = std::string(i->first); auto key = std::string(i->first);
auto value = std::string(i->second); auto value = std::string(i->second);
t.insert(std::make_pair(key, value)); t.insert(std::make_pair(key, value));
} }
auto bconfig = broker::record::field(move(t)); auto bconfig = broker::record::field(move(t));

View file

@ -34,8 +34,6 @@ public:
* *
* info: The meta information struct for the writer. * info: The meta information struct for the writer.
* *
* writer_name: A descriptive name for the writer's type.
*
* local: If true, the writer will instantiate a local backend. * local: If true, the writer will instantiate a local backend.
* *
* remote: If true, the writer will forward logs to remote * remote: If true, the writer will forward logs to remote
@ -46,7 +44,7 @@ public:
* *
* Frontends must only be instantiated by the main thread. * Frontends must only be instantiated by the main thread.
*/ */
WriterFrontend(const WriterBackend::WriterInfo& info, EnumVal* stream, EnumVal* writer, bool local, bool remote, int arg_remote_flags); WriterFrontend(const WriterBackend::WriterInfo& info, EnumVal* stream, EnumVal* writer, bool local, bool remote, int remote_flags);
/** /**
* Destructor. * Destructor.