From 1097ba31102c53ca7eda4f0aa57ce0e88c70209d Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Mon, 12 Feb 2018 01:53:54 +0000 Subject: [PATCH] Documentation updates - Update documentation about current support in the wire module - Ensure the possible panic is documented for Ipv6Option::data_mut - Add a Repr structure for Ethernet II headers --- src/lib.rs | 19 +++++++++++++++---- src/wire/ipv6option.rs | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cd8fb82..7c728b5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,8 +49,7 @@ //! The wire layer APIs also provide _tcpdump_-like pretty printing. //! //! ## The representation layer -//! The representation layer APIs are provided in the module [wire](wire/index.html); currently, -//! Ethernet, ARP, generic IP, IPv4, ICMPv4, TCP and UDP packet representations are provided. +//! The representation layer APIs are provided in the module [wire]. //! //! The representation layer exists to reduce the state space of raw packets. Raw packets //! may be nonsensical in a multitude of ways: invalid checksums, impossible combinations of flags, @@ -58,8 +57,7 @@ //! as well as any features not supported by _smoltcp_. //! //! ## The packet layer -//! The packet layer APIs are also provided in the module [wire](wire/index.html); currently, -//! Ethernet, ARP, IPv4, ICMPv4, TCP and UDP packet representations are provided. +//! The packet layer APIs are also provided in the module [wire]. //! //! The packet layer exists to provide a more structured way to work with packets than //! treating them as sequences of octets. It makes no judgement as to content of the packets, @@ -67,6 +65,19 @@ //! feature ever defined, to ensure that, when the representation layer is unable to make sense //! of a packet, it is still logged correctly and in full. //! +//! ## Packet and representation layer support +//! | Protocol | Packet | Representation | +//! |----------|--------|----------------| +//! | Ethernet | Yes | No | +//! | ARP | Yes | Yes | +//! | IPv4 | Yes | Yes | +//! | ICMPv4 | Yes | Yes | +//! | IPv6 | Yes | Yes | +//! | ICMPv6 | Yes | Yes | +//! | TCP | Yes | Yes | +//! | UDP | Yes | Yes | +//! +//! [wire]: wire/index.html //! [osi]: https://en.wikipedia.org/wiki/OSI_model //! [berk]: https://en.wikipedia.org/wiki/Berkeley_sockets diff --git a/src/wire/ipv6option.rs b/src/wire/ipv6option.rs index 5135013..7fe911d 100644 --- a/src/wire/ipv6option.rs +++ b/src/wire/ipv6option.rs @@ -154,6 +154,9 @@ impl + AsMut<[u8]>> Ipv6Option { impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> Ipv6Option<&'a mut T> { /// Return a mutable pointer to the option data. + /// + /// # Panics + /// This function panics if this is an 1-byte padding option. #[inline] pub fn data_mut(&mut self) -> &mut [u8] { let len = self.data_len();