Commit graph

40 commits

Author SHA1 Message Date
Jon Siwek
b2923f5528 Documentation improvements/fixes 2018-05-23 16:50:31 -05:00
Robin Sommer
d6cddffe32 Merge remote-tracking branch 'origin/master'
* origin/master:
  Update link to flex pattern docs
2018-05-21 21:38:19 +00:00
Jon Siwek
ed7b0b3503 Update link to flex pattern docs 2018-05-21 13:38:04 -05:00
Robin Sommer
fe7e1ee7f0 Merge topic/actor-system throug a squashed commit. 2018-05-18 22:39:23 +00:00
Daniel Thayer
79afd99229 Add documentation of "option" declarations 2018-03-15 14:29:26 -05:00
Johanna Amann
db6f028003 Add config framework.
The configuration framework consists of three mostly distinct parts:

* option variables
* the config reader
* the script level framework

I will describe the three elements in the following.

Internally, this commit also performs a range of changes to the Input
manager; it marks a lot of functions as const and introduces a new
ValueToVal method (which could in theory replace the already existing
one - it is a bit more powerful).

This also changes SerialTypes to have a subtype for Values, just as
Fields already have it; I think it was mostly an oversight that this was
not introduced from the beginning. This should not necessitate any code
changes for people already using SerialTypes.

option variable
===============

The option keyword allows variables to be specified as run-tine options.
Such variables cannot be changed using normal assignments. Instead, they
can be changed using Option::set. It is possible to "subscribe" to
options and be notified when an option value changes.

Change handlers can also change values before they are applied; this
gives them the opportunity to reject changes. Priorities can be
specified if there are several handlers for one option.

Example script:

option testbool: bool = T;

function option_changed(ID: string, new_value: bool): bool
  {
  print fmt("Value of %s changed from %s to %s", ID, testbool, new_value);
  return new_value;
  }

event bro_init()
  {
  print "Old value", testbool;
  Option::set_change_handler("testbool", option_changed);
  Option::set("testbool", F);
  print "New value", testbool;
  }

config reader
=============

The config reader provides a way to read configuration files back into
Bro. Most importantly it automatically converts values to the correct
types. This is important because it is at least inconvenient (and
sometimes near impossible) to perform the necessary type conversions in
Bro scripts themselves. This is especially true for sets/vectors.

Configuration generally look like this:

[option name][tab/spaces][new variable value]

so, for example:

testaddr 2607:f8b0:4005:801::200e
testinterval 60
testtime 1507321987
test_set a	b	c	d	erdbeerschnitzel

The reader uses the option name to look up the type that variable has in
the Bro core and automatically converts the value to the correct type.

Example script use:

type Idx: record {
  option_name: string;
};

type Val: record {
  option_val: string;
};

global currconfig: table[string] of string = table();

event InputConfig::new_value(name: string, source: string, id: string, value: any)
  {
  print id, value;
  }

event bro_init()
  {
  Input::add_table([$reader=Input::READER_CONFIG, $source="../configfile", $name="configuration", $idx=Idx, $val=Val, $destination=currconfig, $want_record=F]);
  }

Script-level config framework
=============================

The script-level framework ties these two features together and makes
them a bit more convenient to use. Configuration files can simply be
specified by placing them into Config::config_files. The framework also
creates a config.log that shows all value changes that took place.

Usage example:

redef Config::config_files += {configfile};

export {
  option testbool : bool = F;
}

The file is now monitored for changes; when a change occurs the
respective option values are automatically updated and the value change
is written to config.log.
2017-11-29 13:46:59 -08:00
Johanna Amann
9594f69598 SSL: Update OCSP/SCT scripts and documentation. 2017-07-27 16:22:40 -07:00
Daniel Thayer
d1ec71b132 List new log files in the log-files.rst document 2016-10-08 00:32:51 -05:00
Johanna Amann
46aafdc87b Merge branch 'patch-4' of https://github.com/moshekaplan/bro
* 'patch-4' of https://github.com/moshekaplan/bro:
  Clarified string documentation
