From a62e0c10aed3639aedb0c228c7685926b391aae8 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sun, 3 Mar 2019 14:02:17 +0100 Subject: Implement Transfer Size Option (RFC 2349, part 2) --- src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 6a45eeb..f9fc57e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,6 +24,7 @@ pub enum Opcodes { pub struct TftpOptions { blksize: usize, timeout: u8, + tsize: usize, } pub struct Tftp { @@ -34,6 +35,7 @@ fn default_options() -> TftpOptions { TftpOptions { blksize: 512, timeout: 3, + tsize: 0, } } @@ -142,6 +144,15 @@ impl Tftp { _ => false } } + "tsize" => { + match val.parse() { + Ok(t) => { + self.options.tsize = t; + true + } + _ => false + } + } _ => false } }); -- cgit v1.2.3