[−][src]Struct libtelnet_rs::Parser
A telnet parser that handles the main parts of the protocol.
Fields
options: CompatibilityTableMethods
impl Parser[src]
pub fn new() -> Self[src]
Create a default, empty Parser.
pub fn with_support(table: CompatibilityTable) -> Self[src]
Create a parser, directly supplying a CompatibilityTable.
pub fn add_hooks<E: TelnetEvents + 'static>(&mut self, hook: E)[src]
Add a struct that implements the event hooks called when processing.
Arguments
hook - A struct implementing the TelnetEvents trait.
pub fn receive(&mut self, data: &[u8])[src]
Receive bytes into the internal buffer.
Arguments
data- The bytes to be received. This should be sourced from the remote side of a connection.
pub fn escape_iac(data: Vec<u8>) -> Vec<u8>[src]
Escape IAC bytes in data that is to be transmitted and treated as a non-IAC sequence.
Example
[255, 1, 6, 2] -> [255, 255, 1, 6, 2]
pub fn unescape_iac(data: Vec<u8>) -> Vec<u8>[src]
Reverse escaped IAC bytes for non-IAC sequences and data.
Example
[255, 255, 1, 6, 2] -> [255, 1, 6, 2]
pub fn negotiate(&mut self, command: u8, option: u8)[src]
Negotiate an option.
Arguments
command - A u8 representing the telnet command code to be negotiated with. Example: WILL (251), WONT (252), DO (253), DONT (254)
option - A u8 representing the telnet option code that is being negotiated.
Usage
This and other methods meant for sending data to the remote end will generate a TelnetEvents::Send(DataEvent) event.
These Send events contain a buffer that should be sent directly to the remote end, as it will have already been encoded properly.
pub fn _will(&mut self, option: u8)[src]
Indicate to the other side that you are able and wanting to utilize an option.
Arguments
option - A u8 representing the telnet option code that you want to enable locally.
Notes
This method will do nothing if the option is not "supported" locally via the CompatibilityTable.
pub fn _wont(&mut self, option: u8)[src]
Indicate to the other side that you are not wanting to utilize an option.
Arguments
option - A u8 representing the telnet option code that you want to disable locally.
pub fn _do(&mut self, option: u8)[src]
Indicate to the other side that you would like them to utilize an option.
Arguments
option - A u8 representing the telnet option code that you want to enable remotely.
Notes
This method will do nothing if the option is not "supported" remotely via the CompatibilityTable.
pub fn _dont(&mut self, option: u8)[src]
Indicate to the other side that you would like them to stop utilizing an option.
Arguments
option - A u8 representing the telnet option code that you want to disable remotely.
pub fn subnegotiation(&mut self, option: u8, data: Vec<u8>)[src]
Send a subnegotiation for a locally supported option.
Arguments
option - A u8 representing the telnet option code for the negotiation.
data - A Vec<u8> containing the data to be sent in the subnegotiation. This data will have all IAC (255) byte values escaped.
Notes
This method will do nothing if the option is not "supported" locally via the CompatibilityTable.
pub fn subnegotiation_text(&mut self, option: u8, text: &str)[src]
Send a subnegotiation for a locally supported option, using a string instead of raw byte values.
Arguments
option - A u8 representing the telnet option code for the negotiation.
text - A &str representing the text to be sent in the subnegotation. This data will have all IAC (255) byte values escaped.
Notes
This method will do nothing if the option is not "supported" locally via the CompatibilityTable.
pub fn send(&mut self, data: &[u8])[src]
Directly send a buffer to the remote end.
Notes
The buffer supplied here will NOT be escaped. It is recommended to avoid using this method in favor of the more specialized methods.
pub fn send_text(&mut self, text: &str)[src]
Directly send a string, with appended \r\n, to the remote end, along with an IAC (255) GOAHEAD (249) sequence.
Notes
The string will have IAC (255) bytes escaped before being sent.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Parser
impl !Send for Parser
impl !Sync for Parser
impl Unpin for Parser
impl !UnwindSafe for Parser
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,