tx_data: AppLayerTxData,
}
+impl Default for TemplateTransaction {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl TemplateTransaction {
pub fn new() -> TemplateTransaction {
- TemplateTransaction {
+ Self {
tx_id: 0,
request: None,
response: None,
}
}
+#[derive(Default)]
pub struct TemplateState {
state_data: AppLayerStateData,
tx_id: u64,
impl TemplateState {
pub fn new() -> Self {
- Self {
- state_data: AppLayerStateData::new(),
- tx_id: 0,
- transactions: VecDeque::new(),
- request_gap: false,
- response_gap: false,
- }
+ Default::default()
}
// Free a transaction by ID.
MalformedPacket,
}
+#[derive(Default)]
pub struct BitTorrentDHTTransaction {
tx_id: u64,
pub request_type: Option<String>,
}
impl BitTorrentDHTTransaction {
- pub fn new() -> BitTorrentDHTTransaction {
- BitTorrentDHTTransaction {
- tx_id: 0,
- request_type: None,
- request: None,
- response: None,
- error: None,
- transaction_id: Vec::new(),
- client_version: None,
- tx_data: AppLayerTxData::new(),
- }
+ pub fn new() -> Self {
+ Self::default()
}
/// Set an event on the transaction
}
fn new_tx(&mut self) -> BitTorrentDHTTransaction {
- let mut tx = BitTorrentDHTTransaction::new();
+ let mut tx = BitTorrentDHTTransaction::default();
self.tx_id += 1;
tx.tx_id = self.tx_id;
return tx;
pub range2: u32,
}
+impl Default for DCEOpnumRange {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl DCEOpnumRange {
pub fn new() -> Self {
- return Self {
+ Self {
range1: DETECT_DCE_OPNUM_RANGE_UNINITIALIZED,
range2: DETECT_DCE_OPNUM_RANGE_UNINITIALIZED,
- };
+ }
}
}
pub authorities: Vec<DNSAnswerEntry>,
}
-#[derive(Debug)]
+#[derive(Debug, Default)]
pub struct DNSTransaction {
pub id: u64,
pub request: Option<DNSRequest>,
}
impl DNSTransaction {
-
pub fn new() -> Self {
- return Self {
- id: 0,
- request: None,
- response: None,
- tx_data: AppLayerTxData::new(),
- }
+ Default::default()
}
/// Get the DNS transactions ID (not the internal tracking ID).
impl DNSState {
pub fn new() -> Self {
- Default::default()
- }
-
- pub fn new_tcp() -> Self {
- Default::default()
+ Default::default()
}
pub fn new_tx(&mut self) -> DNSTransaction {
/// Returns *mut DNSState
#[no_mangle]
pub extern "C" fn rs_dns_state_tcp_new() -> *mut std::os::raw::c_void {
- let state = DNSState::new_tcp();
+ let state = DNSState::new();
let boxed = Box::new(state);
return Box::into_raw(boxed) as *mut _;
}
}
}
+impl Default for HTTP2Transaction {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl HTTP2Transaction {
- pub fn new() -> HTTP2Transaction {
- HTTP2Transaction {
+ pub fn new() -> Self {
+ Self {
tx_id: 0,
stream_id: 0,
child_stream_id: 0,
pub overflow: u8,
}
+impl Default for HTTP2DynTable {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl HTTP2DynTable {
pub fn new() -> Self {
Self {
}
}
+impl Default for HTTP2State {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl HTTP2State {
pub fn new() -> Self {
Self {
pub ikev2_header: IkeV2Header,
}
+impl Default for IkeHeaderWrapper {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl IkeHeaderWrapper {
- pub fn new() -> IkeHeaderWrapper {
- IkeHeaderWrapper {
+ pub fn new() -> Self {
+ Self {
spi_initiator: String::new(),
spi_responder: String::new(),
maj_ver: 0,
pub ikev2_payload_types: Vec<IkePayloadType>,
}
+#[derive(Default)]
pub struct IKETransaction {
tx_id: u64,
}
impl IKETransaction {
- pub fn new() -> IKETransaction {
- IKETransaction {
- tx_id: 0,
- ike_version: 0,
- direction: Direction::ToServer,
- hdr: IkeHeaderWrapper::new(),
- payload_types: Default::default(),
- notify_types: vec![],
- logged: LoggerFlags::new(),
- tx_data: applayer::AppLayerTxData::new(),
- errors: 0,
- }
+ pub fn new() -> Self {
+ Default::default()
}
/// Set an event.
other: Vec<EncryptionType>,
}
+impl Default for DetectKrb5TicketEncryptionList {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl DetectKrb5TicketEncryptionList {
- pub fn new() -> DetectKrb5TicketEncryptionList {
- DetectKrb5TicketEncryptionList {
+ pub fn new() -> Self {
+ Self {
positive: [false; KRB_TICKET_FASTARRAY_SIZE],
negative: [false; KRB_TICKET_FASTARRAY_SIZE],
other: Vec::new(),
s
}
+impl Default for KRB5State {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl KRB5State {
pub fn new() -> KRB5State {
- KRB5State{
+ Self {
state_data: AppLayerStateData::new(),
req_id: 0,
record_ts: 0,
#![allow(clippy::manual_find)]
#![allow(clippy::match_like_matches_macro)]
#![allow(clippy::module_inception)]
-#![allow(clippy::new_without_default)]
#![allow(clippy::result_unit_err)]
#![allow(clippy::type_complexity)]
#![allow(clippy::upper_case_acronyms)]
}
}
+#[derive(Default)]
pub struct ModbusState {
state_data: AppLayerStateData,
pub transactions: Vec<ModbusTransaction>,
impl ModbusState {
pub fn new() -> Self {
- Self {
- state_data: AppLayerStateData::new(),
- transactions: Vec::new(),
- tx_id: 0,
- givenup: false,
- }
+ Default::default()
}
pub fn get_tx(&mut self, tx_id: u64) -> Option<&mut ModbusTransaction> {
}
}
+impl Default for MQTTState {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl MQTTState {
pub fn new() -> Self {
Self {
pub tx_data: AppLayerTxData,
}
+impl Default for NFSTransaction {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl NFSTransaction {
pub fn new() -> Self {
return Self {
ts: u64,
}
+impl Default for NFSState {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl State<NFSTransaction> for NFSState {
fn get_transaction_count(&self) -> usize {
self.transactions.len()
NotResponse,
}
+#[derive(Default)]
pub struct NTPState {
state_data: AppLayerStateData,
tx_id: u64,
}
-#[derive(Debug)]
+#[derive(Debug, Default)]
pub struct NTPTransaction {
/// The NTP reference ID
pub xid: u32,
}
impl NTPState {
- pub fn new() -> NTPState {
- NTPState {
- state_data: AppLayerStateData::new(),
- transactions: Vec::new(),
- events: 0,
- tx_id: 0,
- }
+ pub fn new() -> Self {
+ Default::default()
}
}
}
}
+impl Default for PgsqlTransaction {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl PgsqlTransaction {
- pub fn new() -> PgsqlTransaction {
- PgsqlTransaction {
+ pub fn new() -> Self {
+ Self {
tx_id: 0,
tx_state: PgsqlTransactionState::Init,
request: None,
}
}
+impl Default for PgsqlState {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl PgsqlState {
pub fn new() -> Self {
Self {
}
}
+impl Default for RFBTransaction {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl RFBTransaction {
- pub fn new() -> RFBTransaction {
- RFBTransaction {
+ pub fn new() -> Self {
+ Self {
tx_id: 0,
complete: false,
chosen_security_type: None,
}
+impl Default for RFBState {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl RFBState {
pub fn new() -> Self {
Self {
InvalidData,
}
+#[derive(Default)]
pub struct SIPState {
state_data: AppLayerStateData,
transactions: Vec<SIPTransaction>,
impl SIPState {
pub fn new() -> SIPState {
- SIPState {
- state_data: AppLayerStateData::new(),
- transactions: Vec::new(),
- tx_id: 0,
- }
+ Default::default()
}
pub fn free(&mut self) {
}
}
+impl Default for SMBTransaction {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl SMBTransaction {
pub fn new() -> Self {
return Self {
id: 0,
vercmd: SMBVerCmdStat::new(),
- hdr: SMBCommonHdr::init(),
+ hdr: SMBCommonHdr::default(),
request_done: false,
response_done: false,
type_data: None,
}
impl SMBCommonHdr {
- pub fn init() -> Self {
- Default::default()
- }
pub fn new(rec_type: u32, ssn_id: u64, tree_id: u32, msg_id: u64) -> Self {
Self {
rec_type,
VersionMismatch,
}
+#[derive(Default)]
pub struct SNMPState<'a> {
state_data: AppLayerStateData,
impl<'a> SNMPState<'a> {
pub fn new() -> SNMPState<'a> {
- SNMPState{
- state_data: AppLayerStateData::new(),
- version: 0,
- transactions: Vec::new(),
- tx_id: 0,
- }
+ Default::default()
}
}
pub hassh_string: Vec<u8>,
}
+impl Default for SshHeader {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl SshHeader {
pub fn new() -> SshHeader {
- SshHeader {
+ Self {
record_left: 0,
record_left_msg: parser::MessageCode::Undefined(0),
}
}
+#[derive(Default)]
pub struct SSHTransaction {
pub srv_hdr: SshHeader,
pub cli_hdr: SshHeader,
impl SSHTransaction {
pub fn new() -> SSHTransaction {
- SSHTransaction {
- srv_hdr: SshHeader::new(),
- cli_hdr: SshHeader::new(),
- tx_data: AppLayerTxData::new(),
- }
+ Default::default()
}
}
+#[derive(Default)]
pub struct SSHState {
state_data: AppLayerStateData,
transaction: SSHTransaction,
impl SSHState {
pub fn new() -> Self {
- Self {
- state_data: AppLayerStateData::new(),
- transaction: SSHTransaction::new(),
- }
+ Default::default()
}
fn set_event(&mut self, event: SSHEvent) {
Data,
}
+#[derive(Default)]
pub struct TelnetTransaction {
tx_id: u64,
tx_data: AppLayerTxData,
}
impl TelnetTransaction {
- pub fn new() -> TelnetTransaction {
- TelnetTransaction {
- tx_id: 0,
- tx_data: AppLayerTxData::new(),
- }
+ pub fn new() -> Self {
+ Default::default()
}
}
}
}
+impl Default for TelnetState {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl TelnetState {
pub fn new() -> Self {
Self {