pub fn incomplete(consumed: u32, needed: u32) -> Self {
return Self {
status: 1,
- consumed: consumed,
- needed: needed,
+ consumed,
+ needed,
};
}
impl AppLayerGetTxIterTuple {
pub fn with_values(tx_ptr: *mut std::os::raw::c_void, tx_id: u64, has_next: bool) -> AppLayerGetTxIterTuple {
AppLayerGetTxIterTuple {
- tx_ptr: tx_ptr, tx_id: tx_id, has_next: has_next,
+ tx_ptr, tx_id, has_next,
}
}
pub fn not_found() -> AppLayerGetTxIterTuple {
}
Ok(DCEIfaceData {
- if_uuid: if_uuid,
- du16: du16,
- any_frag: any_frag,
+ if_uuid,
+ du16,
+ any_frag,
})
}
result: &str, base: ByteMathBase, endian: ByteMathEndian, bitmask_val: u32, flags: u8,
) {
let bmd = DetectByteMathData {
- nbytes: nbytes,
- offset: offset,
- oper: oper,
+ nbytes,
+ offset,
+ oper,
rvalue_str: if !rvalue_str.is_empty() {
CString::new(rvalue_str).unwrap().into_raw()
} else {
std::ptr::null_mut()
},
- rvalue: rvalue,
+ rvalue,
result: CString::new(result).unwrap().into_raw(),
- base: base,
- endian: endian,
- bitmask_val: bitmask_val,
- flags: flags,
+ base,
+ endian,
+ bitmask_val,
+ flags,
..Default::default()
};
let (i, arg1) = map_opt(digit1, |s: &str| s.parse::<u8>().ok())(i)?;
let (i, _) = all_consuming(take_while(|c| c == ' '))(i)?;
let du8 = DetectUintData::<u8> {
- arg1: arg1,
+ arg1,
arg2: 0,
- mode: mode,
+ mode,
};
return Ok((i, DetectIPRepData { du8, cat, cmd }));
}
let (i, arg1) = map_opt(digit1, |s: &str| s.parse::<u32>().ok())(i)?;
let (i, _) = all_consuming(take_while(|c| c == ' '))(i)?;
let du32 = DetectUintData::<u32> {
- arg1: arg1,
+ arg1,
arg2: 0,
- mode: mode,
+ mode,
};
Ok((i, DetectStreamSizeData { flags, du32 }))
}
DetectUintData {
arg1,
arg2: T::min_value(),
- mode: mode,
+ mode,
},
))
}
pub fn new(id: u64, message: DHCPMessage) -> DHCPTransaction {
DHCPTransaction {
tx_id: id,
- message: message,
+ message,
tx_data: applayer::AppLayerTxData::new(),
}
}
Ok((
i,
DHCPHeader {
- opcode: opcode,
- htype: htype,
- hlen: hlen,
- hops: hops,
- txid: txid,
- seconds: seconds,
- flags: flags,
+ opcode,
+ htype,
+ hlen,
+ hops,
+ txid,
+ seconds,
+ flags,
clientip: clientip.to_vec(),
yourip: yourip.to_vec(),
serverip: serverip.to_vec(),
Ok((
i,
DHCPOption {
- code: code,
+ code,
data: None,
option: DHCPOptionWrapper::ClientId(DHCPOptClientId {
htype: 1,
Ok((
i,
DHCPOption {
- code: code,
+ code,
data: None,
- option: DHCPOptionWrapper::TimeValue(DHCPOptTimeValue { seconds: seconds }),
+ option: DHCPOptionWrapper::TimeValue(DHCPOptTimeValue { seconds }),
},
))
}
Ok((
i,
DHCPOption {
- code: code,
+ code,
data: None,
option: DHCPOptionWrapper::Generic(DHCPOptGeneric {
data: data.to_vec(),
}
}
let message = DHCPMessage {
- header: header,
- options: options,
- malformed_options: malformed_options,
- truncated_options: truncated_options,
+ header,
+ options,
+ malformed_options,
+ truncated_options,
};
return Ok((next, message));
}
let hs = parser::HTTP2FrameHeaders {
padlength: None,
priority: None,
- blocks: blocks,
+ blocks,
};
let txdata = HTTP2FrameTypeData::HEADERS(hs);
let tx = state.find_or_create_tx(&head, &txdata, Direction::ToServer);
let hs = parser::HTTP2FrameHeaders {
padlength: None,
priority: None,
- blocks: blocks,
+ blocks,
};
let txdata = HTTP2FrameTypeData::HEADERS(hs);
tx.frames_ts.push(HTTP2Frame {
let mut buf = String::with_capacity(capacity);
buf.push('{');
Self {
- buf: buf,
+ buf,
state: vec![State::None, State::ObjectFirst],
init_type: Type::Object,
}
let mut buf = String::with_capacity(capacity);
buf.push('[');
Self {
- buf: buf,
+ buf,
state: vec![State::None, State::ArrayFirst],
init_type: Type::Array,
}
etype: None,
ticket_etype: None,
error_code: None,
- id: id,
+ id,
tx_data: applayer::AppLayerTxData::new(),
}
}
pub fn new(id: u64) -> NTPTransaction {
NTPTransaction {
xid: 0,
- id: id,
+ id,
tx_data: applayer::AppLayerTxData::new(),
}
}
let key = Aes128Gcm::new(GenericArray::from_slice(&secret));
let mut r = PacketKey {
- key: key,
+ key,
iv: [0u8; AES128_IV_LEN],
};
hkdf_expand_label(&hk, b"quic iv", &mut r.iv, AES128_IV_LEN as u16);
rest,
QuicHeader {
flags,
- ty: ty,
- version: version,
+ ty,
+ version,
version_buf: version_buf.to_vec(),
dcid: dcid.to_vec(),
scid: Vec::new(),
fn new_empty(client: bool, header: QuicHeader) -> Self {
QuicTransaction {
tx_id: 0,
- header: header,
+ header,
cyu: Vec::new(),
sni: None,
ua: None,
extv: Vec::new(),
ja3: None,
- client: client,
+ client,
tx_data: AppLayerTxData::new(),
}
}
let s = SpnegoRequest {
krb: kticket,
- ntlmssp: ntlmssp,
+ ntlmssp,
};
Some(s)
}
domain.retain(|&i|i != 0x00);
let d = NtlmsspData {
- host: host,
- user: user,
- domain: domain,
+ host,
+ user,
+ domain,
version: ad.version,
};
ntlmssp_data = Some(d);
impl DCERPCIface {
pub fn new(uuid: Vec<u8>, ver: u16, ver_min: u16) -> Self {
Self {
- uuid: uuid,
- ver:ver,
- ver_min:ver_min,
+ uuid,
+ ver,
+ ver_min,
..Default::default()
}
}
context_id: 0,
req_cmd: req,
req_set: true,
- call_id: call_id,
+ call_id,
..Default::default()
}
}
fn new_response(call_id: u32) -> Self {
- return Self {
- call_id: call_id,
+ return Self {
+ call_id,
..Default::default()
- }
+ };
}
pub fn set_result(&mut self, res: u8) {
self.res_set = true;
smb_ver: 1,
smb1_cmd: cmd,
status_set: true,
- status: status,
+ status,
..Default::default()
}
}
smb_ver: 2,
smb2_cmd: cmd,
status_set: true,
- status: status,
+ status,
..Default::default()
}
}
-> Self
{
return Self {
- filename: filename, fid: fid,
- subcmd: subcmd,
- loi: loi,
- delete_on_close: delete_on_close,
- }
+ filename, fid,
+ subcmd,
+ loi,
+ delete_on_close,
+ };
}
}
impl SMBTransactionRename {
pub fn new(fuid: Vec<u8>, oldname: Vec<u8>, newname: Vec<u8>) -> Self {
return Self {
- fuid: fuid, oldname: oldname, newname: newname,
- }
+ fuid, oldname, newname,
+ };
}
}
disposition: disp,
delete_on_close: del,
directory: dir,
- filename: filename,
+ filename,
..Default::default()
}
}
impl SMBTransactionNegotiate {
pub fn new(smb_ver: u8) -> Self {
return Self {
- smb_ver: smb_ver,
+ smb_ver,
server_guid: Vec::with_capacity(16),
..Default::default()
- }
+ };
}
}
impl SMBTransactionTreeConnect {
pub fn new(share_name: Vec<u8>) -> Self {
return Self {
- share_name:share_name,
+ share_name,
..Default::default()
- }
+ };
}
}
impl SMBFileGUIDOffset {
pub fn new(guid: Vec<u8>, offset: u64) -> Self {
Self {
- guid:guid,
- offset:offset,
+ guid,
+ offset,
}
}
}
}
pub fn new(rec_type: u32, ssn_id: u64, tree_id: u32, msg_id: u64) -> Self {
Self {
- rec_type : rec_type,
- ssn_id : ssn_id,
- tree_id : tree_id,
- msg_id : msg_id,
+ rec_type,
+ ssn_id,
+ tree_id,
+ msg_id,
}
}
pub fn from2(r: &Smb2Record, rec_type: u32) -> SMBCommonHdr {
};
SMBCommonHdr {
- rec_type : rec_type,
+ rec_type,
ssn_id : r.session_id,
- tree_id : tree_id,
- msg_id : msg_id,
+ tree_id,
+ msg_id,
}
}
};
SMBCommonHdr {
- rec_type : rec_type,
+ rec_type,
ssn_id : r.session_id,
tree_id : 0,
- msg_id : msg_id,
+ msg_id,
}
}
pub fn from1(r: &SmbRecord, rec_type: u32) -> SMBCommonHdr {
};
SMBCommonHdr {
- rec_type : rec_type,
+ rec_type,
ssn_id : r.ssn_id as u64,
- tree_id : tree_id,
- msg_id : msg_id,
+ tree_id,
+ msg_id,
}
}
impl SMBHashKeyHdrGuid {
pub fn new(hdr: SMBCommonHdr, guid: Vec<u8>) -> Self {
Self {
- hdr: hdr, guid: guid,
+ hdr, guid,
}
}
}
impl SMBTree {
pub fn new(name: Vec<u8>, is_pipe: bool) -> Self {
Self {
- name:name,
- is_pipe:is_pipe,
+ name,
+ is_pipe,
}
}
}
SCLogDebug!("name1 {:?} name2 {:?} name3 {:?}", native_os,native_lm,primary_domain);
SessionSetupRequest {
- native_os:native_os,
- native_lm:native_lm,
- primary_domain:primary_domain,
+ native_os,
+ native_lm,
+ primary_domain,
}
} else {
let (native_os, native_lm, primary_domain) = match smb_get_ascii_string(blob) {
SCLogDebug!("session_setup_request_host_info: not unicode");
SessionSetupRequest {
- native_os: native_os,
- native_lm: native_lm,
- primary_domain: primary_domain,
+ native_os,
+ native_lm,
+ primary_domain,
}
}
}
SCLogDebug!("name1 {:?} name2 {:?}", native_os,native_lm);
SessionSetupResponse {
- native_os:native_os,
- native_lm:native_lm,
+ native_os,
+ native_lm,
}
} else {
SCLogDebug!("session_setup_response_host_info: not unicode");
_ => { (Vec::new(), Vec::new()) },
};
SessionSetupResponse {
- native_os: native_os,
- native_lm: native_lm,
+ native_os,
+ native_lm,
}
}
}
impl SMBTransactionIoctl {
pub fn new(func: u32) -> Self {
return Self {
- func: func,
- }
+ func,
+ };
}
}
community: None,
usm: None,
encrypted: false,
- id: id,
+ id,
tx_data: applayer::AppLayerTxData::new(),
}
}