You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The value of the Hop Limit field of the IP packet. (Also known as "Time To Live (TTL)" in IPv4)
348
+
<p>Equivalent to the IP_TTL & IPV6_HOPLIMIT ancillary messages.</p>
349
+
</li>
330
350
</ul>
331
351
<hr />
332
352
<h3>Functions</h3>
@@ -432,12 +452,28 @@ If the TCP/UDP port is zero, the socket will be bound to a random free port.</p>
432
452
<p>This function attempts to receive up to <code>max-results</code> datagrams on the socket without blocking.
433
453
The returned list may contain fewer elements than requested, but never more.
434
454
If <code>max-results</code> is 0, this function returns successfully with an empty list.</p>
455
+
<p>If a platform does not support receiving a particular field, its value will be set to <code>None</code> in the returned datagram.</p>
435
456
<h1>Typical errors</h1>
436
457
<ul>
437
458
<li><code>not-bound</code>: The socket is not bound to any local address. (EINVAL)</li>
438
459
<li><code>remote-unreachable</code>: The remote address is not reachable. (ECONNREFUSED, ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN)</li>
439
460
<li><code>would-block</code>: There is no pending data available to be read at the moment. (EWOULDBLOCK, EAGAIN)</li>
440
461
</ul>
462
+
<h1>Implementors note:</h1>
463
+
<p>The closest equivalent to this function is Linux' <code>recvmmsg</code> function while having the following options enabled:</p>
464
+
<ul>
465
+
<li>IP_RECVPKTINFO or IPV6_RECVPKTINFO</li>
466
+
<li>IP_RECVTOS or IPV6_RECVTCLASS</li>
467
+
<li>IP_RECVTTL or IPV6_RECVHOPLIMIT</li>
468
+
</ul>
469
+
<p>Naming differences:</p>
470
+
<ul>
471
+
<li>IP_RECVPKTINFO exists as-is on NetBSD, Solaris, AIX</li>
472
+
<li>IP_RECVPKTINFO is named IP_PKTINFO on Linux & Windows.</li>
473
+
<li>IP_RECVPKTINFO partially is IP_RECVDSTADDR on MacOS & FreeBSD.</li>
474
+
<li>IPV6_RECVPKTINFO is named IPV6_PKTINFO on Windows.</li>
475
+
<li>IPV6_RECVHOPLIMIT is named IPV6_HOPLIMIT on Windows</li>
@@ -475,10 +511,20 @@ call <a href="#remote_address"><code>remote-address</code></a> to get their addr
475
511
<li><code>invalid-remote-address</code>: The port in <ahref="#remote_address"><code>remote-address</code></a> is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)</li>
476
512
<li><code>already-connected</code>: The socket is in "connected" mode and the <code>datagram.remote-address</code> does not match the address passed to <code>connect</code>. (EISCONN)</li>
477
513
<li><code>not-bound</code>: The socket is not bound to any local address. Unlike POSIX, this function does not perform an implicit bind.</li>
514
+
<li><code>not-supported</code>: An unsupported field in the datagram was set to Some value.</li>
478
515
<li><code>remote-unreachable</code>: The remote address is not reachable. (ECONNREFUSED, ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN)</li>
479
516
<li><code>datagram-too-large</code>: The datagram is too large. (EMSGSIZE)</li>
480
517
<li><code>would-block</code>: The send buffer is currently full. (EWOULDBLOCK, EAGAIN)</li>
481
518
</ul>
519
+
<h1>Implementors note</h1>
520
+
<p>The closest equivalent to this function is Linux' <code>sendmmsg</code> with zero or more
521
+
ancillary messages for each not-None datagram field:</p>
522
+
<ul>
523
+
<li>Some(local-address): IP_PKTINFO or IPV6_PKTINFO</li>
524
+
<li>Some(traffic-class): IP_TOS or IPV6_TCLASS</li>
525
+
<li>Some(hop-limit): IP_TTL or IPV6_HOPLIMIT
526
+
If an implementation does not support a particular ancillary message type, it should return <code>not-supported</code>.</li>
/// Equivalent to the IP_PKTINFO & IPV6_PKTINFO ancillary messages.
18
+
local-address:option<ip-socket-address>,
19
+
20
+
/// The value of the Traffic Class field of the IP packet. (Also known as "Type of Service (TOS)" in IPv4)
21
+
///
22
+
/// This value is typically composed of the DSCP (6 high bits) + ECN (2 low bits).
23
+
///
24
+
/// Equivalent to the IP_TOS & IPV6_TCLASS ancillary messages.
25
+
traffic-class:option<u8>,
26
+
27
+
/// The value of the Hop Limit field of the IP packet. (Also known as "Time To Live (TTL)" in IPv4)
28
+
///
29
+
/// Equivalent to the IP_TTL & IPV6_HOPLIMIT ancillary messages.
30
+
hop-limit:option<u8>,
21
31
}
22
32
23
33
@@ -90,11 +100,26 @@ interface udp {
90
100
/// The returned list may contain fewer elements than requested, but never more.
91
101
/// If `max-results` is 0, this function returns successfully with an empty list.
92
102
///
103
+
/// If a platform does not support receiving a particular field, its value will be set to `None` in the returned datagram.
104
+
///
93
105
/// # Typical errors
94
106
/// - `not-bound`: The socket is not bound to any local address. (EINVAL)
95
107
/// - `remote-unreachable`: The remote address is not reachable. (ECONNREFUSED, ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN)
96
108
/// - `would-block`: There is no pending data available to be read at the moment. (EWOULDBLOCK, EAGAIN)
97
109
///
110
+
/// # Implementors note:
111
+
/// The closest equivalent to this function is Linux' `recvmmsg` function while having the following options enabled:
112
+
/// - IP_RECVPKTINFO or IPV6_RECVPKTINFO
113
+
/// - IP_RECVTOS or IPV6_RECVTCLASS
114
+
/// - IP_RECVTTL or IPV6_RECVHOPLIMIT
115
+
///
116
+
/// Naming differences:
117
+
/// - IP_RECVPKTINFO exists as-is on NetBSD, Solaris, AIX
118
+
/// - IP_RECVPKTINFO is named IP_PKTINFO on Linux & Windows.
119
+
/// - IP_RECVPKTINFO partially is IP_RECVDSTADDR on MacOS & FreeBSD.
120
+
/// - IPV6_RECVPKTINFO is named IPV6_PKTINFO on Windows.
121
+
/// - IPV6_RECVHOPLIMIT is named IPV6_HOPLIMIT on Windows
/// - `invalid-remote-address`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
127
152
/// - `already-connected`: The socket is in "connected" mode and the `datagram.remote-address` does not match the address passed to `connect`. (EISCONN)
128
153
/// - `not-bound`: The socket is not bound to any local address. Unlike POSIX, this function does not perform an implicit bind.
154
+
/// - `not-supported`: An unsupported field in the datagram was set to Some value.
129
155
/// - `remote-unreachable`: The remote address is not reachable. (ECONNREFUSED, ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN)
130
156
/// - `datagram-too-large`: The datagram is too large. (EMSGSIZE)
131
157
/// - `would-block`: The send buffer is currently full. (EWOULDBLOCK, EAGAIN)
132
158
///
159
+
/// # Implementors note
160
+
/// The closest equivalent to this function is Linux' `sendmmsg` with zero or more
161
+
/// ancillary messages for each not-None datagram field:
162
+
/// - Some(local-address): IP_PKTINFO or IPV6_PKTINFO
163
+
/// - Some(traffic-class): IP_TOS or IPV6_TCLASS
164
+
/// - Some(hop-limit): IP_TTL or IPV6_HOPLIMIT
165
+
/// If an implementation does not support a particular ancillary message type, it should return `not-supported`.
0 commit comments