Skip to main content

Module sockets

Module sockets 

Source
Expand description

Server-side socket choices, which belong to the driver and not to the engine: port ranges, which local addresses get candidates, and one UDP port or one ICE-TCP listening port shared by many peer connections.

A shared port works because every ICE connectivity check names its recipient: the USERNAME of a Binding request is <receiver's ufrag>:<sender's ufrag> (RFC 8445 section 7.2.2). The first request from a remote address says which peer connection it is for (UfragMux::route); everything else from that address follows it. Each peer connection registers its local ufrags (RTCPeerConnection::ice_username_fragments: one per transport, several when sections are not bundled) after each local description, an ICE restart’s new ones included. Inside the peer connection the engine does the same between its transports: what the shared port brings goes to the transport whose ufrag the first check names.

Structs§

AddressFilter
Which local addresses get host candidates.
PortRange
An inclusive range of ports for the sockets a peer connection gets.
SharedAccept
A connection accepted on an ICE-TCP listening port shared by many peer connections, with the ufrag its first check names.
UfragMux
Routes what arrives on a shared port to the peer connection it is for: by the receiver’s ufrag of the first Binding request from an address, then by that address.

Functions§

accept_by_ufrag
Accepts the next connection on a shared ICE-TCP port and reads its first RFC 4571 frame (for timeout at most) to learn which peer connection it is for. Connections whose first frame is not a Binding request with a USERNAME are dropped and the next one is awaited.
bind_runtime_udp_in_range
A UDP socket of runtime on ip, on a free port of range, skipping refused ports as bind_udp_in_range does.
bind_tcp_listener_in_range
A TCP listener of runtime on ip, on a free port of range.
bind_udp_in_range
A UDP socket on ip, on a free port of range. Ports the host refuses (an excluded port range on Windows, a privileged port) are skipped like ports in use.
binding_request_ufrags
The ufrags of a STUN Binding request: (receiver, sender) from its USERNAME (RFC 8445 section 7.2.2). None for anything else.
set_traffic_class
Sets the byte the socket’s packets carry in the IPv4 TOS / IPv6 Traffic Class field: the DSCP in its upper six bits (RFC 2474 section 3), the ECN codepoint in the lower two (RFC 3168 section 5). ipv6 says which option (IPV6_TCLASS or IP_TOS) the socket’s family takes.
traffic_class
The byte the socket’s packets carry in the IPv4 TOS / IPv6 Traffic Class field, as the operating system reports it (getsockopt of IP_TOS / IPV6_TCLASS).

Type Aliases§

InterfaceFilter
Keeps an interface by name.
IpFilter
Keeps an address.