Dario Nieuwenhuis
4e11070ff4
Async/await waker support.
2020-12-27 17:31:49 +01:00
Alex Crawford
c9f57150a8
Dereference match expressions to clean up patterns
...
These were flagged by `cargo clippy`:
warning: you don't need to add `&` to all patterns
2020-12-26 10:32:51 -08:00
Ole Martin Ruud
9533e3ac17
Update the docstrings of PollAt
...
Closes : #214
Approved by: whitequark
2018-05-18 00:40:47 +08:00
Ole Martin Ruud
9694949172
Add conditional compile attr to `is_ingress`
...
Closes : #216
Approved by: whitequark
2018-05-17 06:17:47 +08:00
Ole Martin Ruud
0c59e3f5f9
Implement new type for `poll_at`
...
Change return-type for `poll_at` for sockets to be a `PollAt` instead of
the former `Option<Instant>`.
Closes : #216
Approved by: whitequark
2018-05-17 06:17:47 +08:00
Valentin Lorentz
2afc538fd9
Add support for IPv6 to ICMP sockets.
...
Closes : #205
Approved by: whitequark
2018-05-10 07:12:33 +08:00
whitequark
3d12690009
Use storage::PacketBuffer for implementing socket::IcmpSocket.
...
This substantially increases its space efficiency.
2018-02-22 12:23:35 +00:00
whitequark
9353c37a62
Use storage::PacketBuffer for implementing socket::RawSocket.
...
This substantially increases its space efficiency.
2018-02-22 12:05:36 +00:00
whitequark
c474d0c32e
Factor out storage::PacketBuffer from socket::UdpSocket.
2018-02-22 11:34:58 +00:00
Philipp Oppermann
ed2dcaaff9
Use separate metadata and payload buffers for UDP sockets.
...
Co-authored-by: Dan Robertson <danlrobertson89@gmail.com>
2018-02-22 06:33:11 +00:00
Dan Robertson
9747733dd7
Use time types in socket
...
Use the time types (Instant and Duration) in the socket modules instead
of a simple u64.
Closes : #141
Approved by: whitequark
2018-02-16 10:44:03 +08:00
Alex Crawford
066d42c0e0
Clean up dispatch_socket!() syntax
...
This modified syntax is meant to more closely resemble standard Rust.
2018-01-08 07:44:15 +00:00
Dan Robertson
b653a6e421
Fix documentation warnings.
...
- There are several warnings that are thrown when running `cargo doc`. Fix
these warnings.
- Convert all module documentation to use /*! for consistency.
2018-01-05 19:38:23 +00:00
Dan Robertson
439e0a2cc1
Add the proto-ipv4 feature.
2017-12-24 13:28:59 +00:00
whitequark
8dd9bdeaad
Trace neighbor discovery status on a per-socket basis.
...
This avoids delaying the first packets for new neighbors by
(at least) the ARP cache silence time, or potentially even
indefinitely.
2017-12-18 11:06:24 +00:00
whitequark
98a3ec8c3a
Limit the rate at which sockets will request neighbor discovery.
...
The rate of emission of neighbor discovery packets is already
limited at the level of the entire neighbor cache, but poll()
would uselessly spin until the answer arrives (if ever).
2017-11-22 07:20:31 +00:00
whitequark
6c83936872
Extract socket handle into a new SocketMeta structure.
...
This paves way for adding more metadata apart from handles,
such as caches and so on.
This commit also removes SocketHandle::EMPTY in favor of
SocketHandle::default() since they are functionally identical.
2017-11-22 03:50:09 +00:00
Dan Robertson
adb5014780
Add ICMP sockets
...
- Add support for ICMP sockets
- Add tests for ICMP sockets
- Rename proto-<type> features to socket-<type>
- Update documentation
2017-11-09 00:08:24 +00:00
whitequark
d9fa7f6bc6
Rename proto-* features back to socket-*.
...
A proto-* feature does not make sense for ICMP, where the protocol
is always enabled, but sockets, not.
2017-11-06 09:51:03 +00:00
whitequark
d37f4ef254
Use a much more sensible method naming for SocketRef.
2017-10-25 02:16:23 +00:00
whitequark
103fff9233
Expose wrapping and unwrapping of SocketRefs.
2017-10-25 01:28:59 +00:00
whitequark
a9a00baa49
Rename Cargo features: socket-* → proto-*.
2017-10-25 00:20:40 +00:00
Egor Karavaev
19b1b764ed
Implement a SocketRef smart pointer to detect state changes.
2017-10-05 03:44:20 +00:00
whitequark
52600cd521
Replace "socket debug identifiers" with just socket handles.
...
This is basically a rename that now calls an apple an apple,
except user code can no longer change it. It's not obvious if
user code getting the socket handle from the socket is very useful,
but it's not harmful either, so why not.
2017-10-05 03:02:41 +00:00
whitequark
4826d37c45
Allow disabling any of: raw, TCP or UDP sockets.
2017-09-25 00:20:22 +00:00
whitequark
996389d653
Compute soft deadline in poll() and use nonblocking sockets.
...
Before this commit, anything that touched RawSocket or TapInterface
worked partly by accident and partly because of a horrible crutch
that resulted in massive latencies as well as inevitable packet loss
every time an ARP request had to be issued. Also, there was no way
to use poll() other than by continuously calling it in a busy loop.
After this commit, poll() indicates when the earliest timer expires,
and so the caller can sleep until that moment (or until packets
arrive).
Note that there is a subtle problem remaining: every time poll()
is called, every socket with a pending outbound packet whose
IP address doesn't correspond to a MAC address will send a new
ARP request, resulting in potentially a whole lot of such requests.
ARP rate limiting is a separate topic though.
2017-08-29 19:47:11 +00:00
whitequark
379bc60924
Get rid of unused arguments in Socket::{process,dispatch}.
...
I've left those "for consistency" but it just implies data
dependencies where there are none, and bloats signatures.
2017-08-28 04:14:25 +00:00
whitequark
760174048d
Get rid of IpPayload and indirection in Socket::dispatch.
...
This was just completely pointless, and only served to obfuscate
the data path and make testing harder.
2017-08-28 03:56:34 +00:00
whitequark
1d01189278
Use FnOnce, not FnMut, in Socket::dispatch() functions.
...
There was never any reason to use FnMut and this significantly
simplifies the job of the borrow checker.
2017-08-28 00:59:33 +00:00
whitequark
be0854127a
Remove unused imports.
2017-07-30 01:09:14 +00:00
whitequark
8d8a4ea583
Get rid of Result<_, ()>.
...
The use of this type has several drawbacks:
* It does not allow distinguishing between different error
conditions. In fact, we wrongly conflated some of them
before this commit.
* It does not allow propagation via ? and requires manual use
of map_err, which is especially tiresome for downstream code.
* It prevents us from expanding the set of error conditions
even if right now we have only one.
* It prevents us from blanket using Result<T> everywhere
(a nitpick at most).
Instead, use Result<T, Error> everywhere, and differentiate error
conditions where applicable.
2017-07-27 13:55:47 +00:00
whitequark
83c41fd760
Simplify impls of AsSocket.
2017-07-24 17:00:00 +00:00
whitequark
2c1e234b91
Remove Socket::{process,dispatch} from public interface.
...
These no longer have to be public, since our required Rust version
has pub(crate). In addition Socket::process is not used at all.
2017-06-29 15:56:03 +00:00
whitequark
adc51fab7f
Actually export socket::SocketSetItem publicly.
...
It was unintentionally left unnameable. Fixes #14 .
2017-06-21 03:57:13 +00:00
Egor Karavaev
ca56baca65
Add `RawSocket`.
2017-06-21 03:29:31 +00:00
whitequark
1d46ccf432
fn Device::mtu() -> usize → Device::limits() -> DeviceLimits
2017-03-07 11:10:26 +00:00
whitequark
bc1d65ea89
Send the TCP MSS option.
2017-01-27 02:56:27 +00:00
whitequark
f126eab193
Distinguish sockets by debug identifiers (socket set indexes).
2017-01-16 23:35:21 +00:00
whitequark
9fb6d6f4b2
impl Debug for SocketSet.
2017-01-12 05:42:54 +00:00
whitequark
234e5ef29e
Implement socket sets.
2017-01-11 04:05:41 +00:00
whitequark
27ccfc1bb0
Implement TCP retransmission.
2016-12-31 08:35:46 +00:00
whitequark
a8fc4fd832
Improve the user-facing TCP socket API.
2016-12-27 17:49:40 +00:00
whitequark
25d453447f
Generalize the TCP tests to accept multiple packets.
2016-12-26 12:38:40 +00:00
whitequark
ea78053dc1
Factor out IpRepr into the wire module.
2016-12-26 11:20:20 +00:00
whitequark
ea07e79bdf
Group IP header parts in the socket layer as struct IpRepr.
2016-12-26 10:06:49 +00:00
whitequark
6539019f19
Get rid of explicit backlog.
2016-12-23 07:34:10 +00:00
whitequark
1ad8f9c9bd
Implement conversion of incoming TCP connections into TCP streams.
2016-12-20 22:57:21 +00:00
whitequark
bddb5f9127
Implement TCP server sockets.
2016-12-20 19:51:52 +00:00
whitequark
a3481537d9
Add some sanity into buffer names (avoid clases with wire::*).
2016-12-20 13:56:59 +00:00
whitequark
0d9a8a417d
Add some sanity into enumeration names (avoid "*Type").
2016-12-20 13:54:11 +00:00