pub struct Case {
pub name: &'static str,
pub section: &'static str,
pub title: &'static str,
pub expect: Expect,
pub bytes: &'static [u8],
}Expand description
One message from the corpus.
Fields§
§name: &'static strThe RFC’s own name for the message, e.g. ipv6-good. RFC 5118 labels each message with
this name (“Message Details: ipv6-good”), and the archive’s file names match, so the
name is the link from a fixture back to the prose that describes it.
section: &'static strThe section of RFC 5118 that describes it, e.g. 4.1. Two sections describe two
messages each, so this is not unique across cases.
title: &'static strThat section’s title, verbatim.
expect: ExpectWhich layer must object, and how.
bytes: &'static [u8]The message exactly as Appendix A’s archive holds it — LF-terminated, and for the §4.10
pair without a terminating blank line. Use Case::wire to get bytes a SIP parser is
meant to see.
Implementations§
Source§impl Case
impl Case
Sourcepub fn wire(&self) -> Bytes
pub fn wire(&self) -> Bytes
The archive bytes turned into on-the-wire SIP.
Three transformations, all forced by the archive rather than chosen:
-
LF becomes CRLF. RFC 3261 §7 terminates every start line and header field with CRLF. The archive holds none, so without this every message is one unterminated header line and the corpus would measure nothing but that fact.
-
The header section is terminated if the archive left it open, which it does for §4.10’s two files. An unterminated header section is indistinguishable from a truncated message, so a parser is right to refuse it — see how RFC 4475’s
baddnis classified incrate::rfc4475. Refusing it here would test the archive’s formatting, not sipx’s IPv6 handling. -
Content-Lengthis set to the actual body length. The three messages that carry SDP declare a length that matches neither the LF-terminated body in the archive nor the CRLF-terminated one:case declared archive body (LF) wire body (CRLF) §4.6 ipv6-in-sdp268 242 251 §4.8 mult-ip-in-sdp181 180 189 §4.9 ipv4-mapped-ipv6236 236 245 No single convention reconciles those, so the declared values are simply wrong — and RFC 5118 has one verified erratum, on §4.3’s wording, which does not mention them. A parser is right to refuse §4.6 as truncated and right to discard the tail of the other two, but doing so here would measure the RFC’s arithmetic instead of sipx’s IPv6 handling, and would cut §4.8’s and §4.9’s SDP off mid-body before
sipx-sdpever saw thec=lines the sections exist to exercise.Framing is covered thoroughly by RFC 4475, which has cases built for it (
clerr,ncl,mcl01) and correct lengths everywhere else.
None of the three touches an octet inside an IPv6 reference, a URI, or a body — only line
terminators and the digits of one header value. What the corpus is for survives intact,
and wire_changes_only_terminators_and_content_length holds that claim.
Sourcepub fn is_classified(&self) -> bool
pub fn is_classified(&self) -> bool
Whether this case is asserted on by the parser tests. Every RFC 5118 case is: unlike RFC 4475’s archive, this one carries no file that no section references.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Case
impl RefUnwindSafe for Case
impl Send for Case
impl Sync for Case
impl Unpin for Case
impl UnsafeUnpin for Case
impl UnwindSafe for Case
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more