OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
OSDP.Net.Tracing.MessageSpy Class Reference

Provides functionality to parse and decode OSDP messages from raw byte data, tracking secure channel state for encrypted communications. More...

Public Member Functions

 MessageSpy (byte[]? securityKey=null)
 Initializes a new instance of the MessageSpy class with an optional security key.
byte PeekAddressByte (ReadOnlySpan< byte > data)
 Retrieves the address byte from raw OSDP data without parsing the entire message.
IncomingMessage ParseCommand (byte[] data)
 Parses raw OSDP command data into an IncomingMessage, handling the secure channel establishment.
IncomingMessage ParseReply (byte[] data)
 Parses raw OSDP reply data into an IncomingMessage, handling the secure channel establishment.
Packet ParsePacket (byte[] data)
 Parses raw OSDP data into a Packet, automatically detecting command vs.
bool TryParsePacket (byte[] data, out Packet? packet)
 Attempts to parse raw OSDP data into a Packet without throwing exceptions.
IEnumerable< OSDPCaptureEntry > ParseCaptureFile (string json)
 Parses an OSDP capture file in JSON format.

Detailed Description

Provides functionality to parse and decode OSDP messages from raw byte data, tracking secure channel state for encrypted communications.

Definition at line 20 of file MessageSpy.cs.

Constructor & Destructor Documentation

◆ MessageSpy()

OSDP.Net.Tracing.MessageSpy.MessageSpy ( byte?[] securityKey = null)
inline

Initializes a new instance of the MessageSpy class with an optional security key.

Parameters
securityKeyOptional encryption key for decrypting secure channel packets. If null, only non-encrypted packets can be fully parsed.

Definition at line 32 of file MessageSpy.cs.

Member Function Documentation

◆ ParseCaptureFile()

IEnumerable< OSDPCaptureEntry > OSDP.Net.Tracing.MessageSpy.ParseCaptureFile ( string json)
inline

Parses an OSDP capture file in JSON format.

Parameters
jsonThe JSON content of the capture file.
Returns
An enumerable of parsed capture entries.

Definition at line 198 of file MessageSpy.cs.

References OSDP.Net.Utilities.BinaryUtils.HexToBytes(), and ParsePacket().

◆ ParseCommand()

IncomingMessage OSDP.Net.Tracing.MessageSpy.ParseCommand ( byte[] data)
inline

Parses raw OSDP command data into an IncomingMessage, handling the secure channel establishment.

Parameters
dataRaw OSDP command data, optionally prefixed with one or more 0xFF mark bytes, followed by the SOM byte.
Returns
Parsed IncomingMessage containing the command details.

Definition at line 71 of file MessageSpy.cs.

References OSDP.Net.Messages.KeySet, OSDP.Net.Messages.ServerCryptogram, and OSDP.Net.Messages.SessionChallenge.

Referenced by ParsePacket().

◆ ParsePacket()

Packet OSDP.Net.Tracing.MessageSpy.ParsePacket ( byte[] data)
inline

Parses raw OSDP data into a Packet, automatically detecting command vs.

reply.

Parameters
dataRaw OSDP message data starting with SOM byte.
Returns
Parsed Packet containing the message details.

Definition at line 164 of file MessageSpy.cs.

References ParseCommand(), ParseReply(), and PeekAddressByte().

Referenced by ParseCaptureFile(), and TryParsePacket().

◆ ParseReply()

IncomingMessage OSDP.Net.Tracing.MessageSpy.ParseReply ( byte[] data)
inline

Parses raw OSDP reply data into an IncomingMessage, handling the secure channel establishment.

Parameters
dataRaw OSDP reply data, optionally prefixed with one or more 0xFF mark bytes, followed by the SOM byte.
Returns
Parsed IncomingMessage containing the reply details.

Definition at line 106 of file MessageSpy.cs.

References OSDP.Net.Messages.InitialRMac.

Referenced by ParsePacket().

◆ PeekAddressByte()

byte OSDP.Net.Tracing.MessageSpy.PeekAddressByte ( ReadOnlySpan< byte > data)
inline

Retrieves the address byte from raw OSDP data without parsing the entire message.

Parameters
dataRaw OSDP message data, optionally prefixed with one or more 0xFF mark bytes, followed by the SOM byte.
Returns
The address byte from the message.

Definition at line 44 of file MessageSpy.cs.

Referenced by ParsePacket().

◆ TryParsePacket()

bool OSDP.Net.Tracing.MessageSpy.TryParsePacket ( byte[] data,
out Packet? packet )
inline

Attempts to parse raw OSDP data into a Packet without throwing exceptions.

Parameters
dataRaw OSDP message data starting with SOM byte.
packetWhen successful, contains the parsed Packet.
Returns
True if parsing succeeded, false otherwise.

Definition at line 179 of file MessageSpy.cs.

References ParsePacket().


The documentation for this class was generated from the following file: