diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 255fa1593c2..97db321e224 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -15,7 +15,7 @@ * 02110-1301, USA. */ -//! Parser registration functions and common interface +//! Parser registration functions and common interface module. use std; use crate::core::{self,DetectEngineState,Flow,AppLayerEventType,AppProto,Direction}; diff --git a/rust/src/applayertemplate/mod.rs b/rust/src/applayertemplate/mod.rs index 63f4ed139e8..e22bd68e391 100644 --- a/rust/src/applayertemplate/mod.rs +++ b/rust/src/applayertemplate/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Application layer template parser and logger module. + mod parser; pub mod template; /* TEMPLATE_START_REMOVE */ diff --git a/rust/src/asn1/mod.rs b/rust/src/asn1/mod.rs index 7c52b4cb856..4b77b0ca28d 100644 --- a/rust/src/asn1/mod.rs +++ b/rust/src/asn1/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! ASN.1 parser module. + use der_parser::ber::{parse_ber_recursive, BerObject, BerObjectContent, Tag}; use nom7::Err; use std::convert::TryFrom; diff --git a/rust/src/bittorrent_dht/mod.rs b/rust/src/bittorrent_dht/mod.rs index 0c79ecc92fa..9e0d033d300 100644 --- a/rust/src/bittorrent_dht/mod.rs +++ b/rust/src/bittorrent_dht/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! BitTorrent DHT application layer, logger and parser module. + pub mod bittorrent_dht; pub mod logger; pub mod parser; diff --git a/rust/src/common.rs b/rust/src/common.rs index a8880b2c4c0..1d10bbe443d 100644 --- a/rust/src/common.rs +++ b/rust/src/common.rs @@ -1,3 +1,5 @@ +//! Utility library module for commonly used strings, hexadecimals and other elements. + use super::build_slice; use crate::jsonbuilder::HEX; use std::ffi::CString; diff --git a/rust/src/conf.rs b/rust/src/conf.rs index b176d5f71f2..50acf6cae89 100644 --- a/rust/src/conf.rs +++ b/rust/src/conf.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Module for retrieving configuration details. + use std::os::raw::c_char; use std::os::raw::c_void; use std::os::raw::c_int; diff --git a/rust/src/core.rs b/rust/src/core.rs index 5b0a67afc0f..abb27ea578f 100644 --- a/rust/src/core.rs +++ b/rust/src/core.rs @@ -15,7 +15,7 @@ * 02110-1301, USA. */ -// This file exposes items from the core "C" code to Rust. +//! This module exposes items from the core "C" code to Rust. use std; use crate::filecontainer::*; diff --git a/rust/src/dcerpc/mod.rs b/rust/src/dcerpc/mod.rs index 7765e044ca8..800d2ade731 100644 --- a/rust/src/dcerpc/mod.rs +++ b/rust/src/dcerpc/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! DCE/RPC protocol parser, logger and detection module. + pub mod dcerpc; pub mod dcerpc_udp; pub mod parser; diff --git a/rust/src/detect/mod.rs b/rust/src/detect/mod.rs index 84bd28e2863..41c7ff2455b 100644 --- a/rust/src/detect/mod.rs +++ b/rust/src/detect/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Module for rule parsing. + pub mod byte_math; pub mod error; pub mod iprep; diff --git a/rust/src/dhcp/mod.rs b/rust/src/dhcp/mod.rs index bc859d7b54b..fd783d961ff 100644 --- a/rust/src/dhcp/mod.rs +++ b/rust/src/dhcp/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! DHCP parser, detection and logger module. + pub mod dhcp; pub mod parser; pub mod logger; diff --git a/rust/src/dns/mod.rs b/rust/src/dns/mod.rs index 054bb50b259..b0ca00ffc9d 100644 --- a/rust/src/dns/mod.rs +++ b/rust/src/dns/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! DNS parser, detection, logger and application layer module. + pub mod detect; pub mod dns; pub mod log; diff --git a/rust/src/ffi/mod.rs b/rust/src/ffi/mod.rs index ff9f7d1642c..e97e6c98c63 100644 --- a/rust/src/ffi/mod.rs +++ b/rust/src/ffi/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Module that exposes C bindings to the Suricata Rust library. + pub mod hashing; pub mod base64; pub mod strings; diff --git a/rust/src/filecontainer.rs b/rust/src/filecontainer.rs index c51daaa8f13..3a8bde5f7d5 100644 --- a/rust/src/filecontainer.rs +++ b/rust/src/filecontainer.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! This module handles file container operations (open, append, close). + use std::ptr; use std::os::raw::{c_void}; diff --git a/rust/src/filetracker.rs b/rust/src/filetracker.rs index ad1c4c0c3a2..3ae65eecb55 100644 --- a/rust/src/filetracker.rs +++ b/rust/src/filetracker.rs @@ -15,18 +15,17 @@ * 02110-1301, USA. */ -/** - * \file - * \author Victor Julien - * - * Tracks chunk based file transfers. Chunks may be transferred out - * of order, but cannot be transferred in parallel. So only one - * chunk at a time. - * - * GAP handling. If a data gap is encountered, the file is truncated - * and new data is no longer pushed down to the lower level APIs. - * The tracker does continue to follow the file. - */ +//! Gap handling and Chunk-based file transfer tracker module. +//! +//! GAP handling. If a data gap is encountered, the file is truncated +//! and new data is no longer pushed down to the lower level APIs. +//! The tracker does continue to follow the file +// +//! Tracks chunk based file transfers. Chunks may be transferred out +//! of order, but cannot be transferred in parallel. So only one +//! chunk at a time. +//! +//! Author: Victor Julien use crate::core::*; use std::collections::HashMap; diff --git a/rust/src/frames.rs b/rust/src/frames.rs index 3311a4b36f4..3a45d014b47 100644 --- a/rust/src/frames.rs +++ b/rust/src/frames.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Module for bindings to the Suricata C frame API. + use crate::applayer::StreamSlice; use crate::core::Flow; #[cfg(not(test))] diff --git a/rust/src/ftp/mod.rs b/rust/src/ftp/mod.rs index 1a60ca470c3..3839c9661e0 100644 --- a/rust/src/ftp/mod.rs +++ b/rust/src/ftp/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! FTP parser and application layer module. + use nom7::bytes::complete::{tag, take_until}; use nom7::character::complete::{digit1, multispace0}; use nom7::combinator::{complete, map_res, opt, verify}; diff --git a/rust/src/http2/mod.rs b/rust/src/http2/mod.rs index f1d6f30bb27..910e968105d 100644 --- a/rust/src/http2/mod.rs +++ b/rust/src/http2/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! HTTP/2 parser, detection, logger and application layer module. + #![allow(clippy::result_unit_err)] mod decompression; diff --git a/rust/src/ike/mod.rs b/rust/src/ike/mod.rs index 4f8114d2a0a..366688eae2e 100644 --- a/rust/src/ike/mod.rs +++ b/rust/src/ike/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! IKE parser, detection, logger and application layer module. + // written by Pierre Chifflier extern crate ipsec_parser; diff --git a/rust/src/jsonbuilder.rs b/rust/src/jsonbuilder.rs index c1f466563be..82be09953c7 100644 --- a/rust/src/jsonbuilder.rs +++ b/rust/src/jsonbuilder.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ + //! Module for building JSON documents. + #![allow(clippy::missing_safety_doc)] use std::cmp::max; diff --git a/rust/src/kerberos.rs b/rust/src/kerberos.rs index 0a5e9517abf..e7c51cc2f28 100644 --- a/rust/src/kerberos.rs +++ b/rust/src/kerberos.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Kerberos parser wrapper module. + use nom7::IResult; use nom7::error::{ErrorKind, ParseError}; use nom7::number::streaming::le_u16; diff --git a/rust/src/krb/mod.rs b/rust/src/krb/mod.rs index c8be867a093..ca6237d7bb6 100644 --- a/rust/src/krb/mod.rs +++ b/rust/src/krb/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Kerberos-v5 application layer, logger and detection module. + // written by Pierre Chifflier pub mod krb5; diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 4c238538273..da285963778 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -15,6 +15,11 @@ * 02110-1301, USA. */ +//! Suricata is a network intrusion prevention and monitoring engine. +//! +//! Suricata is a hybrid C and Rust application. What is found here are +//! the components written in Rust. + #![cfg_attr(feature = "strict", deny(warnings))] // Allow these patterns as its a style we like. @@ -70,7 +75,6 @@ pub mod conf; pub mod jsonbuilder; #[macro_use] pub mod applayer; -/// cbindgen:ignore pub mod frames; pub mod filecontainer; pub mod filetracker; diff --git a/rust/src/log.rs b/rust/src/log.rs index 05344b6e6cd..744169a9703 100644 --- a/rust/src/log.rs +++ b/rust/src/log.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Logging utility module. + use std; use std::ffi::CString; use std::path::Path; diff --git a/rust/src/lua.rs b/rust/src/lua.rs index 87cb8b3acf9..4fce2a82494 100644 --- a/rust/src/lua.rs +++ b/rust/src/lua.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Lua wrapper module. + use std::os::raw::c_char; use std::os::raw::c_int; use std::os::raw::c_long; diff --git a/rust/src/lzma.rs b/rust/src/lzma.rs index b16c4e7b525..e10d803a6e2 100644 --- a/rust/src/lzma.rs +++ b/rust/src/lzma.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! lzma decompression utility module. + use lzma_rs::decompress::{Options, Stream}; use lzma_rs::error::Error; use std::io::{Cursor, Write}; diff --git a/rust/src/mime/mod.rs b/rust/src/mime/mod.rs index 399500db9ac..6f4a9bc2130 100644 --- a/rust/src/mime/mod.rs +++ b/rust/src/mime/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! MIME protocol parser module. + use crate::common::nom7::take_until_and_consume; use nom7::branch::alt; use nom7::bytes::streaming::{tag, take_until, take_while}; diff --git a/rust/src/modbus/mod.rs b/rust/src/modbus/mod.rs index 50e65939047..6f3c434a044 100644 --- a/rust/src/modbus/mod.rs +++ b/rust/src/modbus/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Modbus application layer, logger, parser and detection module. + pub mod detect; pub mod log; pub mod modbus; diff --git a/rust/src/mqtt/mod.rs b/rust/src/mqtt/mod.rs index c0225ecec31..aefcc33e092 100644 --- a/rust/src/mqtt/mod.rs +++ b/rust/src/mqtt/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! MQTT application layer, detection, logger and parser module. + pub mod detect; pub mod logger; pub mod mqtt; diff --git a/rust/src/nfs/mod.rs b/rust/src/nfs/mod.rs index 17cfc724d3e..2f6fe84df91 100644 --- a/rust/src/nfs/mod.rs +++ b/rust/src/nfs/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! NFS application layer, parser, logger module. + pub mod types; pub mod rpc_records; pub mod nfs_records; diff --git a/rust/src/ntp/mod.rs b/rust/src/ntp/mod.rs index 35f1a70f2e1..30ff834304c 100644 --- a/rust/src/ntp/mod.rs +++ b/rust/src/ntp/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! NTP application layer and parser module. + // written by Pierre Chifflier pub mod ntp; diff --git a/rust/src/pgsql/mod.rs b/rust/src/pgsql/mod.rs index 054fd488659..a4c79c03192 100644 --- a/rust/src/pgsql/mod.rs +++ b/rust/src/pgsql/mod.rs @@ -15,7 +15,7 @@ * 02110-1301, USA. */ -//! PostgreSQL parser and application layer +//! PostgreSQL parser, logger and application layer module. //! //! written by Juliana Fajardini diff --git a/rust/src/plugin.rs b/rust/src/plugin.rs index f9daef7de43..ad214aaa47f 100644 --- a/rust/src/plugin.rs +++ b/rust/src/plugin.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Plugin utility module. + pub fn init() { unsafe { let context = super::core::SCGetContext(); diff --git a/rust/src/quic/mod.rs b/rust/src/quic/mod.rs index 91693059dcc..8a8f1bbd7fc 100644 --- a/rust/src/quic/mod.rs +++ b/rust/src/quic/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! QUIC application layer, parser, detection and logger module. + mod crypto; mod cyu; pub mod detect; diff --git a/rust/src/rdp/mod.rs b/rust/src/rdp/mod.rs index ddfc511d4fa..dc83db82994 100644 --- a/rust/src/rdp/mod.rs +++ b/rust/src/rdp/mod.rs @@ -15,7 +15,7 @@ * 02110-1301, USA. */ -//! RDP parser and application layer +//! RDP parser, logger and application layer module. //! //! written by Zach Kelly diff --git a/rust/src/rfb/mod.rs b/rust/src/rfb/mod.rs index 68d37ec8a0e..050ee7709b7 100644 --- a/rust/src/rfb/mod.rs +++ b/rust/src/rfb/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! RFB protocol parser, logger and detection module. + // Author: Frank Honza pub mod detect; diff --git a/rust/src/sip/mod.rs b/rust/src/sip/mod.rs index 33eec45ccdb..de63aaa5201 100755 --- a/rust/src/sip/mod.rs +++ b/rust/src/sip/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! SIP protocol parser, detection and logger module. + // written by Giuseppe Longo pub mod detect; diff --git a/rust/src/smb/mod.rs b/rust/src/smb/mod.rs index ca1eb7771fd..5b74f1ca4e0 100644 --- a/rust/src/smb/mod.rs +++ b/rust/src/smb/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! SMB application layer, detection, logger and parser module. + pub mod error; pub mod smb_records; pub mod smb_status; diff --git a/rust/src/snmp/mod.rs b/rust/src/snmp/mod.rs index 3bb90ab2f35..7c6ceb35884 100644 --- a/rust/src/snmp/mod.rs +++ b/rust/src/snmp/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! SNMP application layer, parser, detection and logger module. + // written by Pierre Chifflier extern crate snmp_parser; diff --git a/rust/src/ssh/mod.rs b/rust/src/ssh/mod.rs index 12efccd0a55..ff506e9439a 100644 --- a/rust/src/ssh/mod.rs +++ b/rust/src/ssh/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! SSH application layer, logger, detection and parser module. + pub mod detect; pub mod logger; mod parser; diff --git a/rust/src/telnet/mod.rs b/rust/src/telnet/mod.rs index 2dfa97a2f1b..38685c79544 100644 --- a/rust/src/telnet/mod.rs +++ b/rust/src/telnet/mod.rs @@ -15,5 +15,7 @@ * 02110-1301, USA. */ +//! Telnet application layer and parser module. + pub mod telnet; mod parser; diff --git a/rust/src/tftp/mod.rs b/rust/src/tftp/mod.rs index 7c3d292a00f..6ae29ac9014 100644 --- a/rust/src/tftp/mod.rs +++ b/rust/src/tftp/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! TFTP parser, logger and application layer module. + // written by Clément Galland pub mod tftp; diff --git a/rust/src/util.rs b/rust/src/util.rs index a0933689164..d7109464f77 100644 --- a/rust/src/util.rs +++ b/rust/src/util.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Utility module. + use std::ffi::CStr; use std::os::raw::c_char; diff --git a/rust/src/x509/mod.rs b/rust/src/x509/mod.rs index fa9706e9021..c87928cf17a 100644 --- a/rust/src/x509/mod.rs +++ b/rust/src/x509/mod.rs @@ -15,6 +15,8 @@ * 02110-1301, USA. */ +//! Module for SSL/TLS X.509 certificates parser and decoder. + // written by Pierre Chifflier use crate::common::rust_string_to_c;