|
OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
|
Represents a message that was received from the wire. More...
Public Member Functions | |
| IncomingMessage (ReadOnlySpan< byte > data, IMessageSecureChannel channel) | |
| Creates a new instance of IncomingMessage class. | |
| bool | SecureCryptogramHasBeenAccepted () |
| Checks whether the secure cryptogram has been accepted. | |
Protected Member Functions | |
| override ReadOnlySpan< byte > | Data () |
| Protected Member Functions inherited from OSDP.Net.Messages.Message | |
| ReadOnlySpan< byte > | Data () |
| The data. | |
Properties | |
| bool | IsUsingCrc [get] |
| If true, the message has a CRC suffix; otherwise it has a checksum. | |
| byte | Type [get] |
| Command/reply code of the message. | |
| byte | Sequence [get] |
| Message sequence number. | |
| bool | IsSecureMessage [get] |
| Indicates if the message was sent via an established secure channel. | |
| bool | IsValidMac [get] |
| Indicates if the message has a valid MAC signature which was validated via local message channel context. | |
| bool | IsUsingDefaultKey [get, set] |
| Gets whether the incoming message is using the default key. | |
| bool | HasSecureData [get] |
| Determines whether the incoming message has secure data. | |
| bool | IsPayloadDecrypted = true [get] |
| Indicates whether the payload was successfully decrypted. | |
| byte[] | Payload [get] |
| Returns the raw message payload. | |
| ReadOnlySpan< byte > | OriginalMessageData [get] |
| Original byte data which includes the header, security control block, payload, MAC and CRC/Checksum suffix. | |
| byte | SecurityBlockType [get] |
| Type of the security block, if there is one. | |
| byte[] | SecureBlockData [get] |
| Raw security block bytes. | |
| bool | IsDataCorrect [get] |
| Gets a value indicating whether the data in the incoming message is correct. | |
| Properties inherited from OSDP.Net.Messages.Message | |
| byte | Address [get, protected set] |
| Address assigned to the device. | |
| MessageType | MessageType [get, protected set] |
| Type of message. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from OSDP.Net.Messages.Message | |
| static ushort | CalculateMaximumMessageSize (ushort dataSize, bool isEncrypted=false, ushort cryptoLength=16) |
| Calculates the largest payload that fits in a message of the given total size, accounting for the message header, security control block, message code, CRC, MAC and encryption padding. | |
| Static Public Attributes inherited from OSDP.Net.Messages.Message | |
| const byte | AddressMask = 0x7F |
| OSDP message address mask. | |
| const byte | StartOfMessage = 0x53 |
| OSDP message SOM (start of the message) byte. | |
| const ushort | MsgTypeIndex = 5 |
| Index of command/reply code within the message header. | |
| const ushort | MacSize = 4 |
| Size in bytes of MAC signature in message suffix when the secure channel has been established. | |
| const byte | FirstPaddingByte = 0x80 |
| While padding bytes are generally 0x00, the first byte of padding is not. | |
| Static Protected Member Functions inherited from OSDP.Net.Messages.Message | |
| static ushort | CalculateCrc (ReadOnlySpan< byte > packet) |
| Calculates the CRC from the packet data. | |
| static byte | CalculateChecksum (byte[] packet) |
| Calculates the checksum from the packet data. | |
| static void | AddPacketLength (Span< byte > packet, ushort additionalLength=0) |
| Calculates the length and adds it to the packet. | |
| static void | AddChecksum (IList< byte > packet) |
| Adds the checksum to the packet. | |
Represents a message that was received from the wire.
It extends base Message class with extra properties/methods that specifically indicate the parsing and validation of incoming raw bytes.
Definition at line 14 of file IncomingMessage.cs.
|
inline |
Creates a new instance of IncomingMessage class.
| data | Raw byte data received from the wire |
| channel | Message channel context |
Definition at line 24 of file IncomingMessage.cs.
References OSDP.Net.Messages.Message.Address, OSDP.Net.Messages.Message.AddressMask, OSDP.Net.Messages.Message.CalculateChecksum(), OSDP.Net.Messages.Message.CalculateCrc(), OSDP.Net.Messages.Command, OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.DecodePayload(), OSDP.Net.Messages.Message.FirstPaddingByte, OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.GenerateMac(), HasSecureData, IsDataCorrect, IsPayloadDecrypted, IsSecureMessage, OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.IsSecurityEstablished, IsUsingCrc, IsUsingDefaultKey, OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.IsUsingDefaultKey, IsValidMac, OSDP.Net.Messages.Message.MacSize, OSDP.Net.Messages.Message.MessageType, OSDP.Net.Messages.Message.MsgTypeIndex, Payload, SecureBlockData, SecurityBlockType, Sequence, and Type.
| bool OSDP.Net.Messages.IncomingMessage.SecureCryptogramHasBeenAccepted | ( | ) |
Checks whether the secure cryptogram has been accepted.
Per the OSDP spec (section D.1.3.4), the osdp_RMAC_I (SCS_14) security block data byte is 0x01 when the PD accepted the ACU's server cryptogram and the secure channel is established.
References SecureBlockData.
|
get |
Determines whether the incoming message has secure data.
The HasSecureData property is used to check if the incoming message has secure data.
true if the incoming message has secure data; otherwise, false.
Definition at line 146 of file IncomingMessage.cs.
Referenced by IncomingMessage().
|
get |
Gets a value indicating whether the data in the incoming message is correct.
Definition at line 194 of file IncomingMessage.cs.
Referenced by OSDP.Net.Device.EnqueuePollReply(), and IncomingMessage().
|
get |
Indicates whether the payload was successfully decrypted.
When true, the Payload contains decrypted data that can be parsed. When false, the payload is still encrypted because the secure channel was not established or the required key was not available.
Definition at line 158 of file IncomingMessage.cs.
Referenced by IncomingMessage().
|
get |
Indicates if the message was sent via an established secure channel.
Definition at line 119 of file IncomingMessage.cs.
Referenced by IncomingMessage().
|
get |
If true, the message has a CRC suffix; otherwise it has a checksum.
Definition at line 102 of file IncomingMessage.cs.
Referenced by IncomingMessage(), and OSDP.Net.Model.Packet.Packet().
|
getset |
Gets whether the incoming message is using the default key.
The IsUsingDefaultKey property is a boolean value that indicates whether the incoming message is using the default key. This property is true if the incoming message is using the default key; otherwise, false. The default key is a pre-configured key that is used for cryptographic operations.
Definition at line 135 of file IncomingMessage.cs.
Referenced by IncomingMessage(), and OSDP.Net.Model.Packet.Packet().
|
get |
Indicates if the message has a valid MAC signature which was validated via local message channel context.
Definition at line 125 of file IncomingMessage.cs.
Referenced by IncomingMessage().
|
get |
Original byte data which includes the header, security control block, payload, MAC and CRC/Checksum suffix.
Definition at line 169 of file IncomingMessage.cs.
Referenced by OSDP.Net.Model.Packet.Packet().
|
get |
Returns the raw message payload.
Definition at line 163 of file IncomingMessage.cs.
Referenced by Data(), OSDP.Net.Device.EnqueuePollReply(), IncomingMessage(), and OSDP.Net.Model.Packet.Packet().
|
get |
Raw security block bytes.
Definition at line 179 of file IncomingMessage.cs.
Referenced by IncomingMessage(), and SecureCryptogramHasBeenAccepted().
|
get |
Type of the security block, if there is one.
Definition at line 174 of file IncomingMessage.cs.
Referenced by Data(), and IncomingMessage().
|
get |
Message sequence number.
Definition at line 112 of file IncomingMessage.cs.
Referenced by IncomingMessage(), and OSDP.Net.Model.Packet.Packet().
|
get |
Command/reply code of the message.
Definition at line 107 of file IncomingMessage.cs.
Referenced by OSDP.Net.Device.EnqueuePollReply(), IncomingMessage(), and OSDP.Net.Model.Packet.Packet().