1#![warn(unreachable_pub)]
2
3use internal::IResult;
4use nom::character::complete::{char, digit1};
5use nom::combinator::map_res;
6use nom::sequence::preceded;
7use std::str::FromStr;
8
9mod attributes;
10mod bandwidth;
11mod connection;
12mod media;
13mod media_description;
14mod origin;
15mod parser;
16mod session_description;
17mod tagged_address;
18mod time;
19
20pub use attributes::{
21 Direction, ExtMap, Fingerprint, FingerprintAlgorithm, Fmtp, Group, IceCandidate, IceOptions,
22 IcePassword, IceUsernameFragment, InvalidCandidateParamError, Rtcp, RtpMap, Setup,
23 SourceAttribute, SrtpCrypto, SrtpFecOrder, SrtpKeyingMaterial, SrtpSessionParam, SrtpSuite,
24 Ssrc, UnknownAttribute, UntaggedAddress,
25};
26pub use bandwidth::Bandwidth;
27pub use connection::Connection;
28pub use media::{Media, MediaType, TransportProtocol};
29pub use media_description::MediaDescription;
30pub use origin::Origin;
31pub use parser::ParseSessionDescriptionError;
32pub use session_description::SessionDescription;
33pub use tagged_address::TaggedAddress;
34pub use time::Time;
35
36fn slash_num(i: &str) -> IResult<&str, u32> {
37 preceded(char('/'), map_res(digit1, FromStr::from_str))(i)
38}
39
40fn not_whitespace(c: char) -> bool {
41 !c.is_ascii_whitespace()
42}
43
44fn ice_char(c: char) -> bool {
45 c.is_ascii_alphanumeric() || matches!(c, '+' | '/')
46}
47
48fn probe_host(c: char) -> bool {
49 c.is_ascii_alphanumeric() || matches!(c, '_' | '-' | '.')
50}
51
52fn probe_host6(c: char) -> bool {
53 probe_host(c) || c == ':'
54}