Add script wrapper functions for broker BIFs

Also renamed the "print" function to "send_print" and the "event"
function to "send_event" because Bro shows a syntax error when a
Bro script function is named "event" or "print".
This commit is contained in:
Daniel Thayer 2016-04-26 16:24:10 -05:00
parent e9a87566ef
commit f44bb4d9b8
17 changed files with 747 additions and 407 deletions

View file

@ -1,5 +1,14 @@
##! Various data structure definitions for use with Bro's communication system.
module Log;
export {
type Log::ID: enum {
## Dummy place-holder.
UNKNOWN
};
}
module Broker;
export {
@ -52,4 +61,312 @@ export {
key: Broker::Data;
val: Broker::Data;
};
## Enable use of communication.
##
## flags: used to tune the local Broker endpoint behavior.
##
## Returns: true if communication is successfully initialized.
global enable: function(flags: EndpointFlags &default = EndpointFlags()): bool;
## Changes endpoint flags originally supplied to :bro:see:`Broker::enable`.
##
## flags: the new endpoint behavior flags to use.
##
## Returns: true if flags were changed.
global set_endpoint_flags: function(flags: EndpointFlags &default = EndpointFlags()): bool;
## Allow sending messages to peers if associated with the given topic.
## This has no effect if auto publication behavior is enabled via the flags
## supplied to :bro:see:`Broker::enable` or :bro:see:`Broker::set_endpoint_flags`.
##
## topic: a topic to allow messages to be published under.
##
## Returns: true if successful.
global publish_topic: function(topic: string): bool;
## Disallow sending messages to peers if associated with the given topic.
## This has no effect if auto publication behavior is enabled via the flags
## supplied to :bro:see:`Broker::enable` or :bro:see:`Broker::set_endpoint_flags`.
##
## topic: a topic to disallow messages to be published under.
##
## Returns: true if successful.
global unpublish_topic: function(topic: string): bool;
## Listen for remote connections.
##
## p: the TCP port to listen on.
##
## a: an address string on which to accept connections, e.g.
## "127.0.0.1". An empty string refers to @p INADDR_ANY.
##
## reuse: equivalent to behavior of SO_REUSEADDR.
##
## Returns: true if the local endpoint is now listening for connections.
##
## .. bro:see:: Broker::incoming_connection_established
global listen: function(p: port, a: string &default = "", reuse: bool &default = T): bool;
## Initiate a remote connection.
##
## a: an address to connect to, e.g. "localhost" or "127.0.0.1".
##
## p: the TCP port on which the remote side is listening.
##
## retry: an interval at which to retry establishing the
## connection with the remote peer if it cannot be made initially, or
## if it ever becomes disconnected.
##
## Returns: true if it's possible to try connecting with the peer and
## it's a new peer. The actual connection may not be established
## until a later point in time.
##
## .. bro:see:: Broker::outgoing_connection_established
global connect: function(a: string, p: port, retry: interval): bool;
## Remove a remote connection.
##
## a: the address used in previous successful call to :bro:see:`Broker::connect`.
##
## p: the port used in previous successful call to :bro:see:`Broker::connect`.
##
## Returns: true if the arguments match a previously successful call to
## :bro:see:`Broker::connect`.
global disconnect: function(a: string, p: port): bool;
## Print a simple message to any interested peers. The receiver can use
## :bro:see:`Broker::print_handler` to handle messages.
##
## topic: a topic associated with the printed message.
##
## msg: the print message to send to peers.
##
## flags: tune the behavior of how the message is sent.
##
## Returns: true if the message is sent.
global send_print: function(topic: string, msg: string, flags: SendFlags &default = SendFlags()): bool;
## Register interest in all peer print messages that use a certain topic
## prefix. Use :bro:see:`Broker::print_handler` to handle received
## messages.
##
## topic_prefix: a prefix to match against remote message topics.
## e.g. an empty prefix matches everything and "a" matches
## "alice" and "amy" but not "bob".
##
## Returns: true if it's a new print subscription and it is now registered.
global subscribe_to_prints: function(topic_prefix: string): bool;
## Unregister interest in all peer print messages that use a topic prefix.
##
## topic_prefix: a prefix previously supplied to a successful call to
## :bro:see:`Broker::subscribe_to_prints`.
##
## Returns: true if interest in the topic prefix is no longer advertised.
global unsubscribe_to_prints: function(topic_prefix: string): bool;
## Send an event to any interested peers.
##
## topic: a topic associated with the event message.
##
## args: event arguments as made by :bro:see:`Broker::event_args`.
##
## flags: tune the behavior of how the message is sent.
##
## Returns: true if the message is sent.
global send_event: function(topic: string, args: EventArgs, flags: SendFlags &default = SendFlags()): bool;
## Automatically send an event to any interested peers whenever it is
## locally dispatched (e.g. using "event my_event(...);" in a script).
##
## topic: a topic string associated with the event message.
## Peers advertise interest by registering a subscription to some
## prefix of this topic name.
##
## ev: a Bro event value.
##
## flags: tune the behavior of how the message is sent.
##
## Returns: true if automatic event sending is now enabled.
global auto_event: function(topic: string, ev: any, flags: SendFlags &default = SendFlags()): bool;
## Stop automatically sending an event to peers upon local dispatch.
##
## topic: a topic originally given to :bro:see:`Broker::auto_event`.
##
## ev: an event originally given to :bro:see:`Broker::auto_event`.
##
## Returns: true if automatic events will not occur for the topic/event
## pair.
global auto_event_stop: function(topic: string, ev: any): bool;
## Register interest in all peer event messages that use a certain topic
## prefix.
##
## topic_prefix: a prefix to match against remote message topics.
## e.g. an empty prefix matches everything and "a" matches
## "alice" and "amy" but not "bob".
##
## Returns: true if it's a new event subscription and it is now registered.
global subscribe_to_events: function(topic_prefix: string): bool;
## Unregister interest in all peer event messages that use a topic prefix.
##
## topic_prefix: a prefix previously supplied to a successful call to
## :bro:see:`Broker::subscribe_to_events`.
##
## Returns: true if interest in the topic prefix is no longer advertised.
global unsubscribe_to_events: function(topic_prefix: string): bool;
## Enable remote logs for a given log stream.
##
## id: the log stream to enable remote logs for.
##
## flags: tune the behavior of how log entry messages are sent.
##
## Returns: true if remote logs are enabled for the stream.
global enable_remote_logs: function(id: Log::ID, flags: SendFlags &default = SendFlags()): bool;
## Disable remote logs for a given log stream.
##
## id: the log stream to disable remote logs for.
##
## Returns: true if remote logs are disabled for the stream.
global disable_remote_logs: function(id: Log::ID): bool;
## Check if remote logs are enabled for a given log stream.
##
## id: the log stream to check.
##
## Returns: true if remote logs are enabled for the given stream.
global remote_logs_enabled: function(id: Log::ID): bool;
## Register interest in all peer log messages that use a certain topic
## prefix. Logs are implicitly sent with topic "bro/log/<stream-name>" and
## the receiving side processes them through the logging framework as usual.
##
## topic_prefix: a prefix to match against remote message topics.
## e.g. an empty prefix matches everything and "a" matches
## "alice" and "amy" but not "bob".
##
## Returns: true if it's a new log subscription and it is now registered.
global subscribe_to_logs: function(topic_prefix: string): bool;
## Unregister interest in all peer log messages that use a topic prefix.
## Logs are implicitly sent with topic "bro/log/<stream-name>" and the
## receiving side processes them through the logging framework as usual.
##
## topic_prefix: a prefix previously supplied to a successful call to
## :bro:see:`Broker::subscribe_to_logs`.
##
## Returns: true if interest in the topic prefix is no longer advertised.
global unsubscribe_to_logs: function(topic_prefix: string): bool;
}
@load base/bif/comm.bif
@load base/bif/messaging.bif
module Broker;
function enable(flags: EndpointFlags &default = EndpointFlags()) : bool
{
return __enable(flags);
}
function set_endpoint_flags(flags: EndpointFlags &default = EndpointFlags()): bool
{
return __set_endpoint_flags(flags);
}
function publish_topic(topic: string): bool
{
return __publish_topic(topic);
}
function unpublish_topic(topic: string): bool
{
return __unpublish_topic(topic);
}
function listen(p: port, a: string &default = "", reuse: bool &default = T): bool
{
return __listen(p, a, reuse);
}
function connect(a: string, p: port, retry: interval): bool
{
return __connect(a, p, retry);
}
function disconnect(a: string, p: port): bool
{
return __disconnect(a, p);
}
function send_print(topic: string, msg: string, flags: SendFlags &default = SendFlags()): bool
{
return __send_print(topic, msg, flags);
}
function subscribe_to_prints(topic_prefix: string): bool
{
return __subscribe_to_prints(topic_prefix);
}
function unsubscribe_to_prints(topic_prefix: string): bool
{
return __unsubscribe_to_prints(topic_prefix);
}
function send_event(topic: string, args: EventArgs, flags: SendFlags &default = SendFlags()): bool
{
return __event(topic, args, flags);
}
function auto_event(topic: string, ev: any, flags: SendFlags &default = SendFlags()): bool
{
return __auto_event(topic, ev, flags);
}
function auto_event_stop(topic: string, ev: any): bool
{
return __auto_event_stop(topic, ev);
}
function subscribe_to_events(topic_prefix: string): bool
{
return __subscribe_to_events(topic_prefix);
}
function unsubscribe_to_events(topic_prefix: string): bool
{
return __unsubscribe_to_events(topic_prefix);
}
function enable_remote_logs(id: Log::ID, flags: SendFlags &default = SendFlags()): bool
{
return __enable_remote_logs(id, flags);
}
function disable_remote_logs(id: Log::ID): bool
{
return __disable_remote_logs(id);
}
function remote_logs_enabled(id: Log::ID): bool
{
return __remote_logs_enabled(id);
}
function subscribe_to_logs(topic_prefix: string): bool
{
return __subscribe_to_logs(topic_prefix);
}
function unsubscribe_to_logs(topic_prefix: string): bool
{
return __unsubscribe_to_logs(topic_prefix);
}

