Commit Graph

25 Commits (250a84e51329f6b282764ce0406ed1747cadb258)

Author SHA1 Message Date
whitequark 250a84e513 Implement a Device that emits a stream in libpcap format. 2017-07-23 14:56:24 +00:00
whitequark b97cacd521 Inject the current timestamp into Device::{transmit,receive}.
Various parts of smoltcp require an arrow of time; a monotonically
increasing timestamp. Most obviously this is TCP sockets, but
the tracer and the pcap writer devices also benefit from having
timestamps. There are a few ways this could be implemented:
  1. using a static Cell, global for the entire smoltcp crate;
  2. using a static method on Device;
  3. using an instance method on Device;
  4. passing the current timestamp into *Interface::poll.

The first two options are undesirable because they create a notion
of global clock, and interfere e.g. with mocking.
The third option is undesirable because not all devices are
inherently tied to a particular clock, e.g. a loopback device isn't.

Therefore, the timestamp is injected into both sockets and devices
through the *Interface::poll method.
2017-07-23 09:48:14 +00:00
whitequark eae7907f60 Add EthernetTracer, a specialization of Tracer for EthernetFrame.
This makes the loopback example much nicer, #[cfg]-wise.
2017-07-23 06:28:00 +00:00
whitequark 94796a566b Document the loopback. 2017-07-14 03:30:00 +00:00
whitequark 312ff93c86 Remove default impl for Device::limits().
We should not assume any default MTU.
2017-07-14 03:18:11 +00:00
whitequark f3e54966fd LoopbackInterface → Loopback. 2017-07-14 01:17:06 +00:00
whitequark 63ab7d4e7a Implement loopback interfaces.
This also adds a default implementation of Device::limits.
2017-07-14 01:14:40 +00:00
whitequark cc5fb0e5ef Clean up a few doctests. 2017-06-24 09:02:12 +00:00
Egor Karavaev 59fc0c0358 Factor out the "raw_socket" and "tap_interface" features
This makes it possible to build smoltcp with the "std" feature on platforms
without libc, such as redox.
2017-06-15 10:12:11 +00:00
whitequark 1d46ccf432 fn Device::mtu() -> usize → Device::limits() -> DeviceLimits 2017-03-07 11:10:26 +00:00
whitequark 493a319132 Remove the `use_` prefix from feature names.
I haven't realized that a feature `log` with an optional crate
dependency `log` activates that dependency, and added the prefix
to avoid a "clash". This is unnecessary.
2017-03-05 05:49:38 +00:00
whitequark 83bb8c6ae8 Update docs. 2017-01-10 12:29:24 +00:00
whitequark 716a1cf7fe Fix silliness in docs. 2017-01-01 08:15:38 +00:00
whitequark bf3b62bb25 Examples for the phy layer! 2016-12-31 12:28:59 +00:00
whitequark 64a8c36118 Fix length of tx buffers returned by fault injector. 2016-12-31 01:10:46 +00:00
whitequark e1e0c2e838 Impement fault injection. 2016-12-31 01:05:29 +00:00
whitequark de24d635fa Rename features: std→use_std, logging→use_log. 2016-12-27 23:45:24 +00:00
whitequark a6eab874be Parameterize tracer over the write function. 2016-12-26 15:46:30 +00:00
whitequark fb172ed1ed Implement UDP sockets. 2016-12-14 17:39:44 +00:00
whitequark 7f1b88ef45 Implement ARP snooping. 2016-12-12 12:30:35 +00:00
whitequark 4421b2fe27 Implement ARP replies. 2016-12-12 07:19:53 +00:00
whitequark d862512582 Implement an ARP LRU cache. 2016-12-12 02:39:46 +00:00
whitequark e7d6237279 Implement TAP interface support. 2016-12-11 00:30:40 +00:00
whitequark fb3faa9d28 Implement a trait for sending and receiving frames. 2016-12-10 19:27:07 +00:00
whitequark 683652a9a6 smoltcp::interface → smoltcp::phy. 2016-12-10 18:33:19 +00:00