From 93dd9d67977f9d75feeca533f9cfafb378e09f4e Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Tue, 18 Jun 2024 13:00:55 +0200 Subject: [PATCH] Spicy: Reformat `zeek.spicy` with `spicy-format`. --- scripts/spicy/zeek.spicy | 51 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/scripts/spicy/zeek.spicy b/scripts/spicy/zeek.spicy index a6f3b1f344..4af1621a59 100644 --- a/scripts/spicy/zeek.spicy +++ b/scripts/spicy/zeek.spicy @@ -12,13 +12,13 @@ import spicy; ## ## This function has been deprecated and will be removed. Use ``spicy::accept_input`` ## instead, which will have the same effect with Zeek. -public function confirm_protocol() : void &cxxname="zeek::spicy::rt::confirm_protocol"; +public function confirm_protocol(): void &cxxname="zeek::spicy::rt::confirm_protocol"; ## [Deprecated] Triggers a DPD protocol violation for the current connection. ## ## This function has been deprecated and will be removed. Use ``spicy::decline_input`` ## instead, which will have the same effect with Zeek. -public function reject_protocol(reason: string) : void &cxxname="zeek::spicy::rt::reject_protocol"; +public function reject_protocol(reason: string): void &cxxname="zeek::spicy::rt::reject_protocol"; ## Reports a "weird" to Zeek. This should be used with similar semantics as in ## Zeek: something quite unexpected happening at the protocol level, which however @@ -31,19 +31,19 @@ public function reject_protocol(reason: string) : void &cxxname="zeek::spicy::rt public function weird(id: string, addl: string = "") &cxxname="zeek::spicy::rt::weird"; ## Returns true if we're currently parsing the originator side of a connection. -public function is_orig() : bool &cxxname="zeek::spicy::rt::is_orig"; +public function is_orig(): bool &cxxname="zeek::spicy::rt::is_orig"; ## Returns the current connection's UID. -public function uid() : string &cxxname="zeek::spicy::rt::uid"; +public function uid(): string &cxxname="zeek::spicy::rt::uid"; ## Returns the current connection's 4-tuple ID to make IP address and port information available. -public function conn_id() : tuple &cxxname="zeek::spicy::rt::conn_id"; +public function conn_id(): tuple &cxxname="zeek::spicy::rt::conn_id"; ## Instructs Zeek to flip the directionality of the current connection. -public function flip_roles() : void &cxxname="zeek::spicy::rt::flip_roles"; +public function flip_roles(): void &cxxname="zeek::spicy::rt::flip_roles"; ## Returns the number of packets seen so far on the current side of the current connection. -public function number_packets() : uint64 &cxxname="zeek::spicy::rt::number_packets"; +public function number_packets(): uint64 &cxxname="zeek::spicy::rt::number_packets"; ## Opaque handle to a protocol analyzer. public type ProtocolHandle = __library_type("zeek::spicy::rt::ProtocolHandle"); @@ -65,7 +65,7 @@ public type ProtocolHandle = __library_type("zeek::spicy::rt::ProtocolHandle"); ## Note: For backwards compatibility, the analyzer argument can be left unset to add ## a DPD analyzer. This use is deprecated, though; use the single-argument version of ## `protocol_begin` for that instead. -public function protocol_begin(analyzer: optional, protocol: spicy::Protocol = spicy::Protocol::TCP) : void &cxxname="zeek::spicy::rt::protocol_begin"; +public function protocol_begin(analyzer: optional, protocol: spicy::Protocol = spicy::Protocol::TCP): void &cxxname="zeek::spicy::rt::protocol_begin"; ## Adds a Zeek-side DPD child protocol analyzer performing dynamic protocol detection ## on subsequently provided data. @@ -78,7 +78,7 @@ public function protocol_begin(analyzer: optional, protocol: spicy::Prot ## ## protocol: the transport-layer protocol on which to perform protocol detection; ## only TCP is currently supported here -public function protocol_begin(protocol: spicy::Protocol = spicy::Protocol::TCP) : void &cxxname="zeek::spicy::rt::protocol_begin"; +public function protocol_begin(protocol: spicy::Protocol = spicy::Protocol::TCP): void &cxxname="zeek::spicy::rt::protocol_begin"; ## Gets a handle to a Zeek-side child protocol analyzer for the current connection. ## @@ -98,7 +98,7 @@ public function protocol_begin(protocol: spicy::Protocol = spicy::Protocol::TCP) ## protocol: the transport-layer protocol that the analyser uses; only TCP is ## currently supported here ## -public function protocol_handle_get_or_create(analyzer: string, protocol: spicy::Protocol = spicy::Protocol::TCP) : ProtocolHandle &cxxname="zeek::spicy::rt::protocol_handle_get_or_create"; +public function protocol_handle_get_or_create(analyzer: string, protocol: spicy::Protocol = spicy::Protocol::TCP): ProtocolHandle &cxxname="zeek::spicy::rt::protocol_handle_get_or_create"; ## Forwards protocol data to all previously instantiated Zeek-side child protocol analyzers of a given transport-layer. ## @@ -107,7 +107,7 @@ public function protocol_handle_get_or_create(analyzer: string, protocol: spicy: ## data: chunk of data to forward to child analyzer ## ## protocol: the transport-layer protocol of the children to forward to; only TCP is currently supported here -public function protocol_data_in(is_orig: bool, data: bytes, protocol: spicy::Protocol = spicy::Protocol::TCP) : void &cxxname="zeek::spicy::rt::protocol_data_in"; +public function protocol_data_in(is_orig: bool, data: bytes, protocol: spicy::Protocol = spicy::Protocol::TCP): void &cxxname="zeek::spicy::rt::protocol_data_in"; ## Forwards protocol data to a specific previously instantiated Zeek-side child analyzer. ## @@ -116,7 +116,7 @@ public function protocol_data_in(is_orig: bool, data: bytes, protocol: spicy::Pr ## data: chunk of data to forward to child analyzer ## ## h: handle to the child analyzer to forward data into -public function protocol_data_in(is_orig: bool, data: bytes, h: ProtocolHandle) : void &cxxname="zeek::spicy::rt::protocol_data_in"; +public function protocol_data_in(is_orig: bool, data: bytes, h: ProtocolHandle): void &cxxname="zeek::spicy::rt::protocol_data_in"; ## Signals a gap in input data to all previously instantiated Zeek-side child protocol analyzers. ## @@ -127,11 +127,11 @@ public function protocol_data_in(is_orig: bool, data: bytes, h: ProtocolHandle) ## len: size of gap ## ## h: optional handle to the child analyzer signal a gap to, else signal to all child analyzers -public function protocol_gap(is_orig: bool, offset: uint64, len: uint64, h: optional = Null) : void &cxxname="zeek::spicy::rt::protocol_gap"; +public function protocol_gap(is_orig: bool, offset: uint64, len: uint64, h: optional = Null): void &cxxname="zeek::spicy::rt::protocol_gap"; ## Signals end-of-data to all previously instantiated Zeek-side child protocol ## analyzers and removes them. -public function protocol_end() : void &cxxname="zeek::spicy::rt::protocol_end"; +public function protocol_end(): void &cxxname="zeek::spicy::rt::protocol_end"; ## Signals end-of-data to the given child analyzer and removes it. ## @@ -147,54 +147,55 @@ public function protocol_handle_close(handle: ProtocolHandle): void &cxxname="ze ## Optionally, a mime type can be provided. It will be passed on to Zeek's file analysis framework. ## Optionally, a file ID can be provided. It will be passed on to Zeek's file analysis framework. ## Returns the Zeek-side file ID of the new file. -public function file_begin(mime_type: optional = Null, fuid: optional = Null) : string &cxxname="zeek::spicy::rt::file_begin"; +public function file_begin(mime_type: optional = Null, fuid: optional = Null): string &cxxname="zeek::spicy::rt::file_begin"; ## Returns the current file's FUID. -public function fuid() : string &cxxname="zeek::spicy::rt::fuid"; +public function fuid(): string &cxxname="zeek::spicy::rt::fuid"; ## Terminates the currently active Zeek-side session, flushing all state. Any ## subsequent activity will start a new session from scratch. This can only be ## called from inside a protocol analyzer. -public function terminate_session() : void &cxxname="zeek::spicy::rt::terminate_session"; +public function terminate_session(): void &cxxname="zeek::spicy::rt::terminate_session"; ## Tells Zeek to skip sending any further input data to the current analyzer. ## This is supported for protocol and file analyzers. -public function skip_input() : void &cxxname="zeek::spicy::rt::skip_input"; +public function skip_input(): void &cxxname="zeek::spicy::rt::skip_input"; ## Signals the expected size of a file to Zeek's file analysis. ## ## size: expected size of file ## fid: Zeek-side ID of the file to operate on; if not given, the file started by the most recent file_begin() will be used -public function file_set_size(size: uint64, fid: optional = Null) : void &cxxname="zeek::spicy::rt::file_set_size"; +public function file_set_size(size: uint64, fid: optional = Null): void &cxxname="zeek::spicy::rt::file_set_size"; ## Passes file content on to Zeek's file analysis. ## ## data: chunk of raw data to pass into analysis ## fid: Zeek-side ID of the file to operate on; if not given, the file started by the most recent file_begin() will be used -public function file_data_in(data: bytes, fid: optional = Null) : void &cxxname="zeek::spicy::rt::file_data_in"; +public function file_data_in(data: bytes, fid: optional = Null): void &cxxname="zeek::spicy::rt::file_data_in"; ## Passes file content at a specific offset on to Zeek's file analysis. ## ## data: chunk of raw data to pass into analysis ## offset: position in file where data starts ## fid: Zeek-side ID of the file to operate on; if not given, the file started by the most recent file_begin() will be used -public function file_data_in_at_offset(data: bytes, offset: uint64, fid: optional = Null) : void &cxxname="zeek::spicy::rt::file_data_in_at_offset"; +public function file_data_in_at_offset(data: bytes, offset: uint64, fid: optional = Null): void &cxxname="zeek::spicy::rt::file_data_in_at_offset"; ## Signals a gap in a file to Zeek's file analysis. ## ## offset: position in file where gap starts ## len: size of gap ## fid: Zeek-side ID of the file to operate on; if not given, the file started by the most recent file_begin() will be used -public function file_gap(offset: uint64, len: uint64, fid: optional = Null) : void &cxxname="zeek::spicy::rt::file_gap"; +public function file_gap(offset: uint64, len: uint64, fid: optional = Null): void &cxxname="zeek::spicy::rt::file_gap"; ## Signals the end of a file to Zeek's file analysis. ## ## fid: Zeek-side ID of the file to operate on; if not given, the file started by the most recent file_begin() will be used -public function file_end(fid: optional = Null) : void &cxxname="zeek::spicy::rt::file_end"; +public function file_end(fid: optional = Null): void &cxxname="zeek::spicy::rt::file_end"; ## Inside a packet analyzer, forwards what data remains after parsing the top-level unit ## on to another analyzer. The index specifies the target, per the current dispatcher table. -public function forward_packet(identifier: uint32) : void &cxxname="zeek::spicy::rt::forward_packet"; +public function forward_packet(identifier: uint32): void &cxxname="zeek::spicy::rt::forward_packet"; ## Gets the network time from Zeek. -public function network_time() : time &cxxname="zeek::spicy::rt::network_time"; +public function network_time(): time &cxxname="zeek::spicy::rt::network_time"; +