mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/master' into topic/johanna/remove-deprecated-functions-events
This commit is contained in:
commit
4c19e60488
90 changed files with 719 additions and 580 deletions
33
CHANGES
33
CHANGES
|
@ -1,4 +1,37 @@
|
||||||
|
|
||||||
|
2.6-264 | 2019-05-03 11:16:38 -0700
|
||||||
|
|
||||||
|
* Fix sporadic openflow/broker test failure (Jon Siwek, Corelight)
|
||||||
|
|
||||||
|
2.6-263 | 2019-05-02 22:49:40 -0700
|
||||||
|
|
||||||
|
* Install local.zeek as symlink to pre-existing local.bro (Jon Siwek, Corelight)
|
||||||
|
|
||||||
|
This a convenience for those that are upgrading. If we didn't do
|
||||||
|
this, then deployments can silently break until the user intervenes
|
||||||
|
since BroControl now prefers to load the initially-vanilla local.zeek
|
||||||
|
instead of the formerly-customized local.bro.
|
||||||
|
|
||||||
|
2.6-262 | 2019-05-02 21:39:01 -0700
|
||||||
|
|
||||||
|
* Rename Zeexygen to Zeekygen (Jon Siwek, Corelight)
|
||||||
|
|
||||||
|
2.6-261 | 2019-05-02 20:49:23 -0700
|
||||||
|
|
||||||
|
* Remove previously deprecated policy/protocols/smb/__load__ (Jon Siwek, Corelight)
|
||||||
|
|
||||||
|
2.6-260 | 2019-05-02 19:16:48 -0700
|
||||||
|
|
||||||
|
* GH-243: Remove deprecated functions/events from 2.6 and earlier (Johanna Amann, Corelight)
|
||||||
|
|
||||||
|
2.6-258 | 2019-05-02 12:26:54 -0700
|
||||||
|
|
||||||
|
* GH-340: Improve IPv4/IPv6 regexes, extraction, and validity functions.
|
||||||
|
|
||||||
|
is_valid_ip() is not a BIF, the IP regular expressions are improved and
|
||||||
|
extract_ip_addresses should give better results due to this.
|
||||||
|
(Jon Siwek, Corelight)
|
||||||
|
|
||||||
2.6-255 | 2019-05-01 08:38:49 -0700
|
2.6-255 | 2019-05-01 08:38:49 -0700
|
||||||
|
|
||||||
* Add methods to queue events without handler existence check
|
* Add methods to queue events without handler existence check
|
||||||
|
|
19
NEWS
19
NEWS
|
@ -80,10 +80,13 @@ Changed Functionality
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
- ``$prefix/share/bro/site/local.bro`` has been renamed to
|
- ``$prefix/share/bro/site/local.bro`` has been renamed to
|
||||||
``local.zeek``. If you have made customizations to that file, it
|
``local.zeek``. If you have a ``local.bro`` file from a previous
|
||||||
will no longer be loaded by default by BroControl (ZeekControl),
|
installation, possibly with customizations made to it, the new
|
||||||
but you can simply copy it to ``local.zeek`. You may also want to
|
version of Zeek will install a ``local.zeek`` file that is a symlink
|
||||||
remove old ``local.bro`` files to avoid potential confusion.
|
to the pre-existing ``local.bro``. In that case, you may want to
|
||||||
|
just copy ``local.bro`` into the new ``local.zeek`` location to
|
||||||
|
avoid confusion, but things are otherwise meant to work properly
|
||||||
|
without intervention.
|
||||||
|
|
||||||
- All scripts ending in ``.bro`` that ship with the Zeek source tree have
|
- All scripts ending in ``.bro`` that ship with the Zeek source tree have
|
||||||
been renamed to ``.zeek``.
|
been renamed to ``.zeek``.
|
||||||
|
@ -180,10 +183,10 @@ Changed Functionality
|
||||||
and aren't counted as true gaps.
|
and aren't counted as true gaps.
|
||||||
|
|
||||||
- The Broxygen component, which is used to generate our Doxygen-like
|
- The Broxygen component, which is used to generate our Doxygen-like
|
||||||
scripting API documentation has been renamed to Zeexygen. This likely has
|
scripting API documentation has been renamed to Zeekygen. This likely has
|
||||||
no breaking or visible changes for most users, except in the case one
|
no breaking or visible changes for most users, except in the case one
|
||||||
used it to generate their own documentation via the ``--broxygen`` flag,
|
used it to generate their own documentation via the ``--broxygen`` flag,
|
||||||
which is now named ``--zeexygen``. Besides that, the various documentation
|
which is now named ``--zeekygen``. Besides that, the various documentation
|
||||||
in scripts has also been updated to replace Sphinx cross-referencing roles
|
in scripts has also been updated to replace Sphinx cross-referencing roles
|
||||||
and directives like ":bro:see:" with ":zeek:zee:".
|
and directives like ":bro:see:" with ":zeek:zee:".
|
||||||
|
|
||||||
|
@ -247,6 +250,10 @@ Removed Functionality
|
||||||
- ``remote_log``
|
- ``remote_log``
|
||||||
- ``finished_send_state``
|
- ``finished_send_state``
|
||||||
- ``remote_pong``
|
- ``remote_pong``
|
||||||
|
- ``finished_send_state``
|
||||||
|
|
||||||
|
- The deprecated script ``policy/protocols/smb/__load__.bro`` was removed.
|
||||||
|
Instead of ``@load policy/protocols/smb`` use ``@load base/protocols/smb``.
|
||||||
|
|
||||||
Deprecated Functionality
|
Deprecated Functionality
|
||||||
------------------------
|
------------------------
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.6-255
|
2.6-264
|
||||||
|
|
2
doc
2
doc
|
@ -1 +1 @@
|
||||||
Subproject commit 5915e8d7e24a77bb9bc2a7061790f8efbe871458
|
Subproject commit 8aa690e20d19f79805d7f680e454e4ea10231add
|
|
@ -99,7 +99,7 @@ Record process status in file
|
||||||
\fB\-W\fR,\ \-\-watchdog
|
\fB\-W\fR,\ \-\-watchdog
|
||||||
activate watchdog timer
|
activate watchdog timer
|
||||||
.TP
|
.TP
|
||||||
\fB\-X\fR,\ \-\-zeexygen <cfgfile>
|
\fB\-X\fR,\ \-\-zeekygen <cfgfile>
|
||||||
generate documentation based on config file
|
generate documentation based on config file
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-pseudo\-realtime[=\fR<speedup>]
|
\fB\-\-pseudo\-realtime[=\fR<speedup>]
|
||||||
|
@ -150,7 +150,7 @@ ASCII log file extension
|
||||||
Output file for script execution statistics
|
Output file for script execution statistics
|
||||||
.TP
|
.TP
|
||||||
.B BRO_DISABLE_BROXYGEN
|
.B BRO_DISABLE_BROXYGEN
|
||||||
Disable Zeexygen (Broxygen) documentation support
|
Disable Zeekygen (Broxygen) documentation support
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
.B bro
|
.B bro
|
||||||
was written by The Bro Project <info@bro.org>.
|
was written by The Bro Project <info@bro.org>.
|
||||||
|
|
|
@ -8,8 +8,27 @@ install(DIRECTORY ./ DESTINATION ${BRO_SCRIPT_INSTALL_PATH} FILES_MATCHING
|
||||||
PATTERN "*.fp"
|
PATTERN "*.fp"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install all local* scripts as config files since they are meant to be
|
if ( NOT BINARY_PACKAGING_MODE )
|
||||||
# user modify-able.
|
# If the user has a local.bro file from a previous installation, prefer to
|
||||||
|
# symlink local.zeek to it to avoid breaking their custom configuration --
|
||||||
|
# because BroControl will now prefer to load local.zeek rather than local.bro
|
||||||
|
# and we're about to install a default version of local.zeek.
|
||||||
|
|
||||||
|
set(_local_bro_dst ${BRO_SCRIPT_INSTALL_PATH}/site/local.bro)
|
||||||
|
set(_local_zeek_dst ${BRO_SCRIPT_INSTALL_PATH}/site/local.zeek)
|
||||||
|
|
||||||
|
install(CODE "
|
||||||
|
if ( \"\$ENV{DESTDIR}\" STREQUAL \"\" )
|
||||||
|
if ( EXISTS \"${_local_bro_dst}\" AND NOT EXISTS \"${_local_zeek_dst}\" )
|
||||||
|
message(STATUS \"WARNING: installed ${_local_zeek_dst} as symlink to ${_local_bro_dst}\")
|
||||||
|
execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink
|
||||||
|
\"${_local_bro_dst}\" \"${_local_zeek_dst}\")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Install local script as a config file since it's meant to be modified directly.
|
||||||
InstallPackageConfigFile(
|
InstallPackageConfigFile(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/site/local.zeek
|
${CMAKE_CURRENT_SOURCE_DIR}/site/local.zeek
|
||||||
${BRO_SCRIPT_INSTALL_PATH}/site
|
${BRO_SCRIPT_INSTALL_PATH}/site
|
||||||
|
|
|
@ -1,31 +1,67 @@
|
||||||
##! Functions for parsing and manipulating IP and MAC addresses.
|
##! Functions for parsing and manipulating IP and MAC addresses.
|
||||||
|
|
||||||
# Regular expressions for matching IP addresses in strings.
|
# Regular expressions for matching IP addresses in strings.
|
||||||
const ipv4_addr_regex = /[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}/;
|
|
||||||
const ipv6_8hex_regex = /([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}/;
|
|
||||||
const ipv6_compressed_hex_regex = /(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)::(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)/;
|
|
||||||
const ipv6_hex4dec_regex = /(([0-9A-Fa-f]{1,4}:){6,6})([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/;
|
|
||||||
const ipv6_compressed_hex4dec_regex = /(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)::(([0-9A-Fa-f]{1,4}:)*)([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/;
|
|
||||||
|
|
||||||
# These are commented out until patterns can be constructed this way at init time.
|
const ipv4_decim = /[0-9]{1}|[0-9]{2}|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5]/;
|
||||||
#const ipv6_addr_regex = ipv6_8hex_regex |
|
|
||||||
# ipv6_compressed_hex_regex |
|
|
||||||
# ipv6_hex4dec_regex |
|
|
||||||
# ipv6_compressed_hex4dec_regex;
|
|
||||||
#const ip_addr_regex = ipv4_addr_regex | ipv6_addr_regex;
|
|
||||||
|
|
||||||
const ipv6_addr_regex =
|
const ipv4_addr_regex = ipv4_decim & /\./ & ipv4_decim & /\./ & ipv4_decim & /\./ & ipv4_decim;
|
||||||
/([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}/ |
|
|
||||||
/(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)::(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)/ | # IPv6 Compressed Hex
|
|
||||||
/(([0-9A-Fa-f]{1,4}:){6,6})([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/ | # 6Hex4Dec
|
|
||||||
/(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)::(([0-9A-Fa-f]{1,4}:)*)([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/; # CompressedHex4Dec
|
|
||||||
|
|
||||||
const ip_addr_regex =
|
const ipv6_hextet = /[0-9A-Fa-f]{1,4}/;
|
||||||
/[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}/ |
|
|
||||||
/([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}/ |
|
const ipv6_8hex_regex = /([0-9A-Fa-f]{1,4}:){7}/ & ipv6_hextet;
|
||||||
/(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)::(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)/ | # IPv6 Compressed Hex
|
|
||||||
/(([0-9A-Fa-f]{1,4}:){6,6})([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/ | # 6Hex4Dec
|
const ipv6_hex4dec_regex = /([0-9A-Fa-f]{1,4}:){6}/ & ipv4_addr_regex;
|
||||||
/(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4})*)?)::(([0-9A-Fa-f]{1,4}:)*)([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/; # CompressedHex4Dec
|
|
||||||
|
const ipv6_compressed_lead_hextets0 = /::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,6})?/;
|
||||||
|
|
||||||
|
const ipv6_compressed_lead_hextets1 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?/;
|
||||||
|
|
||||||
|
const ipv6_compressed_lead_hextets2 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){1}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,4})?/;
|
||||||
|
|
||||||
|
const ipv6_compressed_lead_hextets3 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){2}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,3})?/;
|
||||||
|
|
||||||
|
const ipv6_compressed_lead_hextets4 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){3}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,2})?/;
|
||||||
|
|
||||||
|
const ipv6_compressed_lead_hextets5 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){4}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,1})?/;
|
||||||
|
|
||||||
|
const ipv6_compressed_lead_hextets6 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){5}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,0})?/;
|
||||||
|
|
||||||
|
const ipv6_compressed_lead_hextets7 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){6}::/;
|
||||||
|
|
||||||
|
const ipv6_compressed_hex_regex = ipv6_compressed_lead_hextets0 |
|
||||||
|
ipv6_compressed_lead_hextets1 |
|
||||||
|
ipv6_compressed_lead_hextets2 |
|
||||||
|
ipv6_compressed_lead_hextets3 |
|
||||||
|
ipv6_compressed_lead_hextets4 |
|
||||||
|
ipv6_compressed_lead_hextets5 |
|
||||||
|
ipv6_compressed_lead_hextets6 |
|
||||||
|
ipv6_compressed_lead_hextets7;
|
||||||
|
|
||||||
|
const ipv6_compressed_hext4dec_lead_hextets0 = /::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,4})?/ & ipv4_addr_regex;
|
||||||
|
|
||||||
|
const ipv6_compressed_hext4dec_lead_hextets1 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,3})?/ & ipv4_addr_regex;
|
||||||
|
|
||||||
|
const ipv6_compressed_hext4dec_lead_hextets2 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){1}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,2})?/ & ipv4_addr_regex;
|
||||||
|
|
||||||
|
const ipv6_compressed_hext4dec_lead_hextets3 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){2}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,1})?/ & ipv4_addr_regex;
|
||||||
|
|
||||||
|
const ipv6_compressed_hext4dec_lead_hextets4 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){3}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,0})?/ & ipv4_addr_regex;
|
||||||
|
|
||||||
|
const ipv6_compressed_hext4dec_lead_hextets5 = /[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){4}::/ & ipv4_addr_regex;
|
||||||
|
|
||||||
|
const ipv6_compressed_hex4dec_regex = ipv6_compressed_hext4dec_lead_hextets0 |
|
||||||
|
ipv6_compressed_hext4dec_lead_hextets1 |
|
||||||
|
ipv6_compressed_hext4dec_lead_hextets2 |
|
||||||
|
ipv6_compressed_hext4dec_lead_hextets3 |
|
||||||
|
ipv6_compressed_hext4dec_lead_hextets4 |
|
||||||
|
ipv6_compressed_hext4dec_lead_hextets5;
|
||||||
|
|
||||||
|
const ipv6_addr_regex = ipv6_8hex_regex |
|
||||||
|
ipv6_compressed_hex_regex |
|
||||||
|
ipv6_hex4dec_regex |
|
||||||
|
ipv6_compressed_hex4dec_regex;
|
||||||
|
|
||||||
|
const ip_addr_regex = ipv4_addr_regex | ipv6_addr_regex;
|
||||||
|
|
||||||
## Checks if all elements of a string array are a valid octet value.
|
## Checks if all elements of a string array are a valid octet value.
|
||||||
##
|
##
|
||||||
|
@ -44,49 +80,6 @@ function has_valid_octets(octets: string_vec): bool
|
||||||
return T;
|
return T;
|
||||||
}
|
}
|
||||||
|
|
||||||
## Checks if a string appears to be a valid IPv4 or IPv6 address.
|
|
||||||
##
|
|
||||||
## ip_str: the string to check for valid IP formatting.
|
|
||||||
##
|
|
||||||
## Returns: T if the string is a valid IPv4 or IPv6 address format.
|
|
||||||
function is_valid_ip(ip_str: string): bool
|
|
||||||
{
|
|
||||||
local octets: string_vec;
|
|
||||||
if ( ip_str == ipv4_addr_regex )
|
|
||||||
{
|
|
||||||
octets = split_string(ip_str, /\./);
|
|
||||||
if ( |octets| != 4 )
|
|
||||||
return F;
|
|
||||||
|
|
||||||
return has_valid_octets(octets);
|
|
||||||
}
|
|
||||||
else if ( ip_str == ipv6_addr_regex )
|
|
||||||
{
|
|
||||||
if ( ip_str == ipv6_hex4dec_regex ||
|
|
||||||
ip_str == ipv6_compressed_hex4dec_regex )
|
|
||||||
{
|
|
||||||
# the regexes for hybrid IPv6-IPv4 address formats don't for valid
|
|
||||||
# octets within the IPv4 part, so do that now
|
|
||||||
octets = split_string(ip_str, /\./);
|
|
||||||
if ( |octets| != 4 )
|
|
||||||
return F;
|
|
||||||
|
|
||||||
# get rid of remaining IPv6 stuff in first octet
|
|
||||||
local tmp = split_string(octets[0], /:/);
|
|
||||||
octets[0] = tmp[|tmp| - 1];
|
|
||||||
|
|
||||||
return has_valid_octets(octets);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# pure IPv6 address formats that only use hex digits don't need
|
|
||||||
# any additional checks -- the regexes should be complete
|
|
||||||
return T;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return F;
|
|
||||||
}
|
|
||||||
|
|
||||||
## Extracts all IP (v4 or v6) address strings from a given string.
|
## Extracts all IP (v4 or v6) address strings from a given string.
|
||||||
##
|
##
|
||||||
## input: a string that may contain an IP address anywhere within it.
|
## input: a string that may contain an IP address anywhere within it.
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
@deprecated "Use '@load base/protocols/smb' instead"
|
|
||||||
|
|
||||||
@load base/protocols/smb
|
|
|
@ -83,7 +83,6 @@
|
||||||
@load protocols/modbus/track-memmap.zeek
|
@load protocols/modbus/track-memmap.zeek
|
||||||
@load protocols/mysql/software.zeek
|
@load protocols/mysql/software.zeek
|
||||||
@load protocols/rdp/indicate_ssl.zeek
|
@load protocols/rdp/indicate_ssl.zeek
|
||||||
#@load protocols/smb/__load__.zeek
|
|
||||||
@load protocols/smb/log-cmds.zeek
|
@load protocols/smb/log-cmds.zeek
|
||||||
@load protocols/smtp/blocklists.zeek
|
@load protocols/smtp/blocklists.zeek
|
||||||
@load protocols/smtp/detect-suspicious-orig.zeek
|
@load protocols/smtp/detect-suspicious-orig.zeek
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
This package is loaded during the process which automatically generates
|
This package is loaded during the process which automatically generates
|
||||||
reference documentation for all Zeek scripts (i.e. "Zeexygen"). Its only
|
reference documentation for all Zeek scripts (i.e. "Zeekygen"). Its only
|
||||||
purpose is to provide an easy way to load all known Zeek scripts plus any
|
purpose is to provide an easy way to load all known Zeek scripts plus any
|
||||||
extra scripts needed or used by the documentation process.
|
extra scripts needed or used by the documentation process.
|
|
@ -6,7 +6,6 @@
|
||||||
@load frameworks/control/controller.zeek
|
@load frameworks/control/controller.zeek
|
||||||
@load frameworks/files/extract-all-files.zeek
|
@load frameworks/files/extract-all-files.zeek
|
||||||
@load policy/misc/dump-events.zeek
|
@load policy/misc/dump-events.zeek
|
||||||
@load policy/protocols/smb/__load__.zeek
|
|
||||||
|
|
||||||
@load ./example.zeek
|
@load ./example.zeek
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
##! This is an example script that demonstrates Zeexygen-style
|
##! This is an example script that demonstrates Zeekygen-style
|
||||||
##! documentation. It generally will make most sense when viewing
|
##! documentation. It generally will make most sense when viewing
|
||||||
##! the script's raw source code and comparing to the HTML-rendered
|
##! the script's raw source code and comparing to the HTML-rendered
|
||||||
##! version.
|
##! version.
|
||||||
|
@ -13,12 +13,12 @@
|
||||||
##! There's also a custom role to reference any identifier node in
|
##! There's also a custom role to reference any identifier node in
|
||||||
##! the Zeek Sphinx domain that's good for "see alsos", e.g.
|
##! the Zeek Sphinx domain that's good for "see alsos", e.g.
|
||||||
##!
|
##!
|
||||||
##! See also: :zeek:see:`ZeexygenExample::a_var`,
|
##! See also: :zeek:see:`ZeekygenExample::a_var`,
|
||||||
##! :zeek:see:`ZeexygenExample::ONE`, :zeek:see:`SSH::Info`
|
##! :zeek:see:`ZeekygenExample::ONE`, :zeek:see:`SSH::Info`
|
||||||
##!
|
##!
|
||||||
##! And a custom directive does the equivalent references:
|
##! And a custom directive does the equivalent references:
|
||||||
##!
|
##!
|
||||||
##! .. zeek:see:: ZeexygenExample::a_var ZeexygenExample::ONE SSH::Info
|
##! .. zeek:see:: ZeekygenExample::a_var ZeekygenExample::ONE SSH::Info
|
||||||
|
|
||||||
# Comments that use a single pound sign (#) are not significant to
|
# Comments that use a single pound sign (#) are not significant to
|
||||||
# a script's auto-generated documentation, but ones that use a
|
# a script's auto-generated documentation, but ones that use a
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
# variable declarations to associate with the last-declared identifier.
|
# variable declarations to associate with the last-declared identifier.
|
||||||
#
|
#
|
||||||
# Generally, the auto-doc comments (##) are associated with the
|
# Generally, the auto-doc comments (##) are associated with the
|
||||||
# next declaration/identifier found in the script, but Zeexygen
|
# next declaration/identifier found in the script, but Zeekygen
|
||||||
# will track/render identifiers regardless of whether they have any
|
# will track/render identifiers regardless of whether they have any
|
||||||
# of these special comments associated with them.
|
# of these special comments associated with them.
|
||||||
#
|
#
|
||||||
|
@ -49,19 +49,19 @@
|
||||||
|
|
||||||
# "module" statements are self-documenting, don't use any ``##`` style
|
# "module" statements are self-documenting, don't use any ``##`` style
|
||||||
# comments with them.
|
# comments with them.
|
||||||
module ZeexygenExample;
|
module ZeekygenExample;
|
||||||
|
|
||||||
# Redefinitions of "Notice::Type" are self-documenting, but
|
# Redefinitions of "Notice::Type" are self-documenting, but
|
||||||
# more information can be supplied in two different ways.
|
# more information can be supplied in two different ways.
|
||||||
redef enum Notice::Type += {
|
redef enum Notice::Type += {
|
||||||
## Any number of this type of comment
|
## Any number of this type of comment
|
||||||
## will document "Zeexygen_One".
|
## will document "Zeekygen_One".
|
||||||
Zeexygen_One,
|
Zeekygen_One,
|
||||||
Zeexygen_Two, ##< Any number of this type of comment
|
Zeekygen_Two, ##< Any number of this type of comment
|
||||||
##< will document "ZEEXYGEN_TWO".
|
##< will document "ZEEKYGEN_TWO".
|
||||||
Zeexygen_Three,
|
Zeekygen_Three,
|
||||||
## Omitting comments is fine, and so is mixing ``##`` and ``##<``, but
|
## Omitting comments is fine, and so is mixing ``##`` and ``##<``, but
|
||||||
Zeexygen_Four, ##< it's probably best to use only one style consistently.
|
Zeekygen_Four, ##< it's probably best to use only one style consistently.
|
||||||
};
|
};
|
||||||
|
|
||||||
# All redefs are automatically tracked. Comments of the "##" form can be use
|
# All redefs are automatically tracked. Comments of the "##" form can be use
|
||||||
|
@ -110,7 +110,7 @@ export {
|
||||||
type ComplexRecord: record {
|
type ComplexRecord: record {
|
||||||
field1: count; ##< Counts something.
|
field1: count; ##< Counts something.
|
||||||
field2: bool; ##< Toggles something.
|
field2: bool; ##< Toggles something.
|
||||||
field3: SimpleRecord; ##< Zeexygen automatically tracks types
|
field3: SimpleRecord; ##< Zeekygen automatically tracks types
|
||||||
##< and cross-references are automatically
|
##< and cross-references are automatically
|
||||||
##< inserted in to generated docs.
|
##< inserted in to generated docs.
|
||||||
msg: string &default="blah"; ##< Attributes are self-documenting.
|
msg: string &default="blah"; ##< Attributes are self-documenting.
|
||||||
|
@ -163,9 +163,9 @@ export {
|
||||||
## Summarize "an_event" here.
|
## Summarize "an_event" here.
|
||||||
## Give more details about "an_event" here.
|
## Give more details about "an_event" here.
|
||||||
##
|
##
|
||||||
## ZeexygenExample::a_function should not be confused as a parameter
|
## ZeekygenExample::a_function should not be confused as a parameter
|
||||||
## in the generated docs, but it also doesn't generate a cross-reference
|
## in the generated docs, but it also doesn't generate a cross-reference
|
||||||
## link. Use the see role instead: :zeek:see:`ZeexygenExample::a_function`.
|
## link. Use the see role instead: :zeek:see:`ZeekygenExample::a_function`.
|
||||||
##
|
##
|
||||||
## name: Describe the argument here.
|
## name: Describe the argument here.
|
||||||
global an_event: event(name: string);
|
global an_event: event(name: string);
|
|
@ -143,7 +143,7 @@ set(bro_PLUGIN_LIBS CACHE INTERNAL "plugin libraries" FORCE)
|
||||||
|
|
||||||
add_subdirectory(analyzer)
|
add_subdirectory(analyzer)
|
||||||
add_subdirectory(broker)
|
add_subdirectory(broker)
|
||||||
add_subdirectory(zeexygen)
|
add_subdirectory(zeekygen)
|
||||||
add_subdirectory(file_analysis)
|
add_subdirectory(file_analysis)
|
||||||
add_subdirectory(input)
|
add_subdirectory(input)
|
||||||
add_subdirectory(iosource)
|
add_subdirectory(iosource)
|
||||||
|
|
|
@ -18,7 +18,7 @@ DebugLogger::Stream DebugLogger::streams[NUM_DBGS] = {
|
||||||
{ "dpd", 0, false }, { "tm", 0, false },
|
{ "dpd", 0, false }, { "tm", 0, false },
|
||||||
{ "logging", 0, false }, {"input", 0, false },
|
{ "logging", 0, false }, {"input", 0, false },
|
||||||
{ "threading", 0, false }, { "file_analysis", 0, false },
|
{ "threading", 0, false }, { "file_analysis", 0, false },
|
||||||
{ "plugins", 0, false }, { "zeexygen", 0, false },
|
{ "plugins", 0, false }, { "zeekygen", 0, false },
|
||||||
{ "pktio", 0, false }, { "broker", 0, false },
|
{ "pktio", 0, false }, { "broker", 0, false },
|
||||||
{ "scripts", 0, false}
|
{ "scripts", 0, false}
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@ enum DebugStream {
|
||||||
DBG_THREADING, // Threading system
|
DBG_THREADING, // Threading system
|
||||||
DBG_FILE_ANALYSIS, // File analysis
|
DBG_FILE_ANALYSIS, // File analysis
|
||||||
DBG_PLUGINS, // Plugin system
|
DBG_PLUGINS, // Plugin system
|
||||||
DBG_ZEEXYGEN, // Zeexygen
|
DBG_ZEEKYGEN, // Zeekygen
|
||||||
DBG_PKTIO, // Packet sources and dumpers.
|
DBG_PKTIO, // Packet sources and dumpers.
|
||||||
DBG_BROKER, // Broker communication
|
DBG_BROKER, // Broker communication
|
||||||
DBG_SCRIPTS, // Script initialization
|
DBG_SCRIPTS, // Script initialization
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "Serializer.h"
|
#include "Serializer.h"
|
||||||
#include "Scope.h"
|
#include "Scope.h"
|
||||||
#include "Traverse.h"
|
#include "Traverse.h"
|
||||||
#include "zeexygen/Manager.h"
|
#include "zeekygen/Manager.h"
|
||||||
|
|
||||||
ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export)
|
ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export)
|
||||||
{
|
{
|
||||||
|
@ -632,7 +632,7 @@ void ID::DescribeReSTShort(ODesc* d) const
|
||||||
if ( is_type )
|
if ( is_type )
|
||||||
d->Add(type_name(t));
|
d->Add(type_name(t));
|
||||||
else
|
else
|
||||||
d->Add(zeexygen_mgr->GetEnumTypeName(Name()).c_str());
|
d->Add(zeekygen_mgr->GetEnumTypeName(Name()).c_str());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -101,38 +101,44 @@ void IPAddr::ReverseMask(int top_bits_to_chop)
|
||||||
p[i] &= mask_bits[i];
|
p[i] &= mask_bits[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPAddr::Init(const std::string& s)
|
bool IPAddr::ConvertString(const char* s, in6_addr* result)
|
||||||
{
|
{
|
||||||
if ( s.find(':') == std::string::npos ) // IPv4.
|
for ( auto p = s; *p; ++p )
|
||||||
|
if ( *p == ':' )
|
||||||
|
// IPv6
|
||||||
|
return (inet_pton(AF_INET6, s, result->s6_addr) == 1);
|
||||||
|
|
||||||
|
// IPv4
|
||||||
|
// Parse the address directly instead of using inet_pton since
|
||||||
|
// some platforms have more sensitive implementations than others
|
||||||
|
// that can't e.g. handle leading zeroes.
|
||||||
|
int a[4];
|
||||||
|
int n = 0;
|
||||||
|
int match_count = sscanf(s, "%d.%d.%d.%d%n", a+0, a+1, a+2, a+3, &n);
|
||||||
|
|
||||||
|
if ( match_count != 4 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( s[n] != '\0' )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for ( auto i = 0; i < 4; ++i )
|
||||||
|
if ( a[i] < 0 || a[i] > 255 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint32_t addr = (a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3];
|
||||||
|
addr = htonl(addr);
|
||||||
|
memcpy(result->s6_addr, v4_mapped_prefix, sizeof(v4_mapped_prefix));
|
||||||
|
memcpy(&result->s6_addr[12], &addr, sizeof(uint32_t));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPAddr::Init(const char* s)
|
||||||
|
{
|
||||||
|
if ( ! ConvertString(s, &in6) )
|
||||||
{
|
{
|
||||||
memcpy(in6.s6_addr, v4_mapped_prefix, sizeof(v4_mapped_prefix));
|
reporter->Error("Bad IP address: %s", s);
|
||||||
|
memset(in6.s6_addr, 0, sizeof(in6.s6_addr));
|
||||||
// Parse the address directly instead of using inet_pton since
|
|
||||||
// some platforms have more sensitive implementations than others
|
|
||||||
// that can't e.g. handle leading zeroes.
|
|
||||||
int a[4];
|
|
||||||
int n = sscanf(s.c_str(), "%d.%d.%d.%d", a+0, a+1, a+2, a+3);
|
|
||||||
|
|
||||||
if ( n != 4 || a[0] < 0 || a[1] < 0 || a[2] < 0 || a[3] < 0 ||
|
|
||||||
a[0] > 255 || a[1] > 255 || a[2] > 255 || a[3] > 255 )
|
|
||||||
{
|
|
||||||
reporter->Error("Bad IP address: %s", s.c_str());
|
|
||||||
memset(in6.s6_addr, 0, sizeof(in6.s6_addr));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t addr = (a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3];
|
|
||||||
addr = htonl(addr);
|
|
||||||
memcpy(&in6.s6_addr[12], &addr, sizeof(uint32_t));
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( inet_pton(AF_INET6, s.c_str(), in6.s6_addr) <=0 )
|
|
||||||
{
|
|
||||||
reporter->Error("Bad IP address: %s", s.c_str());
|
|
||||||
memset(in6.s6_addr, 0, sizeof(in6.s6_addr));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
29
src/IPAddr.h
29
src/IPAddr.h
|
@ -68,7 +68,7 @@ public:
|
||||||
*/
|
*/
|
||||||
IPAddr(const std::string& s)
|
IPAddr(const std::string& s)
|
||||||
{
|
{
|
||||||
Init(s);
|
Init(s.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -366,6 +366,29 @@ public:
|
||||||
|
|
||||||
unsigned int MemoryAllocation() const { return padded_sizeof(*this); }
|
unsigned int MemoryAllocation() const { return padded_sizeof(*this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an IPv4 or IPv6 string into a network address structure
|
||||||
|
* (IPv6 or v4-to-v6-mapping in network bytes order).
|
||||||
|
*
|
||||||
|
* @param s the IPv4 or IPv6 string to convert (ASCII, NUL-terminated).
|
||||||
|
*
|
||||||
|
* @param result buffer that the caller supplies to store the result.
|
||||||
|
*
|
||||||
|
* @return whether the conversion was successful.
|
||||||
|
*/
|
||||||
|
static bool ConvertString(const char* s, in6_addr* result);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param s the IPv4 or IPv6 string to convert (ASCII, NUL-terminated).
|
||||||
|
*
|
||||||
|
* @return whether the string is a valid IP address
|
||||||
|
*/
|
||||||
|
static bool IsValid(const char* s)
|
||||||
|
{
|
||||||
|
in6_addr tmp;
|
||||||
|
return ConvertString(s, &tmp);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class IPPrefix;
|
friend class IPPrefix;
|
||||||
|
|
||||||
|
@ -373,9 +396,9 @@ private:
|
||||||
* Initializes an address instance from a string representation.
|
* Initializes an address instance from a string representation.
|
||||||
*
|
*
|
||||||
* @param s String containing an IP address as either a dotted IPv4
|
* @param s String containing an IP address as either a dotted IPv4
|
||||||
* address or a hex IPv6 address.
|
* address or a hex IPv6 address (ASCII, NUL-terminated).
|
||||||
*/
|
*/
|
||||||
void Init(const std::string& s);
|
void Init(const char* s);
|
||||||
|
|
||||||
in6_addr in6; // IPv6 or v4-to-v6-mapped address
|
in6_addr in6; // IPv6 or v4-to-v6-mapped address
|
||||||
|
|
||||||
|
|
22
src/Type.cc
22
src/Type.cc
|
@ -8,8 +8,8 @@
|
||||||
#include "Scope.h"
|
#include "Scope.h"
|
||||||
#include "Serializer.h"
|
#include "Serializer.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
#include "zeexygen/Manager.h"
|
#include "zeekygen/Manager.h"
|
||||||
#include "zeexygen/utils.h"
|
#include "zeekygen/utils.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -1197,8 +1197,8 @@ void RecordType::DescribeFieldsReST(ODesc* d, bool func_args) const
|
||||||
if ( func_args )
|
if ( func_args )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
using zeexygen::IdentifierInfo;
|
using zeekygen::IdentifierInfo;
|
||||||
IdentifierInfo* doc = zeexygen_mgr->GetIdentifierInfo(GetName());
|
IdentifierInfo* doc = zeekygen_mgr->GetIdentifierInfo(GetName());
|
||||||
|
|
||||||
if ( ! doc )
|
if ( ! doc )
|
||||||
{
|
{
|
||||||
|
@ -1217,7 +1217,7 @@ void RecordType::DescribeFieldsReST(ODesc* d, bool func_args) const
|
||||||
field_from_script != type_from_script )
|
field_from_script != type_from_script )
|
||||||
{
|
{
|
||||||
d->PushIndent();
|
d->PushIndent();
|
||||||
d->Add(zeexygen::redef_indication(field_from_script).c_str());
|
d->Add(zeekygen::redef_indication(field_from_script).c_str());
|
||||||
d->PopIndent();
|
d->PopIndent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1237,7 +1237,7 @@ void RecordType::DescribeFieldsReST(ODesc* d, bool func_args) const
|
||||||
{
|
{
|
||||||
string s = cmnts[i];
|
string s = cmnts[i];
|
||||||
|
|
||||||
if ( zeexygen::prettify_params(s) )
|
if ( zeekygen::prettify_params(s) )
|
||||||
d->NL();
|
d->NL();
|
||||||
|
|
||||||
d->Add(s.c_str());
|
d->Add(s.c_str());
|
||||||
|
@ -1505,7 +1505,7 @@ void EnumType::CheckAndAddName(const string& module_name, const char* name,
|
||||||
if ( deprecated )
|
if ( deprecated )
|
||||||
id->MakeDeprecated();
|
id->MakeDeprecated();
|
||||||
|
|
||||||
zeexygen_mgr->Identifier(id);
|
zeekygen_mgr->Identifier(id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1618,8 +1618,8 @@ void EnumType::DescribeReST(ODesc* d, bool roles_only) const
|
||||||
else
|
else
|
||||||
d->Add(fmt(".. zeek:enum:: %s %s", it->second.c_str(), GetName().c_str()));
|
d->Add(fmt(".. zeek:enum:: %s %s", it->second.c_str(), GetName().c_str()));
|
||||||
|
|
||||||
using zeexygen::IdentifierInfo;
|
using zeekygen::IdentifierInfo;
|
||||||
IdentifierInfo* doc = zeexygen_mgr->GetIdentifierInfo(it->second);
|
IdentifierInfo* doc = zeekygen_mgr->GetIdentifierInfo(it->second);
|
||||||
|
|
||||||
if ( ! doc )
|
if ( ! doc )
|
||||||
{
|
{
|
||||||
|
@ -1634,7 +1634,7 @@ void EnumType::DescribeReST(ODesc* d, bool roles_only) const
|
||||||
if ( doc->GetDeclaringScript() )
|
if ( doc->GetDeclaringScript() )
|
||||||
enum_from_script = doc->GetDeclaringScript()->Name();
|
enum_from_script = doc->GetDeclaringScript()->Name();
|
||||||
|
|
||||||
IdentifierInfo* type_doc = zeexygen_mgr->GetIdentifierInfo(GetName());
|
IdentifierInfo* type_doc = zeekygen_mgr->GetIdentifierInfo(GetName());
|
||||||
|
|
||||||
if ( type_doc && type_doc->GetDeclaringScript() )
|
if ( type_doc && type_doc->GetDeclaringScript() )
|
||||||
type_from_script = type_doc->GetDeclaringScript()->Name();
|
type_from_script = type_doc->GetDeclaringScript()->Name();
|
||||||
|
@ -1644,7 +1644,7 @@ void EnumType::DescribeReST(ODesc* d, bool roles_only) const
|
||||||
{
|
{
|
||||||
d->NL();
|
d->NL();
|
||||||
d->PushIndent();
|
d->PushIndent();
|
||||||
d->Add(zeexygen::redef_indication(enum_from_script).c_str());
|
d->Add(zeekygen::redef_indication(enum_from_script).c_str());
|
||||||
d->PopIndent();
|
d->PopIndent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
src/bro.bif
19
src/bro.bif
|
@ -2409,6 +2409,19 @@ function to_addr%(ip: string%): addr
|
||||||
return ret;
|
return ret;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
## Checks if a string is a valid IPv4 or IPv6 address.
|
||||||
|
##
|
||||||
|
## ip: the string to check for valid IP formatting.
|
||||||
|
##
|
||||||
|
## Returns: T if the string is a valid IPv4 or IPv6 address format.
|
||||||
|
function is_valid_ip%(ip: string%): bool
|
||||||
|
%{
|
||||||
|
char* s = ip->AsString()->Render();
|
||||||
|
auto rval = IPAddr::IsValid(s);
|
||||||
|
delete [] s;
|
||||||
|
return val_mgr->GetBool(rval);
|
||||||
|
%}
|
||||||
|
|
||||||
## Converts a :zeek:type:`string` to a :zeek:type:`subnet`.
|
## Converts a :zeek:type:`string` to a :zeek:type:`subnet`.
|
||||||
##
|
##
|
||||||
## sn: The subnet to convert.
|
## sn: The subnet to convert.
|
||||||
|
@ -3293,7 +3306,7 @@ const char* conn_id_string(Val* c)
|
||||||
##
|
##
|
||||||
## Returns: True on success.
|
## Returns: True on success.
|
||||||
##
|
##
|
||||||
## .. zeek:see:: dump_packet get_current_packet send_current_packet
|
## .. zeek:see:: dump_packet get_current_packet
|
||||||
function dump_current_packet%(file_name: string%) : bool
|
function dump_current_packet%(file_name: string%) : bool
|
||||||
%{
|
%{
|
||||||
const Packet* pkt;
|
const Packet* pkt;
|
||||||
|
@ -3324,7 +3337,7 @@ function dump_current_packet%(file_name: string%) : bool
|
||||||
## Returns: The currently processed packet, which is a record
|
## Returns: The currently processed packet, which is a record
|
||||||
## containing the timestamp, ``snaplen``, and packet data.
|
## containing the timestamp, ``snaplen``, and packet data.
|
||||||
##
|
##
|
||||||
## .. zeek:see:: dump_current_packet dump_packet send_current_packet
|
## .. zeek:see:: dump_current_packet dump_packet
|
||||||
function get_current_packet%(%) : pcap_packet
|
function get_current_packet%(%) : pcap_packet
|
||||||
%{
|
%{
|
||||||
const Packet* p;
|
const Packet* p;
|
||||||
|
@ -3380,7 +3393,7 @@ function get_current_packet_header%(%) : raw_pkt_hdr
|
||||||
##
|
##
|
||||||
## Returns: True on success
|
## Returns: True on success
|
||||||
##
|
##
|
||||||
## .. zeek:see:: get_current_packet dump_current_packet send_current_packet
|
## .. zeek:see:: get_current_packet dump_current_packet
|
||||||
function dump_packet%(pkt: pcap_packet, file_name: string%) : bool
|
function dump_packet%(pkt: pcap_packet, file_name: string%) : bool
|
||||||
%{
|
%{
|
||||||
if ( addl_pkt_dumper && addl_pkt_dumper->Path() != file_name->CheckString())
|
if ( addl_pkt_dumper && addl_pkt_dumper->Path() != file_name->CheckString())
|
||||||
|
|
24
src/main.cc
24
src/main.cc
|
@ -53,7 +53,7 @@ extern "C" {
|
||||||
#include "analyzer/Tag.h"
|
#include "analyzer/Tag.h"
|
||||||
#include "plugin/Manager.h"
|
#include "plugin/Manager.h"
|
||||||
#include "file_analysis/Manager.h"
|
#include "file_analysis/Manager.h"
|
||||||
#include "zeexygen/Manager.h"
|
#include "zeekygen/Manager.h"
|
||||||
#include "iosource/Manager.h"
|
#include "iosource/Manager.h"
|
||||||
#include "broker/Manager.h"
|
#include "broker/Manager.h"
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ input::Manager* input_mgr = 0;
|
||||||
plugin::Manager* plugin_mgr = 0;
|
plugin::Manager* plugin_mgr = 0;
|
||||||
analyzer::Manager* analyzer_mgr = 0;
|
analyzer::Manager* analyzer_mgr = 0;
|
||||||
file_analysis::Manager* file_mgr = 0;
|
file_analysis::Manager* file_mgr = 0;
|
||||||
zeexygen::Manager* zeexygen_mgr = 0;
|
zeekygen::Manager* zeekygen_mgr = 0;
|
||||||
iosource::Manager* iosource_mgr = 0;
|
iosource::Manager* iosource_mgr = 0;
|
||||||
bro_broker::Manager* broker_mgr = 0;
|
bro_broker::Manager* broker_mgr = 0;
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ void usage(int code = 1)
|
||||||
fprintf(stderr, " -T|--re-level <level> | set 'RE_level' for rules\n");
|
fprintf(stderr, " -T|--re-level <level> | set 'RE_level' for rules\n");
|
||||||
fprintf(stderr, " -U|--status-file <file> | Record process status in file\n");
|
fprintf(stderr, " -U|--status-file <file> | Record process status in file\n");
|
||||||
fprintf(stderr, " -W|--watchdog | activate watchdog timer\n");
|
fprintf(stderr, " -W|--watchdog | activate watchdog timer\n");
|
||||||
fprintf(stderr, " -X|--zeexygen <cfgfile> | generate documentation based on config file\n");
|
fprintf(stderr, " -X|--zeekygen <cfgfile> | generate documentation based on config file\n");
|
||||||
|
|
||||||
#ifdef USE_PERFTOOLS_DEBUG
|
#ifdef USE_PERFTOOLS_DEBUG
|
||||||
fprintf(stderr, " -m|--mem-leaks | show leaks [perftools]\n");
|
fprintf(stderr, " -m|--mem-leaks | show leaks [perftools]\n");
|
||||||
|
@ -208,7 +208,7 @@ void usage(int code = 1)
|
||||||
fprintf(stderr, " $BRO_SEED_FILE | file to load seeds from (not set)\n");
|
fprintf(stderr, " $BRO_SEED_FILE | file to load seeds from (not set)\n");
|
||||||
fprintf(stderr, " $BRO_LOG_SUFFIX | ASCII log file extension (.%s)\n", logging::writer::Ascii::LogExt().c_str());
|
fprintf(stderr, " $BRO_LOG_SUFFIX | ASCII log file extension (.%s)\n", logging::writer::Ascii::LogExt().c_str());
|
||||||
fprintf(stderr, " $BRO_PROFILER_FILE | Output file for script execution statistics (not set)\n");
|
fprintf(stderr, " $BRO_PROFILER_FILE | Output file for script execution statistics (not set)\n");
|
||||||
fprintf(stderr, " $BRO_DISABLE_BROXYGEN | Disable Zeexygen documentation support (%s)\n", getenv("BRO_DISABLE_BROXYGEN") ? "set" : "not set");
|
fprintf(stderr, " $BRO_DISABLE_BROXYGEN | Disable Zeekygen documentation support (%s)\n", getenv("BRO_DISABLE_BROXYGEN") ? "set" : "not set");
|
||||||
fprintf(stderr, " $ZEEK_DNS_RESOLVER | IPv4/IPv6 address of DNS resolver to use (%s)\n", getenv("ZEEK_DNS_RESOLVER") ? getenv("ZEEK_DNS_RESOLVER") : "not set, will use first IPv4 address from /etc/resolv.conf");
|
fprintf(stderr, " $ZEEK_DNS_RESOLVER | IPv4/IPv6 address of DNS resolver to use (%s)\n", getenv("ZEEK_DNS_RESOLVER") ? getenv("ZEEK_DNS_RESOLVER") : "not set, will use first IPv4 address from /etc/resolv.conf");
|
||||||
|
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -351,7 +351,7 @@ void terminate_bro()
|
||||||
|
|
||||||
plugin_mgr->FinishPlugins();
|
plugin_mgr->FinishPlugins();
|
||||||
|
|
||||||
delete zeexygen_mgr;
|
delete zeekygen_mgr;
|
||||||
delete timer_mgr;
|
delete timer_mgr;
|
||||||
delete event_serializer;
|
delete event_serializer;
|
||||||
delete state_serializer;
|
delete state_serializer;
|
||||||
|
@ -448,7 +448,7 @@ int main(int argc, char** argv)
|
||||||
{"filter", required_argument, 0, 'f'},
|
{"filter", required_argument, 0, 'f'},
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, 0, 'h'},
|
||||||
{"iface", required_argument, 0, 'i'},
|
{"iface", required_argument, 0, 'i'},
|
||||||
{"zeexygen", required_argument, 0, 'X'},
|
{"zeekygen", required_argument, 0, 'X'},
|
||||||
{"prefix", required_argument, 0, 'p'},
|
{"prefix", required_argument, 0, 'p'},
|
||||||
{"readfile", required_argument, 0, 'r'},
|
{"readfile", required_argument, 0, 'r'},
|
||||||
{"rulefile", required_argument, 0, 's'},
|
{"rulefile", required_argument, 0, 's'},
|
||||||
|
@ -500,7 +500,7 @@ int main(int argc, char** argv)
|
||||||
if ( p )
|
if ( p )
|
||||||
add_to_name_list(p, ':', prefixes);
|
add_to_name_list(p, ':', prefixes);
|
||||||
|
|
||||||
string zeexygen_config;
|
string zeekygen_config;
|
||||||
|
|
||||||
#ifdef USE_IDMEF
|
#ifdef USE_IDMEF
|
||||||
string libidmef_dtd_path = "idmef-message.dtd";
|
string libidmef_dtd_path = "idmef-message.dtd";
|
||||||
|
@ -649,7 +649,7 @@ int main(int argc, char** argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
zeexygen_config = optarg;
|
zeekygen_config = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef USE_PERFTOOLS_DEBUG
|
#ifdef USE_PERFTOOLS_DEBUG
|
||||||
|
@ -731,7 +731,7 @@ int main(int argc, char** argv)
|
||||||
timer_mgr = new PQ_TimerMgr("<GLOBAL>");
|
timer_mgr = new PQ_TimerMgr("<GLOBAL>");
|
||||||
// timer_mgr = new CQ_TimerMgr();
|
// timer_mgr = new CQ_TimerMgr();
|
||||||
|
|
||||||
zeexygen_mgr = new zeexygen::Manager(zeexygen_config, bro_argv[0]);
|
zeekygen_mgr = new zeekygen::Manager(zeekygen_config, bro_argv[0]);
|
||||||
|
|
||||||
add_essential_input_file("base/init-bare.zeek");
|
add_essential_input_file("base/init-bare.zeek");
|
||||||
add_essential_input_file("base/init-frameworks-and-bifs.zeek");
|
add_essential_input_file("base/init-frameworks-and-bifs.zeek");
|
||||||
|
@ -780,7 +780,7 @@ int main(int argc, char** argv)
|
||||||
plugin_mgr->InitPreScript();
|
plugin_mgr->InitPreScript();
|
||||||
analyzer_mgr->InitPreScript();
|
analyzer_mgr->InitPreScript();
|
||||||
file_mgr->InitPreScript();
|
file_mgr->InitPreScript();
|
||||||
zeexygen_mgr->InitPreScript();
|
zeekygen_mgr->InitPreScript();
|
||||||
|
|
||||||
bool missing_plugin = false;
|
bool missing_plugin = false;
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ int main(int argc, char** argv)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
plugin_mgr->InitPostScript();
|
plugin_mgr->InitPostScript();
|
||||||
zeexygen_mgr->InitPostScript();
|
zeekygen_mgr->InitPostScript();
|
||||||
broker_mgr->InitPostScript();
|
broker_mgr->InitPostScript();
|
||||||
|
|
||||||
if ( print_plugins )
|
if ( print_plugins )
|
||||||
|
@ -879,7 +879,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
reporter->InitOptions();
|
reporter->InitOptions();
|
||||||
zeexygen_mgr->GenerateDocs();
|
zeekygen_mgr->GenerateDocs();
|
||||||
|
|
||||||
if ( user_pcap_filter )
|
if ( user_pcap_filter )
|
||||||
{
|
{
|
||||||
|
|
26
src/parse.y
26
src/parse.y
|
@ -87,7 +87,7 @@
|
||||||
#include "Scope.h"
|
#include "Scope.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
#include "Brofiler.h"
|
#include "Brofiler.h"
|
||||||
#include "zeexygen/Manager.h"
|
#include "zeekygen/Manager.h"
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -1038,7 +1038,7 @@ type_decl:
|
||||||
$$ = new TypeDecl($3, $1, $4, (in_record > 0));
|
$$ = new TypeDecl($3, $1, $4, (in_record > 0));
|
||||||
|
|
||||||
if ( in_record > 0 && cur_decl_type_id )
|
if ( in_record > 0 && cur_decl_type_id )
|
||||||
zeexygen_mgr->RecordField(cur_decl_type_id, $$, ::filename);
|
zeekygen_mgr->RecordField(cur_decl_type_id, $$, ::filename);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1072,7 +1072,7 @@ decl:
|
||||||
TOK_MODULE TOK_ID ';'
|
TOK_MODULE TOK_ID ';'
|
||||||
{
|
{
|
||||||
current_module = $2;
|
current_module = $2;
|
||||||
zeexygen_mgr->ModuleUsage(::filename, current_module);
|
zeekygen_mgr->ModuleUsage(::filename, current_module);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_EXPORT '{' { is_export = true; } decl_list '}'
|
| TOK_EXPORT '{' { is_export = true; } decl_list '}'
|
||||||
|
@ -1081,36 +1081,36 @@ decl:
|
||||||
| TOK_GLOBAL def_global_id opt_type init_class opt_init opt_attr ';'
|
| TOK_GLOBAL def_global_id opt_type init_class opt_init opt_attr ';'
|
||||||
{
|
{
|
||||||
add_global($2, $3, $4, $5, $6, VAR_REGULAR);
|
add_global($2, $3, $4, $5, $6, VAR_REGULAR);
|
||||||
zeexygen_mgr->Identifier($2);
|
zeekygen_mgr->Identifier($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_OPTION def_global_id opt_type init_class opt_init opt_attr ';'
|
| TOK_OPTION def_global_id opt_type init_class opt_init opt_attr ';'
|
||||||
{
|
{
|
||||||
add_global($2, $3, $4, $5, $6, VAR_OPTION);
|
add_global($2, $3, $4, $5, $6, VAR_OPTION);
|
||||||
zeexygen_mgr->Identifier($2);
|
zeekygen_mgr->Identifier($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_CONST def_global_id opt_type init_class opt_init opt_attr ';'
|
| TOK_CONST def_global_id opt_type init_class opt_init opt_attr ';'
|
||||||
{
|
{
|
||||||
add_global($2, $3, $4, $5, $6, VAR_CONST);
|
add_global($2, $3, $4, $5, $6, VAR_CONST);
|
||||||
zeexygen_mgr->Identifier($2);
|
zeekygen_mgr->Identifier($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_REDEF global_id opt_type init_class opt_init opt_attr ';'
|
| TOK_REDEF global_id opt_type init_class opt_init opt_attr ';'
|
||||||
{
|
{
|
||||||
add_global($2, $3, $4, $5, $6, VAR_REDEF);
|
add_global($2, $3, $4, $5, $6, VAR_REDEF);
|
||||||
zeexygen_mgr->Redef($2, ::filename);
|
zeekygen_mgr->Redef($2, ::filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_REDEF TOK_ENUM global_id TOK_ADD_TO '{'
|
| TOK_REDEF TOK_ENUM global_id TOK_ADD_TO '{'
|
||||||
{ parser_redef_enum($3); zeexygen_mgr->Redef($3, ::filename); }
|
{ parser_redef_enum($3); zeekygen_mgr->Redef($3, ::filename); }
|
||||||
enum_body '}' ';'
|
enum_body '}' ';'
|
||||||
{
|
{
|
||||||
// Zeexygen already grabbed new enum IDs as the type created them.
|
// Zeekygen already grabbed new enum IDs as the type created them.
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_REDEF TOK_RECORD global_id
|
| TOK_REDEF TOK_RECORD global_id
|
||||||
{ cur_decl_type_id = $3; zeexygen_mgr->Redef($3, ::filename); }
|
{ cur_decl_type_id = $3; zeekygen_mgr->Redef($3, ::filename); }
|
||||||
TOK_ADD_TO '{'
|
TOK_ADD_TO '{'
|
||||||
{ ++in_record; }
|
{ ++in_record; }
|
||||||
type_decl_list
|
type_decl_list
|
||||||
|
@ -1126,12 +1126,12 @@ decl:
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_TYPE global_id ':'
|
| TOK_TYPE global_id ':'
|
||||||
{ cur_decl_type_id = $2; zeexygen_mgr->StartType($2); }
|
{ cur_decl_type_id = $2; zeekygen_mgr->StartType($2); }
|
||||||
type opt_attr ';'
|
type opt_attr ';'
|
||||||
{
|
{
|
||||||
cur_decl_type_id = 0;
|
cur_decl_type_id = 0;
|
||||||
add_type($2, $5, $6);
|
add_type($2, $5, $6);
|
||||||
zeexygen_mgr->Identifier($2);
|
zeekygen_mgr->Identifier($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
| func_hdr func_body
|
| func_hdr func_body
|
||||||
|
@ -1166,7 +1166,7 @@ func_hdr:
|
||||||
begin_func($2, current_module.c_str(),
|
begin_func($2, current_module.c_str(),
|
||||||
FUNC_FLAVOR_FUNCTION, 0, $3, $4);
|
FUNC_FLAVOR_FUNCTION, 0, $3, $4);
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
zeexygen_mgr->Identifier($2);
|
zeekygen_mgr->Identifier($2);
|
||||||
}
|
}
|
||||||
| TOK_EVENT event_id func_params opt_attr
|
| TOK_EVENT event_id func_params opt_attr
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "Var.h"
|
#include "Var.h"
|
||||||
#include "Val.h"
|
#include "Val.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
#include "zeexygen/Manager.h"
|
#include "zeekygen/Manager.h"
|
||||||
|
|
||||||
namespace plugin {
|
namespace plugin {
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ ComponentManager<T, C>::ComponentManager(const string& arg_module, const string&
|
||||||
tag_enum_type = new EnumType(module + "::" + local_id);
|
tag_enum_type = new EnumType(module + "::" + local_id);
|
||||||
::ID* id = install_ID(local_id.c_str(), module.c_str(), true, true);
|
::ID* id = install_ID(local_id.c_str(), module.c_str(), true, true);
|
||||||
add_type(id, tag_enum_type, 0);
|
add_type(id, tag_enum_type, 0);
|
||||||
zeexygen_mgr->Identifier(id);
|
zeekygen_mgr->Identifier(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T, class C>
|
template <class T, class C>
|
||||||
|
|
12
src/scan.l
12
src/scan.l
|
@ -29,7 +29,7 @@
|
||||||
#include "Traverse.h"
|
#include "Traverse.h"
|
||||||
|
|
||||||
#include "analyzer/Analyzer.h"
|
#include "analyzer/Analyzer.h"
|
||||||
#include "zeexygen/Manager.h"
|
#include "zeekygen/Manager.h"
|
||||||
|
|
||||||
#include "plugin/Manager.h"
|
#include "plugin/Manager.h"
|
||||||
|
|
||||||
|
@ -162,19 +162,19 @@ ESCSEQ (\\([^\n]|[0-7]+|x[[:xdigit:]]+))
|
||||||
%%
|
%%
|
||||||
|
|
||||||
##!.* {
|
##!.* {
|
||||||
zeexygen_mgr->SummaryComment(::filename, yytext + 3);
|
zeekygen_mgr->SummaryComment(::filename, yytext + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
##<.* {
|
##<.* {
|
||||||
string hint(cur_enum_type && last_id_tok ?
|
string hint(cur_enum_type && last_id_tok ?
|
||||||
make_full_var_name(current_module.c_str(), last_id_tok) : "");
|
make_full_var_name(current_module.c_str(), last_id_tok) : "");
|
||||||
|
|
||||||
zeexygen_mgr->PostComment(yytext + 3, hint);
|
zeekygen_mgr->PostComment(yytext + 3, hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
##.* {
|
##.* {
|
||||||
if ( yytext[2] != '#' )
|
if ( yytext[2] != '#' )
|
||||||
zeexygen_mgr->PreComment(yytext + 2);
|
zeekygen_mgr->PreComment(yytext + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#{OWS}@no-test.* return TOK_NO_TEST;
|
#{OWS}@no-test.* return TOK_NO_TEST;
|
||||||
|
@ -365,7 +365,7 @@ when return TOK_WHEN;
|
||||||
string loader = ::filename; // load_files may change ::filename, save copy
|
string loader = ::filename; // load_files may change ::filename, save copy
|
||||||
string loading = find_relative_script_file(new_file);
|
string loading = find_relative_script_file(new_file);
|
||||||
(void) load_files(new_file);
|
(void) load_files(new_file);
|
||||||
zeexygen_mgr->ScriptDependency(loader, loading);
|
zeekygen_mgr->ScriptDependency(loader, loading);
|
||||||
}
|
}
|
||||||
|
|
||||||
@load-sigs{WS}{FILE} {
|
@load-sigs{WS}{FILE} {
|
||||||
|
@ -709,7 +709,7 @@ static int load_files(const char* orig_file)
|
||||||
else
|
else
|
||||||
file_stack.append(new FileInfo);
|
file_stack.append(new FileInfo);
|
||||||
|
|
||||||
zeexygen_mgr->Script(file_path);
|
zeekygen_mgr->Script(file_path);
|
||||||
|
|
||||||
DBG_LOG(DBG_SCRIPTS, "Loading %s", file_path.c_str());
|
DBG_LOG(DBG_SCRIPTS, "Loading %s", file_path.c_str());
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,13 @@
|
||||||
#include "iosource/Manager.h"
|
#include "iosource/Manager.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return IP address without enclosing brackets and any leading 0x.
|
* Return IP address without enclosing brackets and any leading 0x. Also
|
||||||
|
* trims leading/trailing whitespace.
|
||||||
*/
|
*/
|
||||||
std::string extract_ip(const std::string& i)
|
std::string extract_ip(const std::string& i)
|
||||||
{
|
{
|
||||||
std::string s(skip_whitespace(i.c_str()));
|
std::string s(strstrip(i));
|
||||||
|
|
||||||
if ( s.size() > 0 && s[0] == '[' )
|
if ( s.size() > 0 && s[0] == '[' )
|
||||||
s.erase(0, 1);
|
s.erase(0, 1);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ include_directories(BEFORE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(zeexygen_SRCS
|
set(zeekygen_SRCS
|
||||||
Manager.cc
|
Manager.cc
|
||||||
Info.h
|
Info.h
|
||||||
PackageInfo.cc
|
PackageInfo.cc
|
||||||
|
@ -19,7 +19,7 @@ set(zeexygen_SRCS
|
||||||
utils.cc
|
utils.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
bif_target(zeexygen.bif)
|
bif_target(zeekygen.bif)
|
||||||
bro_add_subdir_library(zeexygen ${zeexygen_SRCS})
|
bro_add_subdir_library(zeekygen ${zeekygen_SRCS})
|
||||||
|
|
||||||
add_dependencies(bro_zeexygen generate_outputs)
|
add_dependencies(bro_zeekygen generate_outputs)
|
|
@ -11,7 +11,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static TargetFactory create_target_factory()
|
static TargetFactory create_target_factory()
|
||||||
|
@ -37,7 +37,7 @@ Config::Config(const string& arg_file, const string& delim)
|
||||||
ifstream f(file.c_str());
|
ifstream f(file.c_str());
|
||||||
|
|
||||||
if ( ! f.is_open() )
|
if ( ! f.is_open() )
|
||||||
reporter->FatalError("failed to open Zeexygen config file '%s': %s",
|
reporter->FatalError("failed to open Zeekygen config file '%s': %s",
|
||||||
file.c_str(), strerror(errno));
|
file.c_str(), strerror(errno));
|
||||||
|
|
||||||
string line;
|
string line;
|
||||||
|
@ -59,20 +59,20 @@ Config::Config(const string& arg_file, const string& delim)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( tokens.size() != 3 )
|
if ( tokens.size() != 3 )
|
||||||
reporter->FatalError("malformed Zeexygen target in %s:%u: %s",
|
reporter->FatalError("malformed Zeekygen target in %s:%u: %s",
|
||||||
file.c_str(), line_number, line.c_str());
|
file.c_str(), line_number, line.c_str());
|
||||||
|
|
||||||
Target* target = target_factory.Create(tokens[0], tokens[2], tokens[1]);
|
Target* target = target_factory.Create(tokens[0], tokens[2], tokens[1]);
|
||||||
|
|
||||||
if ( ! target )
|
if ( ! target )
|
||||||
reporter->FatalError("unknown Zeexygen target type: %s",
|
reporter->FatalError("unknown Zeekygen target type: %s",
|
||||||
tokens[0].c_str());
|
tokens[0].c_str());
|
||||||
|
|
||||||
targets.push_back(target);
|
targets.push_back(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( f.bad() )
|
if ( f.bad() )
|
||||||
reporter->InternalError("error reading Zeexygen config file '%s': %s",
|
reporter->InternalError("error reading Zeekygen config file '%s': %s",
|
||||||
file.c_str(), strerror(errno));
|
file.c_str(), strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,5 +99,5 @@ time_t Config::GetModificationTime() const
|
||||||
if ( file.empty() )
|
if ( file.empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return zeexygen::get_mtime(file);
|
return zeekygen::get_mtime(file);
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_CONFIGURATION_H
|
#ifndef ZEEKYGEN_CONFIGURATION_H
|
||||||
#define ZEEXYGEN_CONFIGURATION_H
|
#define ZEEKYGEN_CONFIGURATION_H
|
||||||
|
|
||||||
#include "Info.h"
|
#include "Info.h"
|
||||||
#include "Target.h"
|
#include "Target.h"
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the generation of reStructuredText documents corresponding to
|
* Manages the generation of reStructuredText documents corresponding to
|
||||||
|
@ -22,8 +22,8 @@ class Config {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a Zeexygen configuration file, parsing all targets in it.
|
* Read a Zeekygen configuration file, parsing all targets in it.
|
||||||
* @param file The file containing a list of Zeexygen targets. If it's
|
* @param file The file containing a list of Zeekygen targets. If it's
|
||||||
* an empty string most methods are a no-op.
|
* an empty string most methods are a no-op.
|
||||||
* @param delim The delimiter between target fields.
|
* @param delim The delimiter between target fields.
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
void FindDependencies(const std::vector<Info*>& infos);
|
void FindDependencies(const std::vector<Info*>& infos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build each Zeexygen target (i.e. write out the reST documents to disk).
|
* Build each Zeekygen target (i.e. write out the reST documents to disk).
|
||||||
*/
|
*/
|
||||||
void GenerateDocs() const;
|
void GenerateDocs() const;
|
||||||
|
|
||||||
|
@ -58,6 +58,6 @@ private:
|
||||||
TargetFactory target_factory;
|
TargetFactory target_factory;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -7,7 +7,7 @@
|
||||||
#include "Val.h"
|
#include "Val.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
|
|
||||||
IdentifierInfo::IdentifierInfo(ID* arg_id, ScriptInfo* script)
|
IdentifierInfo::IdentifierInfo(ID* arg_id, ScriptInfo* script)
|
||||||
: Info(),
|
: Info(),
|
||||||
|
@ -128,7 +128,7 @@ string IdentifierInfo::DoReStructuredText(bool roles_only) const
|
||||||
{
|
{
|
||||||
string s = comments[i];
|
string s = comments[i];
|
||||||
|
|
||||||
if ( zeexygen::prettify_params(s) )
|
if ( zeekygen::prettify_params(s) )
|
||||||
d.NL();
|
d.NL();
|
||||||
|
|
||||||
d.Add(s.c_str());
|
d.Add(s.c_str());
|
|
@ -1,7 +1,7 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_IDENTIFIERINFO_H
|
#ifndef ZEEKYGEN_IDENTIFIERINFO_H
|
||||||
#define ZEEXYGEN_IDENTIFIERINFO_H
|
#define ZEEKYGEN_IDENTIFIERINFO_H
|
||||||
|
|
||||||
#include "Info.h"
|
#include "Info.h"
|
||||||
#include "ScriptInfo.h"
|
#include "ScriptInfo.h"
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
class ScriptInfo;
|
class ScriptInfo;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public:
|
||||||
* Add a comment associated with the identifier. If the identifier is a
|
* Add a comment associated with the identifier. If the identifier is a
|
||||||
* record type and it's in the middle of parsing fields, the comment is
|
* record type and it's in the middle of parsing fields, the comment is
|
||||||
* associated with the last field that was parsed.
|
* associated with the last field that was parsed.
|
||||||
* @param comment A string extracted from Zeexygen-style comment.
|
* @param comment A string extracted from Zeekygen-style comment.
|
||||||
*/
|
*/
|
||||||
void AddComment(const std::string& comment)
|
void AddComment(const std::string& comment)
|
||||||
{ last_field_seen ? last_field_seen->comments.push_back(comment)
|
{ last_field_seen ? last_field_seen->comments.push_back(comment)
|
||||||
|
@ -102,13 +102,13 @@ public:
|
||||||
std::string GetDeclaringScriptForField(const std::string& field) const;
|
std::string GetDeclaringScriptForField(const std::string& field) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return All Zeexygen comments associated with the identifier.
|
* @return All Zeekygen comments associated with the identifier.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> GetComments() const;
|
std::vector<std::string> GetComments() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param field A record field name.
|
* @param field A record field name.
|
||||||
* @return All Zeexygen comments associated with the record field.
|
* @return All Zeekygen comments associated with the record field.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> GetFieldComments(const std::string& field) const;
|
std::vector<std::string> GetFieldComments(const std::string& field) const;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
struct Redefinition {
|
struct Redefinition {
|
||||||
std::string from_script; /**< Name of script doing the redef. */
|
std::string from_script; /**< Name of script doing the redef. */
|
||||||
std::string new_val_desc; /**< Description of new value bound to ID. */
|
std::string new_val_desc; /**< Description of new value bound to ID. */
|
||||||
std::vector<std::string> comments; /**< Zeexygen comments on redef. */
|
std::vector<std::string> comments; /**< Zeekygen comments on redef. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,6 +159,6 @@ private:
|
||||||
ScriptInfo* declaring_script;
|
ScriptInfo* declaring_script;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,15 +1,15 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_INFO_H
|
#ifndef ZEEKYGEN_INFO_H
|
||||||
#define ZEEXYGEN_INFO_H
|
#define ZEEKYGEN_INFO_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract base class for any thing that Zeexygen can document.
|
* Abstract base class for any thing that Zeekygen can document.
|
||||||
*/
|
*/
|
||||||
class Info {
|
class Info {
|
||||||
|
|
||||||
|
@ -68,6 +68,6 @@ private:
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -7,7 +7,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static void DbgAndWarn(const char* msg)
|
static void DbgAndWarn(const char* msg)
|
||||||
|
@ -19,7 +19,7 @@ static void DbgAndWarn(const char* msg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
reporter->Warning("%s", msg);
|
reporter->Warning("%s", msg);
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "%s", msg);
|
DBG_LOG(DBG_ZEEKYGEN, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WarnMissingScript(const char* type, const ID* id,
|
static void WarnMissingScript(const char* type, const ID* id,
|
||||||
|
@ -28,7 +28,7 @@ static void WarnMissingScript(const char* type, const ID* id,
|
||||||
if ( script == "<command line>" )
|
if ( script == "<command line>" )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DbgAndWarn(fmt("Can't generate Zeexygen doumentation for %s %s, "
|
DbgAndWarn(fmt("Can't generate Zeekygen doumentation for %s %s, "
|
||||||
"lookup of %s failed",
|
"lookup of %s failed",
|
||||||
type, id->Name(), script.c_str()));
|
type, id->Name(), script.c_str()));
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ Manager::Manager(const string& arg_config, const string& bro_command)
|
||||||
// a PATH component that starts with a tilde (such as "~/bin"). A simple
|
// a PATH component that starts with a tilde (such as "~/bin"). A simple
|
||||||
// workaround is to just run bro with a relative or absolute path.
|
// workaround is to just run bro with a relative or absolute path.
|
||||||
if ( path_to_bro.empty() || stat(path_to_bro.c_str(), &s) < 0 )
|
if ( path_to_bro.empty() || stat(path_to_bro.c_str(), &s) < 0 )
|
||||||
reporter->InternalError("Zeexygen can't get mtime of bro binary %s (try again by specifying the absolute or relative path to Bro): %s",
|
reporter->InternalError("Zeekygen can't get mtime of bro binary %s (try again by specifying the absolute or relative path to Bro): %s",
|
||||||
path_to_bro.c_str(), strerror(errno));
|
path_to_bro.c_str(), strerror(errno));
|
||||||
|
|
||||||
bro_mtime = s.st_mtime;
|
bro_mtime = s.st_mtime;
|
||||||
|
@ -129,7 +129,7 @@ void Manager::Script(const string& path)
|
||||||
|
|
||||||
if ( scripts.GetInfo(name) )
|
if ( scripts.GetInfo(name) )
|
||||||
{
|
{
|
||||||
DbgAndWarn(fmt("Duplicate Zeexygen script documentation: %s",
|
DbgAndWarn(fmt("Duplicate Zeekygen script documentation: %s",
|
||||||
name.c_str()));
|
name.c_str()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ void Manager::Script(const string& path)
|
||||||
ScriptInfo* info = new ScriptInfo(name, path);
|
ScriptInfo* info = new ScriptInfo(name, path);
|
||||||
scripts.map[name] = info;
|
scripts.map[name] = info;
|
||||||
all_info.push_back(info);
|
all_info.push_back(info);
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Made ScriptInfo %s", name.c_str());
|
DBG_LOG(DBG_ZEEKYGEN, "Made ScriptInfo %s", name.c_str());
|
||||||
|
|
||||||
if ( ! info->IsPkgLoader() )
|
if ( ! info->IsPkgLoader() )
|
||||||
return;
|
return;
|
||||||
|
@ -146,7 +146,7 @@ void Manager::Script(const string& path)
|
||||||
|
|
||||||
if ( packages.GetInfo(name) )
|
if ( packages.GetInfo(name) )
|
||||||
{
|
{
|
||||||
DbgAndWarn(fmt("Duplicate Zeexygen package documentation: %s",
|
DbgAndWarn(fmt("Duplicate Zeekygen package documentation: %s",
|
||||||
name.c_str()));
|
name.c_str()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ void Manager::Script(const string& path)
|
||||||
PackageInfo* pkginfo = new PackageInfo(name);
|
PackageInfo* pkginfo = new PackageInfo(name);
|
||||||
packages.map[name] = pkginfo;
|
packages.map[name] = pkginfo;
|
||||||
all_info.push_back(pkginfo);
|
all_info.push_back(pkginfo);
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Made PackageInfo %s", name.c_str());
|
DBG_LOG(DBG_ZEEKYGEN, "Made PackageInfo %s", name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::ScriptDependency(const string& path, const string& dep)
|
void Manager::ScriptDependency(const string& path, const string& dep)
|
||||||
|
@ -164,7 +164,7 @@ void Manager::ScriptDependency(const string& path, const string& dep)
|
||||||
|
|
||||||
if ( dep.empty() )
|
if ( dep.empty() )
|
||||||
{
|
{
|
||||||
DbgAndWarn(fmt("Empty Zeexygen script doc dependency: %s",
|
DbgAndWarn(fmt("Empty Zeekygen script doc dependency: %s",
|
||||||
path.c_str()));
|
path.c_str()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -175,17 +175,17 @@ void Manager::ScriptDependency(const string& path, const string& dep)
|
||||||
|
|
||||||
if ( ! script_info )
|
if ( ! script_info )
|
||||||
{
|
{
|
||||||
DbgAndWarn(fmt("Failed to add Zeexygen script doc dependency %s "
|
DbgAndWarn(fmt("Failed to add Zeekygen script doc dependency %s "
|
||||||
"for %s", depname.c_str(), name.c_str()));
|
"for %s", depname.c_str(), name.c_str()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
script_info->AddDependency(depname);
|
script_info->AddDependency(depname);
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Added script dependency %s for %s",
|
DBG_LOG(DBG_ZEEKYGEN, "Added script dependency %s for %s",
|
||||||
depname.c_str(), name.c_str());
|
depname.c_str(), name.c_str());
|
||||||
|
|
||||||
for ( size_t i = 0; i < comment_buffer.size(); ++i )
|
for ( size_t i = 0; i < comment_buffer.size(); ++i )
|
||||||
DbgAndWarn(fmt("Discarded extraneous Zeexygen comment: %s",
|
DbgAndWarn(fmt("Discarded extraneous Zeekygen comment: %s",
|
||||||
comment_buffer[i].c_str()));
|
comment_buffer[i].c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,13 +199,13 @@ void Manager::ModuleUsage(const string& path, const string& module)
|
||||||
|
|
||||||
if ( ! script_info )
|
if ( ! script_info )
|
||||||
{
|
{
|
||||||
DbgAndWarn(fmt("Failed to add Zeexygen module usage %s in %s",
|
DbgAndWarn(fmt("Failed to add Zeekygen module usage %s in %s",
|
||||||
module.c_str(), name.c_str()));
|
module.c_str(), name.c_str()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
script_info->AddModule(module);
|
script_info->AddModule(module);
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Added module usage %s in %s",
|
DBG_LOG(DBG_ZEEKYGEN, "Added module usage %s in %s",
|
||||||
module.c_str(), name.c_str());
|
module.c_str(), name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ void Manager::StartType(ID* id)
|
||||||
|
|
||||||
if ( id->GetLocationInfo() == &no_location )
|
if ( id->GetLocationInfo() == &no_location )
|
||||||
{
|
{
|
||||||
DbgAndWarn(fmt("Can't generate zeexygen doumentation for %s, "
|
DbgAndWarn(fmt("Can't generate zeekygen doumentation for %s, "
|
||||||
"no location available", id->Name()));
|
"no location available", id->Name()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ void Manager::StartType(ID* id)
|
||||||
}
|
}
|
||||||
|
|
||||||
incomplete_type = CreateIdentifierInfo(id, script_info);
|
incomplete_type = CreateIdentifierInfo(id, script_info);
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Made IdentifierInfo (incomplete) %s, in %s",
|
DBG_LOG(DBG_ZEEKYGEN, "Made IdentifierInfo (incomplete) %s, in %s",
|
||||||
id->Name(), script.c_str());
|
id->Name(), script.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ void Manager::Identifier(ID* id)
|
||||||
{
|
{
|
||||||
if ( incomplete_type->Name() == id->Name() )
|
if ( incomplete_type->Name() == id->Name() )
|
||||||
{
|
{
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Finished document for type %s", id->Name());
|
DBG_LOG(DBG_ZEEKYGEN, "Finished document for type %s", id->Name());
|
||||||
incomplete_type->CompletedTypeDecl();
|
incomplete_type->CompletedTypeDecl();
|
||||||
incomplete_type = 0;
|
incomplete_type = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -309,7 +309,7 @@ void Manager::Identifier(ID* id)
|
||||||
{
|
{
|
||||||
// Internally-created identifier (e.g. file/proto analyzer enum tags).
|
// Internally-created identifier (e.g. file/proto analyzer enum tags).
|
||||||
// Handled specially since they don't have a script location.
|
// Handled specially since they don't have a script location.
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Made internal IdentifierInfo %s",
|
DBG_LOG(DBG_ZEEKYGEN, "Made internal IdentifierInfo %s",
|
||||||
id->Name());
|
id->Name());
|
||||||
CreateIdentifierInfo(id, 0);
|
CreateIdentifierInfo(id, 0);
|
||||||
return;
|
return;
|
||||||
|
@ -325,7 +325,7 @@ void Manager::Identifier(ID* id)
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateIdentifierInfo(id, script_info);
|
CreateIdentifierInfo(id, script_info);
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Made IdentifierInfo %s, in script %s",
|
DBG_LOG(DBG_ZEEKYGEN, "Made IdentifierInfo %s, in script %s",
|
||||||
id->Name(), script.c_str());
|
id->Name(), script.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ void Manager::RecordField(const ID* id, const TypeDecl* field,
|
||||||
|
|
||||||
if ( ! idd )
|
if ( ! idd )
|
||||||
{
|
{
|
||||||
DbgAndWarn(fmt("Can't generate zeexygen doumentation for "
|
DbgAndWarn(fmt("Can't generate zeekygen doumentation for "
|
||||||
"record field %s, unknown record: %s",
|
"record field %s, unknown record: %s",
|
||||||
field->id, id->Name()));
|
field->id, id->Name()));
|
||||||
return;
|
return;
|
||||||
|
@ -348,7 +348,7 @@ void Manager::RecordField(const ID* id, const TypeDecl* field,
|
||||||
string script = NormalizeScriptPath(path);
|
string script = NormalizeScriptPath(path);
|
||||||
idd->AddRecordField(field, script, comment_buffer);
|
idd->AddRecordField(field, script, comment_buffer);
|
||||||
comment_buffer.clear();
|
comment_buffer.clear();
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Document record field %s, identifier %s, script %s",
|
DBG_LOG(DBG_ZEEKYGEN, "Document record field %s, identifier %s, script %s",
|
||||||
field->id, id->Name(), script.c_str());
|
field->id, id->Name(), script.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ void Manager::Redef(const ID* id, const string& path)
|
||||||
|
|
||||||
if ( ! id_info )
|
if ( ! id_info )
|
||||||
{
|
{
|
||||||
DbgAndWarn(fmt("Can't generate zeexygen doumentation for "
|
DbgAndWarn(fmt("Can't generate zeekygen doumentation for "
|
||||||
"redef of %s, identifier lookup failed",
|
"redef of %s, identifier lookup failed",
|
||||||
id->Name()));
|
id->Name()));
|
||||||
return;
|
return;
|
||||||
|
@ -384,7 +384,7 @@ void Manager::Redef(const ID* id, const string& path)
|
||||||
script_info->AddRedef(id_info);
|
script_info->AddRedef(id_info);
|
||||||
comment_buffer.clear();
|
comment_buffer.clear();
|
||||||
last_identifier_seen = id_info;
|
last_identifier_seen = id_info;
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Added redef of %s from %s",
|
DBG_LOG(DBG_ZEEKYGEN, "Added redef of %s from %s",
|
||||||
id->Name(), from_script.c_str());
|
id->Name(), from_script.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ void Manager::PostComment(const string& comment, const string& id_hint)
|
||||||
if ( last_identifier_seen )
|
if ( last_identifier_seen )
|
||||||
last_identifier_seen->AddComment(RemoveLeadingSpace(comment));
|
last_identifier_seen->AddComment(RemoveLeadingSpace(comment));
|
||||||
else
|
else
|
||||||
DbgAndWarn(fmt("Discarded unassociated Zeexygen comment %s",
|
DbgAndWarn(fmt("Discarded unassociated Zeekygen comment %s",
|
||||||
comment.c_str()));
|
comment.c_str()));
|
||||||
|
|
||||||
return;
|
return;
|
|
@ -1,7 +1,7 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_MANAGER_H
|
#ifndef ZEEKYGEN_MANAGER_H
|
||||||
#define ZEEXYGEN_MANAGER_H
|
#define ZEEKYGEN_MANAGER_H
|
||||||
|
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
#include "Info.h"
|
#include "Info.h"
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of info objects. Just a wrapper around std::map to improve code
|
* Map of info objects. Just a wrapper around std::map to improve code
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ctor.
|
* Ctor.
|
||||||
* @param config Path to a Zeexygen config file if documentation is to be
|
* @param config Path to a Zeekygen config file if documentation is to be
|
||||||
* written to disk.
|
* written to disk.
|
||||||
* @param bro_command The command used to invoke the bro process.
|
* @param bro_command The command used to invoke the bro process.
|
||||||
* It's used when checking for out-of-date targets. If the bro binary is
|
* It's used when checking for out-of-date targets. If the bro binary is
|
||||||
|
@ -80,7 +80,7 @@ public:
|
||||||
void InitPostScript();
|
void InitPostScript();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds all Zeexygen targets specified by config file and write out
|
* Builds all Zeekygen targets specified by config file and write out
|
||||||
* documentation to disk.
|
* documentation to disk.
|
||||||
*/
|
*/
|
||||||
void GenerateDocs() const;
|
void GenerateDocs() const;
|
||||||
|
@ -140,24 +140,24 @@ public:
|
||||||
void Redef(const ID* id, const std::string& path);
|
void Redef(const ID* id, const std::string& path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register Zeexygen script summary content.
|
* Register Zeekygen script summary content.
|
||||||
* @param path Absolute path to a Bro script.
|
* @param path Absolute path to a Bro script.
|
||||||
* @param comment Zeexygen-style summary comment ("##!") to associate with
|
* @param comment Zeekygen-style summary comment ("##!") to associate with
|
||||||
* script given by \a path.
|
* script given by \a path.
|
||||||
*/
|
*/
|
||||||
void SummaryComment(const std::string& path, const std::string& comment);
|
void SummaryComment(const std::string& path, const std::string& comment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a Zeexygen comment ("##") for an upcoming identifier (i.e.
|
* Register a Zeekygen comment ("##") for an upcoming identifier (i.e.
|
||||||
* this content is buffered and consumed by next identifier/field
|
* this content is buffered and consumed by next identifier/field
|
||||||
* declaration.
|
* declaration.
|
||||||
* @param comment Content of the Zeexygen comment.
|
* @param comment Content of the Zeekygen comment.
|
||||||
*/
|
*/
|
||||||
void PreComment(const std::string& comment);
|
void PreComment(const std::string& comment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a Zeexygen comment ("##<") for the last identifier seen.
|
* Register a Zeekygen comment ("##<") for the last identifier seen.
|
||||||
* @param comment Content of the Zeexygen comment.
|
* @param comment Content of the Zeekygen comment.
|
||||||
* @param identifier_hint Expected name of identifier with which to
|
* @param identifier_hint Expected name of identifier with which to
|
||||||
* associate \a comment.
|
* associate \a comment.
|
||||||
*/
|
*/
|
||||||
|
@ -197,11 +197,11 @@ public:
|
||||||
{ return packages.GetInfo(name); }
|
{ return packages.GetInfo(name); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a Zeexygen target is up-to-date.
|
* Check if a Zeekygen target is up-to-date.
|
||||||
* @param target_file output file of a Zeexygen target.
|
* @param target_file output file of a Zeekygen target.
|
||||||
* @param dependencies all dependencies of the target.
|
* @param dependencies all dependencies of the target.
|
||||||
* @return true if modification time of \a target_file is newer than
|
* @return true if modification time of \a target_file is newer than
|
||||||
* modification time of Bro binary, Zeexygen config file, and all
|
* modification time of Bro binary, Zeekygen config file, and all
|
||||||
* dependencies, else false.
|
* dependencies, else false.
|
||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -241,7 +241,7 @@ bool Manager::IsUpToDate(const string& target_file,
|
||||||
// Doesn't exist.
|
// Doesn't exist.
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
reporter->InternalError("Zeexygen failed to stat target file '%s': %s",
|
reporter->InternalError("Zeekygen failed to stat target file '%s': %s",
|
||||||
target_file.c_str(), strerror(errno));
|
target_file.c_str(), strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,8 +258,8 @@ bool Manager::IsUpToDate(const string& target_file,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
extern zeexygen::Manager* zeexygen_mgr;
|
extern zeekygen::Manager* zeekygen_mgr;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -9,7 +9,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
|
|
||||||
PackageInfo::PackageInfo(const string& arg_name)
|
PackageInfo::PackageInfo(const string& arg_name)
|
||||||
: Info(),
|
: Info(),
|
||||||
|
@ -23,7 +23,7 @@ PackageInfo::PackageInfo(const string& arg_name)
|
||||||
ifstream f(readme_file.c_str());
|
ifstream f(readme_file.c_str());
|
||||||
|
|
||||||
if ( ! f.is_open() )
|
if ( ! f.is_open() )
|
||||||
reporter->InternalWarning("Zeexygen failed to open '%s': %s",
|
reporter->InternalWarning("Zeekygen failed to open '%s': %s",
|
||||||
readme_file.c_str(), strerror(errno));
|
readme_file.c_str(), strerror(errno));
|
||||||
|
|
||||||
string line;
|
string line;
|
||||||
|
@ -32,7 +32,7 @@ PackageInfo::PackageInfo(const string& arg_name)
|
||||||
readme.push_back(line);
|
readme.push_back(line);
|
||||||
|
|
||||||
if ( f.bad() )
|
if ( f.bad() )
|
||||||
reporter->InternalWarning("Zeexygen error reading '%s': %s",
|
reporter->InternalWarning("Zeekygen error reading '%s': %s",
|
||||||
readme_file.c_str(), strerror(errno));
|
readme_file.c_str(), strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,5 +54,5 @@ time_t PackageInfo::DoGetModificationTime() const
|
||||||
if ( readme_file.empty() )
|
if ( readme_file.empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return zeexygen::get_mtime(readme_file);
|
return zeekygen::get_mtime(readme_file);
|
||||||
}
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_PACKAGEINFO_H
|
#ifndef ZEEKYGEN_PACKAGEINFO_H
|
||||||
#define ZEEXYGEN_PACKAGEINFO_H
|
#define ZEEKYGEN_PACKAGEINFO_H
|
||||||
|
|
||||||
#include "Info.h"
|
#include "Info.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about a Bro script package.
|
* Information about a Bro script package.
|
||||||
|
@ -45,6 +45,6 @@ private:
|
||||||
std::vector<std::string> readme;
|
std::vector<std::string> readme;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -5,7 +5,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
|
|
||||||
ReStructuredTextTable::ReStructuredTextTable(size_t arg_num_cols)
|
ReStructuredTextTable::ReStructuredTextTable(size_t arg_num_cols)
|
||||||
: num_cols(arg_num_cols), rows(), longest_row_in_column()
|
: num_cols(arg_num_cols), rows(), longest_row_in_column()
|
|
@ -1,12 +1,12 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_RESTTABLE_H
|
#ifndef ZEEKYGEN_RESTTABLE_H
|
||||||
#define ZEEXYGEN_RESTTABLE_H
|
#define ZEEKYGEN_RESTTABLE_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reST table with arbitrary number of columns.
|
* A reST table with arbitrary number of columns.
|
||||||
|
@ -48,6 +48,6 @@ private:
|
||||||
std::vector<size_t> longest_row_in_column;
|
std::vector<size_t> longest_row_in_column;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,7 +10,7 @@
|
||||||
#include "Desc.h"
|
#include "Desc.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
|
|
||||||
bool IdInfoComp::operator ()(const IdentifierInfo* lhs,
|
bool IdInfoComp::operator ()(const IdentifierInfo* lhs,
|
||||||
const IdentifierInfo* rhs) const
|
const IdentifierInfo* rhs) const
|
||||||
|
@ -24,11 +24,11 @@ static vector<string> summary_comment(const vector<string>& cmnts)
|
||||||
|
|
||||||
for ( size_t i = 0; i < cmnts.size(); ++i )
|
for ( size_t i = 0; i < cmnts.size(); ++i )
|
||||||
{
|
{
|
||||||
size_t end = zeexygen::end_of_first_sentence(cmnts[i]);
|
size_t end = zeekygen::end_of_first_sentence(cmnts[i]);
|
||||||
|
|
||||||
if ( end == string::npos )
|
if ( end == string::npos )
|
||||||
{
|
{
|
||||||
if ( zeexygen::is_all_whitespace(cmnts[i]) )
|
if ( zeekygen::is_all_whitespace(cmnts[i]) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rval.push_back(cmnts[i]);
|
rval.push_back(cmnts[i]);
|
||||||
|
@ -86,7 +86,7 @@ static string make_summary(const string& heading, char underline, char border,
|
||||||
add_summary_rows(d, summary_comment((*it)->GetComments()), &table);
|
add_summary_rows(d, summary_comment((*it)->GetComments()), &table);
|
||||||
}
|
}
|
||||||
|
|
||||||
return zeexygen::make_heading(heading, underline) + table.AsString(border)
|
return zeekygen::make_heading(heading, underline) + table.AsString(border)
|
||||||
+ "\n";
|
+ "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ static string make_redef_summary(const string& heading, char underline,
|
||||||
add_summary_rows(d, summary_comment(iit->comments), &table);
|
add_summary_rows(d, summary_comment(iit->comments), &table);
|
||||||
}
|
}
|
||||||
|
|
||||||
return zeexygen::make_heading(heading, underline) + table.AsString(border)
|
return zeekygen::make_heading(heading, underline) + table.AsString(border)
|
||||||
+ "\n";
|
+ "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ static string make_details(const string& heading, char underline,
|
||||||
if ( id_list.empty() )
|
if ( id_list.empty() )
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
string rval = zeexygen::make_heading(heading, underline);
|
string rval = zeekygen::make_heading(heading, underline);
|
||||||
|
|
||||||
for ( id_info_list::const_iterator it = id_list.begin();
|
for ( id_info_list::const_iterator it = id_list.begin();
|
||||||
it != id_list.end(); ++it )
|
it != id_list.end(); ++it )
|
||||||
|
@ -143,7 +143,7 @@ static string make_redef_details(const string& heading, char underline,
|
||||||
if ( id_set.empty() )
|
if ( id_set.empty() )
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
string rval = zeexygen::make_heading(heading, underline);
|
string rval = zeekygen::make_heading(heading, underline);
|
||||||
|
|
||||||
for ( id_info_set::const_iterator it = id_set.begin();
|
for ( id_info_set::const_iterator it = id_set.begin();
|
||||||
it != id_set.end(); ++it )
|
it != id_set.end(); ++it )
|
||||||
|
@ -178,13 +178,13 @@ void ScriptInfo::DoInitPostScript()
|
||||||
IdentifierInfo* info = it->second;
|
IdentifierInfo* info = it->second;
|
||||||
ID* id = info->GetID();
|
ID* id = info->GetID();
|
||||||
|
|
||||||
if ( ! zeexygen::is_public_api(id) )
|
if ( ! zeekygen::is_public_api(id) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( id->AsType() )
|
if ( id->AsType() )
|
||||||
{
|
{
|
||||||
types.push_back(info);
|
types.push_back(info);
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Filter id '%s' in '%s' as a type",
|
DBG_LOG(DBG_ZEEKYGEN, "Filter id '%s' in '%s' as a type",
|
||||||
id->Name(), name.c_str());
|
id->Name(), name.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -193,17 +193,17 @@ void ScriptInfo::DoInitPostScript()
|
||||||
{
|
{
|
||||||
switch ( id->Type()->AsFuncType()->Flavor() ) {
|
switch ( id->Type()->AsFuncType()->Flavor() ) {
|
||||||
case FUNC_FLAVOR_HOOK:
|
case FUNC_FLAVOR_HOOK:
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Filter id '%s' in '%s' as a hook",
|
DBG_LOG(DBG_ZEEKYGEN, "Filter id '%s' in '%s' as a hook",
|
||||||
id->Name(), name.c_str());
|
id->Name(), name.c_str());
|
||||||
hooks.push_back(info);
|
hooks.push_back(info);
|
||||||
break;
|
break;
|
||||||
case FUNC_FLAVOR_EVENT:
|
case FUNC_FLAVOR_EVENT:
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Filter id '%s' in '%s' as a event",
|
DBG_LOG(DBG_ZEEKYGEN, "Filter id '%s' in '%s' as a event",
|
||||||
id->Name(), name.c_str());
|
id->Name(), name.c_str());
|
||||||
events.push_back(info);
|
events.push_back(info);
|
||||||
break;
|
break;
|
||||||
case FUNC_FLAVOR_FUNCTION:
|
case FUNC_FLAVOR_FUNCTION:
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Filter id '%s' in '%s' as a function",
|
DBG_LOG(DBG_ZEEKYGEN, "Filter id '%s' in '%s' as a function",
|
||||||
id->Name(), name.c_str());
|
id->Name(), name.c_str());
|
||||||
functions.push_back(info);
|
functions.push_back(info);
|
||||||
break;
|
break;
|
||||||
|
@ -219,13 +219,13 @@ void ScriptInfo::DoInitPostScript()
|
||||||
{
|
{
|
||||||
if ( id->FindAttr(ATTR_REDEF) )
|
if ( id->FindAttr(ATTR_REDEF) )
|
||||||
{
|
{
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Filter id '%s' in '%s' as a redef_option",
|
DBG_LOG(DBG_ZEEKYGEN, "Filter id '%s' in '%s' as a redef_option",
|
||||||
id->Name(), name.c_str());
|
id->Name(), name.c_str());
|
||||||
redef_options.push_back(info);
|
redef_options.push_back(info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Filter id '%s' in '%s' as a constant",
|
DBG_LOG(DBG_ZEEKYGEN, "Filter id '%s' in '%s' as a constant",
|
||||||
id->Name(), name.c_str());
|
id->Name(), name.c_str());
|
||||||
constants.push_back(info);
|
constants.push_back(info);
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ void ScriptInfo::DoInitPostScript()
|
||||||
}
|
}
|
||||||
else if ( id->IsOption() )
|
else if ( id->IsOption() )
|
||||||
{
|
{
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Filter id '%s' in '%s' as an runtime option",
|
DBG_LOG(DBG_ZEEKYGEN, "Filter id '%s' in '%s' as an runtime option",
|
||||||
id->Name(), name.c_str());
|
id->Name(), name.c_str());
|
||||||
options.push_back(info);
|
options.push_back(info);
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ void ScriptInfo::DoInitPostScript()
|
||||||
// documentation.
|
// documentation.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Filter id '%s' in '%s' as a state variable",
|
DBG_LOG(DBG_ZEEKYGEN, "Filter id '%s' in '%s' as a state variable",
|
||||||
id->Name(), name.c_str());
|
id->Name(), name.c_str());
|
||||||
state_vars.push_back(info);
|
state_vars.push_back(info);
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ string ScriptInfo::DoReStructuredText(bool roles_only) const
|
||||||
string rval;
|
string rval;
|
||||||
|
|
||||||
rval += ":tocdepth: 3\n\n";
|
rval += ":tocdepth: 3\n\n";
|
||||||
rval += zeexygen::make_heading(name, '=');
|
rval += zeekygen::make_heading(name, '=');
|
||||||
|
|
||||||
for ( string_set::const_iterator it = module_usages.begin();
|
for ( string_set::const_iterator it = module_usages.begin();
|
||||||
it != module_usages.end(); ++it )
|
it != module_usages.end(); ++it )
|
||||||
|
@ -329,7 +329,7 @@ string ScriptInfo::DoReStructuredText(bool roles_only) const
|
||||||
|
|
||||||
//rval += fmt(":Source File: :download:`/scripts/%s`\n", name.c_str());
|
//rval += fmt(":Source File: :download:`/scripts/%s`\n", name.c_str());
|
||||||
rval += "\n";
|
rval += "\n";
|
||||||
rval += zeexygen::make_heading("Summary", '~');
|
rval += zeekygen::make_heading("Summary", '~');
|
||||||
rval += make_summary("Runtime Options", '#', '=', options);
|
rval += make_summary("Runtime Options", '#', '=', options);
|
||||||
rval += make_summary("Redefinable Options", '#', '=', redef_options);
|
rval += make_summary("Redefinable Options", '#', '=', redef_options);
|
||||||
rval += make_summary("Constants", '#', '=', constants);
|
rval += make_summary("Constants", '#', '=', constants);
|
||||||
|
@ -340,7 +340,7 @@ string ScriptInfo::DoReStructuredText(bool roles_only) const
|
||||||
rval += make_summary("Hooks", '#', '=', hooks);
|
rval += make_summary("Hooks", '#', '=', hooks);
|
||||||
rval += make_summary("Functions", '#', '=', functions);
|
rval += make_summary("Functions", '#', '=', functions);
|
||||||
rval += "\n";
|
rval += "\n";
|
||||||
rval += zeexygen::make_heading("Detailed Interface", '~');
|
rval += zeekygen::make_heading("Detailed Interface", '~');
|
||||||
rval += make_details("Runtime Options", '#', options);
|
rval += make_details("Runtime Options", '#', options);
|
||||||
rval += make_details("Redefinable Options", '#', redef_options);
|
rval += make_details("Redefinable Options", '#', redef_options);
|
||||||
rval += make_details("Constants", '#', constants);
|
rval += make_details("Constants", '#', constants);
|
||||||
|
@ -356,25 +356,25 @@ string ScriptInfo::DoReStructuredText(bool roles_only) const
|
||||||
|
|
||||||
time_t ScriptInfo::DoGetModificationTime() const
|
time_t ScriptInfo::DoGetModificationTime() const
|
||||||
{
|
{
|
||||||
time_t most_recent = zeexygen::get_mtime(path);
|
time_t most_recent = zeekygen::get_mtime(path);
|
||||||
|
|
||||||
for ( string_set::const_iterator it = dependencies.begin();
|
for ( string_set::const_iterator it = dependencies.begin();
|
||||||
it != dependencies.end(); ++it )
|
it != dependencies.end(); ++it )
|
||||||
{
|
{
|
||||||
Info* info = zeexygen_mgr->GetScriptInfo(*it);
|
Info* info = zeekygen_mgr->GetScriptInfo(*it);
|
||||||
|
|
||||||
if ( ! info )
|
if ( ! info )
|
||||||
{
|
{
|
||||||
for (const string& ext : script_extensions)
|
for (const string& ext : script_extensions)
|
||||||
{
|
{
|
||||||
string pkg_name = *it + "/__load__" + ext;
|
string pkg_name = *it + "/__load__" + ext;
|
||||||
info = zeexygen_mgr->GetScriptInfo(pkg_name);
|
info = zeekygen_mgr->GetScriptInfo(pkg_name);
|
||||||
if ( info )
|
if ( info )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! info )
|
if ( ! info )
|
||||||
reporter->InternalWarning("Zeexygen failed to get mtime of %s",
|
reporter->InternalWarning("Zeekygen failed to get mtime of %s",
|
||||||
it->c_str());
|
it->c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_SCRIPTINFO_H
|
#ifndef ZEEKYGEN_SCRIPTINFO_H
|
||||||
#define ZEEXYGEN_SCRIPTINFO_H
|
#define ZEEKYGEN_SCRIPTINFO_H
|
||||||
|
|
||||||
#include "Info.h"
|
#include "Info.h"
|
||||||
#include "IdentifierInfo.h"
|
#include "IdentifierInfo.h"
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
class IdentifierInfo;
|
class IdentifierInfo;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public:
|
||||||
ScriptInfo(const std::string& name, const std::string& path);
|
ScriptInfo(const std::string& name, const std::string& path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associate a Zeexygen summary comment ("##!") with the script.
|
* Associate a Zeekygen summary comment ("##!") with the script.
|
||||||
* @param comment String extracted from the comment.
|
* @param comment String extracted from the comment.
|
||||||
*/
|
*/
|
||||||
void AddComment(const std::string& comment)
|
void AddComment(const std::string& comment)
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
{ return is_pkg_loader; }
|
{ return is_pkg_loader; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return All the scripts Zeexygen summary comments.
|
* @return All the scripts Zeekygen summary comments.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> GetComments() const;
|
std::vector<std::string> GetComments() const;
|
||||||
|
|
||||||
|
@ -119,6 +119,6 @@ private:
|
||||||
id_info_set redefs;
|
id_info_set redefs;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -16,7 +16,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
|
|
||||||
static void write_plugin_section_heading(FILE* f, const plugin::Plugin* p)
|
static void write_plugin_section_heading(FILE* f, const plugin::Plugin* p)
|
||||||
{
|
{
|
||||||
|
@ -123,13 +123,13 @@ static void write_plugin_bif_items(FILE* f, const plugin::Plugin* p,
|
||||||
|
|
||||||
for ( it = bifitems.begin(); it != bifitems.end(); ++it )
|
for ( it = bifitems.begin(); it != bifitems.end(); ++it )
|
||||||
{
|
{
|
||||||
zeexygen::IdentifierInfo* doc = zeexygen_mgr->GetIdentifierInfo(
|
zeekygen::IdentifierInfo* doc = zeekygen_mgr->GetIdentifierInfo(
|
||||||
it->GetID());
|
it->GetID());
|
||||||
|
|
||||||
if ( doc )
|
if ( doc )
|
||||||
fprintf(f, "%s\n\n", doc->ReStructuredText().c_str());
|
fprintf(f, "%s\n\n", doc->ReStructuredText().c_str());
|
||||||
else
|
else
|
||||||
reporter->InternalWarning("Zeexygen ID lookup failed: %s\n",
|
reporter->InternalWarning("Zeekygen ID lookup failed: %s\n",
|
||||||
it->GetID().c_str());
|
it->GetID().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,10 +138,10 @@ static void WriteAnalyzerTagDefn(FILE* f, const string& module)
|
||||||
{
|
{
|
||||||
string tag_id = module + "::Tag";
|
string tag_id = module + "::Tag";
|
||||||
|
|
||||||
zeexygen::IdentifierInfo* doc = zeexygen_mgr->GetIdentifierInfo(tag_id);
|
zeekygen::IdentifierInfo* doc = zeekygen_mgr->GetIdentifierInfo(tag_id);
|
||||||
|
|
||||||
if ( ! doc )
|
if ( ! doc )
|
||||||
reporter->InternalError("Zeexygen failed analyzer tag lookup: %s",
|
reporter->InternalError("Zeekygen failed analyzer tag lookup: %s",
|
||||||
tag_id.c_str());
|
tag_id.c_str());
|
||||||
|
|
||||||
fprintf(f, "%s\n", doc->ReStructuredText().c_str());
|
fprintf(f, "%s\n", doc->ReStructuredText().c_str());
|
||||||
|
@ -177,7 +177,7 @@ static vector<T*> filter_matches(const vector<Info*>& from, Target* t)
|
||||||
|
|
||||||
if ( t->MatchesPattern(d) )
|
if ( t->MatchesPattern(d) )
|
||||||
{
|
{
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "'%s' matched pattern for target '%s'",
|
DBG_LOG(DBG_ZEEKYGEN, "'%s' matched pattern for target '%s'",
|
||||||
d->Name().c_str(), t->Name().c_str());
|
d->Name().c_str(), t->Name().c_str());
|
||||||
rval.push_back(d);
|
rval.push_back(d);
|
||||||
}
|
}
|
||||||
|
@ -194,14 +194,14 @@ TargetFile::TargetFile(const string& arg_name)
|
||||||
string dir = SafeDirname(name).result;
|
string dir = SafeDirname(name).result;
|
||||||
|
|
||||||
if ( ! ensure_intermediate_dirs(dir.c_str()) )
|
if ( ! ensure_intermediate_dirs(dir.c_str()) )
|
||||||
reporter->FatalError("Zeexygen failed to make dir %s",
|
reporter->FatalError("Zeekygen failed to make dir %s",
|
||||||
dir.c_str());
|
dir.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen(name.c_str(), "w");
|
f = fopen(name.c_str(), "w");
|
||||||
|
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
reporter->FatalError("Zeexygen failed to open '%s' for writing: %s",
|
reporter->FatalError("Zeekygen failed to open '%s' for writing: %s",
|
||||||
name.c_str(), strerror(errno));
|
name.c_str(), strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ TargetFile::~TargetFile()
|
||||||
if ( f )
|
if ( f )
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Wrote out-of-date target '%s'", name.c_str());
|
DBG_LOG(DBG_ZEEKYGEN, "Wrote out-of-date target '%s'", name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,11 +245,11 @@ void AnalyzerTarget::DoFindDependencies(const std::vector<Info *>& infos)
|
||||||
|
|
||||||
void AnalyzerTarget::DoGenerate() const
|
void AnalyzerTarget::DoGenerate() const
|
||||||
{
|
{
|
||||||
if ( zeexygen_mgr->IsUpToDate(Name(), vector<Info*>()) )
|
if ( zeekygen_mgr->IsUpToDate(Name(), vector<Info*>()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( Pattern() != "*" )
|
if ( Pattern() != "*" )
|
||||||
reporter->InternalWarning("Zeexygen only implements analyzer target"
|
reporter->InternalWarning("Zeekygen only implements analyzer target"
|
||||||
" pattern '*'");
|
" pattern '*'");
|
||||||
|
|
||||||
TargetFile file(Name());
|
TargetFile file(Name());
|
||||||
|
@ -313,7 +313,7 @@ void PackageTarget::DoFindDependencies(const vector<Info*>& infos)
|
||||||
pkg_deps = filter_matches<PackageInfo>(infos, this);
|
pkg_deps = filter_matches<PackageInfo>(infos, this);
|
||||||
|
|
||||||
if ( pkg_deps.empty() )
|
if ( pkg_deps.empty() )
|
||||||
reporter->FatalError("No match for Zeexygen target '%s' pattern '%s'",
|
reporter->FatalError("No match for Zeekygen target '%s' pattern '%s'",
|
||||||
Name().c_str(), Pattern().c_str());
|
Name().c_str(), Pattern().c_str());
|
||||||
|
|
||||||
for ( size_t i = 0; i < infos.size(); ++i )
|
for ( size_t i = 0; i < infos.size(); ++i )
|
||||||
|
@ -329,7 +329,7 @@ void PackageTarget::DoFindDependencies(const vector<Info*>& infos)
|
||||||
pkg_deps[j]->Name().size()))
|
pkg_deps[j]->Name().size()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Script %s associated with package %s",
|
DBG_LOG(DBG_ZEEKYGEN, "Script %s associated with package %s",
|
||||||
script->Name().c_str(), pkg_deps[j]->Name().c_str());
|
script->Name().c_str(), pkg_deps[j]->Name().c_str());
|
||||||
pkg_manifest[pkg_deps[j]].push_back(script);
|
pkg_manifest[pkg_deps[j]].push_back(script);
|
||||||
script_deps.push_back(script);
|
script_deps.push_back(script);
|
||||||
|
@ -339,8 +339,8 @@ void PackageTarget::DoFindDependencies(const vector<Info*>& infos)
|
||||||
|
|
||||||
void PackageTarget::DoGenerate() const
|
void PackageTarget::DoGenerate() const
|
||||||
{
|
{
|
||||||
if ( zeexygen_mgr->IsUpToDate(Name(), script_deps) &&
|
if ( zeekygen_mgr->IsUpToDate(Name(), script_deps) &&
|
||||||
zeexygen_mgr->IsUpToDate(Name(), pkg_deps) )
|
zeekygen_mgr->IsUpToDate(Name(), pkg_deps) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TargetFile file(Name());
|
TargetFile file(Name());
|
||||||
|
@ -382,13 +382,13 @@ void PackageIndexTarget::DoFindDependencies(const vector<Info*>& infos)
|
||||||
pkg_deps = filter_matches<PackageInfo>(infos, this);
|
pkg_deps = filter_matches<PackageInfo>(infos, this);
|
||||||
|
|
||||||
if ( pkg_deps.empty() )
|
if ( pkg_deps.empty() )
|
||||||
reporter->FatalError("No match for Zeexygen target '%s' pattern '%s'",
|
reporter->FatalError("No match for Zeekygen target '%s' pattern '%s'",
|
||||||
Name().c_str(), Pattern().c_str());
|
Name().c_str(), Pattern().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageIndexTarget::DoGenerate() const
|
void PackageIndexTarget::DoGenerate() const
|
||||||
{
|
{
|
||||||
if ( zeexygen_mgr->IsUpToDate(Name(), pkg_deps) )
|
if ( zeekygen_mgr->IsUpToDate(Name(), pkg_deps) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TargetFile file(Name());
|
TargetFile file(Name());
|
||||||
|
@ -402,7 +402,7 @@ void ScriptTarget::DoFindDependencies(const vector<Info*>& infos)
|
||||||
script_deps = filter_matches<ScriptInfo>(infos, this);
|
script_deps = filter_matches<ScriptInfo>(infos, this);
|
||||||
|
|
||||||
if ( script_deps.empty() )
|
if ( script_deps.empty() )
|
||||||
reporter->FatalError("No match for Zeexygen target '%s' pattern '%s'",
|
reporter->FatalError("No match for Zeekygen target '%s' pattern '%s'",
|
||||||
Name().c_str(), Pattern().c_str());
|
Name().c_str(), Pattern().c_str());
|
||||||
|
|
||||||
if ( ! IsDir() )
|
if ( ! IsDir() )
|
||||||
|
@ -483,7 +483,7 @@ void ScriptTarget::DoGenerate() const
|
||||||
vector<ScriptInfo*> dep;
|
vector<ScriptInfo*> dep;
|
||||||
dep.push_back(script_deps[i]);
|
dep.push_back(script_deps[i]);
|
||||||
|
|
||||||
if ( zeexygen_mgr->IsUpToDate(target_filename, dep) )
|
if ( zeekygen_mgr->IsUpToDate(target_filename, dep) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TargetFile file(target_filename);
|
TargetFile file(target_filename);
|
||||||
|
@ -508,7 +508,7 @@ void ScriptTarget::DoGenerate() const
|
||||||
reporter->Warning("Failed to unlink %s: %s", f.c_str(),
|
reporter->Warning("Failed to unlink %s: %s", f.c_str(),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
|
||||||
DBG_LOG(DBG_ZEEXYGEN, "Delete stale script file %s", f.c_str());
|
DBG_LOG(DBG_ZEEKYGEN, "Delete stale script file %s", f.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -516,7 +516,7 @@ void ScriptTarget::DoGenerate() const
|
||||||
|
|
||||||
// Target is a single file, all matching scripts get written there.
|
// Target is a single file, all matching scripts get written there.
|
||||||
|
|
||||||
if ( zeexygen_mgr->IsUpToDate(Name(), script_deps) )
|
if ( zeekygen_mgr->IsUpToDate(Name(), script_deps) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TargetFile file(Name());
|
TargetFile file(Name());
|
||||||
|
@ -527,7 +527,7 @@ void ScriptTarget::DoGenerate() const
|
||||||
|
|
||||||
void ScriptSummaryTarget::DoGenerate() const
|
void ScriptSummaryTarget::DoGenerate() const
|
||||||
{
|
{
|
||||||
if ( zeexygen_mgr->IsUpToDate(Name(), script_deps) )
|
if ( zeekygen_mgr->IsUpToDate(Name(), script_deps) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TargetFile file(Name());
|
TargetFile file(Name());
|
||||||
|
@ -552,7 +552,7 @@ void ScriptSummaryTarget::DoGenerate() const
|
||||||
|
|
||||||
void ScriptIndexTarget::DoGenerate() const
|
void ScriptIndexTarget::DoGenerate() const
|
||||||
{
|
{
|
||||||
if ( zeexygen_mgr->IsUpToDate(Name(), script_deps) )
|
if ( zeekygen_mgr->IsUpToDate(Name(), script_deps) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TargetFile file(Name());
|
TargetFile file(Name());
|
||||||
|
@ -577,13 +577,13 @@ void IdentifierTarget::DoFindDependencies(const vector<Info*>& infos)
|
||||||
id_deps = filter_matches<IdentifierInfo>(infos, this);
|
id_deps = filter_matches<IdentifierInfo>(infos, this);
|
||||||
|
|
||||||
if ( id_deps.empty() )
|
if ( id_deps.empty() )
|
||||||
reporter->FatalError("No match for Zeexygen target '%s' pattern '%s'",
|
reporter->FatalError("No match for Zeekygen target '%s' pattern '%s'",
|
||||||
Name().c_str(), Pattern().c_str());
|
Name().c_str(), Pattern().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdentifierTarget::DoGenerate() const
|
void IdentifierTarget::DoGenerate() const
|
||||||
{
|
{
|
||||||
if ( zeexygen_mgr->IsUpToDate(Name(), id_deps) )
|
if ( zeekygen_mgr->IsUpToDate(Name(), id_deps) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TargetFile file(Name());
|
TargetFile file(Name());
|
|
@ -1,7 +1,7 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_TARGET_H
|
#ifndef ZEEKYGEN_TARGET_H
|
||||||
#define ZEEXYGEN_TARGET_H
|
#define ZEEKYGEN_TARGET_H
|
||||||
|
|
||||||
#include "Info.h"
|
#include "Info.h"
|
||||||
#include "PackageInfo.h"
|
#include "PackageInfo.h"
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to create files in arbitrary file paths and automatically
|
* Helper class to create files in arbitrary file paths and automatically
|
||||||
|
@ -39,7 +39,7 @@ struct TargetFile {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Zeexygen target abstract base class. A target is generally any portion of
|
* A Zeekygen target abstract base class. A target is generally any portion of
|
||||||
* documentation that Bro can build. It's identified by a type (e.g. script,
|
* documentation that Bro can build. It's identified by a type (e.g. script,
|
||||||
* identifier, package), a pattern (e.g. "example.zeek", "HTTP::Info"), and
|
* identifier, package), a pattern (e.g. "example.zeek", "HTTP::Info"), and
|
||||||
* a path to an output file.
|
* a path to an output file.
|
||||||
|
@ -125,7 +125,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new target type.
|
* Register a new target type.
|
||||||
* @param type_name The target type name as it will appear in Zeexygen
|
* @param type_name The target type name as it will appear in Zeekygen
|
||||||
* config files.
|
* config files.
|
||||||
*/
|
*/
|
||||||
template<class T>
|
template<class T>
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a target.
|
* Instantiate a target.
|
||||||
* @param type_name The target type name as it appears in Zeexygen config
|
* @param type_name The target type name as it appears in Zeekygen config
|
||||||
* files.
|
* files.
|
||||||
* @param name The output file name of the target.
|
* @param name The output file name of the target.
|
||||||
* @param pattern The dependency pattern of the target.
|
* @param pattern The dependency pattern of the target.
|
||||||
|
@ -384,6 +384,6 @@ private:
|
||||||
std::vector<IdentifierInfo*> id_deps;
|
std::vector<IdentifierInfo*> id_deps;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -7,10 +7,10 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
bool zeexygen::prettify_params(string& s)
|
bool zeekygen::prettify_params(string& s)
|
||||||
{
|
{
|
||||||
size_t identifier_start_pos = 0;
|
size_t identifier_start_pos = 0;
|
||||||
bool in_identifier = false;
|
bool in_identifier = false;
|
||||||
|
@ -76,29 +76,29 @@ bool zeexygen::prettify_params(string& s)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zeexygen::is_public_api(const ID* id)
|
bool zeekygen::is_public_api(const ID* id)
|
||||||
{
|
{
|
||||||
return (id->Scope() == SCOPE_GLOBAL) ||
|
return (id->Scope() == SCOPE_GLOBAL) ||
|
||||||
(id->Scope() == SCOPE_MODULE && id->IsExport());
|
(id->Scope() == SCOPE_MODULE && id->IsExport());
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t zeexygen::get_mtime(const string& filename)
|
time_t zeekygen::get_mtime(const string& filename)
|
||||||
{
|
{
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
if ( stat(filename.c_str(), &s) < 0 )
|
if ( stat(filename.c_str(), &s) < 0 )
|
||||||
reporter->InternalError("Zeexygen failed to stat file '%s': %s",
|
reporter->InternalError("Zeekygen failed to stat file '%s': %s",
|
||||||
filename.c_str(), strerror(errno));
|
filename.c_str(), strerror(errno));
|
||||||
|
|
||||||
return s.st_mtime;
|
return s.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
string zeexygen::make_heading(const string& heading, char underline)
|
string zeekygen::make_heading(const string& heading, char underline)
|
||||||
{
|
{
|
||||||
return heading + "\n" + string(heading.size(), underline) + "\n";
|
return heading + "\n" + string(heading.size(), underline) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t zeexygen::end_of_first_sentence(const string& s)
|
size_t zeekygen::end_of_first_sentence(const string& s)
|
||||||
{
|
{
|
||||||
size_t rval = 0;
|
size_t rval = 0;
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ size_t zeexygen::end_of_first_sentence(const string& s)
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zeexygen::is_all_whitespace(const string& s)
|
bool zeekygen::is_all_whitespace(const string& s)
|
||||||
{
|
{
|
||||||
for ( size_t i = 0; i < s.size(); ++i )
|
for ( size_t i = 0; i < s.size(); ++i )
|
||||||
if ( ! isspace(s[i]) )
|
if ( ! isspace(s[i]) )
|
||||||
|
@ -128,7 +128,7 @@ bool zeexygen::is_all_whitespace(const string& s)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
string zeexygen::redef_indication(const string& from_script)
|
string zeekygen::redef_indication(const string& from_script)
|
||||||
{
|
{
|
||||||
return fmt("(present if :doc:`/scripts/%s` is loaded)",
|
return fmt("(present if :doc:`/scripts/%s` is loaded)",
|
||||||
from_script.c_str());
|
from_script.c_str());
|
|
@ -1,18 +1,18 @@
|
||||||
// See the file "COPYING" in the main distribution directory for copyright.
|
// See the file "COPYING" in the main distribution directory for copyright.
|
||||||
|
|
||||||
#ifndef ZEEXYGEN_UTILS_H
|
#ifndef ZEEKYGEN_UTILS_H
|
||||||
#define ZEEXYGEN_UTILS_H
|
#define ZEEKYGEN_UTILS_H
|
||||||
|
|
||||||
#include "ID.h"
|
#include "ID.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace zeexygen {
|
namespace zeekygen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform content of a Zeexygen comment which may contain function
|
* Transform content of a Zeekygen comment which may contain function
|
||||||
* parameter or return value documentation to a prettier reST format.
|
* parameter or return value documentation to a prettier reST format.
|
||||||
* @param s Content from a Zeexygen comment to transform. "id: ..." and
|
* @param s Content from a Zeekygen comment to transform. "id: ..." and
|
||||||
* "Returns: ..." change to ":id: ..." and ":returns: ...".
|
* "Returns: ..." change to ":id: ..." and ":returns: ...".
|
||||||
* @return Whether any content in \a s was transformed.
|
* @return Whether any content in \a s was transformed.
|
||||||
*/
|
*/
|
||||||
|
@ -62,6 +62,6 @@ bool is_all_whitespace(const std::string& s);
|
||||||
*/
|
*/
|
||||||
std::string redef_indication(const std::string& from_script);
|
std::string redef_indication(const std::string& from_script);
|
||||||
|
|
||||||
} // namespace zeexygen
|
} // namespace zeekygen
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,7 +3,7 @@
|
||||||
##! Functions for querying script, package, or variable documentation.
|
##! Functions for querying script, package, or variable documentation.
|
||||||
|
|
||||||
%%{
|
%%{
|
||||||
#include "zeexygen/Manager.h"
|
#include "zeekygen/Manager.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static StringVal* comments_to_val(const vector<string>& comments)
|
static StringVal* comments_to_val(const vector<string>& comments)
|
||||||
|
@ -12,7 +12,7 @@ static StringVal* comments_to_val(const vector<string>& comments)
|
||||||
}
|
}
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
## Retrieve the Zeexygen-style comments (``##``) associated with an identifier
|
## Retrieve the Zeekygen-style comments (``##``) associated with an identifier
|
||||||
## (e.g. a variable or type).
|
## (e.g. a variable or type).
|
||||||
##
|
##
|
||||||
## name: a script-level identifier for which to retrieve comments.
|
## name: a script-level identifier for which to retrieve comments.
|
||||||
|
@ -21,8 +21,8 @@ static StringVal* comments_to_val(const vector<string>& comments)
|
||||||
## identifier, an empty string is returned.
|
## identifier, an empty string is returned.
|
||||||
function get_identifier_comments%(name: string%): string
|
function get_identifier_comments%(name: string%): string
|
||||||
%{
|
%{
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
IdentifierInfo* d = zeexygen_mgr->GetIdentifierInfo(name->CheckString());
|
IdentifierInfo* d = zeekygen_mgr->GetIdentifierInfo(name->CheckString());
|
||||||
|
|
||||||
if ( ! d )
|
if ( ! d )
|
||||||
return val_mgr->GetEmptyString();
|
return val_mgr->GetEmptyString();
|
||||||
|
@ -30,7 +30,7 @@ function get_identifier_comments%(name: string%): string
|
||||||
return comments_to_val(d->GetComments());
|
return comments_to_val(d->GetComments());
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Retrieve the Zeexygen-style summary comments (``##!``) associated with
|
## Retrieve the Zeekygen-style summary comments (``##!``) associated with
|
||||||
## a Bro script.
|
## a Bro script.
|
||||||
##
|
##
|
||||||
## name: the name of a Bro script. It must be a relative path to where
|
## name: the name of a Bro script. It must be a relative path to where
|
||||||
|
@ -41,8 +41,8 @@ function get_identifier_comments%(name: string%): string
|
||||||
## *name* is not a known script, an empty string is returned.
|
## *name* is not a known script, an empty string is returned.
|
||||||
function get_script_comments%(name: string%): string
|
function get_script_comments%(name: string%): string
|
||||||
%{
|
%{
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
ScriptInfo* d = zeexygen_mgr->GetScriptInfo(name->CheckString());
|
ScriptInfo* d = zeekygen_mgr->GetScriptInfo(name->CheckString());
|
||||||
|
|
||||||
if ( ! d )
|
if ( ! d )
|
||||||
return val_mgr->GetEmptyString();
|
return val_mgr->GetEmptyString();
|
||||||
|
@ -59,8 +59,8 @@ function get_script_comments%(name: string%): string
|
||||||
## package, an empty string is returned.
|
## package, an empty string is returned.
|
||||||
function get_package_readme%(name: string%): string
|
function get_package_readme%(name: string%): string
|
||||||
%{
|
%{
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
PackageInfo* d = zeexygen_mgr->GetPackageInfo(name->CheckString());
|
PackageInfo* d = zeekygen_mgr->GetPackageInfo(name->CheckString());
|
||||||
|
|
||||||
if ( ! d )
|
if ( ! d )
|
||||||
return val_mgr->GetEmptyString();
|
return val_mgr->GetEmptyString();
|
||||||
|
@ -68,7 +68,7 @@ function get_package_readme%(name: string%): string
|
||||||
return comments_to_val(d->GetReadme());
|
return comments_to_val(d->GetReadme());
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Retrieve the Zeexygen-style comments (``##``) associated with a record field.
|
## Retrieve the Zeekygen-style comments (``##``) associated with a record field.
|
||||||
##
|
##
|
||||||
## name: the name of a record type and a field within it formatted like
|
## name: the name of a record type and a field within it formatted like
|
||||||
## a typical record field access: "<record_type>$<field>".
|
## a typical record field access: "<record_type>$<field>".
|
||||||
|
@ -78,7 +78,7 @@ function get_package_readme%(name: string%): string
|
||||||
## type, an empty string is returned.
|
## type, an empty string is returned.
|
||||||
function get_record_field_comments%(name: string%): string
|
function get_record_field_comments%(name: string%): string
|
||||||
%{
|
%{
|
||||||
using namespace zeexygen;
|
using namespace zeekygen;
|
||||||
string accessor = name->CheckString();
|
string accessor = name->CheckString();
|
||||||
size_t i = accessor.find('$');
|
size_t i = accessor.find('$');
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ function get_record_field_comments%(name: string%): string
|
||||||
|
|
||||||
string id = accessor.substr(0, i);
|
string id = accessor.substr(0, i);
|
||||||
|
|
||||||
IdentifierInfo* d = zeexygen_mgr->GetIdentifierInfo(id);
|
IdentifierInfo* d = zeekygen_mgr->GetIdentifierInfo(id);
|
||||||
|
|
||||||
if ( ! d )
|
if ( ! d )
|
||||||
return val_mgr->GetEmptyString();
|
return val_mgr->GetEmptyString();
|
|
@ -275,7 +275,7 @@
|
||||||
0.000000 MetaHookPost LoadFile(./average) -> -1
|
0.000000 MetaHookPost LoadFile(./average) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(./bloom-filter.bif.bro) -> -1
|
0.000000 MetaHookPost LoadFile(./bloom-filter.bif.bro) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(./bro.bif.bro) -> -1
|
0.000000 MetaHookPost LoadFile(./bro.bif.bro) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(./zeexygen.bif.bro) -> -1
|
0.000000 MetaHookPost LoadFile(./zeekygen.bif.bro) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(./cardinality-counter.bif.bro) -> -1
|
0.000000 MetaHookPost LoadFile(./cardinality-counter.bif.bro) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(./const.bif.bro) -> -1
|
0.000000 MetaHookPost LoadFile(./const.bif.bro) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(./consts) -> -1
|
0.000000 MetaHookPost LoadFile(./consts) -> -1
|
||||||
|
@ -855,7 +855,7 @@
|
||||||
0.000000 MetaHookPre LoadFile(./average)
|
0.000000 MetaHookPre LoadFile(./average)
|
||||||
0.000000 MetaHookPre LoadFile(./bloom-filter.bif.bro)
|
0.000000 MetaHookPre LoadFile(./bloom-filter.bif.bro)
|
||||||
0.000000 MetaHookPre LoadFile(./bro.bif.bro)
|
0.000000 MetaHookPre LoadFile(./bro.bif.bro)
|
||||||
0.000000 MetaHookPre LoadFile(./zeexygen.bif.bro)
|
0.000000 MetaHookPre LoadFile(./zeekygen.bif.bro)
|
||||||
0.000000 MetaHookPre LoadFile(./cardinality-counter.bif.bro)
|
0.000000 MetaHookPre LoadFile(./cardinality-counter.bif.bro)
|
||||||
0.000000 MetaHookPre LoadFile(./const.bif.bro)
|
0.000000 MetaHookPre LoadFile(./const.bif.bro)
|
||||||
0.000000 MetaHookPre LoadFile(./consts)
|
0.000000 MetaHookPre LoadFile(./consts)
|
||||||
|
@ -1435,7 +1435,7 @@
|
||||||
0.000000 | HookLoadFile ./average.bro/bro
|
0.000000 | HookLoadFile ./average.bro/bro
|
||||||
0.000000 | HookLoadFile ./bloom-filter.bif.bro/bro
|
0.000000 | HookLoadFile ./bloom-filter.bif.bro/bro
|
||||||
0.000000 | HookLoadFile ./bro.bif.bro/bro
|
0.000000 | HookLoadFile ./bro.bif.bro/bro
|
||||||
0.000000 | HookLoadFile ./zeexygen.bif.bro/bro
|
0.000000 | HookLoadFile ./zeekygen.bif.bro/bro
|
||||||
0.000000 | HookLoadFile ./cardinality-counter.bif.bro/bro
|
0.000000 | HookLoadFile ./cardinality-counter.bif.bro/bro
|
||||||
0.000000 | HookLoadFile ./const.bif.bro/bro
|
0.000000 | HookLoadFile ./const.bif.bro/bro
|
||||||
0.000000 | HookLoadFile ./consts.bif.bro/bro
|
0.000000 | HookLoadFile ./consts.bif.bro/bro
|
||||||
|
|
|
@ -55,7 +55,7 @@ scripts/base/init-frameworks-and-bifs.zeek
|
||||||
scripts/base/utils/patterns.zeek
|
scripts/base/utils/patterns.zeek
|
||||||
scripts/base/frameworks/files/magic/__load__.zeek
|
scripts/base/frameworks/files/magic/__load__.zeek
|
||||||
build/scripts/base/bif/__load__.zeek
|
build/scripts/base/bif/__load__.zeek
|
||||||
build/scripts/base/bif/zeexygen.bif.zeek
|
build/scripts/base/bif/zeekygen.bif.zeek
|
||||||
build/scripts/base/bif/pcap.bif.zeek
|
build/scripts/base/bif/pcap.bif.zeek
|
||||||
build/scripts/base/bif/bloom-filter.bif.zeek
|
build/scripts/base/bif/bloom-filter.bif.zeek
|
||||||
build/scripts/base/bif/cardinality-counter.bif.zeek
|
build/scripts/base/bif/cardinality-counter.bif.zeek
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
warning in /Users/johanna/bro/master/scripts/policy/misc/trim-trace-file.zeek, line 25: deprecated (rotate_file_by_name)
|
warning in /Users/johanna/bro/master/scripts/policy/misc/trim-trace-file.zeek, line 25: deprecated (rotate_file_by_name)
|
||||||
warning in /Users/johanna/bro/master/scripts/policy/misc/trim-trace-file.zeek, line 25: deprecated (rotate_file_by_name)
|
warning in /Users/johanna/bro/master/scripts/policy/misc/trim-trace-file.zeek, line 25: deprecated (rotate_file_by_name)
|
||||||
warning in /Users/johanna/bro/master/scripts/policy/protocols/smb/__load__.zeek, line 1: deprecated script loaded from /Users/johanna/bro/master/testing/btest/../../scripts//zeexygen/__load__.zeek:9 "Use '@load base/protocols/smb' instead"
|
|
||||||
warning in /Users/johanna/bro/master/scripts/policy/misc/trim-trace-file.zeek, line 25: deprecated (rotate_file_by_name)
|
warning in /Users/johanna/bro/master/scripts/policy/misc/trim-trace-file.zeek, line 25: deprecated (rotate_file_by_name)
|
||||||
warning in /Users/johanna/bro/master/testing/btest/../../scripts//policy/misc/trim-trace-file.zeek, line 25: deprecated (rotate_file_by_name)
|
warning in /Users/johanna/bro/master/testing/btest/../../scripts//policy/misc/trim-trace-file.zeek, line 25: deprecated (rotate_file_by_name)
|
||||||
warning in /Users/johanna/bro/master/testing/btest/../../scripts//policy/protocols/smb/__load__.zeek, line 1: deprecated script loaded from command line arguments "Use '@load base/protocols/smb' instead"
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ scripts/base/init-frameworks-and-bifs.zeek
|
||||||
scripts/base/utils/patterns.zeek
|
scripts/base/utils/patterns.zeek
|
||||||
scripts/base/frameworks/files/magic/__load__.zeek
|
scripts/base/frameworks/files/magic/__load__.zeek
|
||||||
build/scripts/base/bif/__load__.zeek
|
build/scripts/base/bif/__load__.zeek
|
||||||
build/scripts/base/bif/zeexygen.bif.zeek
|
build/scripts/base/bif/zeekygen.bif.zeek
|
||||||
build/scripts/base/bif/pcap.bif.zeek
|
build/scripts/base/bif/pcap.bif.zeek
|
||||||
build/scripts/base/bif/bloom-filter.bif.zeek
|
build/scripts/base/bif/bloom-filter.bif.zeek
|
||||||
build/scripts/base/bif/cardinality-counter.bif.zeek
|
build/scripts/base/bif/cardinality-counter.bif.zeek
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
:tocdepth: 3
|
:tocdepth: 3
|
||||||
|
|
||||||
zeexygen/example.zeek
|
zeekygen/example.zeek
|
||||||
=====================
|
=====================
|
||||||
.. zeek:namespace:: ZeexygenExample
|
.. zeek:namespace:: ZeekygenExample
|
||||||
|
|
||||||
This is an example script that demonstrates Zeexygen-style
|
This is an example script that demonstrates Zeekygen-style
|
||||||
documentation. It generally will make most sense when viewing
|
documentation. It generally will make most sense when viewing
|
||||||
the script's raw source code and comparing to the HTML-rendered
|
the script's raw source code and comparing to the HTML-rendered
|
||||||
version.
|
version.
|
||||||
|
@ -19,14 +19,14 @@ purpose. They are transferred directly in to the generated
|
||||||
There's also a custom role to reference any identifier node in
|
There's also a custom role to reference any identifier node in
|
||||||
the Zeek Sphinx domain that's good for "see alsos", e.g.
|
the Zeek Sphinx domain that's good for "see alsos", e.g.
|
||||||
|
|
||||||
See also: :zeek:see:`ZeexygenExample::a_var`,
|
See also: :zeek:see:`ZeekygenExample::a_var`,
|
||||||
:zeek:see:`ZeexygenExample::ONE`, :zeek:see:`SSH::Info`
|
:zeek:see:`ZeekygenExample::ONE`, :zeek:see:`SSH::Info`
|
||||||
|
|
||||||
And a custom directive does the equivalent references:
|
And a custom directive does the equivalent references:
|
||||||
|
|
||||||
.. zeek:see:: ZeexygenExample::a_var ZeexygenExample::ONE SSH::Info
|
.. zeek:see:: ZeekygenExample::a_var ZeekygenExample::ONE SSH::Info
|
||||||
|
|
||||||
:Namespace: ZeexygenExample
|
:Namespace: ZeekygenExample
|
||||||
:Imports: :doc:`base/frameworks/notice </scripts/base/frameworks/notice/index>`, :doc:`base/protocols/http </scripts/base/protocols/http/index>`, :doc:`policy/frameworks/software/vulnerable.zeek </scripts/policy/frameworks/software/vulnerable.zeek>`
|
:Imports: :doc:`base/frameworks/notice </scripts/base/frameworks/notice/index>`, :doc:`base/protocols/http </scripts/base/protocols/http/index>`, :doc:`policy/frameworks/software/vulnerable.zeek </scripts/policy/frameworks/software/vulnerable.zeek>`
|
||||||
|
|
||||||
Summary
|
Summary
|
||||||
|
@ -34,25 +34,25 @@ Summary
|
||||||
Redefinable Options
|
Redefinable Options
|
||||||
###################
|
###################
|
||||||
======================================================================================= =======================================================
|
======================================================================================= =======================================================
|
||||||
:zeek:id:`ZeexygenExample::an_option`: :zeek:type:`set` :zeek:attr:`&redef` Add documentation for "an_option" here.
|
:zeek:id:`ZeekygenExample::an_option`: :zeek:type:`set` :zeek:attr:`&redef` Add documentation for "an_option" here.
|
||||||
:zeek:id:`ZeexygenExample::option_with_init`: :zeek:type:`interval` :zeek:attr:`&redef` Default initialization will be generated automatically.
|
:zeek:id:`ZeekygenExample::option_with_init`: :zeek:type:`interval` :zeek:attr:`&redef` Default initialization will be generated automatically.
|
||||||
======================================================================================= =======================================================
|
======================================================================================= =======================================================
|
||||||
|
|
||||||
State Variables
|
State Variables
|
||||||
###############
|
###############
|
||||||
========================================================================== ========================================================================
|
========================================================================== ========================================================================
|
||||||
:zeek:id:`ZeexygenExample::a_var`: :zeek:type:`bool` Put some documentation for "a_var" here.
|
:zeek:id:`ZeekygenExample::a_var`: :zeek:type:`bool` Put some documentation for "a_var" here.
|
||||||
:zeek:id:`ZeexygenExample::summary_test`: :zeek:type:`string` The first sentence for a particular identifier's summary text ends here.
|
:zeek:id:`ZeekygenExample::summary_test`: :zeek:type:`string` The first sentence for a particular identifier's summary text ends here.
|
||||||
:zeek:id:`ZeexygenExample::var_without_explicit_type`: :zeek:type:`string` Types are inferred, that information is self-documenting.
|
:zeek:id:`ZeekygenExample::var_without_explicit_type`: :zeek:type:`string` Types are inferred, that information is self-documenting.
|
||||||
========================================================================== ========================================================================
|
========================================================================== ========================================================================
|
||||||
|
|
||||||
Types
|
Types
|
||||||
#####
|
#####
|
||||||
==================================================================================== ===========================================================
|
==================================================================================== ===========================================================
|
||||||
:zeek:type:`ZeexygenExample::ComplexRecord`: :zeek:type:`record` :zeek:attr:`&redef` General documentation for a type "ComplexRecord" goes here.
|
:zeek:type:`ZeekygenExample::ComplexRecord`: :zeek:type:`record` :zeek:attr:`&redef` General documentation for a type "ComplexRecord" goes here.
|
||||||
:zeek:type:`ZeexygenExample::Info`: :zeek:type:`record` An example record to be used with a logging stream.
|
:zeek:type:`ZeekygenExample::Info`: :zeek:type:`record` An example record to be used with a logging stream.
|
||||||
:zeek:type:`ZeexygenExample::SimpleEnum`: :zeek:type:`enum` Documentation for the "SimpleEnum" type goes here.
|
:zeek:type:`ZeekygenExample::SimpleEnum`: :zeek:type:`enum` Documentation for the "SimpleEnum" type goes here.
|
||||||
:zeek:type:`ZeexygenExample::SimpleRecord`: :zeek:type:`record` General documentation for a type "SimpleRecord" goes here.
|
:zeek:type:`ZeekygenExample::SimpleRecord`: :zeek:type:`record` General documentation for a type "SimpleRecord" goes here.
|
||||||
==================================================================================== ===========================================================
|
==================================================================================== ===========================================================
|
||||||
|
|
||||||
Redefinitions
|
Redefinitions
|
||||||
|
@ -60,21 +60,21 @@ Redefinitions
|
||||||
=============================================================== ====================================================================
|
=============================================================== ====================================================================
|
||||||
:zeek:type:`Log::ID`: :zeek:type:`enum`
|
:zeek:type:`Log::ID`: :zeek:type:`enum`
|
||||||
:zeek:type:`Notice::Type`: :zeek:type:`enum`
|
:zeek:type:`Notice::Type`: :zeek:type:`enum`
|
||||||
:zeek:type:`ZeexygenExample::SimpleEnum`: :zeek:type:`enum` Document the "SimpleEnum" redef here with any special info regarding
|
:zeek:type:`ZeekygenExample::SimpleEnum`: :zeek:type:`enum` Document the "SimpleEnum" redef here with any special info regarding
|
||||||
the *redef* itself.
|
the *redef* itself.
|
||||||
:zeek:type:`ZeexygenExample::SimpleRecord`: :zeek:type:`record` Document the record extension *redef* itself here.
|
:zeek:type:`ZeekygenExample::SimpleRecord`: :zeek:type:`record` Document the record extension *redef* itself here.
|
||||||
=============================================================== ====================================================================
|
=============================================================== ====================================================================
|
||||||
|
|
||||||
Events
|
Events
|
||||||
######
|
######
|
||||||
======================================================== ==========================
|
======================================================== ==========================
|
||||||
:zeek:id:`ZeexygenExample::an_event`: :zeek:type:`event` Summarize "an_event" here.
|
:zeek:id:`ZeekygenExample::an_event`: :zeek:type:`event` Summarize "an_event" here.
|
||||||
======================================================== ==========================
|
======================================================== ==========================
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
#########
|
#########
|
||||||
============================================================= =======================================
|
============================================================= =======================================
|
||||||
:zeek:id:`ZeexygenExample::a_function`: :zeek:type:`function` Summarize purpose of "a_function" here.
|
:zeek:id:`ZeekygenExample::a_function`: :zeek:type:`function` Summarize purpose of "a_function" here.
|
||||||
============================================================= =======================================
|
============================================================= =======================================
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ Detailed Interface
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
Redefinable Options
|
Redefinable Options
|
||||||
###################
|
###################
|
||||||
.. zeek:id:: ZeexygenExample::an_option
|
.. zeek:id:: ZeekygenExample::an_option
|
||||||
|
|
||||||
:Type: :zeek:type:`set` [:zeek:type:`addr`, :zeek:type:`addr`, :zeek:type:`string`]
|
:Type: :zeek:type:`set` [:zeek:type:`addr`, :zeek:type:`addr`, :zeek:type:`string`]
|
||||||
:Attributes: :zeek:attr:`&redef`
|
:Attributes: :zeek:attr:`&redef`
|
||||||
|
@ -91,7 +91,7 @@ Redefinable Options
|
||||||
Add documentation for "an_option" here.
|
Add documentation for "an_option" here.
|
||||||
The type/attribute information is all generated automatically.
|
The type/attribute information is all generated automatically.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::option_with_init
|
.. zeek:id:: ZeekygenExample::option_with_init
|
||||||
|
|
||||||
:Type: :zeek:type:`interval`
|
:Type: :zeek:type:`interval`
|
||||||
:Attributes: :zeek:attr:`&redef`
|
:Attributes: :zeek:attr:`&redef`
|
||||||
|
@ -102,7 +102,7 @@ Redefinable Options
|
||||||
|
|
||||||
State Variables
|
State Variables
|
||||||
###############
|
###############
|
||||||
.. zeek:id:: ZeexygenExample::a_var
|
.. zeek:id:: ZeekygenExample::a_var
|
||||||
|
|
||||||
:Type: :zeek:type:`bool`
|
:Type: :zeek:type:`bool`
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ State Variables
|
||||||
isn't a function/event/hook is classified as a "state variable"
|
isn't a function/event/hook is classified as a "state variable"
|
||||||
in the generated docs.
|
in the generated docs.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::summary_test
|
.. zeek:id:: ZeekygenExample::summary_test
|
||||||
|
|
||||||
:Type: :zeek:type:`string`
|
:Type: :zeek:type:`string`
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ State Variables
|
||||||
And this second sentence doesn't show in the short description provided
|
And this second sentence doesn't show in the short description provided
|
||||||
by the table of all identifiers declared by this script.
|
by the table of all identifiers declared by this script.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::var_without_explicit_type
|
.. zeek:id:: ZeekygenExample::var_without_explicit_type
|
||||||
|
|
||||||
:Type: :zeek:type:`string`
|
:Type: :zeek:type:`string`
|
||||||
:Default: ``"this works"``
|
:Default: ``"this works"``
|
||||||
|
@ -127,7 +127,7 @@ State Variables
|
||||||
|
|
||||||
Types
|
Types
|
||||||
#####
|
#####
|
||||||
.. zeek:type:: ZeexygenExample::ComplexRecord
|
.. zeek:type:: ZeekygenExample::ComplexRecord
|
||||||
|
|
||||||
:Type: :zeek:type:`record`
|
:Type: :zeek:type:`record`
|
||||||
|
|
||||||
|
@ -137,8 +137,8 @@ Types
|
||||||
field2: :zeek:type:`bool`
|
field2: :zeek:type:`bool`
|
||||||
Toggles something.
|
Toggles something.
|
||||||
|
|
||||||
field3: :zeek:type:`ZeexygenExample::SimpleRecord`
|
field3: :zeek:type:`ZeekygenExample::SimpleRecord`
|
||||||
Zeexygen automatically tracks types
|
Zeekygen automatically tracks types
|
||||||
and cross-references are automatically
|
and cross-references are automatically
|
||||||
inserted in to generated docs.
|
inserted in to generated docs.
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ Types
|
||||||
|
|
||||||
General documentation for a type "ComplexRecord" goes here.
|
General documentation for a type "ComplexRecord" goes here.
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenExample::Info
|
.. zeek:type:: ZeekygenExample::Info
|
||||||
|
|
||||||
:Type: :zeek:type:`record`
|
:Type: :zeek:type:`record`
|
||||||
|
|
||||||
|
@ -164,33 +164,33 @@ Types
|
||||||
fields plus the extensions and the scripts which contributed to it
|
fields plus the extensions and the scripts which contributed to it
|
||||||
(provided they are also @load'ed).
|
(provided they are also @load'ed).
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenExample::SimpleEnum
|
.. zeek:type:: ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
:Type: :zeek:type:`enum`
|
:Type: :zeek:type:`enum`
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::ONE ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::ONE ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
Documentation for particular enum values is added like this.
|
Documentation for particular enum values is added like this.
|
||||||
And can also span multiple lines.
|
And can also span multiple lines.
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::TWO ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::TWO ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
Or this style is valid to document the preceding enum value.
|
Or this style is valid to document the preceding enum value.
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::THREE ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::THREE ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::FOUR ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::FOUR ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
And some documentation for "FOUR".
|
And some documentation for "FOUR".
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::FIVE ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::FIVE ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
Also "FIVE".
|
Also "FIVE".
|
||||||
|
|
||||||
Documentation for the "SimpleEnum" type goes here.
|
Documentation for the "SimpleEnum" type goes here.
|
||||||
It can span multiple lines.
|
It can span multiple lines.
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenExample::SimpleRecord
|
.. zeek:type:: ZeekygenExample::SimpleRecord
|
||||||
|
|
||||||
:Type: :zeek:type:`record`
|
:Type: :zeek:type:`record`
|
||||||
|
|
||||||
|
@ -210,23 +210,23 @@ Types
|
||||||
|
|
||||||
Events
|
Events
|
||||||
######
|
######
|
||||||
.. zeek:id:: ZeexygenExample::an_event
|
.. zeek:id:: ZeekygenExample::an_event
|
||||||
|
|
||||||
:Type: :zeek:type:`event` (name: :zeek:type:`string`)
|
:Type: :zeek:type:`event` (name: :zeek:type:`string`)
|
||||||
|
|
||||||
Summarize "an_event" here.
|
Summarize "an_event" here.
|
||||||
Give more details about "an_event" here.
|
Give more details about "an_event" here.
|
||||||
|
|
||||||
ZeexygenExample::a_function should not be confused as a parameter
|
ZeekygenExample::a_function should not be confused as a parameter
|
||||||
in the generated docs, but it also doesn't generate a cross-reference
|
in the generated docs, but it also doesn't generate a cross-reference
|
||||||
link. Use the see role instead: :zeek:see:`ZeexygenExample::a_function`.
|
link. Use the see role instead: :zeek:see:`ZeekygenExample::a_function`.
|
||||||
|
|
||||||
|
|
||||||
:name: Describe the argument here.
|
:name: Describe the argument here.
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
#########
|
#########
|
||||||
.. zeek:id:: ZeexygenExample::a_function
|
.. zeek:id:: ZeekygenExample::a_function
|
||||||
|
|
||||||
:Type: :zeek:type:`function` (tag: :zeek:type:`string`, msg: :zeek:type:`string`) : :zeek:type:`string`
|
:Type: :zeek:type:`function` (tag: :zeek:type:`string`, msg: :zeek:type:`string`) : :zeek:type:`string`
|
||||||
|
|
|
@ -1,91 +1,91 @@
|
||||||
.. zeek:id:: ZeexygenExample::Zeexygen_One
|
.. zeek:id:: ZeekygenExample::Zeekygen_One
|
||||||
|
|
||||||
:Type: :zeek:type:`Notice::Type`
|
:Type: :zeek:type:`Notice::Type`
|
||||||
|
|
||||||
Any number of this type of comment
|
Any number of this type of comment
|
||||||
will document "Zeexygen_One".
|
will document "Zeekygen_One".
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::Zeexygen_Two
|
.. zeek:id:: ZeekygenExample::Zeekygen_Two
|
||||||
|
|
||||||
:Type: :zeek:type:`Notice::Type`
|
:Type: :zeek:type:`Notice::Type`
|
||||||
|
|
||||||
Any number of this type of comment
|
Any number of this type of comment
|
||||||
will document "ZEEXYGEN_TWO".
|
will document "ZEEKYGEN_TWO".
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::Zeexygen_Three
|
.. zeek:id:: ZeekygenExample::Zeekygen_Three
|
||||||
|
|
||||||
:Type: :zeek:type:`Notice::Type`
|
:Type: :zeek:type:`Notice::Type`
|
||||||
|
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::Zeexygen_Four
|
.. zeek:id:: ZeekygenExample::Zeekygen_Four
|
||||||
|
|
||||||
:Type: :zeek:type:`Notice::Type`
|
:Type: :zeek:type:`Notice::Type`
|
||||||
|
|
||||||
Omitting comments is fine, and so is mixing ``##`` and ``##<``, but
|
Omitting comments is fine, and so is mixing ``##`` and ``##<``, but
|
||||||
it's probably best to use only one style consistently.
|
it's probably best to use only one style consistently.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::LOG
|
.. zeek:id:: ZeekygenExample::LOG
|
||||||
|
|
||||||
:Type: :zeek:type:`Log::ID`
|
:Type: :zeek:type:`Log::ID`
|
||||||
|
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenExample::SimpleEnum
|
.. zeek:type:: ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
:Type: :zeek:type:`enum`
|
:Type: :zeek:type:`enum`
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::ONE ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::ONE ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
Documentation for particular enum values is added like this.
|
Documentation for particular enum values is added like this.
|
||||||
And can also span multiple lines.
|
And can also span multiple lines.
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::TWO ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::TWO ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
Or this style is valid to document the preceding enum value.
|
Or this style is valid to document the preceding enum value.
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::THREE ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::THREE ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::FOUR ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::FOUR ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
And some documentation for "FOUR".
|
And some documentation for "FOUR".
|
||||||
|
|
||||||
.. zeek:enum:: ZeexygenExample::FIVE ZeexygenExample::SimpleEnum
|
.. zeek:enum:: ZeekygenExample::FIVE ZeekygenExample::SimpleEnum
|
||||||
|
|
||||||
Also "FIVE".
|
Also "FIVE".
|
||||||
|
|
||||||
Documentation for the "SimpleEnum" type goes here.
|
Documentation for the "SimpleEnum" type goes here.
|
||||||
It can span multiple lines.
|
It can span multiple lines.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::ONE
|
.. zeek:id:: ZeekygenExample::ONE
|
||||||
|
|
||||||
:Type: :zeek:type:`ZeexygenExample::SimpleEnum`
|
:Type: :zeek:type:`ZeekygenExample::SimpleEnum`
|
||||||
|
|
||||||
Documentation for particular enum values is added like this.
|
Documentation for particular enum values is added like this.
|
||||||
And can also span multiple lines.
|
And can also span multiple lines.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::TWO
|
.. zeek:id:: ZeekygenExample::TWO
|
||||||
|
|
||||||
:Type: :zeek:type:`ZeexygenExample::SimpleEnum`
|
:Type: :zeek:type:`ZeekygenExample::SimpleEnum`
|
||||||
|
|
||||||
Or this style is valid to document the preceding enum value.
|
Or this style is valid to document the preceding enum value.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::THREE
|
.. zeek:id:: ZeekygenExample::THREE
|
||||||
|
|
||||||
:Type: :zeek:type:`ZeexygenExample::SimpleEnum`
|
:Type: :zeek:type:`ZeekygenExample::SimpleEnum`
|
||||||
|
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::FOUR
|
.. zeek:id:: ZeekygenExample::FOUR
|
||||||
|
|
||||||
:Type: :zeek:type:`ZeexygenExample::SimpleEnum`
|
:Type: :zeek:type:`ZeekygenExample::SimpleEnum`
|
||||||
|
|
||||||
And some documentation for "FOUR".
|
And some documentation for "FOUR".
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::FIVE
|
.. zeek:id:: ZeekygenExample::FIVE
|
||||||
|
|
||||||
:Type: :zeek:type:`ZeexygenExample::SimpleEnum`
|
:Type: :zeek:type:`ZeekygenExample::SimpleEnum`
|
||||||
|
|
||||||
Also "FIVE".
|
Also "FIVE".
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenExample::SimpleRecord
|
.. zeek:type:: ZeekygenExample::SimpleRecord
|
||||||
|
|
||||||
:Type: :zeek:type:`record`
|
:Type: :zeek:type:`record`
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
The way fields can be documented is similar to what's already seen
|
The way fields can be documented is similar to what's already seen
|
||||||
for enums.
|
for enums.
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenExample::ComplexRecord
|
.. zeek:type:: ZeekygenExample::ComplexRecord
|
||||||
|
|
||||||
:Type: :zeek:type:`record`
|
:Type: :zeek:type:`record`
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@
|
||||||
field2: :zeek:type:`bool`
|
field2: :zeek:type:`bool`
|
||||||
Toggles something.
|
Toggles something.
|
||||||
|
|
||||||
field3: :zeek:type:`ZeexygenExample::SimpleRecord`
|
field3: :zeek:type:`ZeekygenExample::SimpleRecord`
|
||||||
Zeexygen automatically tracks types
|
Zeekygen automatically tracks types
|
||||||
and cross-references are automatically
|
and cross-references are automatically
|
||||||
inserted in to generated docs.
|
inserted in to generated docs.
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
|
|
||||||
General documentation for a type "ComplexRecord" goes here.
|
General documentation for a type "ComplexRecord" goes here.
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenExample::Info
|
.. zeek:type:: ZeekygenExample::Info
|
||||||
|
|
||||||
:Type: :zeek:type:`record`
|
:Type: :zeek:type:`record`
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
fields plus the extensions and the scripts which contributed to it
|
fields plus the extensions and the scripts which contributed to it
|
||||||
(provided they are also @load'ed).
|
(provided they are also @load'ed).
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::an_option
|
.. zeek:id:: ZeekygenExample::an_option
|
||||||
|
|
||||||
:Type: :zeek:type:`set` [:zeek:type:`addr`, :zeek:type:`addr`, :zeek:type:`string`]
|
:Type: :zeek:type:`set` [:zeek:type:`addr`, :zeek:type:`addr`, :zeek:type:`string`]
|
||||||
:Attributes: :zeek:attr:`&redef`
|
:Attributes: :zeek:attr:`&redef`
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
Add documentation for "an_option" here.
|
Add documentation for "an_option" here.
|
||||||
The type/attribute information is all generated automatically.
|
The type/attribute information is all generated automatically.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::option_with_init
|
.. zeek:id:: ZeekygenExample::option_with_init
|
||||||
|
|
||||||
:Type: :zeek:type:`interval`
|
:Type: :zeek:type:`interval`
|
||||||
:Attributes: :zeek:attr:`&redef`
|
:Attributes: :zeek:attr:`&redef`
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
Default initialization will be generated automatically.
|
Default initialization will be generated automatically.
|
||||||
More docs can be added here.
|
More docs can be added here.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::a_var
|
.. zeek:id:: ZeekygenExample::a_var
|
||||||
|
|
||||||
:Type: :zeek:type:`bool`
|
:Type: :zeek:type:`bool`
|
||||||
|
|
||||||
|
@ -166,14 +166,14 @@
|
||||||
isn't a function/event/hook is classified as a "state variable"
|
isn't a function/event/hook is classified as a "state variable"
|
||||||
in the generated docs.
|
in the generated docs.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::var_without_explicit_type
|
.. zeek:id:: ZeekygenExample::var_without_explicit_type
|
||||||
|
|
||||||
:Type: :zeek:type:`string`
|
:Type: :zeek:type:`string`
|
||||||
:Default: ``"this works"``
|
:Default: ``"this works"``
|
||||||
|
|
||||||
Types are inferred, that information is self-documenting.
|
Types are inferred, that information is self-documenting.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::summary_test
|
.. zeek:id:: ZeekygenExample::summary_test
|
||||||
|
|
||||||
:Type: :zeek:type:`string`
|
:Type: :zeek:type:`string`
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@
|
||||||
And this second sentence doesn't show in the short description provided
|
And this second sentence doesn't show in the short description provided
|
||||||
by the table of all identifiers declared by this script.
|
by the table of all identifiers declared by this script.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::a_function
|
.. zeek:id:: ZeekygenExample::a_function
|
||||||
|
|
||||||
:Type: :zeek:type:`function` (tag: :zeek:type:`string`, msg: :zeek:type:`string`) : :zeek:type:`string`
|
:Type: :zeek:type:`function` (tag: :zeek:type:`string`, msg: :zeek:type:`string`) : :zeek:type:`string`
|
||||||
|
|
||||||
|
@ -200,26 +200,26 @@
|
||||||
|
|
||||||
:returns: Describe the return type here.
|
:returns: Describe the return type here.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::an_event
|
.. zeek:id:: ZeekygenExample::an_event
|
||||||
|
|
||||||
:Type: :zeek:type:`event` (name: :zeek:type:`string`)
|
:Type: :zeek:type:`event` (name: :zeek:type:`string`)
|
||||||
|
|
||||||
Summarize "an_event" here.
|
Summarize "an_event" here.
|
||||||
Give more details about "an_event" here.
|
Give more details about "an_event" here.
|
||||||
|
|
||||||
ZeexygenExample::a_function should not be confused as a parameter
|
ZeekygenExample::a_function should not be confused as a parameter
|
||||||
in the generated docs, but it also doesn't generate a cross-reference
|
in the generated docs, but it also doesn't generate a cross-reference
|
||||||
link. Use the see role instead: :zeek:see:`ZeexygenExample::a_function`.
|
link. Use the see role instead: :zeek:see:`ZeekygenExample::a_function`.
|
||||||
|
|
||||||
|
|
||||||
:name: Describe the argument here.
|
:name: Describe the argument here.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenExample::function_without_proto
|
.. zeek:id:: ZeekygenExample::function_without_proto
|
||||||
|
|
||||||
:Type: :zeek:type:`function` (tag: :zeek:type:`string`) : :zeek:type:`string`
|
:Type: :zeek:type:`function` (tag: :zeek:type:`string`) : :zeek:type:`string`
|
||||||
|
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenExample::PrivateRecord
|
.. zeek:type:: ZeekygenExample::PrivateRecord
|
||||||
|
|
||||||
:Type: :zeek:type:`record`
|
:Type: :zeek:type:`record`
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
:orphan:
|
:orphan:
|
||||||
|
|
||||||
Package: zeexygen
|
Package: zeekygen
|
||||||
=================
|
=================
|
||||||
|
|
||||||
This package is loaded during the process which automatically generates
|
This package is loaded during the process which automatically generates
|
||||||
reference documentation for all Zeek scripts (i.e. "Zeexygen"). Its only
|
reference documentation for all Zeek scripts (i.e. "Zeekygen"). Its only
|
||||||
purpose is to provide an easy way to load all known Zeek scripts plus any
|
purpose is to provide an easy way to load all known Zeek scripts plus any
|
||||||
extra scripts needed or used by the documentation process.
|
extra scripts needed or used by the documentation process.
|
||||||
|
|
||||||
:doc:`/scripts/zeexygen/__load__.zeek`
|
:doc:`/scripts/zeekygen/__load__.zeek`
|
||||||
|
|
||||||
|
|
||||||
:doc:`/scripts/zeexygen/example.zeek`
|
:doc:`/scripts/zeekygen/example.zeek`
|
||||||
|
|
||||||
This is an example script that demonstrates Zeexygen-style
|
This is an example script that demonstrates Zeekygen-style
|
||||||
documentation. It generally will make most sense when viewing
|
documentation. It generally will make most sense when viewing
|
||||||
the script's raw source code and comparing to the HTML-rendered
|
the script's raw source code and comparing to the HTML-rendered
|
||||||
version.
|
version.
|
||||||
|
@ -28,10 +28,10 @@ extra scripts needed or used by the documentation process.
|
||||||
There's also a custom role to reference any identifier node in
|
There's also a custom role to reference any identifier node in
|
||||||
the Zeek Sphinx domain that's good for "see alsos", e.g.
|
the Zeek Sphinx domain that's good for "see alsos", e.g.
|
||||||
|
|
||||||
See also: :zeek:see:`ZeexygenExample::a_var`,
|
See also: :zeek:see:`ZeekygenExample::a_var`,
|
||||||
:zeek:see:`ZeexygenExample::ONE`, :zeek:see:`SSH::Info`
|
:zeek:see:`ZeekygenExample::ONE`, :zeek:see:`SSH::Info`
|
||||||
|
|
||||||
And a custom directive does the equivalent references:
|
And a custom directive does the equivalent references:
|
||||||
|
|
||||||
.. zeek:see:: ZeexygenExample::a_var ZeexygenExample::ONE SSH::Info
|
.. zeek:see:: ZeekygenExample::a_var ZeekygenExample::ONE SSH::Info
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
:doc:`zeexygen </scripts/zeexygen/index>`
|
:doc:`zeekygen </scripts/zeekygen/index>`
|
||||||
|
|
||||||
This package is loaded during the process which automatically generates
|
This package is loaded during the process which automatically generates
|
||||||
reference documentation for all Zeek scripts (i.e. "Zeexygen"). Its only
|
reference documentation for all Zeek scripts (i.e. "Zeekygen"). Its only
|
||||||
purpose is to provide an easy way to load all known Zeek scripts plus any
|
purpose is to provide an easy way to load all known Zeek scripts plus any
|
||||||
extra scripts needed or used by the documentation process.
|
extra scripts needed or used by the documentation process.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 1
|
||||||
|
|
||||||
|
zeekygen/__load__.zeek </scripts/zeekygen/__load__.zeek>
|
||||||
|
zeekygen/example.zeek </scripts/zeekygen/example.zeek>
|
|
@ -1,5 +1,5 @@
|
||||||
:doc:`/scripts/zeexygen/example.zeek`
|
:doc:`/scripts/zeekygen/example.zeek`
|
||||||
This is an example script that demonstrates Zeexygen-style
|
This is an example script that demonstrates Zeekygen-style
|
||||||
documentation. It generally will make most sense when viewing
|
documentation. It generally will make most sense when viewing
|
||||||
the script's raw source code and comparing to the HTML-rendered
|
the script's raw source code and comparing to the HTML-rendered
|
||||||
version.
|
version.
|
||||||
|
@ -14,10 +14,10 @@
|
||||||
There's also a custom role to reference any identifier node in
|
There's also a custom role to reference any identifier node in
|
||||||
the Zeek Sphinx domain that's good for "see alsos", e.g.
|
the Zeek Sphinx domain that's good for "see alsos", e.g.
|
||||||
|
|
||||||
See also: :zeek:see:`ZeexygenExample::a_var`,
|
See also: :zeek:see:`ZeekygenExample::a_var`,
|
||||||
:zeek:see:`ZeexygenExample::ONE`, :zeek:see:`SSH::Info`
|
:zeek:see:`ZeekygenExample::ONE`, :zeek:see:`SSH::Info`
|
||||||
|
|
||||||
And a custom directive does the equivalent references:
|
And a custom directive does the equivalent references:
|
||||||
|
|
||||||
.. zeek:see:: ZeexygenExample::a_var ZeexygenExample::ONE SSH::Info
|
.. zeek:see:: ZeekygenExample::a_var ZeekygenExample::ONE SSH::Info
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
.. zeek:type:: ZeexygenTest::TypeAlias
|
.. zeek:type:: ZeekygenTest::TypeAlias
|
||||||
|
|
||||||
:Type: :zeek:type:`bool`
|
:Type: :zeek:type:`bool`
|
||||||
|
|
||||||
This is just an alias for a builtin type ``bool``.
|
This is just an alias for a builtin type ``bool``.
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenTest::NotTypeAlias
|
.. zeek:type:: ZeekygenTest::NotTypeAlias
|
||||||
|
|
||||||
:Type: :zeek:type:`bool`
|
:Type: :zeek:type:`bool`
|
||||||
|
|
||||||
This type should get its own comments, not associated w/ TypeAlias.
|
This type should get its own comments, not associated w/ TypeAlias.
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenTest::OtherTypeAlias
|
.. zeek:type:: ZeekygenTest::OtherTypeAlias
|
||||||
|
|
||||||
:Type: :zeek:type:`bool`
|
:Type: :zeek:type:`bool`
|
||||||
|
|
||||||
|
@ -19,25 +19,25 @@
|
||||||
one doesn't have to click through the full type alias chain to
|
one doesn't have to click through the full type alias chain to
|
||||||
find out what the actual type is...
|
find out what the actual type is...
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenTest::a
|
.. zeek:id:: ZeekygenTest::a
|
||||||
|
|
||||||
:Type: :zeek:type:`ZeexygenTest::TypeAlias`
|
:Type: :zeek:type:`ZeekygenTest::TypeAlias`
|
||||||
|
|
||||||
But this should reference a type of ``TypeAlias``.
|
But this should reference a type of ``TypeAlias``.
|
||||||
|
|
||||||
.. zeek:id:: ZeexygenTest::b
|
.. zeek:id:: ZeekygenTest::b
|
||||||
|
|
||||||
:Type: :zeek:type:`ZeexygenTest::OtherTypeAlias`
|
:Type: :zeek:type:`ZeekygenTest::OtherTypeAlias`
|
||||||
|
|
||||||
And this should reference a type of ``OtherTypeAlias``.
|
And this should reference a type of ``OtherTypeAlias``.
|
||||||
|
|
||||||
.. zeek:type:: ZeexygenTest::MyRecord
|
.. zeek:type:: ZeekygenTest::MyRecord
|
||||||
|
|
||||||
:Type: :zeek:type:`record`
|
:Type: :zeek:type:`record`
|
||||||
|
|
||||||
f1: :zeek:type:`ZeexygenTest::TypeAlias`
|
f1: :zeek:type:`ZeekygenTest::TypeAlias`
|
||||||
|
|
||||||
f2: :zeek:type:`ZeexygenTest::OtherTypeAlias`
|
f2: :zeek:type:`ZeekygenTest::OtherTypeAlias`
|
||||||
|
|
||||||
f3: :zeek:type:`bool`
|
f3: :zeek:type:`bool`
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 1
|
|
||||||
|
|
||||||
zeexygen/__load__.zeek </scripts/zeexygen/__load__.zeek>
|
|
||||||
zeexygen/example.zeek </scripts/zeexygen/example.zeek>
|
|
|
@ -785,7 +785,7 @@
|
||||||
0.000000 MetaHookPost LoadFile(0, .<...>/utils.zeek) -> -1
|
0.000000 MetaHookPost LoadFile(0, .<...>/utils.zeek) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(0, .<...>/variance.zeek) -> -1
|
0.000000 MetaHookPost LoadFile(0, .<...>/variance.zeek) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(0, .<...>/weird.zeek) -> -1
|
0.000000 MetaHookPost LoadFile(0, .<...>/weird.zeek) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(0, .<...>/zeexygen.bif.zeek) -> -1
|
0.000000 MetaHookPost LoadFile(0, .<...>/zeekygen.bif.zeek) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(0, <...>/__load__.zeek) -> -1
|
0.000000 MetaHookPost LoadFile(0, <...>/__load__.zeek) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(0, <...>/__preload__.zeek) -> -1
|
0.000000 MetaHookPost LoadFile(0, <...>/__preload__.zeek) -> -1
|
||||||
0.000000 MetaHookPost LoadFile(0, <...>/hooks.zeek) -> -1
|
0.000000 MetaHookPost LoadFile(0, <...>/hooks.zeek) -> -1
|
||||||
|
@ -1688,7 +1688,7 @@
|
||||||
0.000000 MetaHookPre LoadFile(0, .<...>/utils.zeek)
|
0.000000 MetaHookPre LoadFile(0, .<...>/utils.zeek)
|
||||||
0.000000 MetaHookPre LoadFile(0, .<...>/variance.zeek)
|
0.000000 MetaHookPre LoadFile(0, .<...>/variance.zeek)
|
||||||
0.000000 MetaHookPre LoadFile(0, .<...>/weird.zeek)
|
0.000000 MetaHookPre LoadFile(0, .<...>/weird.zeek)
|
||||||
0.000000 MetaHookPre LoadFile(0, .<...>/zeexygen.bif.zeek)
|
0.000000 MetaHookPre LoadFile(0, .<...>/zeekygen.bif.zeek)
|
||||||
0.000000 MetaHookPre LoadFile(0, <...>/__load__.zeek)
|
0.000000 MetaHookPre LoadFile(0, <...>/__load__.zeek)
|
||||||
0.000000 MetaHookPre LoadFile(0, <...>/__preload__.zeek)
|
0.000000 MetaHookPre LoadFile(0, <...>/__preload__.zeek)
|
||||||
0.000000 MetaHookPre LoadFile(0, <...>/hooks.zeek)
|
0.000000 MetaHookPre LoadFile(0, <...>/hooks.zeek)
|
||||||
|
@ -2599,7 +2599,7 @@
|
||||||
0.000000 | HookLoadFile .<...>/variance.zeek
|
0.000000 | HookLoadFile .<...>/variance.zeek
|
||||||
0.000000 | HookLoadFile .<...>/video.sig
|
0.000000 | HookLoadFile .<...>/video.sig
|
||||||
0.000000 | HookLoadFile .<...>/weird.zeek
|
0.000000 | HookLoadFile .<...>/weird.zeek
|
||||||
0.000000 | HookLoadFile .<...>/zeexygen.bif.zeek
|
0.000000 | HookLoadFile .<...>/zeekygen.bif.zeek
|
||||||
0.000000 | HookLoadFile <...>/__load__.zeek
|
0.000000 | HookLoadFile <...>/__load__.zeek
|
||||||
0.000000 | HookLoadFile <...>/__preload__.zeek
|
0.000000 | HookLoadFile <...>/__preload__.zeek
|
||||||
0.000000 | HookLoadFile <...>/hooks.zeek
|
0.000000 | HookLoadFile <...>/hooks.zeek
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
============ test ipv4 regex
|
============ test ipv4 regex (good strings)
|
||||||
T
|
T
|
||||||
T
|
T
|
||||||
T
|
T
|
||||||
|
@ -6,9 +6,24 @@ T
|
||||||
T
|
T
|
||||||
T
|
T
|
||||||
T
|
T
|
||||||
|
T
|
||||||
|
T
|
||||||
|
T
|
||||||
|
T
|
||||||
|
T
|
||||||
|
T
|
||||||
|
T
|
||||||
|
============ bad ipv4 decimals
|
||||||
F
|
F
|
||||||
F
|
F
|
||||||
F
|
F
|
||||||
|
F
|
||||||
|
F
|
||||||
|
F
|
||||||
|
============ too many ipv4 decimals
|
||||||
|
F
|
||||||
|
F
|
||||||
|
============ typical looking ipv4
|
||||||
T
|
T
|
||||||
T
|
T
|
||||||
============ test ipv6 regex
|
============ test ipv6 regex
|
||||||
|
@ -30,6 +45,9 @@ T
|
||||||
F
|
F
|
||||||
F
|
F
|
||||||
F
|
F
|
||||||
|
F
|
||||||
|
F
|
||||||
============ test extract_ip_addresses()
|
============ test extract_ip_addresses()
|
||||||
[1.1.1.1, 2.2.2.2, 3.3.3.3]
|
[1.1.1.1, 2.2.2.2, 3.3.3.3]
|
||||||
[1.1.1.1, 0:0:0:0:0:0:0:0, 3.3.3.3]
|
[1.1.1.1, 0:0:0:0:0:0:0:0, 3.3.3.3]
|
||||||
|
[6:1:2::3:4:5:6]
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# This check piggy-backs on the test-all-policy.zeek test, assuming that every
|
# This check piggy-backs on the test-all-policy.zeek test, assuming that every
|
||||||
# loadable script is referenced there. The only additional check here is
|
# loadable script is referenced there. The only additional check here is
|
||||||
# that the zeexygen package should even load scripts that are commented
|
# that the zeekygen package should even load scripts that are commented
|
||||||
# out in test-all-policy.zeek because the zeexygen package is only loaded
|
# out in test-all-policy.zeek because the zeekygen package is only loaded
|
||||||
# when generated documentation and will terminate has soon as zeek_init
|
# when generated documentation and will terminate has soon as zeek_init
|
||||||
# is handled, even if a script will e.g. put Zeek into listen mode or otherwise
|
# is handled, even if a script will e.g. put Zeek into listen mode or otherwise
|
||||||
# cause it to not terminate after scripts are parsed.
|
# cause it to not terminate after scripts are parsed.
|
||||||
|
|
||||||
# @TEST-EXEC: bash %INPUT $DIST/scripts/test-all-policy.zeek $DIST/scripts/zeexygen/__load__.zeek
|
# @TEST-EXEC: bash %INPUT $DIST/scripts/test-all-policy.zeek $DIST/scripts/zeekygen/__load__.zeek
|
||||||
|
|
||||||
error_count=0
|
error_count=0
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@ if [ $# -ne 2 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
all_loads=$(egrep "#[[:space:]]*@load.*" $1 | sed 's/#[[:space:]]*@load[[:space:]]*//g')
|
all_loads=$(egrep "#[[:space:]]*@load.*" $1 | sed 's/#[[:space:]]*@load[[:space:]]*//g')
|
||||||
zeexygen_loads=$(egrep "@load.*" $2 | sed 's/@load[[:space:]]*//g')
|
zeekygen_loads=$(egrep "@load.*" $2 | sed 's/@load[[:space:]]*//g')
|
||||||
|
|
||||||
for f in $all_loads; do
|
for f in $all_loads; do
|
||||||
echo "$zeexygen_loads" | grep -q $f || error_msg "$f not loaded in zeexygen/__load__.zeek"
|
echo "$zeekygen_loads" | grep -q $f || error_msg "$f not loaded in zeekygen/__load__.zeek"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $error_count -gt 0 ]; then
|
if [ $error_count -gt 0 ]; then
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# This script checks whether the reST docs generated by zeexygen are stale.
|
# This script checks whether the reST docs generated by zeekygen are stale.
|
||||||
# If this test fails when testing the master branch, then simply run:
|
# If this test fails when testing the master branch, then simply run:
|
||||||
#
|
#
|
||||||
# testing/scripts/gen-zeexygen-docs.sh
|
# testing/scripts/update-zeekygen-docs.sh
|
||||||
#
|
#
|
||||||
# and then commit the changes.
|
# and then commit the changes.
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: bash $SCRIPTS/gen-zeexygen-docs.sh ./doc
|
# @TEST-EXEC: bash $SCRIPTS/update-zeekygen-docs.sh ./doc
|
||||||
# @TEST-EXEC: bash %INPUT
|
# @TEST-EXEC: bash %INPUT
|
||||||
|
|
||||||
if [ -n "$TRAVIS_PULL_REQUEST" ]; then
|
if [ -n "$TRAVIS_PULL_REQUEST" ]; then
|
||||||
|
@ -33,7 +33,7 @@ function check_diff
|
||||||
echo "If this fails in the master branch or when merging to master," 1>&2
|
echo "If this fails in the master branch or when merging to master," 1>&2
|
||||||
echo "re-run the following command:" 1>&2
|
echo "re-run the following command:" 1>&2
|
||||||
echo "" 1>&2
|
echo "" 1>&2
|
||||||
echo " $SCRIPTS/gen-zeexygen-docs.sh" 1>&2
|
echo " $SCRIPTS/update-zeekygen-docs.sh" 1>&2
|
||||||
echo "" 1>&2
|
echo "" 1>&2
|
||||||
echo "Then commit/push the changes in the zeek-docs repo" 1>&2
|
echo "Then commit/push the changes in the zeek-docs repo" 1>&2
|
||||||
echo "(the doc/ directory in the zeek repo)." 1>&2
|
echo "(the doc/ directory in the zeek repo)." 1>&2
|
|
@ -1,7 +1,7 @@
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT
|
||||||
# @TEST-EXEC: btest-diff autogen-reST-enums.rst
|
# @TEST-EXEC: btest-diff autogen-reST-enums.rst
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
@TEST-START-FILE zeekygen.config
|
||||||
identifier TestEnum* autogen-reST-enums.rst
|
identifier TestEnum* autogen-reST-enums.rst
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
8
testing/btest/doc/zeekygen/example.zeek
Normal file
8
testing/btest/doc/zeekygen/example.zeek
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -X zeekygen.config %INPUT
|
||||||
|
# @TEST-EXEC: btest-diff example.rst
|
||||||
|
|
||||||
|
@TEST-START-FILE zeekygen.config
|
||||||
|
script zeekygen/example.zeek example.rst
|
||||||
|
@TEST-END-FILE
|
||||||
|
|
||||||
|
@load zeekygen/example
|
|
@ -1,7 +1,7 @@
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT
|
||||||
# @TEST-EXEC: btest-diff autogen-reST-func-params.rst
|
# @TEST-EXEC: btest-diff autogen-reST-func-params.rst
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
@TEST-START-FILE zeekygen.config
|
||||||
identifier test_func_params* autogen-reST-func-params.rst
|
identifier test_func_params* autogen-reST-func-params.rst
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
9
testing/btest/doc/zeekygen/identifier.zeek
Normal file
9
testing/btest/doc/zeekygen/identifier.zeek
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# @TEST-PORT: BROKER_PORT
|
||||||
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT Broker::default_port=$BROKER_PORT
|
||||||
|
# @TEST-EXEC: btest-diff test.rst
|
||||||
|
|
||||||
|
@TEST-START-FILE zeekygen.config
|
||||||
|
identifier ZeekygenExample::* test.rst
|
||||||
|
@TEST-END-FILE
|
||||||
|
|
||||||
|
@load zeekygen
|
9
testing/btest/doc/zeekygen/package.zeek
Normal file
9
testing/btest/doc/zeekygen/package.zeek
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# @TEST-PORT: BROKER_PORT
|
||||||
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT Broker::default_port=$BROKER_PORT
|
||||||
|
# @TEST-EXEC: btest-diff test.rst
|
||||||
|
|
||||||
|
@TEST-START-FILE zeekygen.config
|
||||||
|
package zeekygen test.rst
|
||||||
|
@TEST-END-FILE
|
||||||
|
|
||||||
|
@load zeekygen
|
9
testing/btest/doc/zeekygen/package_index.zeek
Normal file
9
testing/btest/doc/zeekygen/package_index.zeek
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# @TEST-PORT: BROKER_PORT
|
||||||
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT Broker::default_port=$BROKER_PORT
|
||||||
|
# @TEST-EXEC: btest-diff test.rst
|
||||||
|
|
||||||
|
@TEST-START-FILE zeekygen.config
|
||||||
|
package_index zeekygen test.rst
|
||||||
|
@TEST-END-FILE
|
||||||
|
|
||||||
|
@load zeekygen
|
|
@ -1,7 +1,7 @@
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT
|
||||||
# @TEST-EXEC: btest-diff autogen-reST-records.rst
|
# @TEST-EXEC: btest-diff autogen-reST-records.rst
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
@TEST-START-FILE zeekygen.config
|
||||||
identifier TestRecord* autogen-reST-records.rst
|
identifier TestRecord* autogen-reST-records.rst
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
9
testing/btest/doc/zeekygen/script_index.zeek
Normal file
9
testing/btest/doc/zeekygen/script_index.zeek
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# @TEST-PORT: BROKER_PORT
|
||||||
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT Broker::default_port=$BROKER_PORT
|
||||||
|
# @TEST-EXEC: btest-diff test.rst
|
||||||
|
|
||||||
|
@TEST-START-FILE zeekygen.config
|
||||||
|
script_index zeekygen/* test.rst
|
||||||
|
@TEST-END-FILE
|
||||||
|
|
||||||
|
@load zeekygen
|
9
testing/btest/doc/zeekygen/script_summary.zeek
Normal file
9
testing/btest/doc/zeekygen/script_summary.zeek
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# @TEST-PORT: BROKER_PORT
|
||||||
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT Broker::default_port=$BROKER_PORT
|
||||||
|
# @TEST-EXEC: btest-diff test.rst
|
||||||
|
|
||||||
|
@TEST-START-FILE zeekygen.config
|
||||||
|
script_summary zeekygen/example.zeek test.rst
|
||||||
|
@TEST-END-FILE
|
||||||
|
|
||||||
|
@load zeekygen
|
|
@ -1,11 +1,11 @@
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT
|
||||||
# @TEST-EXEC: btest-diff autogen-reST-type-aliases.rst
|
# @TEST-EXEC: btest-diff autogen-reST-type-aliases.rst
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
@TEST-START-FILE zeekygen.config
|
||||||
identifier ZeexygenTest::* autogen-reST-type-aliases.rst
|
identifier ZeekygenTest::* autogen-reST-type-aliases.rst
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
||||||
module ZeexygenTest;
|
module ZeekygenTest;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
## This is just an alias for a builtin type ``bool``.
|
## This is just an alias for a builtin type ``bool``.
|
|
@ -1,7 +1,7 @@
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT
|
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeekygen.config %INPUT
|
||||||
# @TEST-EXEC: btest-diff autogen-reST-vectors.rst
|
# @TEST-EXEC: btest-diff autogen-reST-vectors.rst
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
@TEST-START-FILE zeekygen.config
|
||||||
identifier test_vector* autogen-reST-vectors.rst
|
identifier test_vector* autogen-reST-vectors.rst
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -X zeexygen.config %INPUT
|
|
||||||
# @TEST-EXEC: btest-diff example.rst
|
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
|
||||||
script zeexygen/example.zeek example.rst
|
|
||||||
@TEST-END-FILE
|
|
||||||
|
|
||||||
@load zeexygen/example
|
|
|
@ -1,9 +0,0 @@
|
||||||
# @TEST-PORT: BROKER_PORT
|
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT Broker::default_port=$BROKER_PORT
|
|
||||||
# @TEST-EXEC: btest-diff test.rst
|
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
|
||||||
identifier ZeexygenExample::* test.rst
|
|
||||||
@TEST-END-FILE
|
|
||||||
|
|
||||||
@load zeexygen
|
|
|
@ -1,9 +0,0 @@
|
||||||
# @TEST-PORT: BROKER_PORT
|
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT Broker::default_port=$BROKER_PORT
|
|
||||||
# @TEST-EXEC: btest-diff test.rst
|
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
|
||||||
package zeexygen test.rst
|
|
||||||
@TEST-END-FILE
|
|
||||||
|
|
||||||
@load zeexygen
|
|
|
@ -1,9 +0,0 @@
|
||||||
# @TEST-PORT: BROKER_PORT
|
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT Broker::default_port=$BROKER_PORT
|
|
||||||
# @TEST-EXEC: btest-diff test.rst
|
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
|
||||||
package_index zeexygen test.rst
|
|
||||||
@TEST-END-FILE
|
|
||||||
|
|
||||||
@load zeexygen
|
|
|
@ -1,9 +0,0 @@
|
||||||
# @TEST-PORT: BROKER_PORT
|
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT Broker::default_port=$BROKER_PORT
|
|
||||||
# @TEST-EXEC: btest-diff test.rst
|
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
|
||||||
script_index zeexygen/* test.rst
|
|
||||||
@TEST-END-FILE
|
|
||||||
|
|
||||||
@load zeexygen
|
|
|
@ -1,9 +0,0 @@
|
||||||
# @TEST-PORT: BROKER_PORT
|
|
||||||
# @TEST-EXEC: unset BRO_DISABLE_BROXYGEN; bro -b -X zeexygen.config %INPUT Broker::default_port=$BROKER_PORT
|
|
||||||
# @TEST-EXEC: btest-diff test.rst
|
|
||||||
|
|
||||||
@TEST-START-FILE zeexygen.config
|
|
||||||
script_summary zeexygen/example.zeek test.rst
|
|
||||||
@TEST-END-FILE
|
|
||||||
|
|
||||||
@load zeexygen
|
|
|
@ -55,14 +55,26 @@ event connection_established(c: connection)
|
||||||
OpenFlow::flow_mod(of_controller, match_rev, flow_mod);
|
OpenFlow::flow_mod(of_controller, match_rev, flow_mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global msg_count: count = 0;
|
||||||
|
|
||||||
|
function got_message()
|
||||||
|
{
|
||||||
|
++msg_count;
|
||||||
|
|
||||||
|
if ( msg_count == 6 )
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
event OpenFlow::flow_mod_success(name: string, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod, msg: string)
|
event OpenFlow::flow_mod_success(name: string, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod, msg: string)
|
||||||
{
|
{
|
||||||
print "Flow_mod_success";
|
print "Flow_mod_success";
|
||||||
|
got_message();
|
||||||
}
|
}
|
||||||
|
|
||||||
event OpenFlow::flow_mod_failure(name: string, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod, msg: string)
|
event OpenFlow::flow_mod_failure(name: string, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod, msg: string)
|
||||||
{
|
{
|
||||||
print "Flow_mod_failure";
|
print "Flow_mod_failure";
|
||||||
|
got_message();
|
||||||
}
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
@ -73,13 +85,6 @@ event OpenFlow::flow_mod_failure(name: string, match: OpenFlow::ofp_match, flow_
|
||||||
|
|
||||||
redef exit_only_after_terminate = T;
|
redef exit_only_after_terminate = T;
|
||||||
|
|
||||||
global msg_count: count = 0;
|
|
||||||
|
|
||||||
event die()
|
|
||||||
{
|
|
||||||
terminate();
|
|
||||||
}
|
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
Broker::subscribe("bro/openflow");
|
Broker::subscribe("bro/openflow");
|
||||||
|
@ -96,28 +101,16 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function got_message()
|
|
||||||
{
|
|
||||||
++msg_count;
|
|
||||||
|
|
||||||
if ( msg_count >= 4 )
|
|
||||||
{
|
|
||||||
schedule 2sec { die() };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
event OpenFlow::broker_flow_mod(name: string, dpid: count, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod)
|
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;
|
print "got flow_mod", dpid, match, flow_mod;
|
||||||
Broker::publish("bro/openflow", OpenFlow::flow_mod_success, name, match, flow_mod, "");
|
Broker::publish("bro/openflow", OpenFlow::flow_mod_success, name, match, flow_mod, "");
|
||||||
Broker::publish("bro/openflow", OpenFlow::flow_mod_failure, name, match, flow_mod, "");
|
Broker::publish("bro/openflow", OpenFlow::flow_mod_failure, name, match, flow_mod, "");
|
||||||
got_message();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event OpenFlow::broker_flow_clear(name: string, dpid: count)
|
event OpenFlow::broker_flow_clear(name: string, dpid: count)
|
||||||
{
|
{
|
||||||
print "flow_clear", dpid;
|
print "flow_clear", dpid;
|
||||||
got_message();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
|
@ -5,23 +5,54 @@
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
|
print "============ test ipv4 regex (good strings)";
|
||||||
local ip = "0.0.0.0";
|
local ip = "0.0.0.0";
|
||||||
|
|
||||||
print "============ test ipv4 regex";
|
|
||||||
print ip == ipv4_addr_regex;
|
print ip == ipv4_addr_regex;
|
||||||
print is_valid_ip(ip);
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
ip = "1.1.1.1";
|
ip = "1.1.1.1";
|
||||||
print ip == ipv4_addr_regex;
|
print ip == ipv4_addr_regex;
|
||||||
print is_valid_ip(ip);
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
ip = "9.9.9.9";
|
||||||
|
print ip == ipv4_addr_regex;
|
||||||
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
ip = "99.99.99.99";
|
||||||
|
print ip == ipv4_addr_regex;
|
||||||
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
ip = "09.99.99.99";
|
||||||
|
print ip == ipv4_addr_regex;
|
||||||
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
ip = "009.99.99.99";
|
||||||
|
print ip == ipv4_addr_regex;
|
||||||
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
ip = "255.255.255.255";
|
ip = "255.255.255.255";
|
||||||
print ip == ipv4_addr_regex;
|
print ip == ipv4_addr_regex;
|
||||||
print is_valid_ip(ip);
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
print "============ bad ipv4 decimals";
|
||||||
ip = "255.255.255.256";
|
ip = "255.255.255.256";
|
||||||
print ip == ipv4_addr_regex; # the regex doesn't check for 0-255
|
print ip == ipv4_addr_regex;
|
||||||
print is_valid_ip(ip); # but is_valid_ip() will
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
ip = "255.255.255.295";
|
||||||
|
print ip == ipv4_addr_regex;
|
||||||
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
ip = "255.255.255.300";
|
||||||
|
print ip == ipv4_addr_regex;
|
||||||
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
print "============ too many ipv4 decimals";
|
||||||
ip = "255.255.255.255.255";
|
ip = "255.255.255.255.255";
|
||||||
print ip == ipv4_addr_regex;
|
print ip == ipv4_addr_regex;
|
||||||
print is_valid_ip(ip);
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
print "============ typical looking ipv4";
|
||||||
ip = "192.168.1.100";
|
ip = "192.168.1.100";
|
||||||
print ip == ipv4_addr_regex;
|
print ip == ipv4_addr_regex;
|
||||||
print is_valid_ip(ip);
|
print is_valid_ip(ip);
|
||||||
|
@ -97,8 +128,16 @@ event zeek_init()
|
||||||
ip = "2001:db8:0:0:0:FFFF:192.168.0.256";
|
ip = "2001:db8:0:0:0:FFFF:192.168.0.256";
|
||||||
print is_valid_ip(ip);
|
print is_valid_ip(ip);
|
||||||
|
|
||||||
|
# These have too many hextets ("::" must expand to at least one hextet)
|
||||||
|
print is_valid_ip("6:1:2::3:4:5:6:7");
|
||||||
|
print is_valid_ip("6:1:2::3:4:5:6:7:8");
|
||||||
|
|
||||||
print "============ test extract_ip_addresses()";
|
print "============ test extract_ip_addresses()";
|
||||||
print extract_ip_addresses("this is 1.1.1.1 a test 2.2.2.2 string with ip addresses 3.3.3.3");
|
print extract_ip_addresses("this is 1.1.1.1 a test 2.2.2.2 string with ip addresses 3.3.3.3");
|
||||||
print extract_ip_addresses("this is 1.1.1.1 a test 0:0:0:0:0:0:0:0 string with ip addresses 3.3.3.3");
|
print extract_ip_addresses("this is 1.1.1.1 a test 0:0:0:0:0:0:0:0 string with ip addresses 3.3.3.3");
|
||||||
|
|
||||||
|
# This will use the leading 6 from "IPv6" (maybe that's not intended
|
||||||
|
# by a person trying to parse such a string, but that's just what's going
|
||||||
|
# to happen; it's on them to deal).
|
||||||
|
print extract_ip_addresses("IPv6:1:2::3:4:5:6:7");
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@ unset BRO_DEFAULT_CONNECT_RETRY
|
||||||
dir="$( cd "$( dirname "$0" )" && pwd )"
|
dir="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
source_dir="$( cd $dir/../.. && pwd )"
|
source_dir="$( cd $dir/../.. && pwd )"
|
||||||
build_dir=$source_dir/build
|
build_dir=$source_dir/build
|
||||||
conf_file=$build_dir/zeexygen-test.conf
|
conf_file=$build_dir/zeekygen-test.conf
|
||||||
output_dir=$source_dir/doc
|
output_dir=$source_dir/doc
|
||||||
zeek_error_file=$build_dir/zeexygen-test-stderr.txt
|
zeek_error_file=$build_dir/zeekygen-test-stderr.txt
|
||||||
|
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
output_dir=$1
|
output_dir=$1
|
||||||
|
@ -30,10 +30,10 @@ export BRO_SEED_FILE=$source_dir/testing/btest/random.seed
|
||||||
|
|
||||||
function run_zeek
|
function run_zeek
|
||||||
{
|
{
|
||||||
ZEEK_ALLOW_INIT_ERRORS=1 bro -X $conf_file zeexygen >/dev/null 2>$zeek_error_file
|
ZEEK_ALLOW_INIT_ERRORS=1 bro -X $conf_file zeekygen >/dev/null 2>$zeek_error_file
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed running zeek with zeexygen config file $conf_file"
|
echo "Failed running zeek with zeekygen config file $conf_file"
|
||||||
echo "See stderr in $zeek_error_file"
|
echo "See stderr in $zeek_error_file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue