:tocdepth: 3

base/frameworks/broker/main.bro
===============================
.. bro:namespace:: BrokerComm
.. bro:namespace:: BrokerStore

Various data structure definitions for use with Bro's communication system.

:Namespaces: BrokerComm, BrokerStore
:Source File: :download:`/scripts/base/frameworks/broker/main.bro`

Summary
~~~~~~~
Options
#######
========================================================================== ===============================================
:bro:id:`BrokerComm::endpoint_name`: :bro:type:`string` :bro:attr:`&redef` A name used to identify this endpoint to peers.
========================================================================== ===============================================

Types
#####
=========================================================== =======================================================================
:bro:type:`BrokerComm::Data`: :bro:type:`record`            Opaque communication data.
:bro:type:`BrokerComm::DataVector`: :bro:type:`vector`      Opaque communication data.
:bro:type:`BrokerComm::EndpointFlags`: :bro:type:`record`   Change communication behavior.
:bro:type:`BrokerComm::EventArgs`: :bro:type:`record`       Opaque event communication data.
:bro:type:`BrokerComm::SendFlags`: :bro:type:`record`       Fine-grained tuning of communication behavior for a particular message.
:bro:type:`BrokerComm::TableItem`: :bro:type:`record`       Opaque communication data used as a convenient way to wrap key-value
                                                            pairs that comprise table entries.
:bro:type:`BrokerStore::BackendOptions`: :bro:type:`record` Options to tune the particular storage backends.
:bro:type:`BrokerStore::ExpiryTime`: :bro:type:`record`     An expiry time for a key-value pair inserted in to a data store.
:bro:type:`BrokerStore::QueryResult`: :bro:type:`record`    The result of a data store query.
:bro:type:`BrokerStore::QueryStatus`: :bro:type:`enum`      Whether a data store query could be completed or not.
:bro:type:`BrokerStore::RocksDBOptions`: :bro:type:`record` Options to tune the RocksDB storage backend.
:bro:type:`BrokerStore::SQLiteOptions`: :bro:type:`record`  Options to tune the SQLite storage backend.
=========================================================== =======================================================================


Detailed Interface
~~~~~~~~~~~~~~~~~~
Options
#######
.. bro:id:: BrokerComm::endpoint_name

   :Type: :bro:type:`string`
   :Attributes: :bro:attr:`&redef`
   :Default: ``""``

   A name used to identify this endpoint to peers.
   .. bro:see:: BrokerComm::connect BrokerComm::listen

Types
#####
.. bro:type:: BrokerComm::Data

   :Type: :bro:type:`record`

      d: :bro:type:`opaque` of BrokerComm::Data :bro:attr:`&optional`

   Opaque communication data.

.. bro:type:: BrokerComm::DataVector

   :Type: :bro:type:`vector` of :bro:type:`BrokerComm::Data`

   Opaque communication data.

.. bro:type:: BrokerComm::EndpointFlags

   :Type: :bro:type:`record`

      auto_publish: :bro:type:`bool` :bro:attr:`&default` = ``T`` :bro:attr:`&optional`
         Whether to restrict message topics that can be published to peers.

      auto_advertise: :bro:type:`bool` :bro:attr:`&default` = ``T`` :bro:attr:`&optional`
         Whether to restrict what message topics or data store identifiers
         the local endpoint advertises to peers (e.g. subscribing to
         events or making a master data store available).

   Change communication behavior.

.. bro:type:: BrokerComm::EventArgs

   :Type: :bro:type:`record`

      name: :bro:type:`string` :bro:attr:`&optional`
         The name of the event.  Not set if invalid event or arguments.

      args: :bro:type:`BrokerComm::DataVector`
         The arguments to the event.

   Opaque event communication data.

.. bro:type:: BrokerComm::SendFlags

   :Type: :bro:type:`record`

      self: :bro:type:`bool` :bro:attr:`&default` = ``F`` :bro:attr:`&optional`
         Send the message to the local endpoint.

      peers: :bro:type:`bool` :bro:attr:`&default` = ``T`` :bro:attr:`&optional`
         Send the message to peer endpoints that advertise interest in
         the topic associated with the message.

      unsolicited: :bro:type:`bool` :bro:attr:`&default` = ``F`` :bro:attr:`&optional`
         Send the message to peer endpoints even if they don't advertise
         interest in the topic associated with the message.

   Fine-grained tuning of communication behavior for a particular message.

.. bro:type:: BrokerComm::TableItem

   :Type: :bro:type:`record`

      key: :bro:type:`BrokerComm::Data`

      val: :bro:type:`BrokerComm::Data`

   Opaque communication data used as a convenient way to wrap key-value
   pairs that comprise table entries.

.. bro:type:: BrokerStore::BackendOptions

   :Type: :bro:type:`record`

      sqlite: :bro:type:`BrokerStore::SQLiteOptions` :bro:attr:`&default` = ``[path=store.sqlite]`` :bro:attr:`&optional`

      rocksdb: :bro:type:`BrokerStore::RocksDBOptions` :bro:attr:`&default` = ``[path=store.rocksdb]`` :bro:attr:`&optional`

   Options to tune the particular storage backends.

.. bro:type:: BrokerStore::ExpiryTime

   :Type: :bro:type:`record`

      absolute: :bro:type:`time` :bro:attr:`&optional`
         Absolute point in time at which to expire the entry.

      since_last_modification: :bro:type:`interval` :bro:attr:`&optional`
         A point in time relative to the last modification time at which
         to expire the entry.  New modifications will delay the expiration.

   An expiry time for a key-value pair inserted in to a data store.

.. bro:type:: BrokerStore::QueryResult

   :Type: :bro:type:`record`

      status: :bro:type:`BrokerStore::QueryStatus`
         Whether the query completed or not.

      result: :bro:type:`BrokerComm::Data`
         The result of the query.  Certain queries may use a particular
         data type (e.g. querying store size always returns a count, but
         a lookup may return various data types).

   The result of a data store query.

.. bro:type:: BrokerStore::QueryStatus

   :Type: :bro:type:`enum`

      .. bro:enum:: BrokerStore::SUCCESS BrokerStore::QueryStatus

      .. bro:enum:: BrokerStore::FAILURE BrokerStore::QueryStatus

   Whether a data store query could be completed or not.

.. bro:type:: BrokerStore::RocksDBOptions

   :Type: :bro:type:`record`

      path: :bro:type:`string` :bro:attr:`&default` = ``"store.rocksdb"`` :bro:attr:`&optional`
         File system path of the database.

   Options to tune the RocksDB storage backend.

.. bro:type:: BrokerStore::SQLiteOptions

   :Type: :bro:type:`record`

      path: :bro:type:`string` :bro:attr:`&default` = ``"store.sqlite"`` :bro:attr:`&optional`
         File system path of the database.

   Options to tune the SQLite storage backend.


