webrtc_sdp_candidate (webrtc v0.1.0)
View SourceICE candidate attribute codec (RFC 8839 §5.1, RFC 6544 §4.5).
Used for a=candidate lines and for trickle ICE signaling, where a candidate travels alone as candidate:... (RFC 8840).
{ok, C} = webrtc_sdp_candidate:parse(
<<"candidate:1 1 udp 2122260223 192.0.2.1 54400 typ host">>),
<<"candidate:1 1 udp ", _/binary>> = webrtc_sdp_candidate:encode_attr(C).Addresses are parsed to inet:ip_address() tuples; host names such as mDNS <uuid>.local names (RFC 8839 allows FQDNs) stay binaries. Known extension attributes other than tcptype (generation, ufrag, network-id, network-cost, ...) are kept in order in extensions.
Summary
Functions
Encode as an attribute value, without the candidate: prefix. Fields come in RFC 8839 order: raddr, rport, then tcptype, then the other extensions.
Encode in the trickle ICE form candidate:<value>.
Value of the first extension attribute named Name.
True when the candidate address is an mDNS .local host name (draft-ietf-mmusic-mdns-ice-candidates).
Parse a candidate. Accepts the bare attribute value, the candidate: form used by trickle ICE, and the full a=candidate: line.
Types
-type candidate() :: #sdp_candidate{foundation :: binary(), component :: 1..256, transport :: binary(), priority :: 1..2147483647, address :: webrtc_sdp_lex:address(), port :: inet:port_number(), type :: host | srflx | prflx | relay | binary(), raddr :: webrtc_sdp_lex:address() | undefined, rport :: inet:port_number() | undefined, tcptype :: active | passive | so | undefined, extensions :: [{binary(), binary()}]}.
Functions
Encode as an attribute value, without the candidate: prefix. Fields come in RFC 8839 order: raddr, rport, then tcptype, then the other extensions.
Encode in the trickle ICE form candidate:<value>.
Value of the first extension attribute named Name.
True when the candidate address is an mDNS .local host name (draft-ietf-mmusic-mdns-ice-candidates).
Parse a candidate. Accepts the bare attribute value, the candidate: form used by trickle ICE, and the full a=candidate: line.