Contact, DispositionType, Handling, DispositionParam, ContentCoding, Day, Month, Date,
Time, DateTime, ErrorUri, FromParam, From, Priority, Domain, DigestChallenge,
Challenge, OptionTag, Route, ReplyTo, RetryAfterParam, RetryAfter, Server, ToParam,
- To, Protocol, SentProtocol, Received, ViaParam, Via};
+ To, Protocol, SentProtocol, Received, ViaParam, Via, WarningAgent, Warning};
pub fn float(input: &[u8]) -> IResult<&[u8], f32> {
flat_map!(input,
tag!(b","),
via)));
+named!(warning_agent<WarningAgent>, alt!(
+ hostport => { |h| WarningAgent::Host(h) } |
+ token => { |p| WarningAgent::Pseudonym(p) }));
+
+named!(warning<Warning>, tuple!(
+ terminated!(number, tag!(b" ")),
+ terminated!(warning_agent, tag!(b" ")),
+ quoted_string));
+
+named!(warning_header<Vec<Warning>>, preceded!(
+ tag!(b"Warning:"),
+ separated_nonempty_list!(
+ tag!(b","),
+ warning)));
+
named!(pub header<Header>, alt!(
// RFC 3261 Headers
accept_header => { |a| Header::Accept(a) } |
to_header => { |t| Header::To(t) } |
unsupported_header => { |u| Header::Unsupported(u) } |
user_agent_header => { |u| Header::UserAgent(u) } |
- via_header => { |v| Header::Via(v) }
+ via_header => { |v| Header::Via(v) } |
+ warning_header => { |w| Header::Warning(w) }
));
pub type Via = (SentProtocol, HostPort, Vec<ViaParam>);
+#[derive(Debug)]
+pub enum WarningAgent {
+ Host(HostPort),
+ Pseudonym(Vec<u8>),
+}
+
+pub type Warning = (u16, WarningAgent, Vec<u8>);
+
#[derive(Debug)]
pub enum Header {
Accept(Vec<AcceptRange>),
Unsupported(Vec<OptionTag>),
UserAgent(Vec<Server>),
Via(Vec<Via>),
+ Warning(Vec<Warning>),
Extension { name: String, value: String },
}