Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/sixlowpan.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! 6lowpan exmaple
//! 6lowpan example
//!
//! This example is designed to run using the Linux ieee802154/6lowpan support,
//! using mac802154_hwsim.
Expand Down
2 changes: 1 addition & 1 deletion examples/sixlowpan_benchmark.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/iface/interface/igmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/iface/interface/tests/ipv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/iface/interface/tests/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/iface/rpl/trickle.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/socket/dhcpv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/socket/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/storage/assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
Expand Down
2 changes: 1 addition & 1 deletion src/storage/packet_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion src/wire/dhcpv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/wire/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/wire/icmpv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/wire/ipv6hbh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/wire/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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")]
Expand Down
40 changes: 20 additions & 20 deletions src/wire/rpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -85,15 +85,15 @@ 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;
//pub const DAO_RESERVED: usize = 6;
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;
Expand All @@ -110,7 +110,7 @@ enum_with_unknown! {
DestinationAdvertisementObjectAck = 0x03,
SecureDodagInformationSolicitation = 0x80,
SecureDodagInformationObject = 0x81,
SecureDesintationAdvertismentObject = 0x82,
SecureDestinationAdvertisementObject = 0x82,
SecureDestinationAdvertisementObjectAck = 0x83,
ConsistencyCheck = 0x8a,
}
Expand All @@ -126,24 +126,24 @@ 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)")
}
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),
Expand Down Expand Up @@ -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),
Expand All @@ -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!(),
Expand Down Expand Up @@ -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!(),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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?}"
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/wire/sixlowpan/iphc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading