Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust/doc: add docstring to rust module files - v5 #9603

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust/src/applayer.rs
Expand Up @@ -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};
Expand Down
2 changes: 2 additions & 0 deletions rust/src/applayertemplate/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! Application layer template parser and logger module.

mod parser;
pub mod template;
/* TEMPLATE_START_REMOVE */
Expand Down
2 changes: 2 additions & 0 deletions rust/src/asn1/mod.rs
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/bittorrent_dht/mod.rs
Expand Up @@ -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;
2 changes: 2 additions & 0 deletions 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;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/conf.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion rust/src/core.rs
Expand Up @@ -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::*;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/dcerpc/mod.rs
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/detect/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! Module for rule parsing.

pub mod byte_math;
pub mod error;
pub mod iprep;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/dhcp/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! DHCP parser, detection and logger module.

pub mod dhcp;
pub mod parser;
pub mod logger;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/dns/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! DNS parser, detection, logger and application layer module.

pub mod detect;
pub mod dns;
pub mod log;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/ffi/mod.rs
Expand Up @@ -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;
2 changes: 2 additions & 0 deletions rust/src/filecontainer.rs
Expand Up @@ -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};

Expand Down
23 changes: 11 additions & 12 deletions rust/src/filetracker.rs
Expand Up @@ -15,18 +15,17 @@
* 02110-1301, USA.
*/

/**
* \file
* \author Victor Julien <victor@inliniac.net>
*
* 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 <victor@inliniac.net>

use crate::core::*;
use std::collections::HashMap;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/frames.rs
Expand Up @@ -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))]
Expand Down
2 changes: 2 additions & 0 deletions rust/src/ftp/mod.rs
Expand Up @@ -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};
Expand Down
2 changes: 2 additions & 0 deletions rust/src/http2/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! HTTP/2 parser, detection, logger and application layer module.

#![allow(clippy::result_unit_err)]

mod decompression;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/ike/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! IKE parser, detection, logger and application layer module.

// written by Pierre Chifflier <chifflier@wzdftpd.net>

extern crate ipsec_parser;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/jsonbuilder.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! Module for building JSON documents.

#![allow(clippy::missing_safety_doc)]

use std::cmp::max;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/kerberos.rs
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/krb/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! Kerberos-v5 application layer, logger and detection module.

// written by Pierre Chifflier <chifflier@wzdftpd.net>

pub mod krb5;
Expand Down
6 changes: 5 additions & 1 deletion rust/src/lib.rs
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/log.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! Logging utility module.

use std;
use std::ffi::CString;
use std::path::Path;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/lua.rs
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/lzma.rs
Expand Up @@ -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};
Expand Down
2 changes: 2 additions & 0 deletions rust/src/mime/mod.rs
Expand Up @@ -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};
Expand Down
2 changes: 2 additions & 0 deletions rust/src/modbus/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! Modbus application layer, logger, parser and detection module.

pub mod detect;
pub mod log;
pub mod modbus;
2 changes: 2 additions & 0 deletions rust/src/mqtt/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! MQTT application layer, detection, logger and parser module.

pub mod detect;
pub mod logger;
pub mod mqtt;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/nfs/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! NFS application layer, parser, logger module.

pub mod types;
pub mod rpc_records;
pub mod nfs_records;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/ntp/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! NTP application layer and parser module.

// written by Pierre Chifflier <chifflier@wzdftpd.net>

pub mod ntp;
2 changes: 1 addition & 1 deletion rust/src/pgsql/mod.rs
Expand Up @@ -15,7 +15,7 @@
* 02110-1301, USA.
*/

//! PostgreSQL parser and application layer
//! PostgreSQL parser, logger and application layer module.
//!
//! written by Juliana Fajardini <jufajardini@oisf.net>

Expand Down
2 changes: 2 additions & 0 deletions rust/src/plugin.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! Plugin utility module.

pub fn init() {
unsafe {
let context = super::core::SCGetContext();
Expand Down
2 changes: 2 additions & 0 deletions rust/src/quic/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! QUIC application layer, parser, detection and logger module.

mod crypto;
mod cyu;
pub mod detect;
Expand Down
2 changes: 1 addition & 1 deletion rust/src/rdp/mod.rs
Expand Up @@ -15,7 +15,7 @@
* 02110-1301, USA.
*/

//! RDP parser and application layer
//! RDP parser, logger and application layer module.
//!
//! written by Zach Kelly <zach.kelly@lmco.com>

Expand Down
2 changes: 2 additions & 0 deletions rust/src/rfb/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! RFB protocol parser, logger and detection module.

// Author: Frank Honza <frank.honza@dcso.de>

pub mod detect;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/sip/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! SIP protocol parser, detection and logger module.

// written by Giuseppe Longo <giuseppe@glongo.it>

pub mod detect;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/smb/mod.rs
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/snmp/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! SNMP application layer, parser, detection and logger module.

// written by Pierre Chifflier <chifflier@wzdftpd.net>

extern crate snmp_parser;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/ssh/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! SSH application layer, logger, detection and parser module.

pub mod detect;
pub mod logger;
mod parser;
Expand Down
2 changes: 2 additions & 0 deletions rust/src/telnet/mod.rs
Expand Up @@ -15,5 +15,7 @@
* 02110-1301, USA.
*/

//! Telnet application layer and parser module.

pub mod telnet;
mod parser;
2 changes: 2 additions & 0 deletions rust/src/tftp/mod.rs
Expand Up @@ -15,6 +15,8 @@
* 02110-1301, USA.
*/

//! TFTP parser, logger and application layer module.

// written by Clément Galland <clement.galland@epita.fr>

pub mod tftp;
Expand Down