pub struct Dmsg {
pub id: MsgId,
pub ty: DmsgType,
pub flags: u8,
pub version: u8,
pub same_dc: bool,
pub source_address: Option<SocketAddr>,
pub mlen: u32,
pub data: Vec<u8>,
pub plen: u32,
pub payload: Vec<u8>,
}Expand description
Parsed DNODE header.
data and payload hold copies of the on-the-wire bytes. The
encoder side fills both before emitting; the parser fills them as
it advances through the state machine.
Fields§
§id: MsgIdMessage id.
ty: DmsgTypeMessage type.
flags: u8Flag bit field; encryption is bit 0, compression is bit 1.
version: u8Protocol version.
same_dc: boolTrue when sender and receiver share a datacenter.
source_address: Option<SocketAddr>Source address recorded by the recv path. Stage 7 leaves it
None; Stage 9 stamps it from the connection state.
mlen: u32Length (in bytes) of the inline data field.
data: Vec<u8>Inline data: either the single-byte placeholder or the RSA-wrapped AES key during the crypto handshake.
plen: u32Length (in bytes) of the trailing payload framed by the header.
payload: Vec<u8>Payload bytes, if collected by the parser.
Implementations§
Source§impl Dmsg
impl Dmsg
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct an empty Dmsg defaulted the same way the
reference engine’s dmsg_get initialises a fresh slot.
§Examples
use dynomite::proto::dnode::{Dmsg, DmsgType, VERSION_10};
let d = Dmsg::new();
assert_eq!(d.ty, DmsgType::Unknown);
assert_eq!(d.version, VERSION_10);
assert!(d.same_dc);Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
True when the encryption flag is set.
§Examples
use dynomite::proto::dnode::{Dmsg, DMSG_FLAG_ENCRYPTED};
let mut d = Dmsg::new();
d.flags = DMSG_FLAG_ENCRYPTED;
assert!(d.is_encrypted());Sourcepub fn is_compressed(&self) -> bool
pub fn is_compressed(&self) -> bool
True when the compression flag is set.
§Examples
use dynomite::proto::dnode::{Dmsg, DMSG_FLAG_COMPRESSED};
let mut d = Dmsg::new();
d.flags = DMSG_FLAG_COMPRESSED;
assert!(d.is_compressed());Trait Implementations§
impl Eq for Dmsg
impl StructuralPartialEq for Dmsg
Auto Trait Implementations§
impl Freeze for Dmsg
impl RefUnwindSafe for Dmsg
impl Send for Dmsg
impl Sync for Dmsg
impl Unpin for Dmsg
impl UnsafeUnpin for Dmsg
impl UnwindSafe for Dmsg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.