Crates.io | rfc2217-rs |
lib.rs | rfc2217-rs |
version | 0.1.0 |
source | src |
created_at | 2022-12-19 17:19:16.448313 |
updated_at | 2022-12-19 17:19:16.448313 |
description | IETF RFC2217 implementation in Rust |
homepage | |
repository | https://github.com/esp-rs/rfc2217-rs |
max_upload_size | |
id | 741422 |
size | 76,073 |
rfc2217-rs is an IETF RFC2217 implementation in rust, enabling Com Port functionality over TCP/IP connections.
IETF RFC2217 defines a Telnet extension providing serial port functionality. It was initially intended to be used with modems, serial printers, fax machines and similar equipment, but it provides the ability to connect any serial based device to the network.
This library provides a server implementation, a protocol parser and data structures with binary serialization/deserialization support.
The library is std
and no_std
compatible, however the server implementation is only available in the std
mode. To use the library in no_std
mode, set the std
feature to false
.
use rfc2217_rs::Server;
// --snip--
let mut server = Server::new("/dev/ttyUSB1", "127.0.0.1:7878").unwrap();
// --snip--
loop {
let result = server.run();
if let Err(error) == result {
handle_err(error);
}
}
use rfc2217_rs::Parser;
use rfc2217_rs::parser::Event;
// --snip--
let mut parser = Parser::new();
// --snip--
loop {
// --snip--
let result = parser.process_byte(byte);
match result {
Ok(event) => handle_event(event),
Err(error) => handle_error(error),
}
}
use rfc2217_rs::Command;
// --snip--
let command_buf = [0; command::SIZE];
let command = Command::NoOp;
command.serialize(&mut command_buf);
let deserialized_command = Command::deserialize(&command_buf);
Licensed under either of:
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.