Struct Client

Source
pub struct Client<S> { /* private fields */ }
Expand description

x224 client

Implementations§

Source§

impl<S: Read + Write> Client<S>

Source

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()
Source

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
Source

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()
Source

pub fn get_selected_protocols(&self) -> Protocols

Getter for selected protocols

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V