Class MsrpStreamParser
This class parses each byte received in a TCP/TLS stream and extracts complete MSRP messages from the steam.
Inherited Members
Namespace: SipLib.Msrp
Assembly: SipLib.dll
Syntax
public class MsrpStreamParser
Constructors
| Edit this page View SourceMsrpStreamParser(int)
Constructor
Declaration
public MsrpStreamParser(int MaxMsrpMessageLength)
Parameters
Type | Name | Description |
---|---|---|
int | MaxMsrpMessageLength |
Methods
| Edit this page View SourceFindEndLinePattern(byte[], int, byte[])
Searches for the MSRP end line pattern byte array pattern within an array by searching from the end of the read buffer.
Declaration
public static int FindEndLinePattern(byte[] SrcArray, int LastSrcIndex, byte[] BytePattern)
Parameters
Type | Name | Description |
---|---|---|
byte[] | SrcArray | Array to search in. |
int | LastSrcIndex | Last index in the source array to include in the search range |
byte[] | BytePattern | Array of bytes containing the end line pattern to search for. |
Returns
Type | Description |
---|---|
int | The index within the search array of the start of the pattern to search for. Returns -1 if the pattern is not found. |
GetMessageBytes()
Gets the full MSRP message transaction from the current stream buffer. This method must be called immediately if the ProcessByte() method returns true.
Declaration
public byte[]? GetMessageBytes()
Returns
Type | Description |
---|---|
byte[] | Returns a byte array containing the full MSRP message transaction. Returns null if this method is not called immediately after ProcessByte() returns true. |
ProcessByte(byte)
Processes the next byte received from the TCP/TLS network stream and searhes for a complete MSRP message transaction.
Declaration
public bool ProcessByte(byte NextByte)
Parameters
Type | Name | Description |
---|---|---|
byte | NextByte | Next byte to process |
Returns
Type | Description |
---|---|
bool | Returns true if a complete MSRP message transaction block is detected. Return false if a message is not available yet. The caller must immediately call GetMessageBytes() to retrive the new message if this method return true. |