View file

@ -31,6 +31,13 @@ export {
result: Broker::Data;
};
## Enumerates the possible storage backends.
type BackendType: enum {
MEMORY,
SQLITE,
ROCKSDB,
};
## Options to tune the SQLite storage backend.
type SQLiteOptions: record {
## File system path of the database.
@ -48,4 +55,341 @@ export {
sqlite: SQLiteOptions &default = SQLiteOptions();
rocksdb: RocksDBOptions &default = RocksDBOptions();
};
## Create a master data store which contains key-value pairs.
##
## id: a unique name for the data store.
##
## b: the storage backend to use.
##
## options: tunes how some storage backends operate.
##
## Returns: a handle to the data store.
global create_master: function(id: string, b: BackendType &default = MEMORY,
options: BackendOptions &default = BackendOptions()): opaque of Broker::Handle;
## Create a clone of a master data store which may live with a remote peer.
## A clone automatically synchronizes to the master by automatically
## receiving modifications and applying them locally. Direct modifications
## are not possible, they must be sent through the master store, which then
## automatically broadcasts the changes out to clones. But queries may be
## made directly against the local cloned copy, which may be resolved
## quicker than reaching out to a remote master store.
##
## id: the unique name which identifies the master data store.
##
## b: the storage backend to use.
##
## options: tunes how some storage backends operate.
##
## resync: the interval at which to re-attempt synchronizing with the master
## store should the connection be lost. If the clone has not yet
## synchronized for the first time, updates and queries queue up
## until the synchronization completes. After, if the connection
## to the master store is lost, queries continue to use the clone's
## version, but updates will be lost until the master is once again
## available.
##
## Returns: a handle to the data store.
global create_clone: function(id: string, b: BackendType &default = MEMORY,
options: BackendOptions &default = BackendOptions(),
resync: interval &default = 1sec): opaque of Broker::Handle;
## Create a frontend interface to an existing master data store that allows
## querying and updating its contents.
##
## id: the unique name which identifies the master data store.
##
## Returns: a handle to the data store.
global create_frontend: function(id: string): opaque of Broker::Handle;
## Close a data store.
##
## h: a data store handle.
##
## Returns: true if store was valid and is now closed. The handle can no
## longer be used for data store operations.
global close_by_handle: function(h: opaque of Broker::Handle): bool;
###########################
# non-blocking update API #
###########################
## Insert a key-value pair in to the store.
##
## h: the handle of the store to modify.
##
## k: the key to insert.
##
## v: the value to insert.
##
## e: the expiration time of the key-value pair.
##
## Returns: false if the store handle was not valid.
global insert: function(h: opaque of Broker::Handle,
k: Broker::Data, v: Broker::Data,
e: Broker::ExpiryTime &default = Broker::ExpiryTime()): bool;
## Remove a key-value pair from the store.
##
## h: the handle of the store to modify.
##
## k: the key to remove.
##
## Returns: false if the store handle was not valid.
global erase: function(h: opaque of Broker::Handle, k: Broker::Data): bool;
## Remove all key-value pairs from the store.
##
## h: the handle of the store to modify.
##
## Returns: false if the store handle was not valid.
global clear: function(h: opaque of Broker::Handle): bool;
## Increment an integer value in a data store.
##
## h: the handle of the store to modify.
##
## k: the key whose associated value is to be modified.
##
## by: the amount to increment the value by. A non-existent key will first
## create it with an implicit value of zero before incrementing.
##
## Returns: false if the store handle was not valid.
global increment: function(h: opaque of Broker::Handle,
k: Broker::Data, by: int &default = +1): bool;
## Decrement an integer value in a data store.
##
## h: the handle of the store to modify.
##
## k: the key whose associated value is to be modified.
##
## by: the amount to decrement the value by. A non-existent key will first
## create it with an implicit value of zero before decrementing.
##
## Returns: false if the store handle was not valid.
global decrement: function(h: opaque of Broker::Handle,
k: Broker::Data, by: int &default = +1): bool;
## Add an element to a set value in a data store.
##
## h: the handle of the store to modify.
##
## k: the key whose associated value is to be modified.
##
## element: the element to add to the set. A non-existent key will first
## create it with an implicit empty set value before modifying.
##
## Returns: false if the store handle was not valid.
global add_to_set: function(h: opaque of Broker::Handle,
k: Broker::Data, element: Broker::Data): bool;
## Remove an element from a set value in a data store.
##
## h: the handle of the store to modify.
##
## k: the key whose associated value is to be modified.
##
## element: the element to remove from the set. A non-existent key will
## implicitly create an empty set value associated with the key.
##
## Returns: false if the store handle was not valid.
global remove_from_set: function(h: opaque of Broker::Handle,
k: Broker::Data, element: Broker::Data): bool;
## Add a new item to the head of a vector value in a data store.
##
## h: the handle of store to modify.
##
## k: the key whose associated value is to be modified.
##
## items: the element to insert in to the vector. A non-existent key will
## first create an empty vector value before modifying.
##
## Returns: false if the store handle was not valid.
global push_left: function(h: opaque of Broker::Handle, k: Broker::Data,
items: Broker::DataVector): bool;
## Add a new item to the tail of a vector value in a data store.
##
## h: the handle of store to modify.
##
## k: the key whose associated value is to be modified.
##
## items: the element to insert in to the vector. A non-existent key will
## first create an empty vector value before modifying.
##
## Returns: false if the store handle was not valid.
global push_right: function(h: opaque of Broker::Handle, k: Broker::Data,
items: Broker::DataVector): bool;
##########################
# non-blocking query API #
##########################
## Pop the head of a data store vector value.
##
## h: the handle of the store to query.
##
## k: the key associated with the vector to modify.
##
## Returns: the result of the query.
global pop_left: function(h: opaque of Broker::Handle,
k: Broker::Data): QueryResult;
## Pop the tail of a data store vector value.
##
## h: the handle of the store to query.
##
## k: the key associated with the vector to modify.
##
## Returns: the result of the query.
global pop_right: function(h: opaque of Broker::Handle,
k: Broker::Data): QueryResult;
## Lookup the value associated with a key in a data store.
##
## h: the handle of the store to query.
##
## k: the key to lookup.
##
## Returns: the result of the query.
global lookup: function(h: opaque of Broker::Handle,
k: Broker::Data): QueryResult;
## Check if a data store contains a given key.
##
## h: the handle of the store to query.
##
## k: the key to check for existence.
##
## Returns: the result of the query (uses :bro:see:`Broker::BOOL`).
global exists: function(h: opaque of Broker::Handle,
k: Broker::Data): QueryResult;
## Retrieve all keys in a data store.
##
## h: the handle of the store to query.
##
## Returns: the result of the query (uses :bro:see:`Broker::VECTOR`).
global keys: function(h: opaque of Broker::Handle): QueryResult;
## Get the number of key-value pairs in a data store.
##
## h: the handle of the store to query.
##
## Returns: the result of the query (uses :bro:see:`Broker::COUNT`).
global size: function(h: opaque of Broker::Handle): QueryResult;
}
@load base/bif/store.bif
module Broker;
function create_master(id: string, b: BackendType &default = MEMORY,
options: BackendOptions &default = BackendOptions()): opaque of Broker::Handle
{
return __create_master(id, b, options);
}
function create_clone(id: string, b: BackendType &default = MEMORY,
options: BackendOptions &default = BackendOptions(),
resync: interval &default = 1sec): opaque of Broker::Handle
{
return __create_clone(id, b, options, resync);
}
function create_frontend(id: string): opaque of Broker::Handle
{
return __create_frontend(id);
}
function close_by_handle(h: opaque of Broker::Handle): bool
{
return __close_by_handle(h);
}
function insert(h: opaque of Broker::Handle, k: Broker::Data, v: Broker::Data,
e: Broker::ExpiryTime &default = Broker::ExpiryTime()): bool
{
return __insert(h, k, v, e);
}
function erase(h: opaque of Broker::Handle, k: Broker::Data): bool
{
return __erase(h, k);
}
function clear(h: opaque of Broker::Handle): bool
{
return __clear(h);
}
function increment(h: opaque of Broker::Handle,
k: Broker::Data, by: int &default = +1): bool
{
return __increment(h, k, by);
}
function decrement(h: opaque of Broker::Handle,
k: Broker::Data, by: int &default = +1): bool
{
return __decrement(h, k, by);
}
function add_to_set(h: opaque of Broker::Handle,
k: Broker::Data, element: Broker::Data): bool
{
return __add_to_set(h, k, element);
}
function remove_from_set(h: opaque of Broker::Handle,
k: Broker::Data, element: Broker::Data): bool
{
return __remove_from_set(h, k, element);
}
function push_left(h: opaque of Broker::Handle, k: Broker::Data,
items: Broker::DataVector): bool
{
return __push_left(h, k, items);
}
function push_right(h: opaque of Broker::Handle, k: Broker::Data,
items: Broker::DataVector): bool
{
return __push_right(h, k, items);
}
function pop_left(h: opaque of Broker::Handle, k: Broker::Data): QueryResult
{
return __pop_left(h, k);
}
function pop_right(h: opaque of Broker::Handle, k: Broker::Data): QueryResult
{
return __pop_right(h, k);
}
function lookup(h: opaque of Broker::Handle, k: Broker::Data): QueryResult
{
return __lookup(h, k);
}
function exists(h: opaque of Broker::Handle, k: Broker::Data): QueryResult
{
return __exists(h, k);
}
function keys(h: opaque of Broker::Handle): QueryResult
{
return __keys(h);
}
function size(h: opaque of Broker::Handle): QueryResult
{
return __size(h);
}

