Browse Source

fix: fix typos (comments, structs, enums and docs)

Thibaut Vandervelden 1 year ago
parent
commit
7ce551db03

+ 2 - 2
CHANGELOG.md

@@ -114,7 +114,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Minimum Supported Rust Version (MSRV) **bumped** from 1.40 to 1.56
 - Add support for IEEE 802.15.4 + 6LoWPAN medium ([#469](https://github.com/smoltcp-rs/smoltcp/pull/469))
 - Add support for IP medium ([#401](https://github.com/smoltcp-rs/smoltcp/pull/401))
-- Add `defmt` logging supprt ([#455](https://github.com/smoltcp-rs/smoltcp/pull/455))
+- Add `defmt` logging support ([#455](https://github.com/smoltcp-rs/smoltcp/pull/455))
 - Add RNG infrastructure ([#547](https://github.com/smoltcp-rs/smoltcp/pull/547), [#573](https://github.com/smoltcp-rs/smoltcp/pull/573))
 - Add `Context` struct that must be passed to some socket methods ([#500](https://github.com/smoltcp-rs/smoltcp/pull/500))
 - Remove `SocketSet`, sockets are owned by `Interface` now. ([#557](https://github.com/smoltcp-rs/smoltcp/pull/557), [#571](https://github.com/smoltcp-rs/smoltcp/pull/571))
@@ -168,7 +168,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ## [0.7.4] - 2021-06-11
 
 - tcp: fix "subtract sequence numbers with underflow" on remote window shrink. ([#490](https://github.com/smoltcp-rs/smoltcp/pull/490))
-- tcp: fix substract with overflow when receiving a SYNACK with unincremented ACK number. ([#491](https://github.com/smoltcp-rs/smoltcp/pull/491))
+- tcp: fix subtract with overflow when receiving a SYNACK with unincremented ACK number. ([#491](https://github.com/smoltcp-rs/smoltcp/pull/491))
 - tcp: use nonzero initial sequence number to workaround misbehaving servers. ([#492](https://github.com/smoltcp-rs/smoltcp/pull/492))
 
 ## [0.7.3] - 2021-05-29

+ 1 - 1
examples/sixlowpan.rs

@@ -1,4 +1,4 @@
-//! 6lowpan exmaple
+//! 6lowpan example
 //!
 //! This example is designed to run using the Linux ieee802154/6lowpan support,
 //! using mac802154_hwsim.

+ 1 - 1
examples/sixlowpan_benchmark.rs

@@ -1,4 +1,4 @@
-//! 6lowpan benchmark exmaple
+//! 6lowpan benchmark example
 //!
 //! This example runs a simple TCP throughput benchmark using the 6lowpan implementation in smoltcp
 //! It is designed to run using the Linux ieee802154/6lowpan support,

+ 1 - 1
src/iface/interface/igmp.rs

@@ -34,7 +34,7 @@ impl std::error::Error for MulticastError {}
 impl Interface {
     /// Add an address to a list of subscribed multicast IP addresses.
     ///
-    /// Returns `Ok(announce_sent)` if the address was added successfully, where `annouce_sent`
+    /// Returns `Ok(announce_sent)` if the address was added successfully, where `announce_sent`
     /// indicates whether an initial immediate announcement has been sent.
     pub fn join_multicast_group<D, T: Into<IpAddress>>(
         &mut self,

+ 4 - 4
src/iface/interface/tests/ipv4.rs

@@ -399,7 +399,7 @@ fn test_handle_valid_arp_request(#[case] medium: Medium) {
         }))
     );
 
-    // Ensure the address of the requestor was entered in the cache
+    // Ensure the address of the requester was entered in the cache
     assert_eq!(
         iface.inner.lookup_hardware_addr(
             MockTxToken,
@@ -448,7 +448,7 @@ fn test_handle_other_arp_request(#[case] medium: Medium) {
         None
     );
 
-    // Ensure the address of the requestor was NOT entered in the cache
+    // Ensure the address of the requester was NOT entered in the cache
     assert_eq!(
         iface.inner.lookup_hardware_addr(
             MockTxToken,
@@ -507,7 +507,7 @@ fn test_arp_flush_after_update_ip(#[case] medium: Medium) {
         }))
     );
 
-    // Ensure the address of the requestor was entered in the cache
+    // Ensure the address of the requester was entered in the cache
     assert_eq!(
         iface.inner.lookup_hardware_addr(
             MockTxToken,
@@ -906,7 +906,7 @@ fn test_icmp_reply_size(#[case] medium: Medium) {
     let dst_addr = Ipv4Address([192, 168, 1, 2]);
 
     // UDP packet that if not tructated will cause a icmp port unreachable reply
-    // to exeed the minimum mtu bytes in length.
+    // to exceed the minimum mtu bytes in length.
     let udp_repr = UdpRepr {
         src_port: 67,
         dst_port: 68,

+ 2 - 2
src/iface/interface/tests/ipv6.rs

@@ -611,7 +611,7 @@ fn test_handle_valid_ndisc_request(#[case] medium: Medium) {
         )))
     );
 
-    // Ensure the address of the requestor was entered in the cache
+    // Ensure the address of the requester was entered in the cache
     assert_eq!(
         iface.inner.lookup_hardware_addr(
             MockTxToken,
@@ -675,7 +675,7 @@ fn test_icmp_reply_size(#[case] medium: Medium) {
     let dst_addr = Ipv6Address::new(0xfe80, 0, 0, 0, 0, 0, 0, 2);
 
     // UDP packet that if not tructated will cause a icmp port unreachable reply
-    // to exeed the minimum mtu bytes in length.
+    // to exceed the minimum mtu bytes in length.
     let udp_repr = UdpRepr {
         src_port: 67,
         dst_port: 68,

+ 3 - 3
src/iface/rpl/trickle.rs

@@ -1,6 +1,6 @@
 //! Implementation of the Trickle timer defined in [RFC 6206]. The algorithm allows node in a lossy
 //! shared medium to exchange information in a highly robust, energy efficient, simple, and
-//! scalable manner. Dynamicaly adjusting transmission windows allows Trickle to spread new
+//! scalable manner. Dynamically adjusting transmission windows allows Trickle to spread new
 //! information fast while sending only a few messages per hour when information does not change.
 //!
 //! **NOTE**: the constants used for the default Trickle timer are the ones from the [Enhanced
@@ -76,7 +76,7 @@ impl TrickleTimer {
         timer
     }
 
-    /// Poll the Trickle timer. Returns `true` when the Trickle timer singals that a message can be
+    /// Poll the Trickle timer. Returns `true` when the Trickle timer signals that a message can be
     /// transmitted. This happens when the Trickle timer expires.
     pub(crate) fn poll(&mut self, now: Instant, rand: &mut Rand) -> bool {
         let can_transmit = self.can_transmit() && self.t_expired(now);
@@ -212,7 +212,7 @@ mod tests {
             if now < trickle.i_exp && now < Instant::ZERO + trickle.min_expiration() {
                 assert_eq!(trickle.counter, 1);
             } else {
-                // The first interval expired, so the conter is reset.
+                // The first interval expired, so the counter is reset.
                 assert_eq!(trickle.counter, 0);
             }
 

+ 1 - 1
src/socket/dhcpv4.rs

@@ -551,7 +551,7 @@ impl<'a> Socket<'a> {
         const MAX_IPV4_HEADER_LEN: usize = 60;
 
         // We don't directly modify self.transaction_id because sending the packet
-        // may fail. We only want to update state after succesfully sending.
+        // may fail. We only want to update state after successfully sending.
         let next_transaction_id = Self::random_transaction_id(cx);
 
         let mut dhcp_repr = DhcpRepr {

+ 1 - 1
src/socket/tcp.rs

@@ -5518,7 +5518,7 @@ mod test {
         let mut s = socket_established();
         s.remote_mss = 6;
 
-        // Normal ACK of previously recived segment
+        // Normal ACK of previously received segment
         send!(s, time 0, TcpRepr {
             seq_number: REMOTE_SEQ + 1,
             ack_number: Some(LOCAL_SEQ + 1),

+ 1 - 1
src/storage/assembler.rs

@@ -197,7 +197,7 @@ impl Assembler {
     }
 
     /// Add a new contiguous range to the assembler,
-    /// or return `Err(TooManyHolesError)` if too many discontiguities are already recorded.
+    /// or return `Err(TooManyHolesError)` if too many discontinuities are already recorded.
     pub fn add(&mut self, mut offset: usize, size: usize) -> Result<(), TooManyHolesError> {
         if size == 0 {
             return Ok(());

+ 1 - 1
src/storage/packet_buffer.rs

@@ -390,7 +390,7 @@ mod test {
     fn clear() {
         let mut buffer = buffer();
 
-        // Ensure enqueuing data in teh buffer fills it somewhat.
+        // Ensure enqueuing data in the buffer fills it somewhat.
         assert!(buffer.is_empty());
         assert!(buffer.enqueue(6, ()).is_ok());
 

+ 1 - 1
src/wire/dhcpv4.rs

@@ -169,7 +169,7 @@ pub(crate) mod field {
     pub const OPT_MAX_DATAGRAM_REASSEMBLY_SIZE: u8 = 22;
     pub const OPT_DEFAULT_TTL: u8 = 23;
     pub const OPT_PATH_MTU_AGING_TIMEOUT: u8 = 24;
-    pub const OPT_PATH_MTU_PLATEU_TABLE: u8 = 25;
+    pub const OPT_PATH_MTU_PLATEAU_TABLE: u8 = 25;
 
     // IP Layer Parameters per Interface
     pub const OPT_INTERFACE_MTU: u8 = 26;

+ 1 - 1
src/wire/dns.rs

@@ -190,7 +190,7 @@ impl<T: AsRef<[u8]>> Packet<T> {
                     }
 
                     // RFC1035 says: "In this scheme, an entire domain name or a list of labels at
-                    //      the end of a domain name is replaced with a pointer to a ***prior*** occurance
+                    //      the end of a domain name is replaced with a pointer to a ***prior*** occurrence
                     //      of the same name.
                     //
                     // Is it unclear if this means the pointer MUST point backwards in the packet or not. Either way,

+ 1 - 1
src/wire/icmpv6.rs

@@ -325,7 +325,7 @@ impl<T: AsRef<[u8]>> Packet<T> {
                 }
                 super::rpl::RplControlMessage::SecureDodagInformationSolicitation
                 | super::rpl::RplControlMessage::SecureDodagInformationObject
-                | super::rpl::RplControlMessage::SecureDesintationAdvertismentObject
+                | super::rpl::RplControlMessage::SecureDestinationAdvertisementObject
                 | super::rpl::RplControlMessage::SecureDestinationAdvertisementObjectAck
                 | super::rpl::RplControlMessage::ConsistencyCheck => return Err(Error),
                 super::rpl::RplControlMessage::Unknown(_) => return Err(Error),

+ 1 - 1
src/wire/ipv6hbh.rs

@@ -78,7 +78,7 @@ impl<'a> Repr<'a> {
             let option = option?;
 
             if let Err(e) = options.push(option) {
-                net_trace!("eror when parsing hop-by-hop options: {}", e);
+                net_trace!("error when parsing hop-by-hop options: {}", e);
                 break;
             }
         }

+ 2 - 2
src/wire/mod.rs

@@ -336,7 +336,7 @@ impl HardwareAddress {
         }
     }
 
-    /// Query wether the address is an unicast address.
+    /// Query whether the address is an unicast address.
     pub fn is_unicast(&self) -> bool {
         match self {
             #[cfg(feature = "medium-ip")]
@@ -348,7 +348,7 @@ impl HardwareAddress {
         }
     }
 
-    /// Query wether the address is a broadcast address.
+    /// Query whether the address is a broadcast address.
     pub fn is_broadcast(&self) -> bool {
         match self {
             #[cfg(feature = "medium-ip")]

+ 20 - 20
src/wire/rpl.rs

@@ -57,7 +57,7 @@ impl InstanceId {
 
     /// Returns `true` when the DODAG ID is the source address of the IPv6 packet.
     ///
-    /// *NOTE*: this only makes sence when using a local RPL Instance ID and the packet is not a
+    /// *NOTE*: this only makes sense when using a local RPL Instance ID and the packet is not a
     /// RPL control message.
     #[inline]
     pub fn dodag_is_source(&self) -> bool {
@@ -85,7 +85,7 @@ mod field {
     //pub const DIO_RESERVED: usize = 11;
     pub const DIO_DODAG_ID: Field = 12..12 + 16;
 
-    // Destination advertisment object (DAO)
+    // Destination advertisement object (DAO)
     pub const DAO_K: usize = 5;
     pub const DAO_D: usize = 5;
     //pub const DAO_FLAGS: usize = 5;
@@ -93,7 +93,7 @@ mod field {
     pub const DAO_SEQUENCE: usize = 7;
     pub const DAO_DODAG_ID: Field = 8..8 + 16;
 
-    // Destination advertisment object ack (DAO-ACK)
+    // Destination advertisement object ack (DAO-ACK)
     pub const DAO_ACK_D: usize = 5;
     //pub const DAO_ACK_RESERVED: usize = 5;
     pub const DAO_ACK_SEQUENCE: usize = 6;
@@ -110,7 +110,7 @@ enum_with_unknown! {
         DestinationAdvertisementObjectAck = 0x03,
         SecureDodagInformationSolicitation = 0x80,
         SecureDodagInformationObject = 0x81,
-        SecureDesintationAdvertismentObject = 0x82,
+        SecureDestinationAdvertisementObject = 0x82,
         SecureDestinationAdvertisementObjectAck = 0x83,
         ConsistencyCheck = 0x8a,
     }
@@ -126,11 +126,11 @@ impl core::fmt::Display for RplControlMessage {
                 write!(f, "DODAG information object (DIO)")
             }
             RplControlMessage::DestinationAdvertisementObject => {
-                write!(f, "destination advertisment object (DAO)")
+                write!(f, "destination advertisement object (DAO)")
             }
             RplControlMessage::DestinationAdvertisementObjectAck => write!(
                 f,
-                "destination advertisment object acknowledgement (DAO-ACK)"
+                "destination advertisement object acknowledgement (DAO-ACK)"
             ),
             RplControlMessage::SecureDodagInformationSolicitation => {
                 write!(f, "secure DODAG information solicitation (DIS)")
@@ -138,12 +138,12 @@ impl core::fmt::Display for RplControlMessage {
             RplControlMessage::SecureDodagInformationObject => {
                 write!(f, "secure DODAG information object (DIO)")
             }
-            RplControlMessage::SecureDesintationAdvertismentObject => {
-                write!(f, "secure destination advertisment object (DAO)")
+            RplControlMessage::SecureDestinationAdvertisementObject => {
+                write!(f, "secure destination advertisement object (DAO)")
             }
             RplControlMessage::SecureDestinationAdvertisementObjectAck => write!(
                 f,
-                "secure destination advertisment object acknowledgement (DAO-ACK)"
+                "secure destination advertisement object acknowledgement (DAO-ACK)"
             ),
             RplControlMessage::ConsistencyCheck => write!(f, "consistency check (CC)"),
             RplControlMessage::Unknown(id) => write!(f, "{}", id),
@@ -190,7 +190,7 @@ impl<'p, T: AsRef<[u8]> + ?Sized> Packet<&'p T> {
             }
             RplControlMessage::SecureDodagInformationSolicitation
             | RplControlMessage::SecureDodagInformationObject
-            | RplControlMessage::SecureDesintationAdvertismentObject
+            | RplControlMessage::SecureDestinationAdvertisementObject
             | RplControlMessage::SecureDestinationAdvertisementObjectAck
             | RplControlMessage::ConsistencyCheck => return Err(Error),
             RplControlMessage::Unknown(_) => return Err(Error),
@@ -215,7 +215,7 @@ impl<'p, T: AsRef<[u8]> + ?Sized> Packet<&'p T> {
             }
             RplControlMessage::SecureDodagInformationSolicitation
             | RplControlMessage::SecureDodagInformationObject
-            | RplControlMessage::SecureDesintationAdvertismentObject
+            | RplControlMessage::SecureDestinationAdvertisementObject
             | RplControlMessage::SecureDestinationAdvertisementObjectAck
             | RplControlMessage::ConsistencyCheck => unreachable!(),
             RplControlMessage::Unknown(_) => unreachable!(),
@@ -257,7 +257,7 @@ impl<'p, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> Packet<&'p mut T> {
             }
             RplControlMessage::SecureDodagInformationSolicitation
             | RplControlMessage::SecureDodagInformationObject
-            | RplControlMessage::SecureDesintationAdvertismentObject
+            | RplControlMessage::SecureDestinationAdvertisementObject
             | RplControlMessage::SecureDestinationAdvertisementObjectAck
             | RplControlMessage::ConsistencyCheck => todo!("Secure messages not supported"),
             RplControlMessage::Unknown(_) => todo!(),
@@ -368,7 +368,7 @@ impl<T: AsRef<[u8]>> Packet<T> {
         get!(self.buffer, field: field::DIO_PRF, mask: 0b111)
     }
 
-    /// Return the destination advertisment trigger sequence number.
+    /// Return the destination advertisement trigger sequence number.
     #[inline]
     pub fn dio_dest_adv_trigger_seq_number(&self) -> u8 {
         get!(self.buffer, field: field::DIO_DTSN)
@@ -419,7 +419,7 @@ impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
         set!(self.buffer, value, field: field::DIO_PRF, mask: 0b111)
     }
 
-    /// Set the destination advertisment trigger sequence number.
+    /// Set the destination advertisement trigger sequence number.
     #[inline]
     pub fn set_dio_dest_adv_trigger_seq_number(&mut self, value: u8) {
         set!(self.buffer, value, field: field::DIO_DTSN)
@@ -432,7 +432,7 @@ impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
     }
 }
 
-/// Getters for the Destination Advertisment Object (DAO) message.
+/// Getters for the Destination Advertisement Object (DAO) message.
 ///
 /// ```txt
 ///  0                   1                   2                   3
@@ -483,7 +483,7 @@ impl<T: AsRef<[u8]>> Packet<T> {
     }
 }
 
-/// Setters for the Destination Advertisment Object (DAO) message.
+/// Setters for the Destination Advertisement Object (DAO) message.
 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
     /// Set the Expect DAO-ACK flag.
     #[inline]
@@ -518,7 +518,7 @@ impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
     }
 }
 
-/// Getters for the Destination Advertisment Object acknowledgement (DAO-ACK) message.
+/// Getters for the Destination Advertisement Object acknowledgement (DAO-ACK) message.
 ///
 /// ```txt
 ///  0                   1                   2                   3
@@ -569,7 +569,7 @@ impl<T: AsRef<[u8]>> Packet<T> {
     }
 }
 
-/// Setters for the Destination Advertisment Object acknowledgement (DAO-ACK) message.
+/// Setters for the Destination Advertisement Object acknowledgement (DAO-ACK) message.
 impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
     /// Set the flag indicating that the DODAG ID is present or not.
     #[inline]
@@ -752,7 +752,7 @@ impl<'p> Repr<'p> {
             }
             RplControlMessage::SecureDodagInformationSolicitation
             | RplControlMessage::SecureDodagInformationObject
-            | RplControlMessage::SecureDesintationAdvertismentObject
+            | RplControlMessage::SecureDestinationAdvertisementObject
             | RplControlMessage::SecureDestinationAdvertisementObjectAck
             | RplControlMessage::ConsistencyCheck => Err(Error),
             RplControlMessage::Unknown(_) => Err(Error),
@@ -2018,7 +2018,7 @@ pub mod options {
                         PrefixLength={prefix_length} \
                         L={on_link} A={autonomous_address_configuration} R={router_address} \
                         Valid={valid_lifetime} \
-                        Prefered={preferred_lifetime} \
+                        Preferred={preferred_lifetime} \
                         Prefix={destination_prefix:0x?}"
                     )
                 }

+ 1 - 1
src/wire/sixlowpan/iphc.rs

@@ -64,7 +64,7 @@ macro_rules! set_field {
 /// - Next Header
 /// - Hop Limit
 /// - IPv6 source address
-/// - IPv6 destinatino address
+/// - IPv6 destination address
 ///
 /// [RFC 6282 § 3.1]: https://datatracker.ietf.org/doc/html/rfc6282#section-3.1
 /// [RFC 6282 § 3.1.1]: https://datatracker.ietf.org/doc/html/rfc6282#section-3.1.1

+ 3 - 3
src/wire/sixlowpan/nhc.rs

@@ -60,7 +60,7 @@ pub enum NhcPacket {
 
 impl NhcPacket {
     /// Returns the type of the Next Header header.
-    /// This can either be an Extenstion header or an 6LoWPAN Udp header.
+    /// This can either be an Extension header or an 6LoWPAN Udp header.
     ///
     /// # Errors
     /// Returns `[Error::Unrecognized]` when neither the Extension Header dispatch or the Udp
@@ -308,7 +308,7 @@ impl ExtHeaderRepr {
         len
     }
 
-    /// Emit a high-level representaiton into a 6LoWPAN NHC Extension Header packet.
+    /// Emit a high-level representation into a 6LoWPAN NHC Extension Header packet.
     pub fn emit<T: AsRef<[u8]> + AsMut<[u8]>>(&self, packet: &mut ExtHeaderPacket<T>) {
         packet.set_dispatch_field();
         packet.set_extension_header_id(self.ext_header_id);
@@ -454,7 +454,7 @@ mod tests {
 /// A read/write wrapper around a 6LoWPAN_NHC UDP frame.
 /// [RFC 6282 § 4.3] specifies the format of the header.
 ///
-/// The base header has the following formath:
+/// The base header has the following format:
 /// ```txt
 ///   0   1   2   3   4   5   6   7
 /// +---+---+---+---+---+---+---+---+