|
OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
|
A base message class for sending or replying. More...
Static Public Member Functions | |
| 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 | |
| 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. | |
Protected Member Functions | |
| ReadOnlySpan< byte > | Data () |
| The data. | |
Static Protected Member Functions | |
| 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. | |
Properties | |
| byte | Address [get, protected set] |
| Address assigned to the device. | |
| MessageType | MessageType [get, protected set] |
| Type of message. | |
A base message class for sending or replying.
Definition at line 11 of file Message.cs.
|
inlinestaticprotected |
Adds the checksum to the packet.
| packet | The packet. |
Definition at line 160 of file Message.cs.
References CalculateChecksum().
|
inlinestaticprotected |
Calculates the length and adds it to the packet.
| packet | The packet. |
| additionalLength | Additional length to add to the calculation. |
Definition at line 137 of file Message.cs.
|
inlinestaticprotected |
Calculates the checksum from the packet data.
| packet | The packet data. |
Definition at line 127 of file Message.cs.
Referenced by AddChecksum(), and OSDP.Net.Messages.IncomingMessage.IncomingMessage().
|
inlinestaticprotected |
Calculates the CRC from the packet data.
| packet | The packet data. |
Definition at line 111 of file Message.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
|
inlinestatic |
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.
| dataSize | Total size in bytes available for the message. |
| isEncrypted | True when the message is sent over an established secure channel. |
| cryptoLength | Encryption block size used for padding. |
Definition at line 202 of file Message.cs.
|
abstractprotected |
The data.
|
static |
OSDP message address mask.
Definition at line 16 of file Message.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
|
static |
While padding bytes are generally 0x00, the first byte of padding is not.
This is the value of that first byte when the payload (or message for MAC signing) is padded
Definition at line 39 of file Message.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
|
static |
Size in bytes of MAC signature in message suffix when the secure channel has been established.
Definition at line 32 of file Message.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
|
static |
Index of command/reply code within the message header.
Definition at line 26 of file Message.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
|
static |
OSDP message SOM (start of the message) byte.
Definition at line 21 of file Message.cs.
Referenced by OSDP.Net.Tracing.PacketBuffer.Append(), and OSDP.Net.Tracing.PacketBuffer.TryExtractPacket().
|
getprotected set |
Address assigned to the device.
Definition at line 68 of file Message.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage(), and OSDP.Net.Model.Packet.Packet().
|
getprotected set |
Type of message.
Definition at line 73 of file Message.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage(), and OSDP.Net.Model.Packet.Packet().