mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-08-08 09:08:01 +00:00
refactor(core): move cursor.rs
Add documentation. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
4154ceea05
commit
7419467ad3
161 changed files with 404 additions and 292 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -2022,6 +2022,7 @@ name = "ironrdp-ainput"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"ironrdp-core",
|
||||
"ironrdp-dvc",
|
||||
"ironrdp-pdu",
|
||||
"num-derive",
|
||||
|
@ -2093,6 +2094,7 @@ dependencies = [
|
|||
name = "ironrdp-cliprdr-format"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ironrdp-core",
|
||||
"ironrdp-pdu",
|
||||
"png",
|
||||
"thiserror",
|
||||
|
@ -2196,6 +2198,7 @@ dependencies = [
|
|||
"bmp",
|
||||
"byteorder",
|
||||
"expect-test",
|
||||
"ironrdp-core",
|
||||
"ironrdp-error",
|
||||
"ironrdp-pdu",
|
||||
"lazy_static",
|
||||
|
@ -2322,6 +2325,7 @@ name = "ironrdp-session"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ironrdp-connector",
|
||||
"ironrdp-core",
|
||||
"ironrdp-displaycontrol",
|
||||
"ironrdp-dvc",
|
||||
"ironrdp-error",
|
||||
|
@ -2355,6 +2359,7 @@ dependencies = [
|
|||
"ironrdp-cliprdr",
|
||||
"ironrdp-cliprdr-format",
|
||||
"ironrdp-connector",
|
||||
"ironrdp-core",
|
||||
"ironrdp-displaycontrol",
|
||||
"ironrdp-dvc",
|
||||
"ironrdp-fuzzing",
|
||||
|
@ -2806,6 +2811,7 @@ name = "now-proto-pdu"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"ironrdp-core",
|
||||
"ironrdp-error",
|
||||
"ironrdp-pdu",
|
||||
]
|
||||
|
|
|
@ -22,6 +22,7 @@ bitflags.workspace = true
|
|||
|
||||
num-derive.workspace = true # TODO: remove
|
||||
num-traits.workspace = true # TODO: remove
|
||||
ironrdp-core.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -3,7 +3,7 @@ use ironrdp_dvc::DvcPduEncode;
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive as _, ToPrimitive as _};
|
||||
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{ensure_fixed_part_size, invalid_message_err, PduDecode, PduEncode, PduResult};
|
||||
// Advanced Input channel as defined from Freerdp, [here]:
|
||||
//
|
||||
|
|
|
@ -20,6 +20,7 @@ test = false
|
|||
ironrdp-pdu.workspace = true
|
||||
thiserror.workspace = true
|
||||
png = "0.17"
|
||||
ironrdp-core.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{cast_int, ensure_fixed_part_size, invalid_message_err, PduDecode, PduEncode, PduResult};
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use std::sync::mpsc as mpsc_sync;
|
||||
|
||||
use ironrdp_core::impl_as_any;
|
||||
use ironrdp_cliprdr::backend::CliprdrBackend;
|
||||
use ironrdp_cliprdr::pdu::{
|
||||
ClipboardFormat, ClipboardGeneralCapabilityFlags, FileContentsRequest, FileContentsResponse, FormatDataRequest,
|
||||
FormatDataResponse, LockDataId,
|
||||
};
|
||||
use ironrdp_core::impl_as_any;
|
||||
use windows::Win32::Foundation::{HWND, LPARAM, WPARAM};
|
||||
use windows::Win32::UI::WindowsAndMessaging::PostMessageW;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use bitflags::bitflags;
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{
|
||||
cast_int, cast_length, ensure_fixed_part_size, ensure_size, impl_pdu_pod, invalid_message_err, read_padding,
|
||||
write_padding, PduDecode, PduEncode, PduResult,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::utils::{read_string_from_cursor, write_string_to_cursor, CharacterSet};
|
||||
use ironrdp_pdu::{
|
||||
cast_int, ensure_size, impl_pdu_borrowing, invalid_message_err, IntoOwnedPdu, PduDecode, PduEncode, PduResult,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use bitflags::bitflags;
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::utils::{combine_u64, split_u64};
|
||||
use ironrdp_pdu::{
|
||||
cast_int, ensure_size, impl_pdu_borrowing, invalid_message_err, IntoOwnedPdu, PduDecode, PduEncode, PduResult,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use bitflags::bitflags;
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::utils::{combine_u64, decode_string, encode_string, split_u64, CharacterSet};
|
||||
use ironrdp_pdu::{cast_length, ensure_fixed_part_size, impl_pdu_pod, write_padding, PduDecode, PduEncode, PduResult};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use bitflags::bitflags;
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{ensure_fixed_part_size, ensure_size, PduDecode, PduEncode, PduResult};
|
||||
|
||||
bitflags! {
|
||||
|
|
|
@ -9,7 +9,7 @@ pub use self::palette::*;
|
|||
#[rustfmt::skip]
|
||||
use std::borrow::Cow;
|
||||
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::utils::{read_string_from_cursor, to_utf16_bytes, CharacterSet};
|
||||
use ironrdp_pdu::{
|
||||
cast_int, ensure_fixed_part_size, ensure_size, impl_pdu_borrowing, IntoOwnedPdu, PduDecode, PduEncode, PduResult,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{impl_pdu_pod, PduDecode, PduEncode, PduResult};
|
||||
|
||||
/// Represents `PALETTEENTRY`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::utils::{read_string_from_cursor, to_utf16_bytes, write_string_to_cursor, CharacterSet};
|
||||
use ironrdp_pdu::{
|
||||
cast_int, ensure_size, impl_pdu_borrowing, impl_pdu_pod, invalid_message_err, IntoOwnedPdu, PduDecode, PduEncode,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{cast_int, ensure_fixed_part_size, impl_pdu_pod, PduDecode, PduEncode, PduResult};
|
||||
|
||||
use crate::pdu::PartialHeader;
|
||||
|
|
|
@ -17,7 +17,7 @@ pub use self::lock::*;
|
|||
|
||||
#[rustfmt::skip]
|
||||
use bitflags::bitflags;
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{ensure_fixed_part_size, invalid_message_err, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_svc::SvcPduEncode;
|
||||
|
||||
|
|
|
@ -1,5 +1,52 @@
|
|||
use crate::PduResult;
|
||||
use core::fmt;
|
||||
|
||||
/// Error indicating that there are not enough bytes in the buffer to perform an operation.
|
||||
#[derive(Copy, Eq, PartialEq, Clone, Debug)]
|
||||
pub struct NotEnoughBytesError {
|
||||
received: usize,
|
||||
expected: usize,
|
||||
}
|
||||
|
||||
impl NotEnoughBytesError {
|
||||
/// The number of bytes received.
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub const fn received(&self) -> usize {
|
||||
self.received
|
||||
}
|
||||
|
||||
/// The number of bytes expected.
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub const fn expected(&self) -> usize {
|
||||
self.expected
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for NotEnoughBytesError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"not enough bytes for operation: received {} bytes, expected {} bytes",
|
||||
self.received, self.expected
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for NotEnoughBytesError {}
|
||||
|
||||
macro_rules! ensure_size {
|
||||
(in: $buf:ident, size: $expected:expr) => {{
|
||||
let received = $buf.len();
|
||||
let expected = $expected;
|
||||
if !(received >= expected) {
|
||||
return Err(NotEnoughBytesError { received, expected });
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
/// A cursor for reading bytes from a buffer.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ReadCursor<'a> {
|
||||
inner: &'a [u8],
|
||||
|
@ -7,27 +54,32 @@ pub struct ReadCursor<'a> {
|
|||
}
|
||||
|
||||
impl<'a> ReadCursor<'a> {
|
||||
/// Create a new `ReadCursor` from a byte slice.
|
||||
#[inline]
|
||||
pub const fn new(bytes: &'a [u8]) -> Self {
|
||||
Self { inner: bytes, pos: 0 }
|
||||
}
|
||||
|
||||
/// Returns the number of bytes remaining.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub const fn len(&self) -> usize {
|
||||
self.inner.len() - self.pos
|
||||
}
|
||||
|
||||
/// Returns `true` if there are no bytes remaining.
|
||||
#[inline]
|
||||
pub const fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
/// Returns `true` if there are no bytes remaining.
|
||||
#[inline]
|
||||
pub const fn eof(&self) -> bool {
|
||||
self.is_empty()
|
||||
}
|
||||
|
||||
/// Returns a slice of the remaining bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn remaining(&self) -> &'a [u8] {
|
||||
|
@ -35,6 +87,7 @@ impl<'a> ReadCursor<'a> {
|
|||
&self.inner[idx..]
|
||||
}
|
||||
|
||||
/// Returns two cursors, one with the first `mid` bytes and the other with the remaining bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
|
@ -48,6 +101,9 @@ impl<'a> ReadCursor<'a> {
|
|||
(left, right)
|
||||
}
|
||||
|
||||
/// Returns two cursors, one with the first `mid` bytes and the other with the remaining bytes.
|
||||
///
|
||||
/// The current cursor will be moved to the end.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
|
@ -57,16 +113,19 @@ impl<'a> ReadCursor<'a> {
|
|||
res
|
||||
}
|
||||
|
||||
/// Return the inner byte slice.
|
||||
#[inline]
|
||||
pub const fn inner(&self) -> &[u8] {
|
||||
self.inner
|
||||
}
|
||||
|
||||
/// Returns the current position.
|
||||
#[inline]
|
||||
pub const fn pos(&self) -> usize {
|
||||
self.pos
|
||||
}
|
||||
|
||||
/// Read an array of `N` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_array<const N: usize>(&mut self) -> [u8; N] {
|
||||
|
@ -75,6 +134,7 @@ impl<'a> ReadCursor<'a> {
|
|||
bytes.try_into().expect("N-elements array")
|
||||
}
|
||||
|
||||
/// Read a slice of `n` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_slice(&mut self, n: usize) -> &'a [u8] {
|
||||
|
@ -83,286 +143,335 @@ impl<'a> ReadCursor<'a> {
|
|||
bytes
|
||||
}
|
||||
|
||||
/// Read the remaining bytes.
|
||||
pub fn read_remaining(&mut self) -> &[u8] {
|
||||
self.read_slice(self.len())
|
||||
}
|
||||
|
||||
/// Read a `u8`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_u8(&mut self) -> u8 {
|
||||
self.read_array::<1>()[0]
|
||||
}
|
||||
|
||||
/// Try to read a `u8`.
|
||||
#[inline]
|
||||
pub fn try_read_u8(&mut self, ctx: &'static str) -> PduResult<u8> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 1);
|
||||
pub fn try_read_u8(&mut self) -> Result<u8, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 1);
|
||||
Ok(self.read_array::<1>()[0])
|
||||
}
|
||||
|
||||
/// Read a `i16`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_i16(&mut self) -> i16 {
|
||||
i16::from_le_bytes(self.read_array::<2>())
|
||||
}
|
||||
|
||||
/// Read a `i16` in big-endian.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_i16_be(&mut self) -> i16 {
|
||||
i16::from_be_bytes(self.read_array::<2>())
|
||||
}
|
||||
|
||||
/// Try to read a `i16`.
|
||||
#[inline]
|
||||
pub fn try_read_i16(&mut self, ctx: &'static str) -> PduResult<i16> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 2);
|
||||
pub fn try_read_i16(&mut self) -> Result<i16, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 2);
|
||||
Ok(i16::from_le_bytes(self.read_array::<2>()))
|
||||
}
|
||||
|
||||
/// Try to read a `i16` in big-endian.
|
||||
#[inline]
|
||||
pub fn try_read_i16_be(&mut self, ctx: &'static str) -> PduResult<i16> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 2);
|
||||
pub fn try_read_i16_be(&mut self) -> Result<i16, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 2);
|
||||
Ok(i16::from_be_bytes(self.read_array::<2>()))
|
||||
}
|
||||
|
||||
/// Read a `u16`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_u16(&mut self) -> u16 {
|
||||
u16::from_le_bytes(self.read_array::<2>())
|
||||
}
|
||||
|
||||
/// Read a `u16` in big-endian.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_u16_be(&mut self) -> u16 {
|
||||
u16::from_be_bytes(self.read_array::<2>())
|
||||
}
|
||||
|
||||
/// Try to read a `u16`.
|
||||
#[inline]
|
||||
pub fn try_read_u16(&mut self, ctx: &'static str) -> PduResult<u16> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 2);
|
||||
pub fn try_read_u16(&mut self) -> Result<u16, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 2);
|
||||
Ok(u16::from_le_bytes(self.read_array::<2>()))
|
||||
}
|
||||
|
||||
/// Try to read a `u16` in big-endian.
|
||||
#[inline]
|
||||
pub fn try_read_u16_be(&mut self, ctx: &'static str) -> PduResult<u16> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 2);
|
||||
pub fn try_read_u16_be(&mut self) -> Result<u16, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 2);
|
||||
Ok(u16::from_be_bytes(self.read_array::<2>()))
|
||||
}
|
||||
|
||||
/// Read a `u32`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_u32(&mut self) -> u32 {
|
||||
u32::from_le_bytes(self.read_array::<4>())
|
||||
}
|
||||
|
||||
/// Read a `u32` in big-endian.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_u32_be(&mut self) -> u32 {
|
||||
u32::from_be_bytes(self.read_array::<4>())
|
||||
}
|
||||
|
||||
/// Try to read a `u32`.
|
||||
#[inline]
|
||||
pub fn try_read_u32(&mut self, ctx: &'static str) -> PduResult<u32> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 4);
|
||||
pub fn try_read_u32(&mut self) -> Result<u32, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 4);
|
||||
Ok(u32::from_le_bytes(self.read_array::<4>()))
|
||||
}
|
||||
|
||||
/// Try to read a `u32` in big-endian.
|
||||
#[inline]
|
||||
pub fn try_read_u32_be(&mut self, ctx: &'static str) -> PduResult<u32> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 4);
|
||||
pub fn try_read_u32_be(&mut self) -> Result<u32, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 4);
|
||||
Ok(u32::from_be_bytes(self.read_array::<4>()))
|
||||
}
|
||||
|
||||
/// Read a `u64`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_u64(&mut self) -> u64 {
|
||||
u64::from_le_bytes(self.read_array::<8>())
|
||||
}
|
||||
|
||||
/// Read a `u64` in big-endian.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn read_u64_be(&mut self) -> u64 {
|
||||
u64::from_be_bytes(self.read_array::<8>())
|
||||
}
|
||||
|
||||
/// Try to read a `u64`.
|
||||
#[inline]
|
||||
pub fn try_read_u64(&mut self, ctx: &'static str) -> PduResult<u64> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 8);
|
||||
pub fn try_read_u64(&mut self) -> Result<u64, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 8);
|
||||
Ok(u64::from_le_bytes(self.read_array::<8>()))
|
||||
}
|
||||
|
||||
/// Try to read a `u64` in big-endian.
|
||||
#[inline]
|
||||
pub fn try_read_u64_be(&mut self, ctx: &'static str) -> PduResult<u64> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 8);
|
||||
pub fn try_read_u64_be(&mut self) -> Result<u64, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 8);
|
||||
Ok(u64::from_be_bytes(self.read_array::<8>()))
|
||||
}
|
||||
|
||||
/// Read a `i32`.
|
||||
#[inline]
|
||||
pub fn read_i32(&mut self) -> i32 {
|
||||
i32::from_le_bytes(self.read_array::<4>())
|
||||
}
|
||||
|
||||
/// Read a `i32` in big-endian.
|
||||
#[inline]
|
||||
pub fn read_i32_be(&mut self) -> i32 {
|
||||
i32::from_be_bytes(self.read_array::<4>())
|
||||
}
|
||||
|
||||
/// Try to read a `i32`.
|
||||
#[inline]
|
||||
pub fn try_read_i32(&mut self, ctx: &'static str) -> PduResult<i32> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 4);
|
||||
pub fn try_read_i32(&mut self) -> Result<i32, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 4);
|
||||
Ok(i32::from_le_bytes(self.read_array::<4>()))
|
||||
}
|
||||
|
||||
/// Try to read a `i32` in big-endian.
|
||||
#[inline]
|
||||
pub fn try_read_i32_be(&mut self, ctx: &'static str) -> PduResult<i32> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 4);
|
||||
pub fn try_read_i32_be(&mut self) -> Result<i32, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 4);
|
||||
Ok(i32::from_be_bytes(self.read_array::<4>()))
|
||||
}
|
||||
|
||||
/// Read a `i64`.
|
||||
#[inline]
|
||||
pub fn read_i64(&mut self) -> i64 {
|
||||
i64::from_le_bytes(self.read_array::<8>())
|
||||
}
|
||||
|
||||
/// Read a `i64` in big-endian.
|
||||
#[inline]
|
||||
pub fn read_i64_be(&mut self) -> i64 {
|
||||
i64::from_be_bytes(self.read_array::<8>())
|
||||
}
|
||||
|
||||
/// Try to read a `i64`.
|
||||
#[inline]
|
||||
pub fn try_read_i64(&mut self, ctx: &'static str) -> PduResult<i64> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 8);
|
||||
pub fn try_read_i64(&mut self) -> Result<i64, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 8);
|
||||
Ok(i64::from_le_bytes(self.read_array::<8>()))
|
||||
}
|
||||
|
||||
/// Try to read a `i64` in big-endian.
|
||||
#[inline]
|
||||
pub fn try_read_i64_be(&mut self, ctx: &'static str) -> PduResult<i64> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 8);
|
||||
pub fn try_read_i64_be(&mut self) -> Result<i64, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 8);
|
||||
Ok(i64::from_be_bytes(self.read_array::<8>()))
|
||||
}
|
||||
|
||||
/// Read a `u128`.
|
||||
#[inline]
|
||||
pub fn read_u128(&mut self) -> u128 {
|
||||
u128::from_le_bytes(self.read_array::<16>())
|
||||
}
|
||||
|
||||
/// Read a `u128` in big-endian.
|
||||
#[inline]
|
||||
pub fn read_u128_be(&mut self) -> u128 {
|
||||
u128::from_be_bytes(self.read_array::<16>())
|
||||
}
|
||||
|
||||
/// Try to read a `u128`.
|
||||
#[inline]
|
||||
pub fn try_read_u128(&mut self, ctx: &'static str) -> PduResult<u128> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 16);
|
||||
pub fn try_read_u128(&mut self) -> Result<u128, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 16);
|
||||
Ok(u128::from_le_bytes(self.read_array::<16>()))
|
||||
}
|
||||
|
||||
/// Try to read a `u128` in big-endian.
|
||||
#[inline]
|
||||
pub fn try_read_u128_be(&mut self, ctx: &'static str) -> PduResult<u128> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 16);
|
||||
pub fn try_read_u128_be(&mut self) -> Result<u128, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 16);
|
||||
Ok(u128::from_be_bytes(self.read_array::<16>()))
|
||||
}
|
||||
|
||||
/// Peek at the next `N` bytes without consuming them.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek<const N: usize>(&mut self) -> [u8; N] {
|
||||
self.inner[self.pos..self.pos + N].try_into().expect("N-elements array")
|
||||
}
|
||||
|
||||
/// Peek at the next `N` bytes without consuming them.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek_slice(&mut self, n: usize) -> &'a [u8] {
|
||||
&self.inner[self.pos..self.pos + n]
|
||||
}
|
||||
|
||||
/// Peek a `u8` without consuming it.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek_u8(&mut self) -> u8 {
|
||||
self.peek::<1>()[0]
|
||||
}
|
||||
|
||||
/// Try to peek a `u8` without consuming it.
|
||||
#[inline]
|
||||
pub fn try_peek_u8(&mut self, ctx: &'static str) -> PduResult<u8> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 1);
|
||||
pub fn try_peek_u8(&mut self) -> Result<u8, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 1);
|
||||
Ok(self.peek::<1>()[0])
|
||||
}
|
||||
|
||||
/// Peek a `u16` without consuming it.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek_u16(&mut self) -> u16 {
|
||||
u16::from_le_bytes(self.peek::<2>())
|
||||
}
|
||||
|
||||
/// Peek a big-endian `u16` without consuming it.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek_u16_be(&mut self) -> u16 {
|
||||
u16::from_be_bytes(self.peek::<2>())
|
||||
}
|
||||
|
||||
/// Try to peek a `u16` without consuming it.
|
||||
#[inline]
|
||||
pub fn try_peek_u16(&mut self, ctx: &'static str) -> PduResult<u16> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 2);
|
||||
pub fn try_peek_u16(&mut self) -> Result<u16, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 2);
|
||||
Ok(u16::from_le_bytes(self.peek::<2>()))
|
||||
}
|
||||
|
||||
/// Try to peek a big-endian `u16` without consuming it.
|
||||
#[inline]
|
||||
pub fn try_peek_u16_be(&mut self, ctx: &'static str) -> PduResult<u16> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 2);
|
||||
pub fn try_peek_u16_be(&mut self) -> Result<u16, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 2);
|
||||
Ok(u16::from_be_bytes(self.peek::<2>()))
|
||||
}
|
||||
|
||||
/// Peek a `u32` without consuming it.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek_u32(&mut self) -> u32 {
|
||||
u32::from_le_bytes(self.peek::<4>())
|
||||
}
|
||||
|
||||
/// Peek a big-endian `u32` without consuming it.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek_u32_be(&mut self) -> u32 {
|
||||
u32::from_be_bytes(self.peek::<4>())
|
||||
}
|
||||
|
||||
/// Try to peek a `u32` without consuming it.
|
||||
#[inline]
|
||||
pub fn try_peek_u32(&mut self, ctx: &'static str) -> PduResult<u32> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 4);
|
||||
pub fn try_peek_u32(&mut self) -> Result<u32, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 4);
|
||||
Ok(u32::from_le_bytes(self.peek::<4>()))
|
||||
}
|
||||
|
||||
/// Try to peek a big-endian `u32` without consuming it.
|
||||
#[inline]
|
||||
pub fn try_peek_u32_be(&mut self, ctx: &'static str) -> PduResult<u32> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 4);
|
||||
pub fn try_peek_u32_be(&mut self) -> Result<u32, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 4);
|
||||
Ok(u32::from_be_bytes(self.peek::<4>()))
|
||||
}
|
||||
|
||||
/// Peek a `u64` without consuming it.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek_u64(&mut self) -> u64 {
|
||||
u64::from_le_bytes(self.peek::<8>())
|
||||
}
|
||||
|
||||
/// Peek a big-endian `u64` without consuming it.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn peek_u64_be(&mut self) -> u64 {
|
||||
u64::from_be_bytes(self.peek::<8>())
|
||||
}
|
||||
|
||||
/// Try to peek a `u64` without consuming it.
|
||||
#[inline]
|
||||
pub fn try_peek_u64(&mut self, ctx: &'static str) -> PduResult<u64> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 8);
|
||||
pub fn try_peek_u64(&mut self) -> Result<u64, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 8);
|
||||
Ok(u64::from_le_bytes(self.peek::<8>()))
|
||||
}
|
||||
|
||||
/// Try to peek a big-endian `u64` without consuming it.
|
||||
#[inline]
|
||||
pub fn try_peek_u64_be(&mut self, ctx: &'static str) -> PduResult<u64> {
|
||||
ensure_size!(ctx: ctx, in: self, size: 8);
|
||||
pub fn try_peek_u64_be(&mut self) -> Result<u64, NotEnoughBytesError> {
|
||||
ensure_size!(in: self, size: 8);
|
||||
Ok(u64::from_be_bytes(self.peek::<8>()))
|
||||
}
|
||||
|
||||
/// Advance the cursor by `len` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn advance(&mut self, len: usize) {
|
||||
self.pos += len;
|
||||
}
|
||||
|
||||
/// Return a new cursor advanced by `len` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
|
@ -373,12 +482,14 @@ impl<'a> ReadCursor<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Rewind the cursor by `len` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn rewind(&mut self, len: usize) {
|
||||
self.pos -= len;
|
||||
}
|
||||
|
||||
/// Return a new cursor rewinded by `len` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
|
@ -400,6 +511,7 @@ impl std::io::Read for ReadCursor<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A cursor for writing bytes to a buffer.
|
||||
#[derive(Debug)]
|
||||
pub struct WriteCursor<'a> {
|
||||
inner: &'a mut [u8],
|
||||
|
@ -407,27 +519,32 @@ pub struct WriteCursor<'a> {
|
|||
}
|
||||
|
||||
impl<'a> WriteCursor<'a> {
|
||||
/// Create a new `WriteCursor` from a mutable slice of bytes.
|
||||
#[inline]
|
||||
pub fn new(bytes: &'a mut [u8]) -> Self {
|
||||
Self { inner: bytes, pos: 0 }
|
||||
}
|
||||
|
||||
/// Returns the number of bytes remaining.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub const fn len(&self) -> usize {
|
||||
self.inner.len() - self.pos
|
||||
}
|
||||
|
||||
/// Returns `true` if there are no bytes remaining.
|
||||
#[inline]
|
||||
pub const fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
/// Returns `true` if there are no bytes remaining.
|
||||
#[inline]
|
||||
pub const fn eof(&self) -> bool {
|
||||
self.is_empty()
|
||||
}
|
||||
|
||||
/// Returns a slice of the remaining bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn remaining(&self) -> &[u8] {
|
||||
|
@ -435,6 +552,7 @@ impl<'a> WriteCursor<'a> {
|
|||
&self.inner[idx..]
|
||||
}
|
||||
|
||||
/// Returns a mutable slice of the remaining bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn remaining_mut(&mut self) -> &mut [u8] {
|
||||
|
@ -442,21 +560,25 @@ impl<'a> WriteCursor<'a> {
|
|||
&mut self.inner[idx..]
|
||||
}
|
||||
|
||||
/// Returns the innner byte slice.
|
||||
#[inline]
|
||||
pub const fn inner(&self) -> &[u8] {
|
||||
self.inner
|
||||
}
|
||||
|
||||
/// Returns the inner mutable byte slice.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut [u8] {
|
||||
self.inner
|
||||
}
|
||||
|
||||
/// Returns the current position of the cursor.
|
||||
#[inline]
|
||||
pub const fn pos(&self) -> usize {
|
||||
self.pos
|
||||
}
|
||||
|
||||
/// Write an array of bytes to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_array<const N: usize>(&mut self, array: [u8; N]) {
|
||||
|
@ -464,6 +586,7 @@ impl<'a> WriteCursor<'a> {
|
|||
self.pos += N;
|
||||
}
|
||||
|
||||
/// Write a slice of bytes to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_slice(&mut self, slice: &[u8]) {
|
||||
|
@ -472,102 +595,119 @@ impl<'a> WriteCursor<'a> {
|
|||
self.pos += n;
|
||||
}
|
||||
|
||||
/// Write a byte to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u8(&mut self, value: u8) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a signed byte to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_i8(&mut self, value: i8) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a little-endian `u16` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u16(&mut self, value: u16) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a big-endian `u16` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u16_be(&mut self, value: u16) {
|
||||
self.write_array(value.to_be_bytes())
|
||||
}
|
||||
|
||||
/// Write a signed little-endian `i16` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_i16(&mut self, value: i16) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a signed big-endian `i16` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_i16_be(&mut self, value: i16) {
|
||||
self.write_array(value.to_be_bytes())
|
||||
}
|
||||
|
||||
/// Write a little-endian `u32` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u32(&mut self, value: u32) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a big-endian `u32` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u32_be(&mut self, value: u32) {
|
||||
self.write_array(value.to_be_bytes())
|
||||
}
|
||||
|
||||
/// Write a signed little-endian `i32` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_i32(&mut self, value: i32) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a little-endian `u64` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u64(&mut self, value: u64) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a big-endian `u64` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u64_be(&mut self, value: u64) {
|
||||
self.write_array(value.to_be_bytes())
|
||||
}
|
||||
|
||||
/// Write a signed little-endian `i64` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_i64(&mut self, value: i64) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a signed big-endian `i64` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_i64_be(&mut self, value: i64) {
|
||||
self.write_array(value.to_be_bytes())
|
||||
}
|
||||
|
||||
/// Write a little-endian `u128` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u128(&mut self, value: u128) {
|
||||
self.write_array(value.to_le_bytes())
|
||||
}
|
||||
|
||||
/// Write a big-endian `u128` to the buffer.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write_u128_be(&mut self, value: u128) {
|
||||
self.write_array(value.to_be_bytes())
|
||||
}
|
||||
|
||||
/// Advance the cursor by `len` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn advance(&mut self, len: usize) {
|
||||
self.pos += len;
|
||||
}
|
||||
|
||||
/// Returns a new cursor advanced by `len` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
|
@ -578,12 +718,14 @@ impl<'a> WriteCursor<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Rewind the cursor by `len` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn rewind(&mut self, len: usize) {
|
||||
self.pos -= len;
|
||||
}
|
||||
|
||||
/// Returns a new cursor rewinded by `len` bytes.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[must_use]
|
|
@ -11,10 +11,12 @@ extern crate alloc;
|
|||
mod macros;
|
||||
|
||||
mod as_any;
|
||||
mod cursor;
|
||||
|
||||
// Flat API hierarchy of common traits and types
|
||||
|
||||
pub use self::as_any::*;
|
||||
pub use self::cursor::*;
|
||||
|
||||
// Trait that can only be implemented within the current module
|
||||
pub(crate) mod private {
|
||||
|
|
|
@ -21,4 +21,3 @@ macro_rules! assert_impl {
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ use crate::{
|
|||
pdu::{DisplayControlCapabilities, DisplayControlMonitorLayout, DisplayControlPdu},
|
||||
CHANNEL_NAME,
|
||||
};
|
||||
use ironrdp_core::impl_as_any;
|
||||
use ironrdp_core::{impl_as_any, ReadCursor};
|
||||
use ironrdp_dvc::{encode_dvc_messages, DvcClientProcessor, DvcMessage, DvcProcessor};
|
||||
use ironrdp_pdu::{cursor::ReadCursor, PduDecode, PduResult};
|
||||
use ironrdp_pdu::{PduDecode, PduResult};
|
||||
use ironrdp_svc::{ChannelFlags, SvcMessage};
|
||||
use tracing::debug;
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
//!
|
||||
//! [1]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpedisp/d2954508-f487-48bc-8731-39743e0854a9
|
||||
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_dvc::DvcPduEncode;
|
||||
use ironrdp_pdu::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{ensure_fixed_part_size, invalid_message_err, PduDecode, PduEncode, PduResult};
|
||||
use tracing::warn;
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ use alloc::vec::Vec;
|
|||
use core::any::TypeId;
|
||||
use core::fmt;
|
||||
use ironrdp_core::impl_as_any;
|
||||
use ironrdp_core::ReadCursor;
|
||||
use ironrdp_pdu as pdu;
|
||||
use ironrdp_svc::{ChannelFlags, CompressionCondition, SvcClientProcessor, SvcMessage, SvcProcessor};
|
||||
use pdu::cursor::ReadCursor;
|
||||
use pdu::gcc::ChannelName;
|
||||
use pdu::other_err;
|
||||
use pdu::PduDecode as _;
|
||||
|
|
|
@ -2,10 +2,9 @@ use alloc::format;
|
|||
use core::fmt;
|
||||
|
||||
use crate::{DynamicChannelId, String, Vec};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::{
|
||||
cast_length,
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
ensure_fixed_part_size, ensure_size, invalid_message_err, unsupported_pdu_err,
|
||||
cast_length, ensure_fixed_part_size, ensure_size, invalid_message_err, unsupported_pdu_err,
|
||||
utils::{checked_sum, encoded_str_len, read_string_from_cursor, strict_sum, write_string_to_cursor, CharacterSet},
|
||||
PduDecode, PduEncode, PduError, PduResult,
|
||||
};
|
||||
|
|
|
@ -6,9 +6,9 @@ use alloc::boxed::Box;
|
|||
use alloc::vec::Vec;
|
||||
use core::fmt;
|
||||
use ironrdp_core::impl_as_any;
|
||||
use ironrdp_core::ReadCursor;
|
||||
use ironrdp_pdu as pdu;
|
||||
use ironrdp_svc::{ChannelFlags, CompressionCondition, SvcMessage, SvcProcessor, SvcServerProcessor};
|
||||
use pdu::cursor::ReadCursor;
|
||||
use pdu::gcc::ChannelName;
|
||||
use pdu::PduDecode as _;
|
||||
use pdu::PduResult;
|
||||
|
|
|
@ -20,6 +20,7 @@ bit_field = "0.10"
|
|||
bitflags.workspace = true
|
||||
bitvec = "1.0"
|
||||
byteorder.workspace = true # TODO: remove
|
||||
ironrdp-core.workspace = true
|
||||
ironrdp-error.workspace = true
|
||||
ironrdp-pdu = { workspace = true, features = ["std"] }
|
||||
lazy_static.workspace = true # TODO: remove in favor of https://doc.rust-lang.org/std/sync/struct.OnceLock.html
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
//! - andMask == 1, xorMask == 0(black color) -> Transparent pixel
|
||||
//! - andMask == 1, xorMask == 1(white color) -> Pixel is inverted
|
||||
|
||||
use ironrdp_pdu::cursor::ReadCursor;
|
||||
use ironrdp_core::ReadCursor;
|
||||
use ironrdp_pdu::pointer::{ColorPointerAttribute, LargePointerAttribute, PointerAttribute};
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ironrdp_core::WriteCursor;
|
||||
use ironrdp_pdu::bitmap::rdp6::{BitmapStreamHeader, ColorPlaneDefinition};
|
||||
use ironrdp_pdu::cursor::WriteCursor;
|
||||
use ironrdp_pdu::PduError;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::io::{Read, Write};
|
||||
|
||||
use byteorder::ReadBytesExt;
|
||||
use ironrdp_pdu::cursor::WriteCursor;
|
||||
use ironrdp_core::WriteCursor;
|
||||
use thiserror::Error;
|
||||
|
||||
/// Maximum possible segment size is 47 (run_length = 2, raw_bytes_count = 15), which is treated as
|
||||
|
|
|
@ -538,7 +538,7 @@ fn extract_run_length_mega_mega(src: &mut Buf<'_>) -> Result<usize, RleError> {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: use ironrdp_pdu::cursor::ReadCursor instead
|
||||
// TODO: use ironrdp_core::ReadCursor instead
|
||||
struct Buf<'a> {
|
||||
inner: &'a [u8],
|
||||
pos: usize,
|
||||
|
@ -584,7 +584,7 @@ impl<'a> Buf<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: use ironrdp_pdu::cursor::WriteCursor instead
|
||||
// TODO: use ironrdp_core::WriteCursor instead
|
||||
struct BufMut<'a> {
|
||||
inner: &'a mut [u8],
|
||||
pos: usize,
|
||||
|
|
|
@ -17,12 +17,12 @@ doctest = false
|
|||
|
||||
[features]
|
||||
default = []
|
||||
std = ["alloc", "ironrdp-error/std"]
|
||||
std = ["alloc", "ironrdp-error/std", "ironrdp-core/std"]
|
||||
alloc = ["ironrdp-core/alloc", "ironrdp-error/alloc"]
|
||||
|
||||
[dependencies]
|
||||
bitflags.workspace = true
|
||||
ironrdp-core.workspace = true
|
||||
ironrdp-core = { workspace = true, features = ["std"] }
|
||||
ironrdp-error.workspace = true
|
||||
tap = "1"
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ use std::fmt::{self, Debug};
|
|||
|
||||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::ReadCursor;
|
||||
use crate::geometry::InclusiveRectangle;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const FIRST_ROW_SIZE_VALUE: u16 = 0;
|
||||
|
||||
|
@ -25,7 +25,7 @@ impl BitmapUpdateData<'_> {
|
|||
}
|
||||
|
||||
impl BitmapUpdateData<'_> {
|
||||
pub fn encode_header(rectangles: u16, dst: &mut crate::cursor::WriteCursor<'_>) -> PduResult<()> {
|
||||
pub fn encode_header(rectangles: u16, dst: &mut WriteCursor<'_>) -> PduResult<()> {
|
||||
ensure_size!(in: dst, size: 2);
|
||||
|
||||
dst.write_u16(BitmapFlags::BITMAP_UPDATE_TYPE.bits());
|
||||
|
@ -36,7 +36,7 @@ impl BitmapUpdateData<'_> {
|
|||
}
|
||||
|
||||
impl PduEncode for BitmapUpdateData<'_> {
|
||||
fn encode(&self, dst: &mut crate::cursor::WriteCursor<'_>) -> PduResult<()> {
|
||||
fn encode(&self, dst: &mut WriteCursor<'_>) -> PduResult<()> {
|
||||
ensure_size!(in: dst, size: self.size());
|
||||
|
||||
if self.rectangles.len() > u16::MAX as usize {
|
||||
|
@ -105,7 +105,7 @@ impl BitmapData<'_> {
|
|||
}
|
||||
|
||||
impl PduEncode for BitmapData<'_> {
|
||||
fn encode(&self, dst: &mut crate::cursor::WriteCursor<'_>) -> PduResult<()> {
|
||||
fn encode(&self, dst: &mut WriteCursor<'_>) -> PduResult<()> {
|
||||
ensure_size!(in: dst, size: self.size());
|
||||
|
||||
let encoded_bitmap_data_length = self.encoded_bitmap_data_length();
|
||||
|
@ -241,7 +241,7 @@ impl<'de> PduDecode<'de> for CompressedDataHeader {
|
|||
}
|
||||
|
||||
impl PduEncode for CompressedDataHeader {
|
||||
fn encode(&self, dst: &mut crate::cursor::WriteCursor<'_>) -> PduResult<()> {
|
||||
fn encode(&self, dst: &mut WriteCursor<'_>) -> PduResult<()> {
|
||||
ensure_fixed_part_size!(in: dst);
|
||||
|
||||
if self.scan_width % 4 != 0 {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{PduDecode, PduEncode, PduResult, ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const NON_RLE_PADDING_SIZE: usize = 1;
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ use num_traits::{FromPrimitive, ToPrimitive};
|
|||
use super::bitmap::BitmapUpdateData;
|
||||
use super::pointer::PointerUpdateData;
|
||||
use super::surface_commands::{SurfaceCommand, SURFACE_COMMAND_HEADER_SIZE};
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::rdp::client_info::CompressionType;
|
||||
use crate::rdp::headers::{CompressionFlags, SHARE_DATA_HEADER_COMPRESSION_MASK};
|
||||
use crate::{decode_cursor, per, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
/// Implements the Fast-Path RDP message header PDU.
|
||||
/// TS_FP_UPDATE_PDU
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
// Represents `TS_POINT16` described in [MS-RDPBCGR] 2.2.9.1.1.4.1
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
|
|
@ -5,9 +5,9 @@ use bitflags::bitflags;
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive as _, ToPrimitive as _};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::geometry::ExclusiveRectangle;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub const SURFACE_COMMAND_HEADER_SIZE: usize = 2;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduResult,
|
||||
};
|
||||
use crate::PduResult;
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[repr(u8)]
|
||||
#[allow(unused)]
|
||||
|
|
|
@ -8,10 +8,8 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive as _, ToPrimitive as _};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduBufferParsing, PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduBufferParsing, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[rustfmt::skip]
|
||||
pub use self::data_messages::{
|
||||
|
|
|
@ -4,8 +4,8 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{decode, PduDecode, PduEncode, PduError, PduErrorKind, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub mod conference_create;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive as _, ToPrimitive as _};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const REDIRECTION_VERSION_MASK: u32 = 0x0000_003C;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::{ClientGccBlocks, ServerGccBlocks};
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{mcs, per, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const CONFERENCE_REQUEST_OBJECT_ID: [u8; 6] = [0, 0, 20, 124, 0, 1];
|
||||
const CONFERENCE_REQUEST_CLIENT_TO_SERVER_H221_NON_STANDARD: &[u8; 4] = b"Duca";
|
||||
|
|
|
@ -4,9 +4,9 @@ use num_traits::{FromPrimitive, ToPrimitive};
|
|||
use tap::Pipe as _;
|
||||
|
||||
use super::{RdpVersion, VERSION_SIZE};
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::nego::SecurityProtocol;
|
||||
use crate::{utils, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub const IME_FILE_NAME_SIZE: usize = 64;
|
||||
|
||||
|
@ -417,29 +417,26 @@ impl<'de> PduDecode<'de> for ClientCoreOptionalData {
|
|||
let mut optional_data = Self::default();
|
||||
|
||||
optional_data.post_beta2_color_depth = Some(
|
||||
ColorDepth::from_u16(try_or_return!(src.try_read_u16("postBeta2ColorDepth"), optional_data))
|
||||
ColorDepth::from_u16(try_or_return!(src.try_read_u16(), optional_data))
|
||||
.ok_or_else(|| invalid_message_err!("postBeta2ColorDepth", "invalid color depth"))?,
|
||||
);
|
||||
|
||||
optional_data.client_product_id = Some(try_or_return!(src.try_read_u16("clientProductId"), optional_data));
|
||||
optional_data.serial_number = Some(try_or_return!(src.try_read_u32("serialNumber"), optional_data));
|
||||
optional_data.client_product_id = Some(try_or_return!(src.try_read_u16(), optional_data));
|
||||
optional_data.serial_number = Some(try_or_return!(src.try_read_u32(), optional_data));
|
||||
|
||||
optional_data.high_color_depth = Some(
|
||||
HighColorDepth::from_u16(try_or_return!(src.try_read_u16("highColorDepth"), optional_data))
|
||||
HighColorDepth::from_u16(try_or_return!(src.try_read_u16(), optional_data))
|
||||
.ok_or_else(|| invalid_message_err!("highColorDepth", "invalid color depth"))?,
|
||||
);
|
||||
|
||||
optional_data.supported_color_depths = Some(
|
||||
SupportedColorDepths::from_bits(try_or_return!(src.try_read_u16("supportedColorDepths"), optional_data))
|
||||
SupportedColorDepths::from_bits(try_or_return!(src.try_read_u16(), optional_data))
|
||||
.ok_or_else(|| invalid_message_err!("supportedColorDepths", "invalid supported color depths"))?,
|
||||
);
|
||||
|
||||
optional_data.early_capability_flags = Some(
|
||||
ClientEarlyCapabilityFlags::from_bits(try_or_return!(
|
||||
src.try_read_u16("earlyCapabilityFlags"),
|
||||
optional_data
|
||||
))
|
||||
.ok_or_else(|| invalid_message_err!("earlyCapabilityFlags", "invalid early capability flags"))?,
|
||||
ClientEarlyCapabilityFlags::from_bits(try_or_return!(src.try_read_u16(), optional_data))
|
||||
.ok_or_else(|| invalid_message_err!("earlyCapabilityFlags", "invalid early capability flags"))?,
|
||||
);
|
||||
|
||||
if src.len() < DIG_PRODUCT_ID_SIZE {
|
||||
|
@ -450,28 +447,23 @@ impl<'de> PduDecode<'de> for ClientCoreOptionalData {
|
|||
optional_data.dig_product_id = Some(utils::from_utf16_bytes(dig_product_id).trim_end_matches('\u{0}').into());
|
||||
|
||||
optional_data.connection_type = Some(
|
||||
ConnectionType::from_u8(try_or_return!(src.try_read_u8("connectionType"), optional_data))
|
||||
ConnectionType::from_u8(try_or_return!(src.try_read_u8(), optional_data))
|
||||
.ok_or_else(|| invalid_message_err!("connectionType", "invalid connection type"))?,
|
||||
);
|
||||
|
||||
try_or_return!(src.try_read_u8("pad1octet"), optional_data);
|
||||
try_or_return!(src.try_read_u8(), optional_data);
|
||||
|
||||
optional_data.server_selected_protocol = Some(
|
||||
SecurityProtocol::from_bits(try_or_return!(
|
||||
src.try_read_u32("serverSelectedProtocol"),
|
||||
optional_data
|
||||
))
|
||||
.ok_or_else(|| invalid_message_err!("serverSelectedProtocol", "invalid security protocol"))?,
|
||||
SecurityProtocol::from_bits(try_or_return!(src.try_read_u32(), optional_data))
|
||||
.ok_or_else(|| invalid_message_err!("serverSelectedProtocol", "invalid security protocol"))?,
|
||||
);
|
||||
|
||||
optional_data.desktop_physical_width =
|
||||
Some(try_or_return!(src.try_read_u32("desktopPhysicalWidth"), optional_data));
|
||||
optional_data.desktop_physical_width = Some(try_or_return!(src.try_read_u32(), optional_data));
|
||||
// physical height must be present, if the physical width is present
|
||||
optional_data.desktop_physical_height = Some(src.read_u32());
|
||||
|
||||
optional_data.desktop_orientation = Some(try_or_return!(src.try_read_u16("desktopOrientation"), optional_data));
|
||||
optional_data.desktop_scale_factor =
|
||||
Some(try_or_return!(src.try_read_u32("desktopScaleFactor"), optional_data));
|
||||
optional_data.desktop_orientation = Some(try_or_return!(src.try_read_u16(), optional_data));
|
||||
optional_data.desktop_scale_factor = Some(try_or_return!(src.try_read_u32(), optional_data));
|
||||
// device scale factor must be present, if the desktop scale factor is present
|
||||
optional_data.device_scale_factor = Some(src.read_u32());
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ use bitflags::bitflags;
|
|||
use tap::Pipe as _;
|
||||
|
||||
use super::RdpVersion;
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::nego::SecurityProtocol;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const CLIENT_REQUESTED_PROTOCOL_SIZE: usize = 4;
|
||||
const EARLY_CAPABILITY_FLAGS_SIZE: usize = 4;
|
||||
|
@ -106,12 +106,12 @@ impl<'de> PduDecode<'de> for ServerCoreOptionalData {
|
|||
let mut optional_data = Self::default();
|
||||
|
||||
optional_data.client_requested_protocols = Some(
|
||||
SecurityProtocol::from_bits(try_or_return!(src.try_read_u32("clientReqProtocols"), optional_data))
|
||||
SecurityProtocol::from_bits(try_or_return!(src.try_read_u32(), optional_data))
|
||||
.ok_or_else(|| invalid_message_err!("clientReqProtocols", "invalid server security protocol"))?,
|
||||
);
|
||||
|
||||
optional_data.early_capability_flags = Some(
|
||||
ServerEarlyCapabilityFlags::from_bits(try_or_return!(src.try_read_u32("earlyCapFlags"), optional_data))
|
||||
ServerEarlyCapabilityFlags::from_bits(try_or_return!(src.try_read_u32(), optional_data))
|
||||
.ok_or_else(|| invalid_message_err!("earlyCapFlags", "invalid early capability flags"))?,
|
||||
);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const CLIENT_FLAGS_SIZE: usize = 4;
|
||||
const SERVER_MCS_MESSAGE_CHANNEL_ID_SIZE: usize = 2;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use bitflags::bitflags;
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
|
||||
pub const MONITOR_COUNT_SIZE: usize = 4;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
|
||||
const MONITOR_COUNT_MAX: usize = 16;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use bitflags::bitflags;
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
use std::borrow::Cow;
|
||||
use std::{io, str};
|
||||
|
||||
|
@ -5,7 +6,6 @@ use bitflags::bitflags;
|
|||
use num_integer::Integer;
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
|
||||
const CHANNELS_MAX: usize = 31;
|
||||
|
|
|
@ -5,8 +5,8 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const CLIENT_ENCRYPTION_METHODS_SIZE: usize = 4;
|
||||
const CLIENT_EXT_ENCRYPTION_METHODS_SIZE: usize = 4;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::cmp::{max, min};
|
||||
|
||||
use crate::cursor::ReadCursor;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub(crate) mod private {
|
||||
pub struct BaseRectangle {
|
||||
|
@ -178,7 +178,7 @@ impl InclusiveRectangle {
|
|||
}
|
||||
|
||||
impl PduEncode for InclusiveRectangle {
|
||||
fn encode(&self, dst: &mut crate::cursor::WriteCursor<'_>) -> PduResult<()> {
|
||||
fn encode(&self, dst: &mut WriteCursor<'_>) -> PduResult<()> {
|
||||
ensure_fixed_part_size!(in: dst);
|
||||
|
||||
dst.write_u16(self.left);
|
||||
|
@ -224,7 +224,7 @@ impl ExclusiveRectangle {
|
|||
}
|
||||
|
||||
impl PduEncode for ExclusiveRectangle {
|
||||
fn encode(&self, dst: &mut crate::cursor::WriteCursor<'_>) -> PduResult<()> {
|
||||
fn encode(&self, dst: &mut WriteCursor<'_>) -> PduResult<()> {
|
||||
ensure_fixed_part_size!(in: dst);
|
||||
|
||||
dst.write_u16(self.left);
|
||||
|
|
|
@ -3,10 +3,10 @@ use bitflags::bitflags;
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::fast_path::EncryptionFlags;
|
||||
use crate::input::{MousePdu, MouseRelPdu, MouseXPdu};
|
||||
use crate::{per, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
/// Implements the Fast-Path RDP message header PDU.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
|
|
@ -4,8 +4,8 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub mod fast_path;
|
||||
pub mod mouse;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use bitflags::bitflags;
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct MousePdu {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use bitflags::bitflags;
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct MouseRelPdu {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use bitflags::bitflags;
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct MouseXPdu {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use bitflags::bitflags;
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ScanCodePdu {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use bitflags::bitflags;
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct SyncPdu {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use bitflags::bitflags;
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct UnicodePdu {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct UnusedPdu;
|
||||
|
|
|
@ -5,18 +5,15 @@
|
|||
#![allow(clippy::cast_sign_loss)] // FIXME: remove
|
||||
|
||||
use core::fmt;
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
use cursor::WriteCursor;
|
||||
#[cfg(feature = "alloc")]
|
||||
use write_buf::WriteBuf;
|
||||
|
||||
use crate::cursor::ReadCursor;
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
pub mod codecs;
|
||||
pub mod cursor;
|
||||
pub mod gcc;
|
||||
pub mod geometry;
|
||||
pub mod input;
|
||||
|
|
|
@ -232,7 +232,7 @@ macro_rules! impl_pdu_pod {
|
|||
}
|
||||
|
||||
impl $crate::PduDecodeOwned for $pdu_ty {
|
||||
fn decode_owned(src: &mut $crate::cursor::ReadCursor<'_>) -> $crate::PduResult<Self> {
|
||||
fn decode_owned(src: &mut ReadCursor<'_>) -> $crate::PduResult<Self> {
|
||||
<Self as $crate::PduDecode>::decode(src)
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ macro_rules! impl_pdu_borrowing {
|
|||
pub type $owned_ty = $pdu_ty<'static>;
|
||||
|
||||
impl $crate::PduDecodeOwned for $owned_ty {
|
||||
fn decode_owned(src: &mut $crate::cursor::ReadCursor<'_>) -> $crate::PduResult<Self> {
|
||||
fn decode_owned(src: &mut ReadCursor<'_>) -> $crate::PduResult<Self> {
|
||||
let pdu = <$pdu_ty $(<$($lt),+>)? as $crate::PduDecode>::decode(src)?;
|
||||
Ok($crate::IntoOwnedPdu::into_owned_pdu(pdu))
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::gcc::{ChannelDef, ClientGccBlocks, ConferenceCreateRequest, ConferenceCreateResponse};
|
||||
use crate::tpdu::{TpduCode, TpduHeader};
|
||||
use crate::tpkt::TpktHeader;
|
||||
use crate::x224::{user_data_size, X224Pdu};
|
||||
use crate::{per, IntoOwnedPdu, PduError, PduErrorExt as _, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
// T.125 MCS is defined in:
|
||||
//
|
||||
|
@ -237,14 +237,14 @@ impl DomainMcsPdu {
|
|||
}
|
||||
|
||||
fn read_mcspdu_header(src: &mut ReadCursor<'_>, ctx: &'static str) -> PduResult<DomainMcsPdu> {
|
||||
let choice = src.try_read_u8(ctx)?;
|
||||
let choice = src.try_read_u8().map_err(|e| custom_err!(ctx, e))?;
|
||||
|
||||
DomainMcsPdu::from_choice(choice)
|
||||
.ok_or_else(|| PduError::invalid_message(ctx, "domain-mcspdu", "unexpected application tag for CHOICE"))
|
||||
}
|
||||
|
||||
fn peek_mcspdu_header(src: &mut ReadCursor<'_>, ctx: &'static str) -> PduResult<DomainMcsPdu> {
|
||||
let choice = src.try_peek_u8(ctx)?;
|
||||
let choice = src.try_read_u8().map_err(|e| custom_err!(ctx, e))?;
|
||||
|
||||
DomainMcsPdu::from_choice(choice)
|
||||
.ok_or_else(|| PduError::invalid_message(ctx, "domain-mcspdu", "unexpected application tag for CHOICE"))
|
||||
|
|
|
@ -5,11 +5,11 @@ use core::fmt;
|
|||
use bitflags::bitflags;
|
||||
use tap::prelude::*;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::tpdu::{TpduCode, TpduHeader};
|
||||
use crate::tpkt::TpktHeader;
|
||||
use crate::x224::X224Pdu;
|
||||
use crate::{Pdu as _, PduError, PduErrorExt as _, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
bitflags! {
|
||||
/// A 32-bit, unsigned integer that contains flags indicating the supported security protocols.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//! and message recipients should not assume padding has any particular
|
||||
//! value.
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
/// Writes zeroes using as few `write_u*` calls as possible.
|
||||
pub fn write(dst: &mut WriteCursor<'_>, mut n: usize) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! This module contains the RDP_PRECONNECTION_PDU_V1 and RDP_PRECONNECTION_PDU_V2 structures.
|
||||
|
||||
use crate::cursor::ReadCursor;
|
||||
use crate::{Pdu, PduDecode, PduEncode, PduError, PduErrorExt as _, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
/// Preconnection PDU version
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -104,7 +104,7 @@ impl<'de> PduDecode<'de> for PreconnectionBlob {
|
|||
}
|
||||
|
||||
impl PduEncode for PreconnectionBlob {
|
||||
fn encode(&self, dst: &mut crate::cursor::WriteCursor<'_>) -> PduResult<()> {
|
||||
fn encode(&self, dst: &mut WriteCursor<'_>) -> PduResult<()> {
|
||||
if self.v2_payload.is_some() && self.version == PcbVersion::V1 {
|
||||
return Err(PduError::invalid_message(
|
||||
Self::NAME,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use core::fmt;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub(crate) const CHOICE_SIZE: usize = 1;
|
||||
pub(crate) const ENUM_SIZE: usize = 1;
|
||||
|
|
|
@ -2,13 +2,13 @@ use std::io;
|
|||
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::input::InputEventError;
|
||||
use crate::rdp::capability_sets::CapabilitySetsError;
|
||||
use crate::rdp::client_info::{ClientInfo, ClientInfoError};
|
||||
use crate::rdp::headers::{BasicSecurityHeader, BasicSecurityHeaderFlags, ShareControlPduType, ShareDataPduType};
|
||||
use crate::rdp::server_license::ServerLicenseError;
|
||||
use crate::{PduDecode, PduEncode, PduError, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub mod capability_sets;
|
||||
pub mod client_info;
|
||||
|
|
|
@ -4,8 +4,8 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive as _, ToPrimitive as _};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{decode, utils, PduDecode, PduEncode, PduError, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
mod bitmap;
|
||||
mod bitmap_cache;
|
||||
|
|
|
@ -3,8 +3,8 @@ mod tests;
|
|||
|
||||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const BITMAP_LENGTH: usize = 24;
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ mod tests;
|
|||
|
||||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub const BITMAP_CACHE_ENTRIES_NUM: usize = 3;
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ use bitflags::bitflags;
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::decode;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const RFX_ICAP_VERSION: u16 = 0x0100;
|
||||
const RFX_ICAP_TILE_SIZE: u16 = 0x40;
|
||||
|
|
|
@ -4,8 +4,8 @@ mod tests;
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const BRUSH_LENGTH: usize = 4;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct FrameAcknowledge {
|
||||
|
|
|
@ -5,8 +5,8 @@ use std::fmt;
|
|||
|
||||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const GENERAL_LENGTH: usize = 20;
|
||||
pub const PROTOCOL_VER: u16 = 0x0200;
|
||||
|
|
|
@ -4,8 +4,8 @@ mod tests;
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub const GLYPH_CACHE_NUM: usize = 10;
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ mod tests;
|
|||
use bitflags::bitflags;
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::gcc::{KeyboardType, IME_FILE_NAME_SIZE};
|
||||
use crate::{utils, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const INPUT_LENGTH: usize = 84;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub struct LargePointer {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub struct MultifragmentUpdate {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const OFFSCREEN_BITMAP_CACHE_LENGTH: usize = 8;
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ mod tests;
|
|||
|
||||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const ORDER_LENGTH: usize = 84;
|
||||
const ORD_LEVEL_1_ORDERS: u16 = 1;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const POINTER_LENGTH: usize = 6;
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ mod tests;
|
|||
|
||||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const SOUND_LENGTH: usize = 4;
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ mod tests;
|
|||
|
||||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const SURFACE_COMMANDS_LENGTH: usize = 8;
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ mod tests;
|
|||
|
||||
use bitflags::bitflags;
|
||||
|
||||
use crate::cursor::WriteCursor;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const FLAGS_FIELD_SIZE: usize = 4;
|
||||
const CHUNK_SIZE_FIELD_SIZE: usize = 4;
|
||||
|
@ -73,7 +73,7 @@ macro_rules! try_or_return {
|
|||
}
|
||||
|
||||
impl<'de> PduDecode<'de> for VirtualChannel {
|
||||
fn decode(src: &mut crate::cursor::ReadCursor<'de>) -> PduResult<Self> {
|
||||
fn decode(src: &mut ReadCursor<'de>) -> PduResult<Self> {
|
||||
ensure_fixed_part_size!(in: src);
|
||||
|
||||
let flags = VirtualChannelFlags::from_bits_truncate(src.read_u32());
|
||||
|
@ -83,7 +83,7 @@ impl<'de> PduDecode<'de> for VirtualChannel {
|
|||
chunk_size: None,
|
||||
};
|
||||
|
||||
virtual_channel_pdu.chunk_size = Some(try_or_return!(src.try_read_u32("chunkSize"), virtual_channel_pdu));
|
||||
virtual_channel_pdu.chunk_size = Some(try_or_return!(src.try_read_u32(), virtual_channel_pdu));
|
||||
|
||||
Ok(virtual_channel_pdu)
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive as _, ToPrimitive as _};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::utils::CharacterSet;
|
||||
use crate::{utils, PduDecode, PduEncode, PduError, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const RECONNECT_COOKIE_LEN: usize = 28;
|
||||
const TIMEZONE_INFO_NAME_LEN: usize = 64;
|
||||
|
|
|
@ -2,8 +2,8 @@ use bitflags::bitflags;
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive as _, ToPrimitive as _};
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{gcc, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const SYNCHRONIZE_PDU_SIZE: usize = 2 + 2;
|
||||
const CONTROL_PDU_SIZE: usize = 2 + 2 + 4;
|
||||
|
|
|
@ -3,7 +3,6 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::codecs::rfx::FrameAcknowledgePdu;
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::input::InputEventPdu;
|
||||
use crate::rdp::capability_sets::{ClientConfirmActive, ServerDemandActive};
|
||||
use crate::rdp::client_info;
|
||||
|
@ -13,6 +12,7 @@ use crate::rdp::server_error_info::ServerSetErrorInfoPdu;
|
|||
use crate::rdp::session_info::SaveSessionInfoPdu;
|
||||
use crate::rdp::suppress_output::SuppressOutputPdu;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub const BASIC_SECURITY_HEADER_SIZE: usize = 4;
|
||||
pub const SHARE_DATA_HEADER_COMPRESSION_MASK: u8 = 0xF;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::geometry::InclusiveRectangle;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
/// [2.2.11.2.1] Refresh Rect PDU Data (TS_REFRESH_RECT_PDU)
|
||||
///
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ServerSetErrorInfoPdu(pub ErrorInfo);
|
||||
|
|
|
@ -6,9 +6,9 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::rdp::headers::{BasicSecurityHeader, BasicSecurityHeaderFlags, BASIC_SECURITY_HEADER_SIZE};
|
||||
use crate::{PduDecode, PduEncode, PduError, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
@ -12,9 +12,9 @@ use super::{
|
|||
PREAMBLE_SIZE, RANDOM_NUMBER_SIZE, UTF8_NULL_TERMINATOR_SIZE,
|
||||
};
|
||||
use crate::crypto::rsa::encrypt_with_public_key;
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::utils::{self, CharacterSet};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const LICENSE_REQUEST_STATIC_FIELDS_SIZE: usize = 20;
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ use super::{
|
|||
BLOB_TYPE_SIZE, MAC_SIZE, PLATFORM_ID, PREAMBLE_SIZE,
|
||||
};
|
||||
use crate::crypto::rc4::Rc4;
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const RESPONSE_DATA_VERSION: u16 = 0x100;
|
||||
const RESPONSE_DATA_STATIC_FIELDS_SIZE: usize = 8;
|
||||
|
|
|
@ -6,13 +6,13 @@ use num_traits::{FromPrimitive, ToPrimitive};
|
|||
|
||||
use super::{BlobHeader, BlobType, LicenseHeader, PreambleFlags, PreambleVersion, BLOB_LENGTH_SIZE, BLOB_TYPE_SIZE};
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
rdp::{
|
||||
headers::{BasicSecurityHeader, BasicSecurityHeaderFlags, BASIC_SECURITY_HEADER_SIZE},
|
||||
server_license::PreambleType,
|
||||
},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const ERROR_CODE_SIZE: usize = 4;
|
||||
const STATE_TRANSITION_SIZE: usize = 4;
|
||||
|
|
|
@ -9,10 +9,8 @@ use super::{
|
|||
BlobHeader, BlobType, LicenseHeader, PreambleType, ServerLicenseError, BLOB_LENGTH_SIZE, BLOB_TYPE_SIZE,
|
||||
KEY_EXCHANGE_ALGORITHM_RSA, RANDOM_NUMBER_SIZE, UTF16_NULL_TERMINATOR_SIZE, UTF8_NULL_TERMINATOR_SIZE,
|
||||
};
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
utils, PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{utils, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const CERT_VERSION_FIELD_SIZE: usize = 4;
|
||||
const KEY_EXCHANGE_FIELD_SIZE: usize = 4;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use super::{BlobHeader, BlobType, KEY_EXCHANGE_ALGORITHM_RSA};
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
pub const SIGNATURE_ALGORITHM_RSA: u32 = 1;
|
||||
pub const PROP_CERT_NO_BLOBS_SIZE: usize = 8;
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
mod test;
|
||||
|
||||
use super::{BlobHeader, BlobType, LicenseHeader, PreambleType, BLOB_LENGTH_SIZE, BLOB_TYPE_SIZE, MAC_SIZE};
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const CONNECT_FLAGS_FIELD_SIZE: usize = 4;
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ use super::{
|
|||
BLOB_TYPE_SIZE, MAC_SIZE, UTF16_NULL_TERMINATOR_SIZE, UTF8_NULL_TERMINATOR_SIZE,
|
||||
};
|
||||
use crate::crypto::rc4::Rc4;
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::utils::CharacterSet;
|
||||
use crate::{utils, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const NEW_LICENSE_INFO_STATIC_FIELDS_SIZE: usize = 20;
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ use num_derive::{FromPrimitive, ToPrimitive};
|
|||
use num_traits::{FromPrimitive as _, ToPrimitive as _};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::{PduDecode, PduEncode, PduError, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
@ -2,10 +2,8 @@ use bitflags::bitflags;
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const LOGON_EX_LENGTH_FIELD_SIZE: usize = 2;
|
||||
const LOGON_EX_FLAGS_FIELD_SIZE: usize = 4;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use crate::{
|
||||
cursor::{ReadCursor, WriteCursor},
|
||||
utils, PduDecode, PduEncode, PduResult,
|
||||
};
|
||||
use crate::{utils, PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
const DOMAIN_NAME_SIZE_FIELD_SIZE: usize = 4;
|
||||
const DOMAIN_NAME_SIZE_V1: usize = 52;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
use crate::geometry::InclusiveRectangle;
|
||||
use crate::{PduDecode, PduEncode, PduResult};
|
||||
use ironrdp_core::{ReadCursor, WriteCursor};
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue