pub struct SipMessage {
pub direction: Direction,
pub transport: Transport,
pub address: String,
pub timestamp: Timestamp,
pub content: Vec<u8>,
pub frame_count: usize,
}Expand description
A reassembled SIP message (Level 2 output).
For TCP, consecutive frames from the same connection are concatenated and split by Content-Length. For UDP, each frame becomes one message (1:1).
Fields§
§direction: DirectionWhether this message was received or sent.
transport: TransportTransport protocol.
address: StringRemote address as ip:port.
timestamp: TimestampTimestamp of the first frame in this message.
content: Vec<u8>Reassembled message bytes (headers + body).
frame_count: usizeNumber of Level 1 frames that were reassembled into this message.
Implementations§
Source§impl SipMessage
impl SipMessage
Sourcepub fn parse(&self) -> Result<ParsedSipMessage, ParseError>
pub fn parse(&self) -> Result<ParsedSipMessage, ParseError>
Parse this reassembled message into a ParsedSipMessage with typed
access to the request/status line, headers, and body.
Sourcepub fn method(&self) -> Option<&str>
pub fn method(&self) -> Option<&str>
The SIP method read straight from the reassembled bytes: the request
line for requests, the CSeq header for responses. This is the answer
ParsedSipMessage::method gives, without parsing the message.
None whenever the bytes leave it in doubt — an invalid start line, a
response carrying no CSeq, or a CSeq value that is folded or not plain
ASCII. Filtering on this therefore drops only what it has classified,
and a message it does classify is one parse accepts.
Source§impl SipMessage
impl SipMessage
Sourcepub fn socket_addr(&self) -> Option<SocketAddr>
pub fn socket_addr(&self) -> Option<SocketAddr>
The remote address as a typed SocketAddr, preserving family and
port. None when the recorded address is not ip:port; the raw string
remains in address.
Trait Implementations§
Source§impl Clone for SipMessage
impl Clone for SipMessage
Source§fn clone(&self) -> SipMessage
fn clone(&self) -> SipMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more