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.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.