Skip to main content

Module outbound

Module outbound 

Source
Expand description

Client-initiated connections — Outbound (RFC 5626).

The problem it solves: a UA behind a NAT registers a Contact naming an address that only exists inside the NAT, and the binding the registrar records is unroutable the moment the mapping lapses. Outbound’s answer is to stop routing to an address and route down a flow instead — the connection the client itself opened — identified by a token the registrar puts in Path and hands back to itself later.

Everything here is a decision, not an action: which parameters a REGISTER carries, whether the registrar accepted the mechanism, how long to wait before the next keep-alive, and how long to wait before retrying a flow that failed. The randomised choices take the fraction as an argument so a test can pin them, with a thin rand wrapper for callers that do not care.

Structs§

Flow
The identity of one Outbound flow: the device, and which of its flows this is (RFC 5626 §4.1, §4.2).
InstanceId
A device identity that outlives a reboot, a re-address and a change of network (§4.1).
RegId
Which flow a registration is for (§4.2).

Enums§

Keepalive
How a flow is kept alive, which depends on the transport (§4.4).
Power
Whether the device is one where a keep-alive every two minutes is a battery problem (§4.4.1).

Constants§

MAX_RECOVERY_WAIT
The longest §4.5 will ever have a UA wait between attempts to re-establish a flow.
MAX_REG_ID
The largest reg-id RFC 5626 §4.2 allows: values run from 1 to 2^31 - 1.
OPTION_TAG
The option tag, registered in RFC 5626 §11.4.
PONG_TIMEOUT
How long a UA waits before pronouncing a CRLF-kept flow dead (§4.4.1).

Functions§

accepted
Whether the registrar actually performed an outbound registration (§6).
contact
The Contact a REGISTER for one flow carries.
flow_timer
The Flow-Timer the registrar named, if any (§6, §4.4).
fraction
Draw a fraction for the randomised choices above.
keepalive_for
Pick the keep-alive technique §4.4 mandates for a transport.
keepalive_interval
How long to wait before the next keep-alive (§4.4.1, §4.4.2).
recovery_delay
How long to wait before trying to re-establish a failed flow (§4.5).
required_by
Whether a registrar demands Outbound of its clients — Require: outbound on a failure.
with_ob
Add the ob URI parameter to a contact for a dialog-forming request (§4.3).