2016-09-19 15:28:39 -07:00
Moshe Kaplan
ca46edbb42 Clarified string documentation 2016-09-14 15:15:56 -04:00
Moshe Kaplan
b1e47eb71f Added String slicing (subscript) examples 2016-08-02 08:45:23 -04:00
Robin Sommer
09ea84bb6e Merge remote-tracking branch 'origin/topic/johanna/netcontrol-improvements'
Great work, and great documentation!

I'm getting one test failure with
scripts.base.frameworks.netcontrol.catch-and-release-cluster Going
ahead and commiting, Jenkins will show the details I assume.

BIT-1584 #merged

* origin/topic/johanna/netcontrol-improvements:
  SMTP does not need to pull in the notice framework.
  Write NetControl framework documentation.
  Use NetControl for ACTION_DROP of notice framework.
  NetControl: slightly update catch and release logging
  NetControl: fix several small logging issues
  NetControl: more catch and release logging and cluster fix
  NetControl: rewrite catch and release and small fixes.
  NetControl: find_rules_subnet works in cluster mode
  NetControl: fix acld whitelist command
  NetControl: add rule exists as state besides added and failure.
  NetControl: Suppress duplicate "plugin activated" messages.
  NetControl: make new broker plugin options accessible
  NetControl: add predicates to broker plugin
2016-06-30 17:34:44 -07:00
Johanna Amann
971f7e236f Fix a number of documentation building errors 2016-06-27 12:41:40 -07:00
Johanna Amann
f1267b0b94 Write NetControl framework documentation.
In the process, some of the script documentation of the NetControl
framework was also updated.
2016-06-22 16:02:48 -07:00
Daniel Thayer
2d9127888f Add some missing Bro script documentation
Also fixed a few reST formatting issues.
2016-05-05 16:35:31 -05:00
Daniel Thayer
f54a5b52e5 Improve documentation of the "for" statement 2016-04-12 15:40:18 -05:00
Daniel Thayer
c1d7337a73 Improve documentation of Bro script statements
Added more documentation of the "delete" statement.  Removed some other
text that was probably more confusing than helpful.
2016-01-12 15:35:29 -06:00
Daniel Thayer
bebd08484c Clarifications to the script reference docs 2015-09-07 03:35:23 -05:00
Daniel Thayer
c6dec18e2b Improve documentation of table and set types
Add a list of the types that are not allowed to be the index type
of a table or set.
2015-08-17 16:24:02 -05:00
Daniel Thayer
4db9b8d792 Update the "Log Files" documentation 2015-06-01 14:26:09 -05:00
Daniel Thayer
d0e304de46 Update script language reference documentation 2015-05-30 01:35:55 -05:00
Jon Siwek
739b295611 Improve documentation of 'for' loop iterator invalidation.
BIT-978 #close
2015-03-20 16:29:10 -05:00
Jon Siwek
778b37b5d0 Deprecate &rotate_interval, &rotate_size, &encrypt, &mergeable.
Addresses BIT-1305.
2015-03-13 14:54:46 -05:00
Robin Sommer
abcb8e7c95 Merge remote-tracking branch 'origin/topic/jsiwek/while'
Added documentation to statement reference.

* origin/topic/jsiwek/while:
  Add 'while' statement to Bro language.

BIT-1315 #merged
2015-02-20 12:59:39 -08:00
Jon Siwek
7b2316262d Update documentation (broken links, outdated tests). 2015-01-21 16:38:31 -06:00
Robin Sommer
21a0e12d82 Merge remote-tracking branch 'origin/topic/jdopheid/BIT-1242'
* origin/topic/jdopheid/BIT-1242:
  Improved the log file reference documentation
  Added missing log files prof, stderr, stdout
  Add a test that detects changes in the list of all Bro log files
  Broke down logs into grouped sections based on use & origin
  Adding deatils for modbus_register_change.log
  More updates to log files page: descriptions
  Changing name of file
  New page for List of Log files, linked to script-reference

