diff --git a/devel/spicy/autogen-spicy-docs b/devel/spicy/autogen-spicy-docs index e09044fff..4c9a19ba5 100755 --- a/devel/spicy/autogen-spicy-docs +++ b/devel/spicy/autogen-spicy-docs @@ -39,10 +39,8 @@ fi cp "${TFTP}"/scripts/main.zeek "${AUTOGEN_FINAL}"/tftp.zeek || exit 1 cp "${TFTP}"/analyzer/tftp.spicy "${AUTOGEN_FINAL}"/tftp.spicy || exit 1 cp "${TFTP}"/analyzer/tftp.evt "${AUTOGEN_FINAL}"/tftp.evt || exit 1 -cat "${TFTP}"/analyzer/tftp.spicy | grep -v spicy::accept_input > "${AUTOGEN_FINAL}"/tftp-no-accept.spicy || exit 1 # Copy some files from the Zeek source tree so that zeek-docs remains standaline for CI. cp "${ZEEK}/scripts/base/frameworks/spicy/init-bare.zeek" "${AUTOGEN_FINAL}/" cp "${ZEEK}/scripts/base/frameworks/spicy/init-framework.zeek" "${AUTOGEN_FINAL}/" cp "${ZEEK}/auxil/spicy/doc/scripts/spicy-pygments.py" "${DOC}/ext" - diff --git a/devel/spicy/autogen/tftp-no-accept.spicy b/devel/spicy/autogen/tftp-no-accept.spicy deleted file mode 100644 index 07b7c39e3..000000000 --- a/devel/spicy/autogen/tftp-no-accept.spicy +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2021 by the Zeek Project. See LICENSE for details. -# -# Trivial File Transfer Protocol -# -# Specs from https://tools.ietf.org/html/rfc1350 - -module TFTP; - -import spicy; - -# Common header for all messages: -# -# 2 bytes -# --------------- -# | TFTP Opcode | -# --------------- - -public type Packet = unit { # public top-level entry point for parsing - op: uint16 &convert=Opcode($$); - switch ( self.op ) { - Opcode::RRQ -> rrq: Request(True); - Opcode::WRQ -> wrq: Request(False); - Opcode::DATA -> data: Data; - Opcode::ACK -> ack: Acknowledgement; - Opcode::ERROR -> error: Error; - }; -}; - -# TFTP supports five types of packets [...]: -# -# opcode operation -# 1 Read request (RRQ) -# 2 Write request (WRQ) -# 3 Data (DATA) -# 4 Acknowledgment (ACK) -# 5 Error (ERROR) -type Opcode = enum { - RRQ = 0x01, - WRQ = 0x02, - DATA = 0x03, - ACK = 0x04, - ERROR = 0x05 -}; - -# Figure 5-1: RRQ/WRQ packet -# -# 2 bytes string 1 byte string 1 byte -# ------------------------------------------------ -# | Opcode | Filename | 0 | Mode | 0 | -# ------------------------------------------------ - -type Request = unit(is_read: bool) { - filename: bytes &until=b"\x00"; - mode: bytes &until=b"\x00"; - -}; - -# Figure 5-2: DATA packet -# -# 2 bytes 2 bytes n bytes -# ---------------------------------- -# | Opcode | Block # | Data | -# ---------------------------------- - -type Data = unit { - num: uint16; - data: bytes &eod; -}; - -# Figure 5-3: ACK packet -# -# 2 bytes 2 bytes -# --------------------- -# | Opcode | Block # | -# --------------------- - -type Acknowledgement = unit { - num: uint16; -}; - -# Figure 5-4: ERROR packet -# -# 2 bytes 2 bytes string 1 byte -# ----------------------------------------- -# | Opcode | ErrorCode | ErrMsg | 0 | -# ----------------------------------------- - -type Error = unit { - code: uint16; - msg: bytes &until=b"\x00"; -}; diff --git a/devel/spicy/autogen/tftp.spicy b/devel/spicy/autogen/tftp.spicy index 7927c6e90..264b8bdc2 100644 --- a/devel/spicy/autogen/tftp.spicy +++ b/devel/spicy/autogen/tftp.spicy @@ -15,15 +15,16 @@ import spicy; # | TFTP Opcode | # --------------- -public type Packet = unit { # public top-level entry point for parsing +public type Packet = unit { + # public top-level entry point for parsing op: uint16 &convert=Opcode($$); - switch ( self.op ) { - Opcode::RRQ -> rrq: Request(True); - Opcode::WRQ -> wrq: Request(False); - Opcode::DATA -> data: Data; - Opcode::ACK -> ack: Acknowledgement; + switch (self.op) { + Opcode::RRQ -> rrq: Request(True); + Opcode::WRQ -> wrq: Request(False); + Opcode::DATA -> data: Data; + Opcode::ACK -> ack: Acknowledgement; Opcode::ERROR -> error: Error; - }; + }; }; # TFTP supports five types of packets [...]: @@ -39,7 +40,7 @@ type Opcode = enum { WRQ = 0x02, DATA = 0x03, ACK = 0x04, - ERROR = 0x05 + ERROR = 0x05, }; # Figure 5-1: RRQ/WRQ packet @@ -51,9 +52,11 @@ type Opcode = enum { type Request = unit(is_read: bool) { filename: bytes &until=b"\x00"; - mode: bytes &until=b"\x00"; + mode: bytes &until=b"\x00"; - on %done { spicy::accept_input(); } + on %done { + spicy::accept_input(); + } }; # Figure 5-2: DATA packet @@ -64,7 +67,7 @@ type Request = unit(is_read: bool) { # ---------------------------------- type Data = unit { - num: uint16; + num: uint16; data: bytes &eod; }; @@ -88,5 +91,5 @@ type Acknowledgement = unit { type Error = unit { code: uint16; - msg: bytes &until=b"\x00"; + msg: bytes &until=b"\x00"; }; diff --git a/scripts/base/utils/urls.zeek.rst b/scripts/base/utils/urls.zeek.rst index 850f1263a..7abcc3236 100644 --- a/scripts/base/utils/urls.zeek.rst +++ b/scripts/base/utils/urls.zeek.rst @@ -106,7 +106,7 @@ Types Functions ######### .. zeek:id:: decompose_uri - :source-code: base/utils/urls.zeek 52 136 + :source-code: base/utils/urls.zeek 52 135 :Type: :zeek:type:`function` (uri: :zeek:type:`string`) : :zeek:type:`URI`