pub struct Client<S> { /* private fields */ }
Expand description
x224 client
Implementations§
Source§impl<S: Read + Write> Client<S>
impl<S: Read + Write> Client<S>
Sourcepub fn write<T>(&mut self, message: T) -> RdpResult<()>where
T: Message + 'static,
pub fn write<T>(&mut self, message: T) -> RdpResult<()>where
T: Message + 'static,
Send a new x224 formated message using the underlying layer
§Example
ⓘ
let addr = "127.0.0.1:3389".parse::<SocketAddr>().unwrap();
let mut tpkt = tpkt::Client(Stream::Raw(TcpStream::connect(&addr).unwrap()));
let mut connector = x224::Connector::new(tpkt);
let mut x224 = connector.connect(
Protocols::ProtocolSSL as u32 Protocols::Hybrid as u32,
Some(&mut Ntlm::new("domain".to_string(), "username".to_string(), "password".to_string())
).unwrap();
x224.write(trame![U16::LE(0)]).unwrap()
Sourcepub fn read(&mut self) -> RdpResult<Payload>
pub fn read(&mut self) -> RdpResult<Payload>
Start reading an entire X224 paylaod This function act to return a valid x224 payload or a fastpath payload coming from directly underlying layer
§Example
ⓘ
let addr = "127.0.0.1:3389".parse::<SocketAddr>().unwrap();
let mut tpkt = tpkt::Client(Stream::Raw(TcpStream::connect(&addr).unwrap()));
let mut connector = x224::Connector::new(tpkt);
let mut x224 = connector.connect(
Protocols::ProtocolSSL as u32 Protocols::Hybrid as u32,
Some(&mut Ntlm::new("domain".to_string(), "username".to_string(), "password".to_string())
).unwrap();
let payload = x224.read().unwrap(); // you have to check the type
Sourcepub fn connect(
tpkt: Client<S>,
security_protocols: u32,
check_certificate: bool,
authentication_protocol: Option<&mut dyn AuthenticationProtocol>,
restricted_admin_mode: bool,
blank_creds: bool,
) -> RdpResult<Client<S>>
pub fn connect( tpkt: Client<S>, security_protocols: u32, check_certificate: bool, authentication_protocol: Option<&mut dyn AuthenticationProtocol>, restricted_admin_mode: bool, blank_creds: bool, ) -> RdpResult<Client<S>>
Launch the connection sequence of the x224 stack It will start security protocol negotiation At the end it will produce a valid x224 layer
security_protocols is a valid mix of Protocols RDP -> Protocols::ProtocolRDP as u32 NOT implemented SSL -> Protocols::ProtocolSSL as u32 NLA -> Protocols::ProtocolSSL as u32 Protocols::Hybrid as u32
If NLA we need to provide an authentication protocol
§Example
ⓘ
// SSL Security layer
x224::Connector::connect(
tpkt,
Protocols::ProtocolSSL as u32,
None,
false
).unwrap();
// NLA security Layer
x224::Client::connect(
tpkt,
Protocols::ProtocolSSL as u32 Protocols::Hybrid as u32,
Some(&mut Ntlm::new("domain".to_string(), "username".to_string(), "password".to_string()),
false
).unwrap()
Sourcepub fn get_selected_protocols(&self) -> Protocols
pub fn get_selected_protocols(&self) -> Protocols
Getter for selected protocols
pub fn shutdown(&mut self) -> RdpResult<()>
Auto Trait Implementations§
impl<S> Freeze for Client<S>where
S: Freeze,
impl<S> RefUnwindSafe for Client<S>where
S: RefUnwindSafe,
impl<S> Send for Client<S>where
S: Send,
impl<S> Sync for Client<S>where
S: Sync,
impl<S> Unpin for Client<S>where
S: Unpin,
impl<S> UnwindSafe for Client<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more