1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! This library provides TFTP async implementation.
//!
//! Currently it implements only server side which can serve read
//! requests, which is the most prominent scenario used.
//!
//! The following RFCs are implemented:
//!
//! * [RFC 1350] - The TFTP Protocol (Revision 2).
//! * [RFC 2347] - TFTP Option Extension.
//! * [RFC 2348] - TFTP Blocksize Option.
//! * [RFC 2349] - TFTP Timeout Interval and Transfer Size Options.
//!
//! Features:
//!
//! * Async implementation.
//! * Serve read requests.
//! * Unlimited transfer file size (block number roll-over).
//! * You can set non-standard reply [`timeout`]. This is useful for faster
//!   file transfer in unstable environments.
//! * You can set [block size limit]. This is useful if you are accessing
//!   client through a VPN.
//! * You can implement your own [`Handler`] for more advance cases than
//!   just serving a directory.
//!
//! ### Example
//!
//! ```ignore
//! use async_tftp::server::TftpServerBuilder;
//! use async_tftp::Result;
//!
//! fn main() -> Result<()> {
//!    async_std::task::block_on(async {
//!        let tftpd = TftpServerBuilder::with_dir_ro(".")?.build().await?;
//!        tftpd.serve().await?;
//!        Ok(())
//!    })
//! }
//! ```
//!
//! [`timeout`]: server/struct.TftpServerBuilder.html#method.timeout
//! [block size limit]: server/struct.TftpServerBuilder.html#method.block_size_limit
//! [`Handler`]: server/trait.Handler.html
//! [RFC 1350]: https://tools.ietf.org/html/rfc1350
//! [RFC 2347]: https://tools.ietf.org/html/rfc2347
//! [RFC 2348]: https://tools.ietf.org/html/rfc2348
//! [RFC 2349]: https://tools.ietf.org/html/rfc2349

#[macro_use]
pub mod log;
pub mod server;

/// Packet definitions that are needed in public API.
pub mod packet;

mod bytes_ext;
mod error;
mod parse;
mod tests;

pub use crate::error::*;

/// Re-export of `async_trait:async_trait`.
pub use async_trait::async_trait;