|
|
@ -72,19 +72,19 @@ fn device_scale_to_opt(x: u32) -> Option<u32> {
|
|
|
|
// ================
|
|
|
|
// ================
|
|
|
|
|
|
|
|
|
|
|
|
/// t.123-spec, section 8
|
|
|
|
/// t.123-spec, section 8
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum TpktVersion {
|
|
|
|
pub enum TpktVersion {
|
|
|
|
T123 = 0x3,
|
|
|
|
T123 = 0x3,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// t.123-spec, section 8
|
|
|
|
/// t.123-spec, section 8
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct T123Tpkt {
|
|
|
|
pub struct T123Tpkt {
|
|
|
|
pub child: T123TpktChild,
|
|
|
|
pub child: T123TpktChild,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// variants that a t.123 tpkt can hold
|
|
|
|
/// variants that a t.123 tpkt can hold
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum T123TpktChild {
|
|
|
|
pub enum T123TpktChild {
|
|
|
|
X224ConnectionRequest(X224ConnectionRequest),
|
|
|
|
X224ConnectionRequest(X224ConnectionRequest),
|
|
|
|
X224ConnectionConfirm(X224ConnectionConfirm),
|
|
|
|
X224ConnectionConfirm(X224ConnectionConfirm),
|
|
|
@ -95,7 +95,7 @@ pub enum T123TpktChild {
|
|
|
|
// ================
|
|
|
|
// ================
|
|
|
|
|
|
|
|
|
|
|
|
/// x.224-spec, sections 13.3.3, 13.4.3, 13.7.3
|
|
|
|
/// x.224-spec, sections 13.3.3, 13.4.3, 13.7.3
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum X224Type {
|
|
|
|
pub enum X224Type {
|
|
|
|
ConnectionConfirm = 0xd,
|
|
|
|
ConnectionConfirm = 0xd,
|
|
|
|
ConnectionRequest = 0xe,
|
|
|
|
ConnectionRequest = 0xe,
|
|
|
@ -104,7 +104,7 @@ pub enum X224Type {
|
|
|
|
|
|
|
|
|
|
|
|
/// x.224-spec, section 13.3
|
|
|
|
/// x.224-spec, section 13.3
|
|
|
|
// rdp-spec, section 2.2.1.1
|
|
|
|
// rdp-spec, section 2.2.1.1
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct X224ConnectionRequest {
|
|
|
|
pub struct X224ConnectionRequest {
|
|
|
|
pub cdt: u8,
|
|
|
|
pub cdt: u8,
|
|
|
|
pub dst_ref: u16,
|
|
|
|
pub dst_ref: u16,
|
|
|
@ -117,13 +117,13 @@ pub struct X224ConnectionRequest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct RdpCookie {
|
|
|
|
pub struct RdpCookie {
|
|
|
|
pub mstshash: String,
|
|
|
|
pub mstshash: String,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, sections 2.2.1.1.1, 2.2.1.2.1, 2.2.1.2.2
|
|
|
|
/// rdp-spec, sections 2.2.1.1.1, 2.2.1.2.1, 2.2.1.2.2
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum X224ConnectionRequestType {
|
|
|
|
pub enum X224ConnectionRequestType {
|
|
|
|
NegotiationRequest = 0x1,
|
|
|
|
NegotiationRequest = 0x1,
|
|
|
|
NegotiationResponse = 0x2,
|
|
|
|
NegotiationResponse = 0x2,
|
|
|
@ -131,7 +131,7 @@ pub enum X224ConnectionRequestType {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct NegotiationRequest {
|
|
|
|
pub struct NegotiationRequest {
|
|
|
|
pub flags: NegotiationRequestFlags,
|
|
|
|
pub flags: NegotiationRequestFlags,
|
|
|
|
pub protocols: ProtocolFlags,
|
|
|
|
pub protocols: ProtocolFlags,
|
|
|
@ -148,7 +148,7 @@ bitflags! {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum Protocol {
|
|
|
|
pub enum Protocol {
|
|
|
|
ProtocolRdp = 0x0,
|
|
|
|
ProtocolRdp = 0x0,
|
|
|
|
ProtocolSsl = 0x1,
|
|
|
|
ProtocolSsl = 0x1,
|
|
|
@ -170,7 +170,7 @@ bitflags! {
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.2
|
|
|
|
/// rdp-spec, section 2.2.1.2
|
|
|
|
/// x.224-spec, section 13.3
|
|
|
|
/// x.224-spec, section 13.3
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct X224ConnectionConfirm {
|
|
|
|
pub struct X224ConnectionConfirm {
|
|
|
|
pub cdt: u8,
|
|
|
|
pub cdt: u8,
|
|
|
|
pub dst_ref: u16,
|
|
|
|
pub dst_ref: u16,
|
|
|
@ -181,14 +181,14 @@ pub struct X224ConnectionConfirm {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// variants of a server negotiation
|
|
|
|
/// variants of a server negotiation
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum NegotiationFromServer {
|
|
|
|
pub enum NegotiationFromServer {
|
|
|
|
Response(NegotiationResponse),
|
|
|
|
Response(NegotiationResponse),
|
|
|
|
Failure(NegotiationFailure),
|
|
|
|
Failure(NegotiationFailure),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct NegotiationResponse {
|
|
|
|
pub struct NegotiationResponse {
|
|
|
|
pub flags: NegotiationResponseFlags,
|
|
|
|
pub flags: NegotiationResponseFlags,
|
|
|
|
pub protocol: Protocol,
|
|
|
|
pub protocol: Protocol,
|
|
|
@ -207,13 +207,13 @@ bitflags! {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
/// rdp-spec, section 2.2.1.1.1
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct NegotiationFailure {
|
|
|
|
pub struct NegotiationFailure {
|
|
|
|
pub code: NegotiationFailureCode,
|
|
|
|
pub code: NegotiationFailureCode,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.2.2
|
|
|
|
/// rdp-spec, section 2.2.1.2.2
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum NegotiationFailureCode {
|
|
|
|
pub enum NegotiationFailureCode {
|
|
|
|
SslRequiredByServer = 0x1,
|
|
|
|
SslRequiredByServer = 0x1,
|
|
|
|
SslNotAllowedByServer = 0x2,
|
|
|
|
SslNotAllowedByServer = 0x2,
|
|
|
@ -226,13 +226,13 @@ pub enum NegotiationFailureCode {
|
|
|
|
// ================
|
|
|
|
// ================
|
|
|
|
|
|
|
|
|
|
|
|
/// x224-spec, section 13.7
|
|
|
|
/// x224-spec, section 13.7
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct X223Data {
|
|
|
|
pub struct X223Data {
|
|
|
|
pub child: X223DataChild,
|
|
|
|
pub child: X223DataChild,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// variants that an x.223 data message can hold
|
|
|
|
/// variants that an x.223 data message can hold
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum X223DataChild {
|
|
|
|
pub enum X223DataChild {
|
|
|
|
McsConnectRequest(McsConnectRequest),
|
|
|
|
McsConnectRequest(McsConnectRequest),
|
|
|
|
McsConnectResponse(McsConnectResponse),
|
|
|
|
McsConnectResponse(McsConnectResponse),
|
|
|
@ -240,20 +240,20 @@ pub enum X223DataChild {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// t.125-spec, section 7, part 2
|
|
|
|
/// t.125-spec, section 7, part 2
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum T125Type {
|
|
|
|
pub enum T125Type {
|
|
|
|
T125TypeMcsConnectRequest = 0x65, // 101
|
|
|
|
T125TypeMcsConnectRequest = 0x65, // 101
|
|
|
|
T125TypeMcsConnectResponse = 0x66, // 102
|
|
|
|
T125TypeMcsConnectResponse = 0x66, // 102
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2
|
|
|
|
/// rdp-spec, section 2.2.1.3.2
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct McsConnectRequest {
|
|
|
|
pub struct McsConnectRequest {
|
|
|
|
pub children: Vec<McsConnectRequestChild>,
|
|
|
|
pub children: Vec<McsConnectRequestChild>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// variants that an mcs connection message can hold
|
|
|
|
/// variants that an mcs connection message can hold
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum McsConnectRequestChild {
|
|
|
|
pub enum McsConnectRequestChild {
|
|
|
|
CsClientCore(CsClientCoreData),
|
|
|
|
CsClientCore(CsClientCoreData),
|
|
|
|
CsNet(CsNet),
|
|
|
|
CsNet(CsNet),
|
|
|
@ -261,14 +261,14 @@ pub enum McsConnectRequestChild {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.1
|
|
|
|
/// rdp-spec, section 2.2.1.3.1
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum CsType {
|
|
|
|
pub enum CsType {
|
|
|
|
Core = 0xc001,
|
|
|
|
Core = 0xc001,
|
|
|
|
Net = 0xc003,
|
|
|
|
Net = 0xc003,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2
|
|
|
|
/// rdp-spec, section 2.2.1.3.2
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct CsClientCoreData {
|
|
|
|
pub struct CsClientCoreData {
|
|
|
|
pub version: Option<RdpClientVersion>,
|
|
|
|
pub version: Option<RdpClientVersion>,
|
|
|
|
pub desktop_width: u16,
|
|
|
|
pub desktop_width: u16,
|
|
|
@ -300,7 +300,7 @@ pub struct CsClientCoreData {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
pub enum RdpClientVersion {
|
|
|
|
pub enum RdpClientVersion {
|
|
|
|
V4 = 0x80001,
|
|
|
|
V4 = 0x80001,
|
|
|
@ -316,14 +316,14 @@ pub enum RdpClientVersion {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum ColorDepth {
|
|
|
|
pub enum ColorDepth {
|
|
|
|
RnsUdColor4Bpp = 0xca00,
|
|
|
|
RnsUdColor4Bpp = 0xca00,
|
|
|
|
RnsUdColor8Bpp = 0xca01,
|
|
|
|
RnsUdColor8Bpp = 0xca01,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum SasSequence {
|
|
|
|
pub enum SasSequence {
|
|
|
|
RnsUdSasDel = 0xaa03,
|
|
|
|
RnsUdSasDel = 0xaa03,
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -331,7 +331,7 @@ pub enum SasSequence {
|
|
|
|
// for keyboard layout, see windows::lcid_to_string
|
|
|
|
// for keyboard layout, see windows::lcid_to_string
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum KeyboardType {
|
|
|
|
pub enum KeyboardType {
|
|
|
|
KbXt = 0x1,
|
|
|
|
KbXt = 0x1,
|
|
|
|
KbIco = 0x2,
|
|
|
|
KbIco = 0x2,
|
|
|
@ -343,7 +343,7 @@ pub enum KeyboardType {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum PostBeta2ColorDepth {
|
|
|
|
pub enum PostBeta2ColorDepth {
|
|
|
|
RnsUdColorNotProvided = 0x0,
|
|
|
|
RnsUdColorNotProvided = 0x0,
|
|
|
|
RnsUdColor4Bpp = 0xca00,
|
|
|
|
RnsUdColor4Bpp = 0xca00,
|
|
|
@ -354,7 +354,7 @@ pub enum PostBeta2ColorDepth {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum HighColorDepth {
|
|
|
|
pub enum HighColorDepth {
|
|
|
|
HighColorNotProvided = 0x0,
|
|
|
|
HighColorNotProvided = 0x0,
|
|
|
|
HighColor4Bpp = 0x4,
|
|
|
|
HighColor4Bpp = 0x4,
|
|
|
@ -394,7 +394,7 @@ bitflags! {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data, `connectionType`
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data, `connectionType`
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum ConnectionHint {
|
|
|
|
pub enum ConnectionHint {
|
|
|
|
ConnectionHintNotProvided = 0x0,
|
|
|
|
ConnectionHintNotProvided = 0x0,
|
|
|
|
ConnectionHintModem = 0x1,
|
|
|
|
ConnectionHintModem = 0x1,
|
|
|
@ -407,7 +407,7 @@ pub enum ConnectionHint {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
/// rdp-spec, section 2.2.1.3.2 Client Core Data
|
|
|
|
#[derive(Clone, Copy, Debug, FromPrimitive, PartialEq)]
|
|
|
|
#[derive(Clone, Copy, Debug, FromPrimitive, PartialEq, Eq)]
|
|
|
|
pub enum DesktopOrientation {
|
|
|
|
pub enum DesktopOrientation {
|
|
|
|
OrientationLandscape = 0,
|
|
|
|
OrientationLandscape = 0,
|
|
|
|
OrientationPortrait = 90, // 0x5a
|
|
|
|
OrientationPortrait = 90, // 0x5a
|
|
|
@ -416,21 +416,21 @@ pub enum DesktopOrientation {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.3.4
|
|
|
|
/// rdp-spec, section 2.2.1.3.4
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct CsNet {
|
|
|
|
pub struct CsNet {
|
|
|
|
pub channels: Vec<String>,
|
|
|
|
pub channels: Vec<String>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// generic structure
|
|
|
|
/// generic structure
|
|
|
|
/// cf. rdp-spec, section 2.2.1.3.4
|
|
|
|
/// cf. rdp-spec, section 2.2.1.3.4
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct CsUnknown {
|
|
|
|
pub struct CsUnknown {
|
|
|
|
pub typ: u16,
|
|
|
|
pub typ: u16,
|
|
|
|
pub data: Vec<u8>,
|
|
|
|
pub data: Vec<u8>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// rdp-spec, section 2.2.1.4
|
|
|
|
/// rdp-spec, section 2.2.1.4
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub struct McsConnectResponse {}
|
|
|
|
pub struct McsConnectResponse {}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================
|
|
|
|
// ==================
|
|
|
|