From: Philippe Antoine Date: Thu, 20 Apr 2023 06:49:48 +0000 (+0200) Subject: rust: remove unused X-Git-Tag: suricata-7.0.0-rc2~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=668501c225d09ce1c5316c0061ff6a7e1980c64c;p=thirdparty%2Fsuricata.git rust: remove unused --- diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 75e507de59..0c1d3a4ba8 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -20,7 +20,6 @@ use std; use crate::core::{self,DetectEngineState,Flow,AppLayerEventType,AppProto,Direction}; use crate::filecontainer::FileContainer; -use crate::applayer; use std::os::raw::{c_void,c_char,c_int}; use crate::core::SC; use std::ffi::CStr; @@ -42,6 +41,7 @@ pub struct StreamSlice { impl StreamSlice { /// Create a StreamSlice from a Rust slice. Useful in unit tests. + #[cfg(test)] pub fn from_slice(slice: &[u8], flags: u8, offset: u64) -> Self { Self { input: slice.as_ptr() as *const u8, @@ -87,16 +87,6 @@ impl AppLayerTxConfig { log_flags: 0, } } - - pub fn add_log_flags(&mut self, flags: u8) { - self.log_flags |= flags; - } - pub fn set_log_flags(&mut self, flags: u8) { - self.log_flags = flags; - } - pub fn get_log_flags(&self) -> u8 { - self.log_flags - } } #[repr(C)] @@ -233,9 +223,6 @@ impl AppLayerStateData { file_flags: 0, } } - pub fn update_file_flags(&mut self, flags: u16) { - self.file_flags |= flags; - } } #[macro_export] @@ -285,15 +272,9 @@ impl AppLayerResult { }; } - pub fn is_ok(self) -> bool { - self.status == 0 - } pub fn is_incomplete(self) -> bool { self.status == 1 } - pub fn is_err(self) -> bool { - self.status == -1 - } } impl From for AppLayerResult { @@ -501,20 +482,11 @@ pub const APP_LAYER_PARSER_OPT_ACCEPT_GAPS: u32 = BIT_U32!(0); pub const APP_LAYER_TX_SKIP_INSPECT_FLAG: u64 = BIT_U64!(62); -pub type AppLayerGetTxIteratorFn = unsafe extern "C" fn (ipproto: u8, - alproto: AppProto, - alstate: *mut c_void, - min_tx_id: u64, - max_tx_id: u64, - istate: &mut u64) -> applayer::AppLayerGetTxIterTuple; - extern { pub fn AppLayerParserStateSetFlag(state: *mut c_void, flag: u16); pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u16) -> u16; pub fn AppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32); pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int; - pub fn AppLayerParserRegisterGetTxIterator(ipproto: u8, alproto: AppProto, fun: AppLayerGetTxIteratorFn); - pub fn AppLayerParserRegisterOptionFlags(ipproto: u8, alproto: AppProto, flags: u32); } #[repr(C)] diff --git a/rust/src/core.rs b/rust/src/core.rs index 6ad9004ea6..f3057c0ed8 100644 --- a/rust/src/core.rs +++ b/rust/src/core.rs @@ -24,7 +24,6 @@ use crate::debug_validate_fail; /// Opaque C types. pub enum DetectEngineState {} pub enum AppLayerDecoderEvents {} -pub enum AppLayerParserState {} // From app-layer-events.h pub type AppLayerEventType = std::os::raw::c_int; diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index 1b93ce9b73..d5ade3fcdf 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -435,15 +435,6 @@ impl DCERPCState { None } - pub fn get_hdr_rpc_vers(&self) -> Option { - debug_validate_bug_on!(self.header.is_none()); - if let Some(ref hdr) = self.header { - return Some(hdr.rpc_vers); - } - // Shouldn't happen - None - } - pub fn get_hdr_call_id(&self) -> Option { debug_validate_bug_on!(self.header.is_none()); if let Some(ref hdr) = self.header { @@ -453,20 +444,6 @@ impl DCERPCState { None } - pub fn handle_gap_ts(&mut self) -> u8 { - if !self.buffer_ts.is_empty() { - self.buffer_ts.clear(); - } - return 0; - } - - pub fn handle_gap_tc(&mut self) -> u8 { - if !self.buffer_tc.is_empty() { - self.buffer_tc.clear(); - } - return 0; - } - pub fn clean_buffer(&mut self, direction: Direction) { match direction { Direction::ToServer => { diff --git a/rust/src/detect/byte_math.rs b/rust/src/detect/byte_math.rs index c6bbec88bd..a2bead3745 100644 --- a/rust/src/detect/byte_math.rs +++ b/rust/src/detect/byte_math.rs @@ -63,7 +63,7 @@ pub enum ByteMathOperator { #[derive(Copy, Clone, Debug, PartialEq, Eq)] // endian pub enum ByteMathEndian { - EndianNone = 0, + _EndianNone = 0, BigEndian = 1, LittleEndian = 2, EndianDCE = 3, @@ -73,7 +73,7 @@ pub const DETECT_BYTEMATH_ENDIAN_DEFAULT: ByteMathEndian = ByteMathEndian::BigEn #[repr(u8)] #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum ByteMathBase { - BaseNone = 0, + _BaseNone = 0, BaseOct = 8, BaseDec = 10, BaseHex = 16, diff --git a/rust/src/dhcp/dhcp.rs b/rust/src/dhcp/dhcp.rs index 00291757c8..5afa1efb37 100644 --- a/rust/src/dhcp/dhcp.rs +++ b/rust/src/dhcp/dhcp.rs @@ -38,7 +38,7 @@ pub const DHCP_OPT_HOSTNAME: u8 = 12; pub const DHCP_OPT_REQUESTED_IP: u8 = 50; pub const DHCP_OPT_ADDRESS_TIME: u8 = 51; pub const DHCP_OPT_TYPE: u8 = 53; -pub const DHCP_OPT_SERVER_ID: u8 = 54; +//unused pub const DHCP_OPT_SERVER_ID: u8 = 54; pub const DHCP_OPT_PARAMETER_LIST: u8 = 55; pub const DHCP_OPT_RENEWAL_TIME: u8 = 58; pub const DHCP_OPT_REBINDING_TIME: u8 = 59; diff --git a/rust/src/dhcp/parser.rs b/rust/src/dhcp/parser.rs index 9f6397fd44..48acccff2c 100644 --- a/rust/src/dhcp/parser.rs +++ b/rust/src/dhcp/parser.rs @@ -19,8 +19,7 @@ use std::cmp::min; use crate::dhcp::dhcp::*; use nom7::bytes::streaming::take; -use nom7::combinator::{complete, verify}; -use nom7::multi::many0; +use nom7::combinator::verify; use nom7::number::streaming::{be_u16, be_u32, be_u8}; use nom7::IResult; @@ -196,12 +195,6 @@ pub fn parse_option(i: &[u8]) -> IResult<&[u8], DHCPOption> { } } -// Parse and return all the options. Upon the end of option indicator -// all the data will be consumed. -pub fn parse_all_options(i: &[u8]) -> IResult<&[u8], Vec> { - many0(complete(parse_option))(i) -} - pub fn dhcp_parse(input: &[u8]) -> IResult<&[u8], DHCPMessage> { match parse_header(input) { Ok((rem, header)) => { diff --git a/rust/src/dns/dns.rs b/rust/src/dns/dns.rs index 67eb308554..382c76ae59 100644 --- a/rust/src/dns/dns.rs +++ b/rust/src/dns/dns.rs @@ -104,7 +104,7 @@ pub const DNS_RCODE_NOTZONE: u16 = 10; // Support for OPT RR from RFC6891 will be needed to // parse RCODE values over 15 pub const DNS_RCODE_BADVERS: u16 = 16; -pub const DNS_RCODE_BADSIG: u16 = 16; +//also pub const DNS_RCODE_BADSIG: u16 = 16; pub const DNS_RCODE_BADKEY: u16 = 17; pub const DNS_RCODE_BADTIME: u16 = 18; pub const DNS_RCODE_BADMODE: u16 = 19; diff --git a/rust/src/dns/log.rs b/rust/src/dns/log.rs index 01dac80d0b..5212b1a0da 100644 --- a/rust/src/dns/log.rs +++ b/rust/src/dns/log.rs @@ -22,9 +22,6 @@ use std::string::String; use crate::dns::dns::*; use crate::jsonbuilder::{JsonBuilder, JsonError}; -pub const LOG_QUERIES: u64 = BIT_U64!(0); -pub const LOG_ANSWER: u64 = BIT_U64!(1); - pub const LOG_A: u64 = BIT_U64!(2); pub const LOG_NS: u64 = BIT_U64!(3); pub const LOG_MD: u64 = BIT_U64!(4); diff --git a/rust/src/dns/parser.rs b/rust/src/dns/parser.rs index 25e8abc23c..a1d97a53fd 100644 --- a/rust/src/dns/parser.rs +++ b/rust/src/dns/parser.rs @@ -191,13 +191,6 @@ fn dns_parse_answer<'a>( return Ok((input, answers)); } -/// Parse a DNS response. -pub fn dns_parse_response(message: &[u8]) -> IResult<&[u8], DNSResponse> { - let i = message; - let (i, header) = dns_parse_header(i)?; - dns_parse_response_body(i, message, header) -} - pub fn dns_parse_response_body<'a>( i: &'a [u8], message: &'a [u8], header: DNSHeader, ) -> IResult<&'a [u8], DNSResponse> { @@ -529,6 +522,13 @@ mod tests { } } + /// Parse a DNS response. + fn dns_parse_response(message: &[u8]) -> IResult<&[u8], DNSResponse> { + let i = message; + let (i, header) = dns_parse_header(i)?; + dns_parse_response_body(i, message, header) + } + #[test] fn test_dns_parse_response() { // DNS response from dig-a-www.suricata-ids.org.pcap. diff --git a/rust/src/filecontainer.rs b/rust/src/filecontainer.rs index ff4ff2e2ab..b1784b6c2f 100644 --- a/rust/src/filecontainer.rs +++ b/rust/src/filecontainer.rs @@ -27,26 +27,6 @@ extern { pub const FILE_USE_DETECT: u16 = BIT_U16!(13); -// Generic file structure, so it can be used by different protocols -#[derive(Debug, Default)] -pub struct Files { - pub files_ts: FileContainer, - pub files_tc: FileContainer, - pub flags_ts: u16, - pub flags_tc: u16, -} - -impl Files { - pub fn get(&mut self, direction: Direction) -> (&mut FileContainer, u16) - { - if direction == Direction::ToServer { - (&mut self.files_ts, self.flags_ts) - } else { - (&mut self.files_tc, self.flags_tc) - } - } -} - #[repr(C)] #[derive(Debug)] pub struct FileContainer { diff --git a/rust/src/filetracker.rs b/rust/src/filetracker.rs index 0aab94bffb..d372882ed1 100644 --- a/rust/src/filetracker.rs +++ b/rust/src/filetracker.rs @@ -122,12 +122,6 @@ impl FileTransferTracker { self.cur_ooo = 0; } - pub fn create(&mut self, _name: &[u8], _file_size: u64) { - if self.file_open { panic!("close existing file first"); } - - SCLogDebug!("CREATE: name {:?} file_size {}", _name, _file_size); - } - pub fn new_chunk(&mut self, config: &'static SuricataFileContext, name: &[u8], data: &[u8], chunk_offset: u64, chunk_size: u32, fill_bytes: u8, is_last: bool, xid: &u32) -> u32 diff --git a/rust/src/ike/ikev2.rs b/rust/src/ike/ikev2.rs index 9e464876cd..ecb54613da 100644 --- a/rust/src/ike/ikev2.rs +++ b/rust/src/ike/ikev2.rs @@ -35,8 +35,6 @@ pub enum IKEV2ConnectionState { InitNonceSent, RespSASent, RespKESent, - RespNonceSent, - RespCertReqSent, ParsingDone, @@ -52,8 +50,7 @@ impl IKEV2ConnectionState { (&InitKESent, &IkeV2PayloadContent::Nonce(_)) => InitNonceSent, (&InitNonceSent, &IkeV2PayloadContent::SA(_)) => RespSASent, (&RespSASent, &IkeV2PayloadContent::KE(_)) => RespKESent, - (&RespKESent, &IkeV2PayloadContent::Nonce(_)) => ParsingDone, // RespNonceSent, - (&RespNonceSent, &IkeV2PayloadContent::CertificateRequest(_)) => ParsingDone, // RespCertReqSent, + (&RespKESent, &IkeV2PayloadContent::Nonce(_)) => ParsingDone, // should go to RespNonceSent, (&ParsingDone, _) => self.clone(), (_, &IkeV2PayloadContent::Notify(_)) => self.clone(), (_, &IkeV2PayloadContent::Dummy) => self.clone(), diff --git a/rust/src/kerberos.rs b/rust/src/kerberos.rs index 3b152735a4..0a5e9517ab 100644 --- a/rust/src/kerberos.rs +++ b/rust/src/kerberos.rs @@ -28,7 +28,6 @@ use kerberos_parser::krb5_parser::parse_ap_req; pub enum SecBlobError { NotSpNego, KrbFmtError, - KrbReqError, Ber(BerError), NomError(ErrorKind), } diff --git a/rust/src/krb/krb5.rs b/rust/src/krb/krb5.rs index 69c89461d2..3282d50ba7 100644 --- a/rust/src/krb/krb5.rs +++ b/rust/src/krb/krb5.rs @@ -97,14 +97,6 @@ impl Transaction for KRB5Transaction { } } -pub fn to_hex_string(bytes: &[u8]) -> String { - let mut s = String::new(); - for &b in bytes { - s.push_str(&format!("{:02X}", b)); - } - s -} - impl Default for KRB5State { fn default() -> Self { Self::new() diff --git a/rust/src/log.rs b/rust/src/log.rs index 3652d03096..05344b6e6c 100644 --- a/rust/src/log.rs +++ b/rust/src/log.rs @@ -25,13 +25,14 @@ use crate::core::*; #[repr(C)] pub enum Level { NotSet = -1, - None = 0, + _None = 0, Error, - Warning, + _Warning, Notice, Info, - Perf, + _Perf, Config, + #[cfg(feature = "debug")] Debug, } diff --git a/rust/src/nfs/types.rs b/rust/src/nfs/types.rs index 749f710546..96195b9940 100644 --- a/rust/src/nfs/types.rs +++ b/rust/src/nfs/types.rs @@ -185,53 +185,6 @@ pub fn rpc_auth_type_known(auth_type: u32) -> i8 { return -1; } -/* http://www.iana.org/assignments/rpc-authentication-numbers/rpc-authentication-numbers.xhtml */ -pub const RPCAUTH_OK: u32 = 0; // success/failed at remote end [RFC5531] -pub const RPCAUTH_BADCRED: u32 = 1; // bad credential (seal broken) [RFC5531] -pub const RPCAUTH_REJECTEDCRED: u32 = 2; // client must begin new session [RFC5531] -pub const RPCAUTH_BADVERF: u32 = 3; // bad verifier (seal broken) [RFC5531] -pub const RPCAUTH_REJECTEDVERF: u32 = 4; // verifier expired or replayed [RFC5531] -pub const RPCAUTH_TOOWEAK: u32 = 5; // rejected for security reasons/failed locally [RFC5531] -pub const RPCAUTH_INVALIDRESP: u32 = 6; // bogus response verifier [RFC5531] -pub const RPCAUTH_FAILED: u32 = 7; // reason unknown/AUTH_KERB errors; deprecated. See [RFC2695] [RFC5531] -pub const RPCAUTH_KERB_GENERIC: u32 = 8; // kerberos generic error [RFC5531] -pub const RPCAUTH_TIMEEXPIRE: u32 = 9; // time of credential expired [RFC5531] -pub const RPCAUTH_TKT_FILE: u32 = 10; // problem with ticket file [RFC5531] -pub const RPCAUTH_DECODE: u32 = 11; // can't decode authenticator [RFC5531] -pub const RPCAUTH_NET_ADDR: u32 = 12; // wrong net address in ticket/RPCSEC_GSS GSS related errors [RFC5531] -pub const RPCSEC_GSS_CREDPROBLEM: u32 = 13; // no credentials for user [RFC5531] -pub const RPCSEC_GSS_CTXPROBLEM: u32 = 14; // problem with context [RFC5531] -pub const RPCSEC_GSS_INNER_CREDPROBLEM: u32 = 15; // No credentials for multi-principal assertion inner context user [RFC7861] -pub const RPCSEC_GSS_LABEL_PROBLEM: u32 = 16; // Problem with label assertion [RFC7861] -pub const RPCSEC_GSS_PRIVILEGE_PROBLEM: u32 = 17; // Problem with structured privilege assertion [RFC7861] -pub const RPCSEC_GSS_UNKNOWN_MESSAGE: u32 = 18; // Unknown structured privilege assertion [RFC7861] - -pub fn rpc_auth_status_string(auth_status: u32) -> String { - match auth_status { - RPCAUTH_OK => "OK", - RPCAUTH_BADCRED => "BADCRED", - RPCAUTH_REJECTEDCRED => "REJECTEDCRED", - RPCAUTH_BADVERF => "BADVERF", - RPCAUTH_REJECTEDVERF => "REJECTEDVERF", - RPCAUTH_TOOWEAK => "TOOWEAK", - RPCAUTH_INVALIDRESP => "NVALIDRESP", - RPCAUTH_FAILED => "FAILED", - RPCAUTH_KERB_GENERIC => "KERB_GENERIC", - RPCAUTH_TIMEEXPIRE => "TIMEEXPIRE", - RPCAUTH_TKT_FILE => "TKT_FILE", - RPCAUTH_DECODE => "DECODE", - RPCAUTH_NET_ADDR => "NET_ADDR", - RPCSEC_GSS_CREDPROBLEM => "GSS_CREDPROBLEM", - RPCSEC_GSS_CTXPROBLEM => "GSS_CTXPROBLEM", - RPCSEC_GSS_INNER_CREDPROBLEM => "GSS_INNER_CREDPROBLEM", - RPCSEC_GSS_LABEL_PROBLEM => "GSS_LABEL_PROBLEM", - RPCSEC_GSS_PRIVILEGE_PROBLEM => "GSS_PRIVILEGE_PROBLEM", - RPCSEC_GSS_UNKNOWN_MESSAGE => "GSS_UNKNOWN_MESSAGE", - _ => { - return (auth_status).to_string(); - }, - }.to_string() -} pub const NFSPROC4_NULL: u32 = 0; pub const NFSPROC4_COMPOUND: u32 = 1; diff --git a/rust/src/pgsql/parser.rs b/rust/src/pgsql/parser.rs index 637bf576fb..bcee6ae9a2 100644 --- a/rust/src/pgsql/parser.rs +++ b/rust/src/pgsql/parser.rs @@ -160,16 +160,6 @@ pub struct ErrorNoticeMessage { pub message_body: Vec, } -impl ErrorNoticeMessage { - pub fn new(identifier: u8, length: u32) -> Self { - ErrorNoticeMessage { - identifier, - length, - message_body: Vec::new(), - } - } -} - #[derive(Debug, PartialEq, Eq)] pub enum SSLResponseMessage { SSLAccepted, @@ -177,16 +167,6 @@ pub enum SSLResponseMessage { InvalidResponse, } -impl SSLResponseMessage { - pub fn to_str(&self) -> &'static str { - match self { - SSLResponseMessage::SSLAccepted => "SSL Accepted", - SSLResponseMessage::SSLRejected => "SSL Rejected", - SSLResponseMessage::InvalidResponse => "Invalid server response", - } - } -} - impl From for SSLResponseMessage { fn from(identifier: u8) -> Self { match identifier { @@ -1091,6 +1071,16 @@ mod tests { use super::*; use nom7::Needed; + impl ErrorNoticeMessage { + pub fn new(identifier: u8, length: u32) -> Self { + ErrorNoticeMessage { + identifier, + length, + message_body: Vec::new(), + } + } + } + #[test] fn test_parse_request() { // An SSLRequest diff --git a/rust/src/pgsql/pgsql.rs b/rust/src/pgsql/pgsql.rs index 63da68b56f..f5fbebc8f9 100644 --- a/rust/src/pgsql/pgsql.rs +++ b/rust/src/pgsql/pgsql.rs @@ -98,7 +98,6 @@ impl PgsqlTransaction { pub enum PgsqlStateProgress { IdleState, SSLRequestReceived, - SSLAcceptedReceived, SSLRejectedReceived, StartupMessageReceived, SASLAuthenticationReceived, @@ -119,6 +118,7 @@ pub enum PgsqlStateProgress { CommandCompletedReceived, ErrorMessageReceived, ConnectionTerminated, + #[cfg(test)] UnknownState, Finished, } @@ -244,7 +244,6 @@ impl PgsqlState { /// responses, we must track State progress to decide on tx completion fn is_tx_completed(&self) -> bool { if let PgsqlStateProgress::ReadyForQueryReceived - | PgsqlStateProgress::SSLAcceptedReceived | PgsqlStateProgress::SSLRejectedReceived | PgsqlStateProgress::SimpleAuthenticationReceived | PgsqlStateProgress::SASLAuthenticationReceived diff --git a/rust/src/quic/parser.rs b/rust/src/quic/parser.rs index dfd09cb00c..5d9d700080 100644 --- a/rust/src/quic/parser.rs +++ b/rust/src/quic/parser.rs @@ -40,7 +40,6 @@ use std::convert::TryFrom; pub struct QuicVersion(pub u32); impl QuicVersion { - pub const Q039: QuicVersion = QuicVersion(0x51303339); pub const Q043: QuicVersion = QuicVersion(0x51303433); pub const Q044: QuicVersion = QuicVersion(0x51303434); pub const Q045: QuicVersion = QuicVersion(0x51303435); diff --git a/rust/src/rdp/parser.rs b/rust/src/rdp/parser.rs index 590ef6ff5b..604d10a19c 100644 --- a/rust/src/rdp/parser.rs +++ b/rust/src/rdp/parser.rs @@ -99,7 +99,7 @@ pub enum T123TpktChild { pub enum X224Type { ConnectionConfirm = 0xd, ConnectionRequest = 0xe, - Data = 0xf, + _Data = 0xf, } /// x.224-spec, section 13.3 diff --git a/rust/src/sip/parser.rs b/rust/src/sip/parser.rs index 1f270f9fb8..a34bc2615e 100644 --- a/rust/src/sip/parser.rs +++ b/rust/src/sip/parser.rs @@ -57,12 +57,6 @@ pub struct Response { pub body_len: u16, } -#[derive(PartialEq, Eq, Debug, Clone)] -pub enum Method { - Register, - Custom(String), -} - #[inline] fn is_token_char(b: u8) -> bool { is_alphanumeric(b) || b"!%'*+-._`".contains(&b) diff --git a/rust/src/smb/smb.rs b/rust/src/smb/smb.rs index 86a20f634c..9099259729 100644 --- a/rust/src/smb/smb.rs +++ b/rust/src/smb/smb.rs @@ -132,9 +132,11 @@ pub fn smb_dos_error_string(c: u16) -> String { } pub const NTLMSSP_NEGOTIATE: u32 = 1; +#[cfg(feature = "debug")] pub const NTLMSSP_CHALLENGE: u32 = 2; pub const NTLMSSP_AUTH: u32 = 3; +#[cfg(feature = "debug")] pub fn ntlmssp_type_string(c: u32) -> String { match c { NTLMSSP_NEGOTIATE => "NTLMSSP_NEGOTIATE", @@ -560,7 +562,7 @@ pub const SMBHDR_TYPE_FILENAME: u32 = 3; pub const SMBHDR_TYPE_OFFSET: u32 = 4; pub const SMBHDR_TYPE_GENERICTX: u32 = 5; pub const SMBHDR_TYPE_HEADER: u32 = 6; -pub const SMBHDR_TYPE_MAX_SIZE: u32 = 7; // max resp size for SMB1_COMMAND_TRANS +//unused pub const SMBHDR_TYPE_MAX_SIZE: u32 = 7; // max resp size for SMB1_COMMAND_TRANS pub const SMBHDR_TYPE_TRANS_FRAG: u32 = 8; pub const SMBHDR_TYPE_TREE: u32 = 9; pub const SMBHDR_TYPE_DCERPCTX: u32 = 10; @@ -1041,26 +1043,6 @@ impl SMBState { return tx_ref.unwrap(); } - pub fn get_create_tx_by_hdr(&mut self, hdr: &SMBCommonHdr) - -> Option<&mut SMBTransaction> - { - for tx in &mut self.transactions { - let found = match tx.type_data { - Some(SMBTransactionTypeData::CREATE(ref _d)) => { - tx.hdr.compare(hdr) - }, - _ => { false }, - }; - - if found { - SCLogDebug!("SMB: Found SMB create TX with ID {}", tx.id); - return Some(tx); - } - } - SCLogDebug!("SMB: Failed to find SMB create TX with key {:?}", hdr); - return None; - } - pub fn get_service_for_guid(&self, guid: &[u8]) -> (&'static str, bool) { let (name, is_dcerpc) = match self.guid2name_map.get(&guid.to_vec()) { diff --git a/rust/src/smb/smb1_records.rs b/rust/src/smb/smb1_records.rs index 0d412da3d6..bf767da8b0 100644 --- a/rust/src/smb/smb1_records.rs +++ b/rust/src/smb/smb1_records.rs @@ -821,9 +821,6 @@ impl<'a> SmbRecord<'a> { pub fn has_unicode_support(&self) -> bool { self.flags2 & 0x8000_u16 != 0 } - pub fn is_dos_error(&self) -> bool { - self.flags2 & 0x4000_u16 != 0 - } /// Return true if record is a request. pub fn is_request(&self) -> bool { diff --git a/rust/src/smb/smb2_records.rs b/rust/src/smb/smb2_records.rs index 84a6faf572..4a7721cdaa 100644 --- a/rust/src/smb/smb2_records.rs +++ b/rust/src/smb/smb2_records.rs @@ -66,10 +66,6 @@ pub struct Smb2Record<'a> { } impl<'a> Smb2Record<'a> { - pub fn is_async(&self) -> bool { - self.async_id != 0 - } - pub fn is_request(&self) -> bool { self.direction == 0 } diff --git a/rust/src/ssh/ssh.rs b/rust/src/ssh/ssh.rs index aa05c59b72..3e2a15b9f1 100644 --- a/rust/src/ssh/ssh.rs +++ b/rust/src/ssh/ssh.rs @@ -92,12 +92,6 @@ pub struct SSHTransaction { tx_data: AppLayerTxData, } -impl SSHTransaction { - pub fn new() -> SSHTransaction { - Default::default() - } -} - #[derive(Default)] pub struct SSHState { state_data: AppLayerStateData, diff --git a/rust/src/telnet/telnet.rs b/rust/src/telnet/telnet.rs index 9c068e2da2..f1e7eec502 100644 --- a/rust/src/telnet/telnet.rs +++ b/rust/src/telnet/telnet.rs @@ -41,12 +41,6 @@ pub struct TelnetTransaction { tx_data: AppLayerTxData, } -impl TelnetTransaction { - pub fn new() -> Self { - Default::default() - } -} - impl Transaction for TelnetTransaction { fn id(&self) -> u64 { self.tx_id @@ -134,13 +128,6 @@ impl TelnetState { self.transactions.iter().find(|tx| tx.tx_id == tx_id + 1) } - fn _new_tx(&mut self) -> TelnetTransaction { - let mut tx = TelnetTransaction::new(); - self.tx_id += 1; - tx.tx_id = self.tx_id; - return tx; - } - fn _find_request(&mut self) -> Option<&mut TelnetTransaction> { // TODO None diff --git a/rust/src/x509/mod.rs b/rust/src/x509/mod.rs index 1b00101e63..fa9706e902 100644 --- a/rust/src/x509/mod.rs +++ b/rust/src/x509/mod.rs @@ -27,7 +27,7 @@ mod log; #[repr(u32)] pub enum X509DecodeError { - Success = 0, + _Success = 0, /// Generic decoding error InvalidCert, /// Some length does not match, or certificate is incomplete