[][src]Struct xylosip::request::Request

pub struct Request<'a> {
    pub request_line: RequestLine<'a>,
    pub headers: Vec<Header<'a>>,
    pub body: Option<&'a [u8]>,
}

Representation of a SIP Request

A SIP request is composed of its Request-Line, a number of mandatory and optional headers, and an optional body. Considering that the request's body is not strictly relevant to the parsing of SIP messages, it is provided in an unparsed and unvalidated form (&[u8]). The body typically contains an SDP description of where the media streams should connect.

Note: Future implementations might list mandatory headers separately from the current headers field.

Sample request

This example is not tested
INVITE sip:bob@biloxi.example.com SIP/2.0                            <-- the Request-Line
Via: SIP/2.0/TCP client.atlanta.example.com:5060;branch=z9hG4bK74b43 |
Max-Forwards: 70                                                     |
Route: <sip:ss1.atlanta.example.com;lr>                              |
From: Alice <sip:alice@atlanta.example.com>;tag=9fxced76sl           |
To: Bob <sip:bob@biloxi.example.com>                                 | - mandatory and
Call-ID: 3848276298220188511@atlanta.example.com                     |  optional headers
CSeq: 1 INVITE                                                       |
Contact: <sip:alice@client.atlanta.example.com;transport=tcp>        |
Content-Type: application/sdp                                        |
Content-Length: 151                                                  |

v=0                                                                  |
o=alice 2890844526 2890844526 IN IP4 client.atlanta.example.com      |
s=-                                                                  |
c=IN IP4 192.0.2.101                                                 | - optional body
t=0 0                                                                |
m=audio 49172 RTP/AVP 0                                              |
a=rtpmap:0 PCMU/8000                                                 |

Fields

request_line: RequestLine<'a>

the parsed Request-Line

headers: Vec<Header<'a>>

mandatory and optional headers extracted from the request

body: Option<&'a [u8]>

the optional body of the request. This is completely unparsed and unvalidated.

Methods

impl<'a> Request<'a>[src]

pub fn parse(input: &'a [u8]) -> Result<Self, Error<'a, &[u8]>>[src]

Attempts to parse a byte-slice representation of a SIP request

Note: The error type of this method will probably change in the future.

Trait Implementations

impl<'a> Clone for Request<'a>[src]

impl<'a> Debug for Request<'a>[src]

impl<'a> PartialEq<Request<'a>> for Request<'a>[src]

impl<'a> StructuralPartialEq for Request<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Request<'a>

impl<'a> Send for Request<'a>

impl<'a> Sync for Request<'a>

impl<'a> Unpin for Request<'a>

impl<'a> UnwindSafe for Request<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.