Language, AlertParam, Qop, AuthenticationInfo, AuthParam, Algorithm, DigestResponse,
Credentials, CallId, Purpose, InfoParam, Info, NameAddr, ContactParam, Target,
Contact, DispositionType, Handling, DispositionParam, ContentCoding, Day, Month, Date,
- Time, DateTime, ErrorUri, FromParam, From, Priority};
+ Time, DateTime, ErrorUri, FromParam, From, Priority, Domain, DigestChallenge,
+ Challenge};
fn is_mark(c: u8) -> bool {
c == b'-' || c == b'_' || c == b'.' || c == b'!' || c == b'~' || c == b'*' || c == b'\'' ||
tag!(b"non-urgent") => { |_| Priority::NonUrgent } |
token => { |t| Priority::Other(t) })));
+named!(domain<Vec<Domain>>, delimited!(
+ tag!(b"domain=\""),
+ separated_nonempty_list!(
+ tag!(" "),
+ alt!(
+ absolute_uri => { |u| Domain::Uri(u) } |
+ abs_path => { |p| Domain::Path(p) }
+ )),
+ tag!(b"\"")));
+
+named!(boolean<bool>, alt!(
+ tag!(b"true") => { |_| true } |
+ tag!(b"false") => { |_| false }));
+
+named!(stale<bool>, preceded!(
+ tag!(b"stale="),
+ boolean));
+
+named!(qop_options<Vec<Qop>>, delimited!(
+ tag!(b"qop=\""),
+ separated_nonempty_list!(
+ tag!(b","),
+ qop_value),
+ tag!(b"\"")));
+
+named!(digest_challenge<Vec<DigestChallenge>>, many1!(alt!(
+ realm => { |r| DigestChallenge::Realm(r) } |
+ domain => { |d| DigestChallenge::Domain(d) } |
+ nonce => { |n| DigestChallenge::Nonce(n) } |
+ opaque => { |o| DigestChallenge::Opaque(o) } |
+ stale => { |s| DigestChallenge::Stale(s) } |
+ qop_options => { |q| DigestChallenge::QopOptions(q) } |
+ auth_param => { |(k, v)| DigestChallenge::AuthParam(k, v) })));
+
+use self::other_response as other_challenge;
+
+named!(challenge<Challenge>, alt!(
+ preceded!(tag!(b"Digest "), digest_challenge) => { |d| Challenge::Digest(d) } |
+ other_challenge => { |(s, p)| Challenge::Other(s, p) }));
+
+named!(proxy_authenticate_header<Challenge>, preceded!(
+ tag!(b"Proxy-Authenticate:"),
+ challenge));
+
named!(pub header<Header>, alt!(
// RFC 3261 Headers
accept_header => { |a| Header::Accept(a) } |
mime_version_header => { |(m, v)| Header::MimeVersion(m, v) } |
min_expires_header => { |m| Header::MinExpires(m) } |
organization_header => { |o| Header::Organization(o) } |
- priority_header => { |p| Header::Priority(p) }
+ priority_header => { |p| Header::Priority(p) } |
+ proxy_authenticate_header => { |p| Header::ProxyAuthenticate(p) }
));