1- use core:: fmt;
2- use std:: io;
3-
41use ironrdp_core:: {
52 Decode , DecodeErrorKind , DecodeResult , Encode , EncodeResult , ReadCursor , WriteCursor , cast_length, decode,
63 ensure_fixed_part_size, ensure_size, invalid_field_err,
74} ;
85use num_derive:: FromPrimitive ;
96use num_traits:: FromPrimitive ;
107
11- use crate :: PduError ;
12-
138pub mod conference_create;
149
1510mod cluster_data;
@@ -21,26 +16,22 @@ mod multi_transport_channel_data;
2116mod network_data;
2217mod security_data;
2318
24- pub use self :: cluster_data:: { ClientClusterData , ClusterDataError , RedirectionFlags , RedirectionVersion } ;
19+ pub use self :: cluster_data:: { ClientClusterData , RedirectionFlags , RedirectionVersion } ;
2520pub use self :: conference_create:: { ConferenceCreateRequest , ConferenceCreateResponse } ;
21+ pub use self :: core_data:: RdpVersion ;
2622pub use self :: core_data:: client:: {
2723 ClientColorDepth , ClientCoreData , ClientCoreOptionalData , ClientEarlyCapabilityFlags , ColorDepth , ConnectionType ,
2824 HighColorDepth , IME_FILE_NAME_SIZE , KeyboardType , SecureAccessSequence , SupportedColorDepths ,
2925} ;
3026pub use self :: core_data:: server:: { ServerCoreData , ServerCoreOptionalData , ServerEarlyCapabilityFlags } ;
31- pub use self :: core_data:: { CoreDataError , RdpVersion } ;
3227pub use self :: message_channel_data:: { ClientMessageChannelData , ServerMessageChannelData } ;
3328pub use self :: monitor_data:: {
3429 ClientMonitorData , MONITOR_COUNT_SIZE , MONITOR_FLAGS_SIZE , MONITOR_SIZE , Monitor , MonitorFlags ,
3530} ;
3631pub use self :: monitor_extended_data:: { ClientMonitorExtendedData , ExtendedMonitorInfo , MonitorOrientation } ;
3732pub use self :: multi_transport_channel_data:: { MultiTransportChannelData , MultiTransportFlags } ;
38- pub use self :: network_data:: {
39- ChannelDef , ChannelName , ChannelOptions , ClientNetworkData , NetworkDataError , ServerNetworkData ,
40- } ;
41- pub use self :: security_data:: {
42- ClientSecurityData , EncryptionLevel , EncryptionMethod , SecurityDataError , ServerSecurityData ,
43- } ;
33+ pub use self :: network_data:: { ChannelDef , ChannelName , ChannelOptions , ClientNetworkData , ServerNetworkData } ;
34+ pub use self :: security_data:: { ClientSecurityData , EncryptionLevel , EncryptionMethod , ServerSecurityData } ;
4435
4536macro_rules! user_header_try {
4637 ( $e: expr) => {
@@ -355,94 +346,3 @@ impl UserDataHeader {
355346 Ok ( ( block_type, src. read_slice ( len) ) )
356347 }
357348}
358-
359- #[ derive( Debug ) ]
360- pub enum GccError {
361- IOError ( io:: Error ) ,
362- CoreError ( CoreDataError ) ,
363- SecurityError ( SecurityDataError ) ,
364- NetworkError ( NetworkDataError ) ,
365- ClusterError ( ClusterDataError ) ,
366- InvalidGccType ,
367- InvalidConferenceCreateRequest ( String ) ,
368- InvalidConferenceCreateResponse ( String ) ,
369- RequiredClientDataBlockIsAbsent ( ClientGccType ) ,
370- RequiredServerDataBlockIsAbsent ( ServerGccType ) ,
371- Pdu ( PduError ) ,
372- }
373-
374- impl fmt:: Display for GccError {
375- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
376- match self {
377- Self :: IOError ( _) => f. write_str ( "IO error" ) ,
378- Self :: CoreError ( _) => f. write_str ( "core data block error" ) ,
379- Self :: SecurityError ( _) => f. write_str ( "security data block error" ) ,
380- Self :: NetworkError ( _) => f. write_str ( "network data block error" ) ,
381- Self :: ClusterError ( _) => f. write_str ( "cluster data block error" ) ,
382- Self :: InvalidGccType => f. write_str ( "invalid GCC block type" ) ,
383- Self :: InvalidConferenceCreateRequest ( s) => write ! ( f, "invalid conference create request: {s}" ) ,
384- Self :: InvalidConferenceCreateResponse ( s) => write ! ( f, "invalid Conference create response: {s}" ) ,
385- Self :: RequiredClientDataBlockIsAbsent ( ty) => {
386- write ! ( f, "a server did not send the required GCC data block: {ty:?}" )
387- }
388- Self :: RequiredServerDataBlockIsAbsent ( ty) => {
389- write ! ( f, "a client did not send the required GCC data block: {ty:?}" )
390- }
391- Self :: Pdu ( e) => write ! ( f, "PDU error: {e}" ) ,
392- }
393- }
394- }
395-
396- impl core:: error:: Error for GccError {
397- fn source ( & self ) -> Option < & ( dyn core:: error:: Error + ' static ) > {
398- match self {
399- Self :: IOError ( e) => Some ( e) ,
400- Self :: CoreError ( e) => Some ( e) ,
401- Self :: SecurityError ( e) => Some ( e) ,
402- Self :: NetworkError ( e) => Some ( e) ,
403- Self :: ClusterError ( e) => Some ( e) ,
404- Self :: InvalidGccType
405- | Self :: InvalidConferenceCreateRequest ( _)
406- | Self :: InvalidConferenceCreateResponse ( _)
407- | Self :: RequiredClientDataBlockIsAbsent ( _)
408- | Self :: RequiredServerDataBlockIsAbsent ( _)
409- | Self :: Pdu ( _) => None ,
410- }
411- }
412- }
413-
414- impl From < io:: Error > for GccError {
415- fn from ( e : io:: Error ) -> Self {
416- Self :: IOError ( e)
417- }
418- }
419-
420- impl From < CoreDataError > for GccError {
421- fn from ( e : CoreDataError ) -> Self {
422- Self :: CoreError ( e)
423- }
424- }
425-
426- impl From < SecurityDataError > for GccError {
427- fn from ( e : SecurityDataError ) -> Self {
428- Self :: SecurityError ( e)
429- }
430- }
431-
432- impl From < NetworkDataError > for GccError {
433- fn from ( e : NetworkDataError ) -> Self {
434- Self :: NetworkError ( e)
435- }
436- }
437-
438- impl From < ClusterDataError > for GccError {
439- fn from ( e : ClusterDataError ) -> Self {
440- Self :: ClusterError ( e)
441- }
442- }
443-
444- impl From < PduError > for GccError {
445- fn from ( e : PduError ) -> Self {
446- Self :: Pdu ( e)
447- }
448- }
0 commit comments