en-gb\r\nAlert-Info:<http://www.example.com/sounds/moo.wav>\r\nAllow:\
MESSAGE\r\nAuthentication-Info:qop=auth\r\nAuthorization:Digest \
username=\"Alice\"\r\nCall-ID:f81d4fae-7dec-11d0-a765-00a0c91e6bf6@foo.\
- bar.com\r\nVia: localhost\r\n\r\n")
+ bar.com\r\nCall-Info:<http://wwww.example.com/alice/photo.jpg>;\
+ purpose=icon\r\nVia: localhost\r\n\r\n")
});
let finished = request.and_then(|(socket, _request)| {
Scheme, Method, Transport, UserParam, Version, RequestLine, StatusLine, TopLine,
Header, MediaType, MediaFullType, MediaParameter, MediaRange, GenericParam,
AcceptParam, AcceptRange, Coding, Encoding, LanguageRange, Language, AlertParam, Qop,
- AuthenticationInfo, AuthParam, Algorithm, DigestResponse, Credentials, CallId};
+ AuthenticationInfo, AuthParam, Algorithm, DigestResponse, Credentials, CallId,
+ Purpose, InfoParam, Info};
fn is_mark(c: u8) -> bool {
c == b'-' || c == b'_' || c == b'.' || c == b'!' || c == b'~' || c == b'*' || c == b'\'' ||
tag!(b"@"),
word)))));
+named!(purpose<Purpose>, alt!(
+ tag!(b"icon") => { |_| Purpose::Icon } |
+ tag!(b"info") => { |_| Purpose::Info } |
+ tag!(b"card") => { |_| Purpose::Card } |
+ token => { |t| Purpose::Token(t) }));
+
+named!(info_param<InfoParam>, alt!(
+ preceded!(
+ tag!(b"purpose="),
+ purpose) => { |p| InfoParam::Purpose(p) } |
+ generic_param => { |g| InfoParam::Generic(g) }));
+
+named!(info<Info>, tuple!(
+ delimited!(
+ tag!(b"<"),
+ absolute_uri,
+ tag!(b">")
+ ),
+ many0!(preceded!(
+ tag!(b";"),
+ info_param))));
+
+named!(call_info_header<Vec<Info>>, preceded!(
+ tag!(b"Call-Info:"),
+ separated_nonempty_list!(
+ tag!(","),
+ info)));
+
named!(pub header<Header>, alt!(
// RFC 3261 Headers
accept_header => { |a| Header::Accept(a) } |
allow_header => { |a| Header::Allow(a) } |
authentication_info_header => { |a| Header::AuthenticationInfo(a) } |
authorization_header => { |a| Header::Authorization(a) } |
- call_id_header => { |c| Header::CallId(c) }
+ call_id_header => { |c| Header::CallId(c) } |
+ call_info_header => { |c| Header::CallInfo(c) }
));
pub type CallId = (Vec<u8>, Option<Vec<u8>>);
+#[derive(Debug)]
+pub enum Purpose {
+ Icon,
+ Info,
+ Card,
+ Token(Vec<u8>),
+}
+
+#[derive(Debug)]
+pub enum InfoParam {
+ Purpose(Purpose),
+ Generic(GenericParam),
+}
+
+pub type Info = (AbsoluteUri, Vec<InfoParam>);
+
#[derive(Debug)]
pub enum Header {
Accept(Vec<AcceptRange>),
AuthenticationInfo(Vec<AuthenticationInfo>),
Authorization(Credentials),
CallId(CallId),
+ CallInfo(Vec<Info>),
From(Uri),
To(Uri),
Extension { name: String, value: String },