Header, MediaType, MediaFullType, MediaParameter, MediaRange, GenericParam,
AcceptParam, AcceptRange, Coding, Encoding, LanguageRange, Language, AlertParam, Qop,
AuthenticationInfo, AuthParam, Algorithm, DigestResponse, Credentials, CallId,
- Purpose, InfoParam, Info, NameAddr, ContactParam, ContactTarget, Contact};
+ Purpose, InfoParam, Info, NameAddr, ContactParam, ContactTarget, Contact,
+ DispositionType, Handling, DispositionParam};
fn is_mark(c: u8) -> bool {
c == b'-' || c == b'_' || c == b'.' || c == b'!' || c == b'~' || c == b'*' || c == b'\'' ||
tag!(","),
contact_target) => { |c| Contact::Contact(c) })));
+named!(disp_type<DispositionType>, alt!(
+ tag!(b"render") => { |_| DispositionType::Render } |
+ tag!(b"session") => { |_| DispositionType::Session } |
+ tag!(b"icon") => { |_| DispositionType::Icon } |
+ tag!(b"alert") => { |_| DispositionType::Alert } |
+ token => { |t| DispositionType::Token(t) }
+));
+
+named!(handling<Handling>, alt!(
+ tag!(b"optional") => { |_| Handling::Optional } |
+ tag!(b"required") => { |_| Handling::Required } |
+ token => { |t| Handling::Token(t) }));
+
+named!(disp_param<DispositionParam>, alt!(
+ preceded!(tag!(b"handling="), handling) => { |h| DispositionParam::Handling(h) } |
+ generic_param => { |g| DispositionParam::Generic(g) }));
+
+named!(content_disposition_header<(DispositionType, Vec<DispositionParam>)>, preceded!(
+ tag!(b"Content-Disposition:"),
+ tuple!(
+ disp_type,
+ many0!(preceded!(
+ tag!(b";"),
+ disp_param)))));
+
named!(pub header<Header>, alt!(
// RFC 3261 Headers
accept_header => { |a| Header::Accept(a) } |
authorization_header => { |a| Header::Authorization(a) } |
call_id_header => { |c| Header::CallId(c) } |
call_info_header => { |c| Header::CallInfo(c) } |
- contact_header => { |c| Header::Contact(c) }
+ contact_header => { |c| Header::Contact(c) } |
+ content_disposition_header => { |(t, p)| Header::ContentDisposition(t, p) }
));