View file

@ -227,7 +227,7 @@ function acld_add_rule_fun(p: PluginState, r: Rule) : bool
if ( ar$command == "" )
return F;
Broker::event(p$acld_config$acld_topic, Broker::event_args(acld_add_rule, p$acld_id, r, ar));
Broker::send_event(p$acld_config$acld_topic, Broker::event_args(acld_add_rule, p$acld_id, r, ar));
return T;
}
@ -242,7 +242,7 @@ function acld_remove_rule_fun(p: PluginState, r: Rule) : bool
else
return F;
Broker::event(p$acld_config$acld_topic, Broker::event_args(acld_remove_rule, p$acld_id, r, ar));
Broker::send_event(p$acld_config$acld_topic, Broker::event_args(acld_remove_rule, p$acld_id, r, ar));
return T;
}

View file

@ -96,13 +96,13 @@ function broker_name(p: PluginState) : string
function broker_add_rule_fun(p: PluginState, r: Rule) : bool
{
Broker::event(p$broker_topic, Broker::event_args(broker_add_rule, p$broker_id, r));
Broker::send_event(p$broker_topic, Broker::event_args(broker_add_rule, p$broker_id, r));
return T;
}
function broker_remove_rule_fun(p: PluginState, r: Rule) : bool
{
Broker::event(p$broker_topic, Broker::event_args(broker_remove_rule, p$broker_id, r));
Broker::send_event(p$broker_topic, Broker::event_args(broker_remove_rule, p$broker_id, r));
return T;
}

View file

@ -47,14 +47,14 @@ function broker_describe(state: ControllerState): string
function broker_flow_mod_fun(state: ControllerState, match: ofp_match, flow_mod: OpenFlow::ofp_flow_mod): bool
{
Broker::event(state$broker_topic, Broker::event_args(broker_flow_mod, state$_name, state$broker_dpid, match, flow_mod));
Broker::send_event(state$broker_topic, Broker::event_args(broker_flow_mod, state$_name, state$broker_dpid, match, flow_mod));
return T;
}
function broker_flow_clear_fun(state: OpenFlow::ControllerState): bool
{
Broker::event(state$broker_topic, Broker::event_args(broker_flow_clear, state$_name, state$broker_dpid));
Broker::send_event(state$broker_topic, Broker::event_args(broker_flow_clear, state$_name, state$broker_dpid));
return T;
}

View file

