style: fix typo

This commit is contained in:
Benoît CORTIER
2022-04-15 13:13:20 -04:00
committed by Benoît Cortier
parent 2837d104bf
commit e19b0af527
14 changed files with 125 additions and 112 deletions
+10 -9
View File
@@ -1,11 +1,3 @@
pub mod color_conversion;
pub mod dwt;
pub mod image_processing;
pub mod quantization;
pub mod rectangles_processing;
pub mod rlgr;
pub mod subband_reconstruction;
mod data_messages;
mod header_messages;
#[cfg(test)]
@@ -18,13 +10,22 @@ use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use crate::{impl_from_error, PduBufferParsing, PduParsing};
pub mod color_conversion;
pub mod dwt;
pub mod image_processing;
pub mod quantization;
pub mod rectangles_processing;
pub mod rlgr;
pub mod subband_reconstruction;
pub use self::data_messages::{
ContextPdu, EntropyAlgorithm, FrameBeginPdu, FrameEndPdu, OperatingMode, Quant, RegionPdu, RfxRectangle, Tile,
TileSetPdu,
};
pub use self::header_messages::{Channel, ChannelsPdu, CodecVersionsPdu, SyncPdu};
pub use self::rlgr::RlgrError;
use crate::{impl_from_error, PduBufferParsing, PduParsing};
const BLOCK_HEADER_SIZE: usize = 6;
const CODEC_CHANNEL_HEADER_SIZE: usize = 2;
+4 -4
View File
@@ -43,8 +43,8 @@ mod tests {
#[test]
fn decode_does_not_change_buffer_with_null_quant_values() {
let mut buffer = QUANTIZIED_BUFFER;
let expected = QUANTIZIED_BUFFER;
let mut buffer = QUANTIZED_BUFFER;
let expected = QUANTIZED_BUFFER;
let quant = Quant {
ll3: 0,
lh3: 0,
@@ -64,7 +64,7 @@ mod tests {
#[test]
fn decode_works_with_not_empty_quant_values() {
let mut buffer = QUANTIZIED_BUFFER;
let mut buffer = QUANTIZED_BUFFER;
let expected = DEQUANTIZED_BUFFER.as_ref();
let quant = Quant {
ll3: 6,
@@ -83,7 +83,7 @@ mod tests {
assert_eq!(expected, buffer.as_ref());
}
const QUANTIZIED_BUFFER: [i16; 4096] = [
const QUANTIZED_BUFFER: [i16; 4096] = [
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,
+12 -10
View File
@@ -1,8 +1,18 @@
pub mod conference_create;
pub(crate) mod monitor_data;
use std::io;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use crate::{impl_from_error, PduParsing};
#[cfg(test)]
pub mod test;
pub mod conference_create;
pub(crate) mod monitor_data;
mod cluster_data;
mod core_data;
mod message_channel_data;
@@ -11,13 +21,6 @@ mod multi_transport_channel_data;
mod network_data;
mod security_data;
use std::io;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
pub use self::cluster_data::{ClientClusterData, ClusterDataError, RedirectionFlags, RedirectionVersion};
pub use self::conference_create::{ConferenceCreateRequest, ConferenceCreateResponse};
pub use self::core_data::client::{
@@ -40,7 +43,6 @@ pub use self::network_data::{Channel, ChannelOptions, ClientNetworkData, Network
pub use self::security_data::{
ClientSecurityData, EncryptionLevel, EncryptionMethod, SecurityDataError, ServerSecurityData,
};
use crate::{impl_from_error, PduParsing};
macro_rules! user_header_try {
($e:expr) => {
+16 -16
View File
@@ -28,7 +28,7 @@ const SERVER_NETWORK_DATA_WITHOUT_CHANNELS_ID_BUFFER: [u8; 4] = [
];
lazy_static! {
pub static ref CLIENT_NETOWORK_DATA_WITH_CHANNELS: ClientNetworkData = ClientNetworkData {
pub static ref CLIENT_NETWORK_DATA_WITH_CHANNELS: ClientNetworkData = ClientNetworkData {
channels: vec![
Channel {
name: String::from("rdpdr"),
@@ -47,12 +47,12 @@ lazy_static! {
},
],
};
pub static ref SERVER_NETOWORK_DATA_WITH_CHANNELS_ID: ServerNetworkData = ServerNetworkData {
pub static ref SERVER_NETWORK_DATA_WITH_CHANNELS_ID: ServerNetworkData = ServerNetworkData {
io_channel: 1003,
channel_ids: vec![1004, 1005, 1006],
};
static ref CLIENT_NETOWORK_DATA_WITHOUT_CHANNELS: ClientNetworkData = ClientNetworkData { channels: Vec::new() };
static ref SERVER_NETOWORK_DATA_WITHOUT_CHANNELS_ID: ServerNetworkData = ServerNetworkData {
static ref CLIENT_NETWORK_DATA_WITHOUT_CHANNELS: ClientNetworkData = ClientNetworkData { channels: Vec::new() };
static ref SERVER_NETWORK_DATA_WITHOUT_CHANNELS_ID: ServerNetworkData = ServerNetworkData {
io_channel: 1003,
channel_ids: Vec::new(),
};
@@ -63,7 +63,7 @@ fn from_buffer_correctly_parses_client_network_data_without_channels() {
let buffer = CLIENT_NETWORK_DATA_WITHOUT_CHANNELS_BUFFER.as_ref();
assert_eq!(
*CLIENT_NETOWORK_DATA_WITHOUT_CHANNELS,
*CLIENT_NETWORK_DATA_WITHOUT_CHANNELS,
ClientNetworkData::from_buffer(buffer).unwrap()
);
}
@@ -73,14 +73,14 @@ fn from_buffer_correctly_parses_client_network_data_with_channels() {
let buffer = CLIENT_NETWORK_DATA_WITH_CHANNELS_BUFFER.as_ref();
assert_eq!(
*CLIENT_NETOWORK_DATA_WITH_CHANNELS,
*CLIENT_NETWORK_DATA_WITH_CHANNELS,
ClientNetworkData::from_buffer(buffer).unwrap()
);
}
#[test]
fn to_buffer_correctly_serializes_client_network_data_without_channels() {
let data = CLIENT_NETOWORK_DATA_WITHOUT_CHANNELS.clone();
let data = CLIENT_NETWORK_DATA_WITHOUT_CHANNELS.clone();
let expected_buffer = CLIENT_NETWORK_DATA_WITHOUT_CHANNELS_BUFFER;
let mut buff = Vec::new();
@@ -91,7 +91,7 @@ fn to_buffer_correctly_serializes_client_network_data_without_channels() {
#[test]
fn to_buffer_correctly_serializes_client_network_data_with_channels() {
let data = CLIENT_NETOWORK_DATA_WITH_CHANNELS.clone();
let data = CLIENT_NETWORK_DATA_WITH_CHANNELS.clone();
let expected_buffer = CLIENT_NETWORK_DATA_WITH_CHANNELS_BUFFER;
let mut buff = Vec::new();
@@ -102,7 +102,7 @@ fn to_buffer_correctly_serializes_client_network_data_with_channels() {
#[test]
fn buffer_length_is_correct_for_client_network_data_without_channels() {
let data = CLIENT_NETOWORK_DATA_WITHOUT_CHANNELS.clone();
let data = CLIENT_NETWORK_DATA_WITHOUT_CHANNELS.clone();
let expected_buffer_len = CLIENT_NETWORK_DATA_WITHOUT_CHANNELS_BUFFER.len();
let len = data.buffer_length();
@@ -112,7 +112,7 @@ fn buffer_length_is_correct_for_client_network_data_without_channels() {
#[test]
fn buffer_length_is_correct_for_client_network_data_with_channels() {
let data = CLIENT_NETOWORK_DATA_WITH_CHANNELS.clone();
let data = CLIENT_NETWORK_DATA_WITH_CHANNELS.clone();
let expected_buffer_len = CLIENT_NETWORK_DATA_WITH_CHANNELS_BUFFER.len();
let len = data.buffer_length();
@@ -125,7 +125,7 @@ fn from_buffer_correctly_parses_server_network_data_without_channels_id() {
let buffer = SERVER_NETWORK_DATA_WITHOUT_CHANNELS_ID_BUFFER.as_ref();
assert_eq!(
*SERVER_NETOWORK_DATA_WITHOUT_CHANNELS_ID,
*SERVER_NETWORK_DATA_WITHOUT_CHANNELS_ID,
ServerNetworkData::from_buffer(buffer).unwrap()
);
}
@@ -135,14 +135,14 @@ fn from_buffer_correctly_parses_server_network_data_with_channels_id() {
let buffer = SERVER_NETWORK_DATA_WITH_CHANNELS_ID_BUFFER.as_ref();
assert_eq!(
*SERVER_NETOWORK_DATA_WITH_CHANNELS_ID,
*SERVER_NETWORK_DATA_WITH_CHANNELS_ID,
ServerNetworkData::from_buffer(buffer).unwrap()
);
}
#[test]
fn to_buffer_correctly_serializes_server_network_data_without_channels_id() {
let data = SERVER_NETOWORK_DATA_WITHOUT_CHANNELS_ID.clone();
let data = SERVER_NETWORK_DATA_WITHOUT_CHANNELS_ID.clone();
let expected_buffer = SERVER_NETWORK_DATA_WITHOUT_CHANNELS_ID_BUFFER;
let mut buff = Vec::new();
@@ -153,7 +153,7 @@ fn to_buffer_correctly_serializes_server_network_data_without_channels_id() {
#[test]
fn to_buffer_correctly_serializes_server_network_data_with_channels_id() {
let data = SERVER_NETOWORK_DATA_WITH_CHANNELS_ID.clone();
let data = SERVER_NETWORK_DATA_WITH_CHANNELS_ID.clone();
let expected_buffer = SERVER_NETWORK_DATA_WITH_CHANNELS_ID_BUFFER;
let mut buff = Vec::new();
@@ -164,7 +164,7 @@ fn to_buffer_correctly_serializes_server_network_data_with_channels_id() {
#[test]
fn buffer_length_is_correct_for_server_network_data_without_channels_id() {
let data = SERVER_NETOWORK_DATA_WITHOUT_CHANNELS_ID.clone();
let data = SERVER_NETWORK_DATA_WITHOUT_CHANNELS_ID.clone();
let expected_buffer_len = SERVER_NETWORK_DATA_WITHOUT_CHANNELS_ID_BUFFER.len();
let len = data.buffer_length();
@@ -174,7 +174,7 @@ fn buffer_length_is_correct_for_server_network_data_without_channels_id() {
#[test]
fn buffer_length_is_correct_for_server_network_data_with_channels_id() {
let data = SERVER_NETOWORK_DATA_WITH_CHANNELS_ID.clone();
let data = SERVER_NETWORK_DATA_WITH_CHANNELS_ID.clone();
let expected_buffer_len = SERVER_NETWORK_DATA_WITH_CHANNELS_ID_BUFFER.len();
let len = data.buffer_length();
+2 -2
View File
@@ -66,7 +66,7 @@ lazy_static! {
pub static ref CLIENT_GCC_WITHOUT_OPTIONAL_FIELDS: ClientGccBlocks = ClientGccBlocks {
core: core_data::client::test::CLIENT_OPTIONAL_CORE_DATA_TO_SERVER_SELECTED_PROTOCOL.clone(),
security: security_data::test::CLIENT_SECURITY_DATA.clone(),
network: Some(network_data::test::CLIENT_NETOWORK_DATA_WITH_CHANNELS.clone()),
network: Some(network_data::test::CLIENT_NETWORK_DATA_WITH_CHANNELS.clone()),
cluster: None,
monitor: None,
message_channel: None,
@@ -88,7 +88,7 @@ lazy_static! {
};
pub static ref SERVER_GCC_WITHOUT_OPTIONAL_FIELDS: ServerGccBlocks = ServerGccBlocks {
core: core_data::server::test::SERVER_CORE_DATA_TO_FLAGS.clone(),
network: network_data::test::SERVER_NETOWORK_DATA_WITH_CHANNELS_ID.clone(),
network: network_data::test::SERVER_NETWORK_DATA_WITH_CHANNELS_ID.clone(),
security: security_data::test::SERVER_SECURITY_DATA_WITH_OPTIONAL_FIELDS.clone(),
message_channel: None,
multi_transport_channel: None,
+12 -10
View File
@@ -1,12 +1,3 @@
pub mod mouse;
pub mod mouse_x;
pub mod scan_code;
pub mod sync;
#[cfg(test)]
mod tests;
pub mod unicode;
pub mod unused;
use std::io;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
@@ -14,13 +5,24 @@ use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use crate::{impl_from_error, PduParsing};
#[cfg(test)]
mod tests;
pub mod mouse;
pub mod mouse_x;
pub mod scan_code;
pub mod sync;
pub mod unicode;
pub mod unused;
pub use self::mouse::MousePdu;
pub use self::mouse_x::MouseXPdu;
pub use self::scan_code::ScanCodePdu;
pub use self::sync::SyncPdu;
pub use self::unicode::UnicodePdu;
pub use self::unused::UnusedPdu;
use crate::{impl_from_error, PduParsing};
#[derive(Debug, Clone, PartialEq)]
pub struct InputEventPdu(pub Vec<InputEvent>);
+7 -5
View File
@@ -1,7 +1,3 @@
mod connect_initial;
#[cfg(test)]
mod test;
use std::io;
use byteorder::{ReadBytesExt, WriteBytesExt};
@@ -9,10 +5,16 @@ use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
pub use self::connect_initial::{ConnectInitial, ConnectResponse, DomainParameters};
use crate::gcc::GccError;
use crate::{impl_from_error, per, PduParsing};
#[cfg(test)]
mod test;
mod connect_initial;
pub use self::connect_initial::{ConnectInitial, ConnectResponse, DomainParameters};
pub const RESULT_ENUM_LENGTH: u8 = 16;
const BASE_CHANNEL_ID: u16 = 1001;
+9 -8
View File
@@ -1,3 +1,12 @@
use std::io;
use failure::Fail;
use self::client_info::ClientInfoError;
use self::finalization_messages::FinalizationMessagesError;
use self::server_license::ServerLicenseError;
use crate::{impl_from_error, PduParsing};
#[cfg(test)]
pub mod test;
@@ -11,20 +20,14 @@ mod finalization_messages;
mod headers;
mod server_error_info;
use std::io;
use failure::Fail;
pub use self::capability_sets::{
CapabilitySet, CapabilitySetsError, ClientConfirmActive, DemandActive, ServerDemandActive, VirtualChannel,
SERVER_CHANNEL_ID,
};
use self::client_info::ClientInfoError;
pub use self::client_info::{
AddressFamily, ClientInfo, ClientInfoFlags, CompressionType, Credentials, DayOfWeek, DayOfWeekOccurrence,
ExtendedClientInfo, ExtendedClientOptionalInfo, Month, PerformanceFlags, SystemTime, TimezoneInfo,
};
use self::finalization_messages::FinalizationMessagesError;
pub use self::finalization_messages::{
ControlAction, ControlPdu, FontPdu, MonitorLayoutPdu, SequenceFlags, SynchronizePdu,
};
@@ -36,8 +39,6 @@ pub use self::server_error_info::{
ErrorInfo, ProtocolIndependentCode, ProtocolIndependentConnectionBrokerCode, ProtocolIndependentLicensingCode,
RdpSpecificCode, ServerSetErrorInfoError, ServerSetErrorInfoPdu,
};
use self::server_license::ServerLicenseError;
use crate::{impl_from_error, PduParsing};
#[derive(Debug, Clone, PartialEq)]
pub struct ClientInfoPdu {
+9 -8
View File
@@ -1,3 +1,12 @@
use std::io;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use crate::{impl_from_error, PduParsing};
#[cfg(test)]
pub mod test;
@@ -18,13 +27,6 @@ mod sound;
mod surface_commands;
mod virtual_channel;
use std::io;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
pub use self::bitmap::{Bitmap, BitmapDrawingFlags};
pub use self::bitmap_cache::{
BitmapCache, BitmapCacheRev2, CacheEntry, CacheFlags, CellInfo, BITMAP_CACHE_ENTRIES_NUM,
@@ -46,7 +48,6 @@ pub use self::pointer::Pointer;
pub use self::sound::{Sound, SoundFlags};
pub use self::surface_commands::{CmdFlags, SurfaceCommands};
pub use self::virtual_channel::{VirtualChannel, VirtualChannelFlags};
use crate::{impl_from_error, PduParsing};
pub const SERVER_CHANNEL_ID: u16 = 0x03ea;
+13 -12
View File
@@ -1,13 +1,3 @@
#[cfg(test)]
pub mod test;
mod client_new_license_request;
mod client_platform_challenge_response;
mod licensing_error_message;
mod server_license_request;
mod server_platform_challenge;
mod server_upgrade_license;
use std::io;
use bitflags::bitflags;
@@ -18,14 +8,25 @@ use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use ring::digest;
use crate::rdp::{BasicSecurityHeader, BasicSecurityHeaderFlags, BASIC_SECURITY_HEADER_SIZE};
use crate::{impl_from_error, PduParsing};
#[cfg(test)]
pub mod test;
mod client_new_license_request;
mod client_platform_challenge_response;
mod licensing_error_message;
mod server_license_request;
mod server_platform_challenge;
mod server_upgrade_license;
pub use self::client_new_license_request::{ClientNewLicenseRequest, PLATFORM_ID};
pub use self::client_platform_challenge_response::ClientPlatformChallengeResponse;
pub use self::licensing_error_message::{LicenseErrorCode, LicensingErrorMessage, LicensingStateTransition};
pub use self::server_license_request::{InitialMessageType, InitialServerLicenseMessage, ServerLicenseRequest};
pub use self::server_platform_challenge::ServerPlatformChallenge;
pub use self::server_upgrade_license::ServerUpgradeLicense;
use crate::rdp::{BasicSecurityHeader, BasicSecurityHeaderFlags, BASIC_SECURITY_HEADER_SIZE};
use crate::{impl_from_error, PduParsing};
pub const PREAMBLE_SIZE: usize = 4;
pub const PREMASTER_SECRET_SIZE: usize = 48;
+8 -7
View File
@@ -1,9 +1,3 @@
#[cfg(test)]
mod tests;
mod logon_extended;
mod logon_info;
use std::io;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
@@ -11,12 +5,19 @@ use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use crate::{impl_from_error, PduParsing};
#[cfg(test)]
mod tests;
mod logon_extended;
mod logon_info;
pub use self::logon_extended::{
LogonErrorNotificationData, LogonErrorNotificationType, LogonErrorsInfo, LogonExFlags, LogonInfoExtended,
ServerAutoReconnect,
};
pub use self::logon_info::{LogonInfo, LogonInfoVersion1, LogonInfoVersion2};
use crate::{impl_from_error, PduParsing};
const INFO_TYPE_FIELD_SIZE: usize = 4;
const PLAIN_NOTIFY_PADDING_SIZE: usize = 576;
+14 -13
View File
@@ -1,14 +1,3 @@
pub mod gfx;
#[cfg(test)]
mod tests;
mod capabilities;
mod close;
mod create;
mod data;
mod data_first;
use std::collections::HashMap;
use std::{io, mem};
@@ -17,13 +6,25 @@ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use super::ChannelError;
use crate::PduParsing;
#[cfg(test)]
mod tests;
pub mod gfx;
mod capabilities;
mod close;
mod create;
mod data;
mod data_first;
pub use self::capabilities::{CapabilitiesRequestPdu, CapabilitiesResponsePdu, CapsVersion};
pub use self::close::ClosePdu;
pub use self::create::{CreateRequestPdu, CreateResponsePdu, DVC_CREATION_STATUS_NO_LISTENER, DVC_CREATION_STATUS_OK};
pub use self::data::DataPdu;
pub use self::data_first::DataFirstPdu;
use super::ChannelError;
use crate::PduParsing;
const HEADER_SIZE: usize = 1;
const PDU_WITH_DATA_MAX_SIZE: usize = 1600;
+4 -4
View File
@@ -1,12 +1,12 @@
pub mod active_session;
pub mod connection_sequence;
pub mod transport;
mod errors;
mod utils;
use ironrdp::{gcc, nego};
pub mod active_session;
pub mod connection_sequence;
pub mod transport;
pub use self::active_session::process_active_stage;
pub use self::connection_sequence::{process_connection_sequence, ConnectionSequenceResult, UpgradedStream};
pub use self::errors::RdpError;
+5 -4
View File
@@ -1,6 +1,3 @@
mod channels;
mod connection;
use std::io;
use bytes::BytesMut;
@@ -8,9 +5,13 @@ use ironrdp::rdp::SERVER_CHANNEL_ID;
use ironrdp::{PduParsing, RdpPdu};
use log::warn;
use crate::RdpError;
mod channels;
mod connection;
pub use self::channels::{ChannelIdentificators, DynamicVirtualChannelTransport, StaticVirtualChannelTransport};
pub use self::connection::{connect, EarlyUserAuthResult, TsRequestTransport};
use crate::RdpError;
pub trait Encoder {
type Item;