Struct adnl::AdnlSender
source · pub struct AdnlSender { /* private fields */ }
Expand description
Low-level outgoing datagram generator
Implementations§
source§impl AdnlSender
impl AdnlSender
sourcepub fn new(aes_params: &AdnlAesParams) -> Self
pub fn new(aes_params: &AdnlAesParams) -> Self
Create sender with given session parameters
sourcepub fn estimate_packet_length(buffer: &[u8]) -> u32
pub fn estimate_packet_length(buffer: &[u8]) -> u32
Get estimated size of datagram for the given buffer
sourcepub async fn send<W: AsyncWriteExt + Unpin>(
&mut self,
transport: &mut W,
nonce: &mut [u8; 32],
buffer: &mut [u8]
) -> Result<(), AdnlError>
pub async fn send<W: AsyncWriteExt + Unpin>( &mut self, transport: &mut W, nonce: &mut [u8; 32], buffer: &mut [u8] ) -> Result<(), AdnlError>
Send buffer
over transport
with nonce
. Note that nonce
must be random
in order to prevent bit-flipping attacks when an attacker knows whole plaintext in datagram.
Auto Trait Implementations§
impl RefUnwindSafe for AdnlSender
impl Send for AdnlSender
impl Sync for AdnlSender
impl Unpin for AdnlSender
impl UnwindSafe for AdnlSender
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
Mutably borrows from an owned value. Read more