@ -9,46 +9,22 @@ module Broker;
type Broker::EndpointFlags: record;
## Enable use of communication.
##
## flags: used to tune the local Broker endpoint behavior.
##
## Returns: true if communication is successfully initialized.
function Broker::enable%(flags: EndpointFlags &default = EndpointFlags()%): bool
function Broker::__enable%(flags: EndpointFlags%): bool
%{
return new Val(broker_mgr->Enable(flags), TYPE_BOOL);
%}
## Changes endpoint flags originally supplied to :bro:see:`Broker::enable`.
##
## flags: the new endpoint behavior flags to use.
##
## Returns: true if flags were changed.
function Broker::set_endpoint_flags%(flags: EndpointFlags &default = EndpointFlags()%): bool
function Broker::__set_endpoint_flags%(flags: EndpointFlags%): bool
%{
return new Val(broker_mgr->SetEndpointFlags(flags), TYPE_BOOL);
%}
## Allow sending messages to peers if associated with the given topic.
## This has no effect if auto publication behavior is enabled via the flags
## supplied to :bro:see:`Broker::enable` or :bro:see:`Broker::set_endpoint_flags`.
##
## topic: a topic to allow messages to be published under.
##
## Returns: true if successful.
function Broker::publish_topic%(topic: string%): bool
function Broker::__publish_topic%(topic: string%): bool
%{
return new Val(broker_mgr->PublishTopic(topic->CheckString()), TYPE_BOOL);
%}
## Disallow sending messages to peers if associated with the given topic.
## This has no effect if auto publication behavior is enabled via the flags
## supplied to :bro:see:`Broker::enable` or :bro:see:`Broker::set_endpoint_flags`.
##
## topic: a topic to disallow messages to be published under.
##
## Returns: true if successful.
function Broker::unpublish_topic%(topic: string%): bool
function Broker::__unpublish_topic%(topic: string%): bool
%{
return new Val(broker_mgr->UnpublishTopic(topic->CheckString()), TYPE_BOOL);
%}
@ -124,20 +100,7 @@ event Broker::incoming_connection_established%(peer_name: string%);
## .. bro:see:: Broker::incoming_connection_established
event Broker::incoming_connection_broken%(peer_name: string%);
## Listen for remote connections.
##
## p: the TCP port to listen on.
##
## a: an address string on which to accept connections, e.g.
## "127.0.0.1". An empty string refers to @p INADDR_ANY.
##
## reuse: equivalent to behavior of SO_REUSEADDR.
##
## Returns: true if the local endpoint is now listening for connections.
##
## .. bro:see:: Broker::incoming_connection_established
function Broker::listen%(p: port, a: string &default = "",
reuse: bool &default = T%): bool
function Broker::__listen%(p: port, a: string, reuse: bool%): bool
%{
if ( ! p->IsTCP() )
{
@ -150,22 +113,7 @@ function Broker::listen%(p: port, a: string &default = "",
return new Val(rval, TYPE_BOOL);
%}
## Initiate a remote connection.
##
## a: an address to connect to, e.g. "localhost" or "127.0.0.1".
##
## p: the TCP port on which the remote side is listening.
##
## retry: an interval at which to retry establishing the
## connection with the remote peer if it cannot be made initially, or
## if it ever becomes disconnected.
##
## Returns: true if it's possible to try connecting with the peer and
## it's a new peer. The actual connection may not be established
## until a later point in time.
##
## .. bro:see:: Broker::outgoing_connection_established
function Broker::connect%(a: string, p: port, retry: interval%): bool
function Broker::__connect%(a: string, p: port, retry: interval%): bool
%{
if ( ! p->IsTCP() )
{
@ -178,15 +126,7 @@ function Broker::connect%(a: string, p: port, retry: interval%): bool
return new Val(rval, TYPE_BOOL);
%}
## Remove a remote connection.
##
## a: the address used in previous successful call to :bro:see:`Broker::connect`.
##
## p: the port used in previous successful call to :bro:see:`Broker::connect`.
##
## Returns: true if the arguments match a previously successful call to
## :bro:see:`Broker::connect`.
function Broker::disconnect%(a: string, p: port%): bool
function Broker::__disconnect%(a: string, p: port%): bool
%{
if ( ! p->IsTCP() )
{

View file

@ -13,202 +13,99 @@ type Broker::SendFlags: record;
type Broker::EventArgs: record;
## Used to handle remote print messages from peers that call
## :bro:see:`Broker::print`.
## :bro:see:`Broker::send_print`.
event Broker::print_handler%(msg: string%);
## Print a simple message to any interested peers. The receiver can use
## :bro:see:`Broker::print_handler` to handle messages.
##
## topic: a topic associated with the printed message.
##
## msg: the print message to send to peers.
##
## flags: tune the behavior of how the message is sent.
##
## Returns: true if the message is sent.
function Broker::print%(topic: string, msg: string,
flags: SendFlags &default = SendFlags()%): bool
function Broker::__send_print%(topic: string, msg: string, flags: Broker::SendFlags%): bool
%{
auto rval = broker_mgr->Print(topic->CheckString(), msg->CheckString(),
flags);
return new Val(rval, TYPE_BOOL);
%}
## Register interest in all peer print messages that use a certain topic prefix.
## Use :bro:see:`Broker::print_handler` to handle received messages.
##
## topic_prefix: a prefix to match against remote message topics.
## e.g. an empty prefix matches everything and "a" matches
## "alice" and "amy" but not "bob".
##
## Returns: true if it's a new print subscription and it is now registered.
function Broker::subscribe_to_prints%(topic_prefix: string%): bool
function Broker::__subscribe_to_prints%(topic_prefix: string%): bool
%{
auto rval = broker_mgr->SubscribeToPrints(topic_prefix->CheckString());
return new Val(rval, TYPE_BOOL);
%}
## Unregister interest in all peer print messages that use a topic prefix.
##
## topic_prefix: a prefix previously supplied to a successful call to
## :bro:see:`Broker::subscribe_to_prints`.
##
## Returns: true if interest in the topic prefix is no longer advertised.
function Broker::unsubscribe_to_prints%(topic_prefix: string%): bool
function Broker::__unsubscribe_to_prints%(topic_prefix: string%): bool
%{
auto rval = broker_mgr->UnsubscribeToPrints(topic_prefix->CheckString());
return new Val(rval, TYPE_BOOL);
%}
## Create a data structure that may be used to send a remote event via
## :bro:see:`Broker::event`.
## :bro:see:`Broker::send_event`.
##
## args: an event, followed by a list of argument values that may be used
## to call it.
##
## Returns: opaque communication data that may be used to send a remote event.
## Returns: opaque communication data that may be used to send a remote
## event.
function Broker::event_args%(...%): Broker::EventArgs
%{
auto rval = broker_mgr->MakeEventArgs(@ARGS@);
return rval;
%}
## Send an event to any interested peers.
##
## topic: a topic associated with the event message.
##
## args: event arguments as made by :bro:see:`Broker::event_args`.
##
## flags: tune the behavior of how the message is sent.
##
## Returns: true if the message is sent.
function Broker::event%(topic: string, args: Broker::EventArgs,
flags: SendFlags &default = SendFlags()%): bool
function Broker::__event%(topic: string, args: Broker::EventArgs, flags: Broker::SendFlags%): bool
%{
auto rval = broker_mgr->Event(topic->CheckString(), args->AsRecordVal(),
flags);
return new Val(rval, TYPE_BOOL);
%}
## Automatically send an event to any interested peers whenever it is
## locally dispatched (e.g. using "event my_event(...);" in a script).
##
## topic: a topic string associated with the event message.
## Peers advertise interest by registering a subscription to some prefix
## of this topic name.
##
## ev: a Bro event value.
##
## flags: tune the behavior of how the message is sent.
##
## Returns: true if automatic event sending is now enabled.
function Broker::auto_event%(topic: string, ev: any,
flags: SendFlags &default = SendFlags()%): bool
function Broker::__auto_event%(topic: string, ev: any, flags: Broker::SendFlags%): bool
%{
auto rval = broker_mgr->AutoEvent(topic->CheckString(), ev, flags);
return new Val(rval, TYPE_BOOL);
%}
## Stop automatically sending an event to peers upon local dispatch.
##
## topic: a topic originally given to :bro:see:`Broker::auto_event`.
##
## ev: an event originally given to :bro:see:`Broker::auto_event`.
##
## Returns: true if automatic events will not occur for the topic/event pair.
function Broker::auto_event_stop%(topic: string, ev: any%): bool
function Broker::__auto_event_stop%(topic: string, ev: any%): bool
%{
auto rval = broker_mgr->AutoEventStop(topic->CheckString(), ev);
return new Val(rval, TYPE_BOOL);
%}
## Register interest in all peer event messages that use a certain topic prefix.
##
## topic_prefix: a prefix to match against remote message topics.
## e.g. an empty prefix matches everything and "a" matches
## "alice" and "amy" but not "bob".
##
## Returns: true if it's a new event subscription and it is now registered.
function Broker::subscribe_to_events%(topic_prefix: string%): bool
function Broker::__subscribe_to_events%(topic_prefix: string%): bool
%{
auto rval = broker_mgr->SubscribeToEvents(topic_prefix->CheckString());
return new Val(rval, TYPE_BOOL);
%}
## Unregister interest in all peer event messages that use a topic prefix.
##
## topic_prefix: a prefix previously supplied to a successful call to
## :bro:see:`Broker::subscribe_to_events`.
##
## Returns: true if interest in the topic prefix is no longer advertised.
function Broker::unsubscribe_to_events%(topic_prefix: string%): bool
function Broker::__unsubscribe_to_events%(topic_prefix: string%): bool
%{
auto rval = broker_mgr->UnsubscribeToEvents(topic_prefix->CheckString());
return new Val(rval, TYPE_BOOL);
%}
## Enable remote logs for a given log stream.
##
## id: the log stream to enable remote logs for.
##
## flags: tune the behavior of how log entry messages are sent.
##
## Returns: true if remote logs are enabled for the stream.
function
Broker::enable_remote_logs%(id: Log::ID,
flags: SendFlags &default = SendFlags()%): bool
function Broker::__enable_remote_logs%(id: Log::ID, flags: Broker::SendFlags%): bool
%{
auto rval = log_mgr->EnableRemoteLogs(id->AsEnumVal(),
bro_broker::Manager::send_flags_to_int(flags));
return new Val(rval, TYPE_BOOL);
%}
## Disable remote logs for a given log stream.
##
## id: the log stream to disable remote logs for.
##
## Returns: true if remote logs are disabled for the stream.
function Broker::disable_remote_logs%(id: Log::ID%): bool
function Broker::__disable_remote_logs%(id: Log::ID%): bool
%{
auto rval = log_mgr->DisableRemoteLogs(id->AsEnumVal());
return new Val(rval, TYPE_BOOL);
%}
## Check if remote logs are enabled for a given log stream.
##
## id: the log stream to check.
##
## Returns: true if remote logs are enabled for the given stream.
function Broker::remote_logs_enabled%(id: Log::ID%): bool
function Broker::__remote_logs_enabled%(id: Log::ID%): bool
%{
auto rval = log_mgr->RemoteLogsAreEnabled(id->AsEnumVal());
return new Val(rval, TYPE_BOOL);
%}
## Register interest in all peer log messages that use a certain topic prefix.
## Logs are implicitly sent with topic "bro/log/<stream-name>" and the
## receiving side processes them through the logging framework as usual.
##
## topic_prefix: a prefix to match against remote message topics.
## e.g. an empty prefix matches everything and "a" matches
## "alice" and "amy" but not "bob".
##
## Returns: true if it's a new log subscription and it is now registered.
function Broker::subscribe_to_logs%(topic_prefix: string%): bool
function Broker::__subscribe_to_logs%(topic_prefix: string%): bool
%{
auto rval = broker_mgr->SubscribeToLogs(topic_prefix->CheckString());
return new Val(rval, TYPE_BOOL);
%}
## Unregister interest in all peer log messages that use a topic prefix.
## Logs are implicitly sent with topic "bro/log/<stream-name>" and the
## receiving side processes them through the logging framework as usual.
##
## topic_prefix: a prefix previously supplied to a successful call to
## :bro:see:`Broker::subscribe_to_logs`.
##
## Returns: true if interest in the topic prefix is no longer advertised.
function Broker::unsubscribe_to_logs%(topic_prefix: string%): bool
function Broker::__unsubscribe_to_logs%(topic_prefix: string%): bool
%{
auto rval = broker_mgr->UnsubscribeToLogs(topic_prefix->CheckString());
return new Val(rval, TYPE_BOOL);

View file

@ -23,16 +23,7 @@ enum BackendType %{
ROCKSDB,
%}
## Create a master data store which contains key-value pairs.
##
## id: a unique name for the data store.
##
## b: the storage backend to use.
##
## options: tunes how some storage backends operate.
##
## Returns: a handle to the data store.
function Broker::create_master%(id: string, b: BackendType &default = MEMORY,
function Broker::__create_master%(id: string, b: BackendType,
options: BackendOptions &default = BackendOptions()%): opaque of Broker::Handle
%{
auto id_str = id->CheckString();
@ -53,29 +44,7 @@ function Broker::create_master%(id: string, b: BackendType &default = MEMORY,
return rval;
%}
## Create a clone of a master data store which may live with a remote peer.
## A clone automatically synchronizes to the master by automatically receiving
## modifications and applying them locally. Direct modifications are not
## possible, they must be sent through the master store, which then
## automatically broadcasts the changes out to clones. But queries may be made
## directly against the local cloned copy, which may be resolved quicker than
## reaching out to a remote master store.
##
## id: the unique name which identifies the master data store.
##
## b: the storage backend to use.
##
## options: tunes how some storage backends operate.
##
## resync: the interval at which to re-attempt synchronizing with the master
## store should the connection be lost. If the clone has not yet
## synchronized for the first time, updates and queries queue up until
## the synchronization completes. After, if the connection to the
## master store is lost, queries continue to use the clone's version,
## but updates will be lost until the master is once again available.
##
## Returns: a handle to the data store.
function Broker::create_clone%(id: string, b: BackendType &default = MEMORY,
function Broker::__create_clone%(id: string, b: BackendType,
options: BackendOptions &default = BackendOptions(),
resync: interval &default = 1sec%): opaque of Broker::Handle
%{
@ -98,13 +67,7 @@ function Broker::create_clone%(id: string, b: BackendType &default = MEMORY,
return rval;
%}
## Create a frontend interface to an existing master data store that allows
## querying and updating its contents.
##
## id: the unique name which identifies the master data store.
##
## Returns: a handle to the data store.
function Broker::create_frontend%(id: string%): opaque of Broker::Handle
function Broker::__create_frontend%(id: string%): opaque of Broker::Handle
%{
auto id_str = id->CheckString();
auto type = bro_broker::StoreType::FRONTEND;
@ -122,13 +85,7 @@ function Broker::create_frontend%(id: string%): opaque of Broker::Handle
return rval;
%}
## Close a data store.
##
## h: a data store handle.
##
## Returns: true if store was valid and is now closed. The handle can no
## longer be used for data store operations.
function Broker::close_by_handle%(h: opaque of Broker::Handle%): bool
function Broker::__close_by_handle%(h: opaque of Broker::Handle%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -143,18 +100,7 @@ function Broker::close_by_handle%(h: opaque of Broker::Handle%): bool
# non-blocking update API #
###########################
## Insert a key-value pair in to the store.
##
## h: the handle of the store to modify.
##
## k: the key to insert.
##
## v: the value to insert.
##
## e: the expiration time of the key-value pair.
##
## Returns: false if the store handle was not valid.
function Broker::insert%(h: opaque of Broker::Handle,
function Broker::__insert%(h: opaque of Broker::Handle,
k: Broker::Data, v: Broker::Data,
e: Broker::ExpiryTime &default = Broker::ExpiryTime()%): bool
%{
@ -191,14 +137,7 @@ function Broker::insert%(h: opaque of Broker::Handle,
return new Val(true, TYPE_BOOL);
%}
## Remove a key-value pair from the store.
##
## h: the handle of the store to modify.
##
## k: the key to remove.
##
## Returns: false if the store handle was not valid.
function Broker::erase%(h: opaque of Broker::Handle, k: Broker::Data%): bool
function Broker::__erase%(h: opaque of Broker::Handle, k: Broker::Data%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -210,12 +149,7 @@ function Broker::erase%(h: opaque of Broker::Handle, k: Broker::Data%): bool
return new Val(true, TYPE_BOOL);
%}
## Remove all key-value pairs from the store.
##
## h: the handle of the store to modify.
##
## Returns: false if the store handle was not valid.
function Broker::clear%(h: opaque of Broker::Handle%): bool
function Broker::__clear%(h: opaque of Broker::Handle%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -226,17 +160,7 @@ function Broker::clear%(h: opaque of Broker::Handle%): bool
return new Val(true, TYPE_BOOL);
%}
## Increment an integer value in a data store.
##
## h: the handle of the store to modify.
##
## k: the key whose associated value is to be modified.
##
## by: the amount to increment the value by. A non-existent key will first
## create it with an implicit value of zero before incrementing.
##
## Returns: false if the store handle was not valid.
function Broker::increment%(h: opaque of Broker::Handle,
function Broker::__increment%(h: opaque of Broker::Handle,
k: Broker::Data, by: int &default = +1%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -249,17 +173,7 @@ function Broker::increment%(h: opaque of Broker::Handle,
return new Val(true, TYPE_BOOL);
%}
## Decrement an integer value in a data store.
##
## h: the handle of the store to modify.
##
## k: the key whose associated value is to be modified.
##
## by: the amount to decrement the value by. A non-existent key will first
## create it with an implicit value of zero before decrementing.
##
## Returns: false if the store handle was not valid.
function Broker::decrement%(h: opaque of Broker::Handle,
function Broker::__decrement%(h: opaque of Broker::Handle,
k: Broker::Data, by: int &default = +1%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -272,17 +186,7 @@ function Broker::decrement%(h: opaque of Broker::Handle,
return new Val(true, TYPE_BOOL);
%}
## Add an element to a set value in a data store.
##
## h: the handle of the store to modify.
##
## k: the key whose associated value is to be modified.
##
## element: the element to add to the set. A non-existent key will first
## create it with an implicit empty set value before modifying.
##
## Returns: false if the store handle was not valid.
function Broker::add_to_set%(h: opaque of Broker::Handle,
function Broker::__add_to_set%(h: opaque of Broker::Handle,
k: Broker::Data, element: Broker::Data%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -296,17 +200,7 @@ function Broker::add_to_set%(h: opaque of Broker::Handle,
return new Val(true, TYPE_BOOL);
%}
## Remove an element from a set value in a data store.
##
## h: the handle of the store to modify.
##
## k: the key whose associated value is to be modified.
##
## element: the element to remove from the set. A non-existent key will
## implicitly create an empty set value associated with the key.
##
## Returns: false if the store handle was not valid.
function Broker::remove_from_set%(h: opaque of Broker::Handle,
function Broker::__remove_from_set%(h: opaque of Broker::Handle,
k: Broker::Data, element: Broker::Data%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -320,17 +214,7 @@ function Broker::remove_from_set%(h: opaque of Broker::Handle,
return new Val(true, TYPE_BOOL);
%}
## Add a new item to the head of a vector value in a data store.
##
## h: the handle of store to modify.
##
## k: the key whose associated value is to be modified.
##
## items: the element to insert in to the vector. A non-existent key will first
## create an empty vector value before modifying.
##
## Returns: false if the store handle was not valid.
function Broker::push_left%(h: opaque of Broker::Handle, k: Broker::Data,
function Broker::__push_left%(h: opaque of Broker::Handle, k: Broker::Data,
items: Broker::DataVector%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -353,17 +237,7 @@ function Broker::push_left%(h: opaque of Broker::Handle, k: Broker::Data,
return new Val(true, TYPE_BOOL);
%}
## Add a new item to the tail of a vector value in a data store.
##
## h: the handle of store to modify.
##
## k: the key whose associated value is to be modified.
##
## items: the element to insert in to the vector. A non-existent key will first
## create an empty vector value before modifying.
##
## Returns: false if the store handle was not valid.
function Broker::push_right%(h: opaque of Broker::Handle, k: Broker::Data,
function Broker::__push_right%(h: opaque of Broker::Handle, k: Broker::Data,
items: Broker::DataVector%): bool
%{
auto handle = static_cast<bro_broker::StoreHandleVal*>(h);
@ -437,14 +311,7 @@ static bool prepare_for_query(Val* opaque, Frame* frame,
%%}
## Pop the head of a data store vector value.
##
## h: the handle of the store to query.
##
## k: the key associated with the vector to modify.
##
## Returns: the result of the query.
function Broker::pop_left%(h: opaque of Broker::Handle,
function Broker::__pop_left%(h: opaque of Broker::Handle,
k: Broker::Data%): Broker::QueryResult
%{
if ( ! broker_mgr->Enabled() )
@ -467,14 +334,7 @@ function Broker::pop_left%(h: opaque of Broker::Handle,
return 0;
%}
## Pop the tail of a data store vector value.
##
## h: the handle of the store to query.
##
## k: the key associated with the vector to modify.
##
## Returns: the result of the query.
function Broker::pop_right%(h: opaque of Broker::Handle,
function Broker::__pop_right%(h: opaque of Broker::Handle,
k: Broker::Data%): Broker::QueryResult
%{
if ( ! broker_mgr->Enabled() )
@ -497,14 +357,7 @@ function Broker::pop_right%(h: opaque of Broker::Handle,
return 0;
%}
## Lookup the value associated with a key in a data store.
##
## h: the handle of the store to query.
##
## k: the key to lookup.
##
## Returns: the result of the query.
function Broker::lookup%(h: opaque of Broker::Handle,
function Broker::__lookup%(h: opaque of Broker::Handle,
k: Broker::Data%): Broker::QueryResult
%{
if ( ! broker_mgr->Enabled() )
@ -527,14 +380,7 @@ function Broker::lookup%(h: opaque of Broker::Handle,
return 0;
%}
## Check if a data store contains a given key.
##
## h: the handle of the store to query.
##
## k: the key to check for existence.
##
## Returns: the result of the query (uses :bro:see:`Broker::BOOL`).
function Broker::exists%(h: opaque of Broker::Handle,
function Broker::__exists%(h: opaque of Broker::Handle,
k: Broker::Data%): Broker::QueryResult
%{
if ( ! broker_mgr->Enabled() )
@ -557,12 +403,7 @@ function Broker::exists%(h: opaque of Broker::Handle,
return 0;
%}
## Retrieve all keys in a data store.
##
## h: the handle of the store to query.
##
## Returns: the result of the query (uses :bro:see:`Broker::VECTOR`).
function Broker::keys%(h: opaque of Broker::Handle%): Broker::QueryResult
function Broker::__keys%(h: opaque of Broker::Handle%): Broker::QueryResult
%{
double timeout;
bro_broker::StoreQueryCallback* cb;
@ -575,12 +416,7 @@ function Broker::keys%(h: opaque of Broker::Handle%): Broker::QueryResult
return 0;
%}
## Get the number of key-value pairs in a data store.
##
## h: the handle of the store to query.
##
## Returns: the result of the query (uses :bro:see:`Broker::COUNT`).
function Broker::size%(h: opaque of Broker::Handle%): Broker::QueryResult
function Broker::__size%(h: opaque of Broker::Handle%): Broker::QueryResult
%{
if ( ! broker_mgr->Enabled() )
return bro_broker::query_result();

View file

@ -3,7 +3,7 @@
#empty_field (empty)
#unset_field -
#path loaded_scripts
#open 2016-04-22-23-21-01
#open 2016-04-26-21-21-19
#fields name
#types string
scripts/base/init-bare.bro
@ -17,7 +17,10 @@ scripts/base/init-bare.bro
build/scripts/base/bif/event.bif.bro
scripts/base/frameworks/broker/__load__.bro
scripts/base/frameworks/broker/main.bro
build/scripts/base/bif/comm.bif.bro
build/scripts/base/bif/messaging.bif.bro
scripts/base/frameworks/broker/store.bro
build/scripts/base/bif/store.bif.bro
scripts/base/frameworks/logging/__load__.bro
scripts/base/frameworks/logging/main.bro
build/scripts/base/bif/logging.bif.bro
@ -51,10 +54,7 @@ scripts/base/init-bare.bro
build/scripts/base/bif/bloom-filter.bif.bro
build/scripts/base/bif/cardinality-counter.bif.bro
build/scripts/base/bif/top-k.bif.bro
build/scripts/base/bif/comm.bif.bro
build/scripts/base/bif/data.bif.bro
build/scripts/base/bif/messaging.bif.bro
build/scripts/base/bif/store.bif.bro
build/scripts/base/bif/plugins/__load__.bro
build/scripts/base/bif/plugins/Bro_ARP.events.bif.bro
build/scripts/base/bif/plugins/Bro_AYIYA.events.bif.bro
@ -131,4 +131,4 @@ scripts/base/init-bare.bro
build/scripts/base/bif/plugins/Bro_SQLiteWriter.sqlite.bif.bro
scripts/policy/misc/loaded-scripts.bro
scripts/base/utils/paths.bro
#close 2016-04-22-23-21-01
#close 2016-04-26-21-21-19

View file

@ -3,7 +3,7 @@
#empty_field (empty)
#unset_field -
#path loaded_scripts
#open 2016-04-22-23-21-18
#open 2016-04-26-21-21-31
#fields name
#types string
scripts/base/init-bare.bro
@ -17,7 +17,10 @@ scripts/base/init-bare.bro
build/scripts/base/bif/event.bif.bro
scripts/base/frameworks/broker/__load__.bro
scripts/base/frameworks/broker/main.bro
build/scripts/base/bif/comm.bif.bro
build/scripts/base/bif/messaging.bif.bro
scripts/base/frameworks/broker/store.bro
build/scripts/base/bif/store.bif.bro
scripts/base/frameworks/logging/__load__.bro
scripts/base/frameworks/logging/main.bro
build/scripts/base/bif/logging.bif.bro
@ -51,10 +54,7 @@ scripts/base/init-bare.bro
build/scripts/base/bif/bloom-filter.bif.bro
build/scripts/base/bif/cardinality-counter.bif.bro
build/scripts/base/bif/top-k.bif.bro
build/scripts/base/bif/comm.bif.bro
build/scripts/base/bif/data.bif.bro
build/scripts/base/bif/messaging.bif.bro
build/scripts/base/bif/store.bif.bro
build/scripts/base/bif/plugins/__load__.bro
build/scripts/base/bif/plugins/Bro_ARP.events.bif.bro
build/scripts/base/bif/plugins/Bro_AYIYA.events.bif.bro
@ -302,4 +302,4 @@ scripts/base/init-default.bro
scripts/base/misc/find-checksum-offloading.bro
scripts/base/misc/find-filtered-trace.bro
scripts/policy/misc/loaded-scripts.bro
#close 2016-04-22-23-21-18
#close 2016-04-26-21-21-31

View file

@ -230,7 +230,7 @@
0.000000 MetaHookPost CallFunction(Log::__create_stream, <frame>, (Weird::LOG, [columns=<no value description>, ev=Weird::log_weird, path=weird])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::__create_stream, <frame>, (X509::LOG, [columns=<no value description>, ev=X509::log_x509, path=x509])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::__create_stream, <frame>, (mysql::LOG, [columns=<no value description>, ev=MySQL::log_mysql, path=mysql])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::__write, <frame>, (PacketFilter::LOG, [ts=1461367323.154279, node=bro, filter=ip or not ip, init=T, success=T])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::__write, <frame>, (PacketFilter::LOG, [ts=1461705704.402549, node=bro, filter=ip or not ip, init=T, success=T])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::add_default_filter, <frame>, (Cluster::LOG)) -> <no result>
0.000000 MetaHookPost CallFunction(Log::add_default_filter, <frame>, (Communication::LOG)) -> <no result>
0.000000 MetaHookPost CallFunction(Log::add_default_filter, <frame>, (Conn::LOG)) -> <no result>
@ -351,7 +351,7 @@
0.000000 MetaHookPost CallFunction(Log::create_stream, <frame>, (Weird::LOG, [columns=<no value description>, ev=Weird::log_weird, path=weird])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::create_stream, <frame>, (X509::LOG, [columns=<no value description>, ev=X509::log_x509, path=x509])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::create_stream, <frame>, (mysql::LOG, [columns=<no value description>, ev=MySQL::log_mysql, path=mysql])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::write, <frame>, (PacketFilter::LOG, [ts=1461367323.154279, node=bro, filter=ip or not ip, init=T, success=T])) -> <no result>
0.000000 MetaHookPost CallFunction(Log::write, <frame>, (PacketFilter::LOG, [ts=1461705704.402549, node=bro, filter=ip or not ip, init=T, success=T])) -> <no result>
0.000000 MetaHookPost CallFunction(NetControl::check_plugins, <frame>, ()) -> <no result>
0.000000 MetaHookPost CallFunction(NetControl::init, <null>, ()) -> <no result>
0.000000 MetaHookPost CallFunction(Notice::want_pp, <frame>, ()) -> <no result>
@ -566,6 +566,7 @@
0.000000 MetaHookPost LoadFile(base<...>/bro.bif) -> -1
0.000000 MetaHookPost LoadFile(base<...>/broker) -> -1
0.000000 MetaHookPost LoadFile(base<...>/cluster) -> -1
0.000000 MetaHookPost LoadFile(base<...>/comm.bif) -> -1
0.000000 MetaHookPost LoadFile(base<...>/communication) -> -1
0.000000 MetaHookPost LoadFile(base<...>/conn) -> -1
0.000000 MetaHookPost LoadFile(base<...>/conn-ids) -> -1
@ -596,6 +597,7 @@
0.000000 MetaHookPost LoadFile(base<...>/logging) -> -1
0.000000 MetaHookPost LoadFile(base<...>/logging.bif) -> -1
0.000000 MetaHookPost LoadFile(base<...>/main) -> -1
0.000000 MetaHookPost LoadFile(base<...>/messaging.bif) -> -1
0.000000 MetaHookPost LoadFile(base<...>/modbus) -> -1
0.000000 MetaHookPost LoadFile(base<...>/mysql) -> -1
0.000000 MetaHookPost LoadFile(base<...>/netcontrol) -> -1
@ -623,6 +625,7 @@
0.000000 MetaHookPost LoadFile(base<...>/software) -> -1
0.000000 MetaHookPost LoadFile(base<...>/ssh) -> -1
0.000000 MetaHookPost LoadFile(base<...>/ssl) -> -1
0.000000 MetaHookPost LoadFile(base<...>/store.bif) -> -1
0.000000 MetaHookPost LoadFile(base<...>/strings) -> -1
0.000000 MetaHookPost LoadFile(base<...>/strings.bif) -> -1
0.000000 MetaHookPost LoadFile(base<...>/sumstats) -> -1
@ -870,7 +873,7 @@
0.000000 MetaHookPre CallFunction(Log::__create_stream, <frame>, (Weird::LOG, [columns=<no value description>, ev=Weird::log_weird, path=weird]))
0.000000 MetaHookPre CallFunction(Log::__create_stream, <frame>, (X509::LOG, [columns=<no value description>, ev=X509::log_x509, path=x509]))
0.000000 MetaHookPre CallFunction(Log::__create_stream, <frame>, (mysql::LOG, [columns=<no value description>, ev=MySQL::log_mysql, path=mysql]))
0.000000 MetaHookPre CallFunction(Log::__write, <frame>, (PacketFilter::LOG, [ts=1461367323.154279, node=bro, filter=ip or not ip, init=T, success=T]))
0.000000 MetaHookPre CallFunction(Log::__write, <frame>, (PacketFilter::LOG, [ts=1461705704.402549, node=bro, filter=ip or not ip, init=T, success=T]))
0.000000 MetaHookPre CallFunction(Log::add_default_filter, <frame>, (Cluster::LOG))
0.000000 MetaHookPre CallFunction(Log::add_default_filter, <frame>, (Communication::LOG))
0.000000 MetaHookPre CallFunction(Log::add_default_filter, <frame>, (Conn::LOG))
@ -991,7 +994,7 @@
0.000000 MetaHookPre CallFunction(Log::create_stream, <frame>, (Weird::LOG, [columns=<no value description>, ev=Weird::log_weird, path=weird]))
0.000000 MetaHookPre CallFunction(Log::create_stream, <frame>, (X509::LOG, [columns=<no value description>, ev=X509::log_x509, path=x509]))
0.000000 MetaHookPre CallFunction(Log::create_stream, <frame>, (mysql::LOG, [columns=<no value description>, ev=MySQL::log_mysql, path=mysql]))
0.000000 MetaHookPre CallFunction(Log::write, <frame>, (PacketFilter::LOG, [ts=1461367323.154279, node=bro, filter=ip or not ip, init=T, success=T]))
0.000000 MetaHookPre CallFunction(Log::write, <frame>, (PacketFilter::LOG, [ts=1461705704.402549, node=bro, filter=ip or not ip, init=T, success=T]))
0.000000 MetaHookPre CallFunction(NetControl::check_plugins, <frame>, ())
0.000000 MetaHookPre CallFunction(NetControl::init, <null>, ())
0.000000 MetaHookPre CallFunction(Notice::want_pp, <frame>, ())
@ -1206,6 +1209,7 @@
0.000000 MetaHookPre LoadFile(base<...>/bro.bif)
0.000000 MetaHookPre LoadFile(base<...>/broker)
0.000000 MetaHookPre LoadFile(base<...>/cluster)
0.000000 MetaHookPre LoadFile(base<...>/comm.bif)
0.000000 MetaHookPre LoadFile(base<...>/communication)
0.000000 MetaHookPre LoadFile(base<...>/conn)
0.000000 MetaHookPre LoadFile(base<...>/conn-ids)
@ -1236,6 +1240,7 @@
0.000000 MetaHookPre LoadFile(base<...>/logging)
0.000000 MetaHookPre LoadFile(base<...>/logging.bif)
0.000000 MetaHookPre LoadFile(base<...>/main)
0.000000 MetaHookPre LoadFile(base<...>/messaging.bif)
0.000000 MetaHookPre LoadFile(base<...>/modbus)
0.000000 MetaHookPre LoadFile(base<...>/mysql)
0.000000 MetaHookPre LoadFile(base<...>/netcontrol)
@ -1263,6 +1268,7 @@
0.000000 MetaHookPre LoadFile(base<...>/software)
0.000000 MetaHookPre LoadFile(base<...>/ssh)
0.000000 MetaHookPre LoadFile(base<...>/ssl)
0.000000 MetaHookPre LoadFile(base<...>/store.bif)
0.000000 MetaHookPre LoadFile(base<...>/strings)
0.000000 MetaHookPre LoadFile(base<...>/strings.bif)
0.000000 MetaHookPre LoadFile(base<...>/sumstats)
@ -1509,7 +1515,7 @@
0.000000 | HookCallFunction Log::__create_stream(Weird::LOG, [columns=<no value description>, ev=Weird::log_weird, path=weird])
0.000000 | HookCallFunction Log::__create_stream(X509::LOG, [columns=<no value description>, ev=X509::log_x509, path=x509])
0.000000 | HookCallFunction Log::__create_stream(mysql::LOG, [columns=<no value description>, ev=MySQL::log_mysql, path=mysql])
0.000000 | HookCallFunction Log::__write(PacketFilter::LOG, [ts=1461367323.154279, node=bro, filter=ip or not ip, init=T, success=T])
0.000000 | HookCallFunction Log::__write(PacketFilter::LOG, [ts=1461705704.402549, node=bro, filter=ip or not ip, init=T, success=T])
0.000000 | HookCallFunction Log::add_default_filter(Cluster::LOG)
0.000000 | HookCallFunction Log::add_default_filter(Communication::LOG)
0.000000 | HookCallFunction Log::add_default_filter(Conn::LOG)
@ -1630,7 +1636,7 @@
0.000000 | HookCallFunction Log::create_stream(Weird::LOG, [columns=<no value description>, ev=Weird::log_weird, path=weird])
0.000000 | HookCallFunction Log::create_stream(X509::LOG, [columns=<no value description>, ev=X509::log_x509, path=x509])
0.000000 | HookCallFunction Log::create_stream(mysql::LOG, [columns=<no value description>, ev=MySQL::log_mysql, path=mysql])
0.000000 | HookCallFunction Log::write(PacketFilter::LOG, [ts=1461367323.154279, node=bro, filter=ip or not ip, init=T, success=T])
0.000000 | HookCallFunction Log::write(PacketFilter::LOG, [ts=1461705704.402549, node=bro, filter=ip or not ip, init=T, success=T])
0.000000 | HookCallFunction NetControl::check_plugins()
0.000000 | HookCallFunction NetControl::init()
0.000000 | HookCallFunction Notice::want_pp()

View file

@ -40,7 +40,7 @@ event event_handler(msg: string, n: count)
event auto_event_handler(msg, n);
local args = Broker::event_args(event_handler, "pong", n);
Broker::event("bro/event/my_topic", args);
Broker::send_event("bro/event/my_topic", args);
}
@TEST-END-FILE
@ -68,7 +68,7 @@ event Broker::outgoing_connection_established(peer_address: string,
{
print "Broker::outgoing_connection_established", peer_address, peer_port;
local args = Broker::event_args(event_handler, "ping", event_count);
Broker::event("bro/event/hi", args);
Broker::send_event("bro/event/hi", args);
++event_count;
}
@ -82,7 +82,7 @@ event event_handler(msg: string, n: count)
{
print "got event msg", msg, n;
local args = Broker::event_args(event_handler, "ping", event_count);
Broker::event("bro/event/hi", args);
Broker::send_event("bro/event/hi", args);
++event_count;
}

View file

@ -35,7 +35,7 @@ event Broker::print_handler(msg: string)
return;
}
Broker::print("bro/print/my_topic", fmt("pong %d", messages_sent));
Broker::send_print("bro/print/my_topic", fmt("pong %d", messages_sent));
++messages_sent;
}
@ -62,7 +62,7 @@ event Broker::outgoing_connection_established(peer_address: string,
peer_name: string)
{
print "Broker::outgoing_connection_established", peer_address, peer_port;
Broker::print("bro/print/hi", fmt("ping %d", messages_sent));
Broker::send_print("bro/print/hi", fmt("ping %d", messages_sent));
++messages_sent;
}
@ -76,7 +76,7 @@ event Broker::print_handler(msg: string)
{
++messages_recv;
print "got print msg", msg;
Broker::print("bro/print/hi", fmt("ping %d", messages_sent));
Broker::send_print("bro/print/hi", fmt("ping %d", messages_sent));
++messages_sent;
}

View file

@ -105,14 +105,14 @@ event NetControl::acld_add_rule(id: count, r: NetControl::Rule, ar: NetControl::
{
print "add_rule", id, r$entity, r$ty, ar;
Broker::event("bro/event/netcontroltest", Broker::event_args(NetControl::acld_rule_added, id, r, ar$command));
Broker::send_event("bro/event/netcontroltest", Broker::event_args(NetControl::acld_rule_added, id, r, ar$command));
}
event NetControl::acld_remove_rule(id: count, r: NetControl::Rule, ar: NetControl::AclRule)
{
print "remove_rule", id, r$entity, r$ty, ar;
Broker::event("bro/event/netcontroltest", Broker::event_args(NetControl::acld_rule_removed, id, r, ar$command));
Broker::send_event("bro/event/netcontroltest", Broker::event_args(NetControl::acld_rule_removed, id, r, ar$command));
if ( r$cid == 4 )
terminate();

View file

@ -98,14 +98,14 @@ event NetControl::acld_add_rule(id: count, r: NetControl::Rule, ar: NetControl::
{
print "add_rule", id, r$entity, r$ty, ar;
Broker::event("bro/event/netcontroltest", Broker::event_args(NetControl::acld_rule_added, id, r, ar$command));
Broker::send_event("bro/event/netcontroltest", Broker::event_args(NetControl::acld_rule_added, id, r, ar$command));
}
event NetControl::acld_remove_rule(id: count, r: NetControl::Rule, ar: NetControl::AclRule)
{
print "remove_rule", id, r$entity, r$ty, ar;
Broker::event("bro/event/netcontroltest", Broker::event_args(NetControl::acld_rule_removed, id, r, ar$command));
Broker::send_event("bro/event/netcontroltest", Broker::event_args(NetControl::acld_rule_removed, id, r, ar$command));
if ( r$cid == 4 )
terminate();

View file

@ -89,15 +89,15 @@ event NetControl::broker_add_rule(id: count, r: NetControl::Rule)
{
print "add_rule", id, r$entity, r$ty;
Broker::event("bro/event/netcontroltest", Broker::event_args(NetControl::broker_rule_added, id, r, ""));
Broker::send_event("bro/event/netcontroltest", Broker::event_args(NetControl::broker_rule_added, id, r, ""));
}
event NetControl::broker_remove_rule(id: count, r: NetControl::Rule)
{
print "remove_rule", id, r$entity, r$ty;
Broker::event("bro/event/netcontroltest", Broker::event_args(NetControl::broker_rule_timeout, id, r, NetControl::FlowInfo()));
Broker::event("bro/event/netcontroltest", Broker::event_args(NetControl::broker_rule_removed, id, r, ""));
Broker::send_event("bro/event/netcontroltest", Broker::event_args(NetControl::broker_rule_timeout, id, r, NetControl::FlowInfo()));
Broker::send_event("bro/event/netcontroltest", Broker::event_args(NetControl::broker_rule_removed, id, r, ""));
if ( r$cid == 3 )
terminate();

View file

@ -104,8 +104,8 @@ function got_message()
event OpenFlow::broker_flow_mod(name: string, dpid: count, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod)
{
print "got flow_mod", dpid, match, flow_mod;
Broker::event("bro/event/openflow", Broker::event_args(OpenFlow::flow_mod_success, name, match, flow_mod, ""));
Broker::event("bro/event/openflow", Broker::event_args(OpenFlow::flow_mod_failure, name, match, flow_mod, ""));
Broker::send_event("bro/event/openflow", Broker::event_args(OpenFlow::flow_mod_success, name, match, flow_mod, ""));
Broker::send_event("bro/event/openflow", Broker::event_args(OpenFlow::flow_mod_failure, name, match, flow_mod, ""));
got_message();
}