#[non_exhaustive]pub struct TftpMessage {
pub opcode: TftpOpcode,
pub filename: Option<String>,
pub mode: Option<TftpMode>,
pub block: Option<u16>,
pub data_len: Option<usize>,
pub error_code: Option<TftpErrorCode>,
pub error_message: Option<String>,
}Available on crate feature
tftp only.Expand description
One parsed TFTP packet. Field semantics depend on
TftpMessage::opcode.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.opcode: TftpOpcodeThe 2-byte opcode at the start of every TFTP packet.
filename: Option<String>RRQ / WRQ: requested file name. Always None for the
other opcodes.
mode: Option<TftpMode>RRQ / WRQ: transfer mode (netascii / octet / mail).
Always None for the other opcodes.
block: Option<u16>DATA / ACK: block number (1-based).
data_len: Option<usize>DATA: payload byte length. We don’t surface the bytes (too large), just the size — useful for transfer-volume counting.
error_code: Option<TftpErrorCode>ERROR: error code (RFC 1350 §5).
error_message: Option<String>ERROR: human-readable message.
Implementations§
Source§impl TftpMessage
impl TftpMessage
Sourcepub fn is_device_config_transfer(&self) -> bool
pub fn is_device_config_transfer(&self) -> bool
true when this is a read or write request for a
device-config-shaped filename — heuristic match for
the strings Cisco / Juniper / Arista boxes use:
running-config, startup-config, confg, .cfg
suffix, .conf suffix. Operationally a useful
config-theft IOC.
Trait Implementations§
Source§impl Clone for TftpMessage
impl Clone for TftpMessage
Source§fn clone(&self) -> TftpMessage
fn clone(&self) -> TftpMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TftpMessage
impl Debug for TftpMessage
Source§impl<'de> Deserialize<'de> for TftpMessage
impl<'de> Deserialize<'de> for TftpMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TftpMessage
Source§impl Hash for TftpMessage
impl Hash for TftpMessage
Source§impl PartialEq for TftpMessage
impl PartialEq for TftpMessage
Source§impl Serialize for TftpMessage
impl Serialize for TftpMessage
impl StructuralPartialEq for TftpMessage
Auto Trait Implementations§
impl Freeze for TftpMessage
impl RefUnwindSafe for TftpMessage
impl Send for TftpMessage
impl Sync for TftpMessage
impl Unpin for TftpMessage
impl UnsafeUnpin for TftpMessage
impl UnwindSafe for TftpMessage
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.