C# Class SipSharp.Messages.SipParser

ファイルを表示 Open project: jgauffin/SipSharp Class Usage Examples

Public Methods

Method Description
Parse ( byte buffer, int offset, int count ) : int

Continue parsing a message

ParseFirstLine ( ) : bool
Reset ( ) : void
SipParser ( ) : System

Initializes a new instance of the SipParser class.

Protected Methods

Method Description
OnBodyBytes ( byte bytes, int offset, int count ) : void

Toggle body bytes event.

OnComplete ( ) : void

Raise the MessageComplete event, since we have successfully parsed a message and it's body.

OnFirstLine ( string words ) : void

First message line.

Used to raise the RequestLineParsed or ResponseLineParsed event depending on the words in the array.

Private Methods

Method Description
GetBody ( ) : bool

Parser method to copy all body bytes.

Needed since a TCP packet can contain multiple messages after each other, or partial messages.

GetHeaderName ( ) : bool

Try to find a header name.

GetHeaderValue ( ) : bool

Get header values.

Will also look for multi header values and automatically merge them to one line.

OnHeader ( string name, string value ) : void

Method Details

OnBodyBytes() protected method

Toggle body bytes event.
protected OnBodyBytes ( byte bytes, int offset, int count ) : void
bytes byte
offset int
count int
return void

OnComplete() protected method

Raise the MessageComplete event, since we have successfully parsed a message and it's body.
protected OnComplete ( ) : void
return void

OnFirstLine() protected method

First message line.
Used to raise the RequestLineParsed or ResponseLineParsed event depending on the words in the array.
BadRequestException.
protected OnFirstLine ( string words ) : void
words string Will always contain three elements.
return void

Parse() public method

Continue parsing a message
Parsing failed.
public Parse ( byte buffer, int offset, int count ) : int
buffer byte Byte buffer containing bytes
offset int Where to start the parsing
count int Number of bytes to parse
return int

ParseFirstLine() public method

public ParseFirstLine ( ) : bool
return bool

Reset() public method

public Reset ( ) : void
return void

SipParser() public method

Initializes a new instance of the SipParser class.
public SipParser ( ) : System
return System