Very nice. I've reorganized slightly more, mostly to shrink down the
"other" category: moved some of that into "Detection" and "Files" (the
latter is small, but will hopefully grow).

BIT-1242 #merged
2014-10-07 14:35:19 -07:00
Robin Sommer
175ff9cf2d Merge remote-tracking branch 'origin/topic/dnthayer/langref'
* origin/topic/dnthayer/langref:
  Minor improvements to script language reference docs
  Add more script language reference documentation
  Split the types and attributes reference doc into two docs

Wow, this is great!

BIT-1269 #merged
2014-10-07 14:18:08 -07:00
Daniel Thayer
f24adc1a95 Minor improvements to script language reference docs 2014-10-06 13:27:21 -05:00
Daniel Thayer
c16384b914 Improved the log file reference documentation
Reorganized the log file reference documentation, improved some of the
descriptions, and corrected a typo in a log filename.  Also removed
non-ascii characters that somehow got in the text.
2014-09-30 00:45:28 -05:00
Jeannette Dopheide
999f846abe Added missing log files prof, stderr, stdout 2014-09-29 10:50:46 -05:00
Jeannette Dopheide
16c70a5179 Broke down logs into grouped sections based on use & origin 2014-09-25 10:22:46 -05:00
Jeannette Dopheide
e402a224d8 Adding deatils for modbus_register_change.log 2014-09-23 08:53:54 -05:00
Jeannette Dopheide
14940c2d89 More updates to log files page: descriptions 2014-09-22 10:59:05 -05:00
Jeannette Dopheide
401ec39ce2 Changing name of file 2014-09-16 09:49:48 -05:00
Jeannette Dopheide
36efc8253d New page for List of Log files, linked to script-reference 2014-09-15 10:57:32 -05:00
Daniel Thayer
5c9a7a92a4 Add more script language reference documentation
Added new sections on operators, statements, and directives.  Also
improved the documentation on types and attributes by providing more
examples and added a chart on the top of each page with links to
each type and attribute for easier access to the information.
2014-09-04 13:32:24 -05:00
Daniel Thayer
22aa821506 Split the types and attributes reference doc into two docs
Also moved them up in the index so that the more fundamental material
comes before the more advanced material in the table of contents.
2014-07-31 10:49:33 -05:00
Daniel Thayer
0a90ddc1dd Merge remote-tracking branch 'origin/master' into topic/dnthayer/doc-updates 2013-12-18 14:35:22 -06:00
Jon Siwek
7e0864468c A couple documentation fixes.
- Move notice index wrapper doc to doc/script-reference -- doc/scripts
  no longer contains any static documentation because that location
  will be managed by Bro to generate per-script docs.

- :doc: references for generated per-script docs now need the ".bro"
  suffix.  (IMO this is better since it directly mirrors the actual
  script's file name and can't be confused w/ a package).
2013-11-21 15:59:07 -06:00
Jon Siwek
9967aea52c Integrate new Broxygen functionality into Sphinx.
Add a "broxygen" domain Sphinx extension w/ directives to allow
on-the-fly documentation to be generated w/ Bro and included in files.

This means all autogenerated reST docs are now done by Bro.  The odd
CMake/Python glue scipts which used to generate some portions are now
gone.  Bro and the Sphinx extension handle checking for outdated docs
themselves.

Parallel builds of `make doc` target should now work (mostly because
I don't think there's any tasks that can be done in parallel anymore).

Overall, this seems to simplify things and make the Broxygen-generated
portions of the documentation visible/traceable from the main Sphinx
source tree.  The one odd thing still is that per-script documentation
is rsync'd in to a shadow copy of the Sphinx source tree within the
build dir.  This is less elegant than using the new broxygen extension
to make per-script docs, but rsync is faster and simpler.  Simpler as in
less code because it seems like, in the best case, I'd need to write a
custom Sphinx Builder to be able to get that to even work.
2013-11-21 14:34:32 -06:00