diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-11-24 17:48:48 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-11-24 17:48:48 +0100 |
| commit | e4de15e4de455f378286f39b5c9c079c26a68014 (patch) | |
| tree | 941019933b994e86978951a7f504163ab9b7ab7c /examples | |
| parent | 8fea6c94f6d0978042554eb6b154706d8f7a9fd5 (diff) | |
net: don't depend directly on smoltcp outside embassy-net
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/std/Cargo.toml | 5 | ||||
| -rw-r--r-- | examples/std/src/tuntap.rs | 6 | ||||
| -rw-r--r-- | examples/stm32f7/Cargo.toml | 12 | ||||
| -rw-r--r-- | examples/stm32h7/Cargo.toml | 12 |
4 files changed, 3 insertions, 32 deletions
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml index 2e2f0bd1c..9a9961a36 100644 --- a/examples/std/Cargo.toml +++ b/examples/std/Cargo.toml | |||
| @@ -17,8 +17,3 @@ libc = "0.2.101" | |||
| 17 | clap = { version = "3.0.0-beta.5", features = ["derive"] } | 17 | clap = { version = "3.0.0-beta.5", features = ["derive"] } |
| 18 | rand_core = { version = "0.6.3", features = ["std"] } | 18 | rand_core = { version = "0.6.3", features = ["std"] } |
| 19 | heapless = { version = "0.7.5", default-features = false } | 19 | heapless = { version = "0.7.5", default-features = false } |
| 20 | |||
| 21 | [dependencies.smoltcp] | ||
| 22 | git = "https://github.com/bobmcwhirter/smoltcp" | ||
| 23 | rev = "faf81d21daae16b650b16e59a8422a8283e8a302" | ||
| 24 | default-features = false | ||
diff --git a/examples/std/src/tuntap.rs b/examples/std/src/tuntap.rs index a32099404..4d30118fb 100644 --- a/examples/std/src/tuntap.rs +++ b/examples/std/src/tuntap.rs | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | use async_io::Async; | 1 | use async_io::Async; |
| 2 | use libc; | ||
| 3 | use log::*; | 2 | use log::*; |
| 4 | use smoltcp::wire::EthernetFrame; | ||
| 5 | use std::io; | 3 | use std::io; |
| 6 | use std::io::{Read, Write}; | 4 | use std::io::{Read, Write}; |
| 7 | use std::os::unix::io::{AsRawFd, RawFd}; | 5 | use std::os::unix::io::{AsRawFd, RawFd}; |
| @@ -14,6 +12,8 @@ pub const _IFF_TUN: libc::c_int = 0x0001; | |||
| 14 | pub const IFF_TAP: libc::c_int = 0x0002; | 12 | pub const IFF_TAP: libc::c_int = 0x0002; |
| 15 | pub const IFF_NO_PI: libc::c_int = 0x1000; | 13 | pub const IFF_NO_PI: libc::c_int = 0x1000; |
| 16 | 14 | ||
| 15 | const ETHERNET_HEADER_LEN: usize = 14; | ||
| 16 | |||
| 17 | #[repr(C)] | 17 | #[repr(C)] |
| 18 | #[derive(Debug)] | 18 | #[derive(Debug)] |
| 19 | struct ifreq { | 19 | struct ifreq { |
| @@ -85,7 +85,7 @@ impl TunTap { | |||
| 85 | 85 | ||
| 86 | // SIOCGIFMTU returns the IP MTU (typically 1500 bytes.) | 86 | // SIOCGIFMTU returns the IP MTU (typically 1500 bytes.) |
| 87 | // smoltcp counts the entire Ethernet packet in the MTU, so add the Ethernet header size to it. | 87 | // smoltcp counts the entire Ethernet packet in the MTU, so add the Ethernet header size to it. |
| 88 | let mtu = ip_mtu + EthernetFrame::<&[u8]>::header_len(); | 88 | let mtu = ip_mtu + ETHERNET_HEADER_LEN; |
| 89 | 89 | ||
| 90 | Ok(TunTap { fd, mtu }) | 90 | Ok(TunTap { fd, mtu }) |
| 91 | } | 91 | } |
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml index 6e9701463..2d3cd0b79 100644 --- a/examples/stm32f7/Cargo.toml +++ b/examples/stm32f7/Cargo.toml | |||
| @@ -25,15 +25,3 @@ heapless = { version = "0.7.5", default-features = false } | |||
| 25 | nb = "1.0.0" | 25 | nb = "1.0.0" |
| 26 | rand_core = "0.6.3" | 26 | rand_core = "0.6.3" |
| 27 | critical-section = "0.2.3" | 27 | critical-section = "0.2.3" |
| 28 | |||
| 29 | |||
| 30 | [dependencies.smoltcp] | ||
| 31 | git = "https://github.com/bobmcwhirter/smoltcp" | ||
| 32 | rev = "faf81d21daae16b650b16e59a8422a8283e8a302" | ||
| 33 | default-features = false | ||
| 34 | features = [ | ||
| 35 | "proto-ipv4", | ||
| 36 | "socket", | ||
| 37 | "async", | ||
| 38 | "defmt", | ||
| 39 | ] | ||
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index 345b8bfe9..a852b6a73 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml | |||
| @@ -26,16 +26,4 @@ futures = { version = "0.3.17", default-features = false, features = ["async-awa | |||
| 26 | heapless = { version = "0.7.5", default-features = false } | 26 | heapless = { version = "0.7.5", default-features = false } |
| 27 | rand_core = "0.6.3" | 27 | rand_core = "0.6.3" |
| 28 | critical-section = "0.2.5" | 28 | critical-section = "0.2.5" |
| 29 | |||
| 30 | micromath = "2.0.0" | 29 | micromath = "2.0.0" |
| 31 | |||
| 32 | [dependencies.smoltcp] | ||
| 33 | git = "https://github.com/bobmcwhirter/smoltcp" | ||
| 34 | rev = "faf81d21daae16b650b16e59a8422a8283e8a302" | ||
| 35 | default-features = false | ||
| 36 | features = [ | ||
| 37 | "proto-ipv4", | ||
| 38 | "socket", | ||
| 39 | "async", | ||
| 40 | "defmt", | ||
| 41 | ] | ||
