1#![allow(unused_parens)]
4
5pub mod cancel;
6pub mod compressed;
7pub mod create;
8pub mod dfsc;
9pub mod echo;
10pub mod encrypted;
11pub mod error;
12pub mod file;
13pub mod header;
14pub mod info;
15pub mod ioctl;
16pub mod lock;
17pub mod message;
18pub mod negotiate;
19pub mod notify;
20pub mod oplock;
21pub mod plain;
22pub mod query_dir;
23pub mod session_setup;
24pub mod smb1;
25pub mod tree_connect;
26
27pub use cancel::*;
28pub use compressed::*;
29pub use create::*;
30pub use dfsc::*;
31pub use echo::*;
32pub use encrypted::*;
33pub use error::*;
34pub use file::*;
35pub use header::*;
36pub use info::*;
37pub use ioctl::*;
38pub use lock::*;
39pub use message::*;
40pub use negotiate::*;
41pub use notify::*;
42pub use oplock::*;
43pub use plain::*;
44pub use query_dir::*;
45pub use session_setup::*;
46pub use tree_connect::*;
47
48#[cfg(test)]
49mod test;
50#[cfg(test)]
51use test::*;
52
53use thiserror::Error;
54#[derive(Error, Debug)]
56pub enum SmbMsgError {
57 #[error("Error code definition not found for NT Status code: {0:#x}")]
58 MissingErrorCodeDefinition(u32),
59
60 #[error("FSCTL definition not found for FSCTL code: {0:#x}")]
61 MissingFsctlDefinition(u32),
62
63 #[error("Unexpected content: {0} - expected {1}", actual, expected)]
66 UnexpectedContent {
67 actual: &'static str,
68 expected: &'static str,
69 },
70
71 #[error("Invalid negotiate dialect cast to dialect: {0:?}")]
72 InvalidDialect(NegotiateDialect),
73
74 #[error("Binary read/write error: {0}")]
75 BinRWError(#[from] binrw::Error),
76}
77
78type Result<T> = std::result::Result<T, SmbMsgError>;