Scanner Intro

From reSIProcate
Jump to: navigation, search

SipMessage parsing happens in phases. MsgHeaderScanner performs the first phase of parsing. MsgHeaderScanner is called from a transport. Framing of the message is an interaction between the transport and the scanner. The transport feeds the scanner consecutive chunks and the scanner reports when it has framed a message.

The chunks containing the memory are handed back to the SipMessage for eventual deallocation. In addition, the scanner lexes the message and identifies the boundaries of header field values.

Each header field value is parsed on demand. The instance of parser that is created for the header field value is determined by the header type accessed in the message.