Skip to main content

Case

Struct Case 

Source
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 str

The 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 str

The 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 str

That section’s title, verbatim.

§expect: Expect

Which 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

Source

pub fn wire(&self) -> Bytes

The archive bytes turned into on-the-wire SIP.

Three transformations, all forced by the archive rather than chosen:

  1. 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.

  2. 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 baddn is classified in crate::rfc4475. Refusing it here would test the archive’s formatting, not sipx’s IPv6 handling.

  3. Content-Length is 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:

    casedeclaredarchive body (LF)wire body (CRLF)
    §4.6 ipv6-in-sdp268242251
    §4.8 mult-ip-in-sdp181180189
    §4.9 ipv4-mapped-ipv6236236245

    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-sdp ever saw the c= 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.

Source

pub fn lossy(&self) -> Cow<'_, str>

The message as a lossy string, for assertion messages.

Source

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.

Source

pub fn has_sdp(&self) -> bool

Whether the message carries an SDP body, and so belongs to the sipx-sdp half of the harness as well as the sipx-sip half.

Trait Implementations§

Source§

impl Clone for Case

Source§

fn clone(&self) -> Case

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Case

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for Case

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,