Default Port: 33333
|0||Packet type & encryption settings.||Never encrypted|
|1||VSCP Level II Head MSB||Yes|
|2||VSCP Level II Head LSB||Yes|
|3||Timestamp microseconds MSB||Yes|
|6||Timestamp microseconds LSB||Yes|
|34||DATA SIZE MSB||Yes|
|35||DATA SIZE LSB||Yes|
|36-n||data ... limited to max 512-25 = 487 bytes||Yes|
|len-2||CRC MSB (Calculated on HEAD + CLASS + TYPE + ADDRESS + SIZE + DATA…)||Yes|
|opt||Optional encryption data such as a 16-byte IV for AES follow here||No|
The number above is the offset in the package. Len is the total datagram size.
Time should always be UTC time. If the time block is set to all zero the current time will be set by interface (VSCP Server for example).
|7,6,5,4||Packet type. Currently always zero.|
|1||AES128 CBC encryption. 16-byte IV is appended to each frame.|
|2||AES192 CBC encryption. 16-byte IV is appended to each frame.|
|3||AES256 CBC encryption. 16-byte IV is appended to each frame.|
For encryption/decryption code using OpenSSL see this link. Note that byte 0 of the frame is never encrypted. The encryption/decryption is instead carried out over byte 1 to the CRC.
|15||GUID is IP v.6 address.|
|14||Dumb node. No MDF. No registers.|
|13-8||Reserved (Set to zero!).|
|3||Don't calculate CRC if bit set. CRC should be set to 0xAA55 if set.|
Note also that the MSB is sent before the LSB (network byte order, Big Endian). So, for little endian machines such as a typical PC the byte order needs to be reversed for multi-byte types.
There is a 24-byte overhead to send one byte of data so this is not a protocol which should be used where an efficient protocol for data intensive applications is required and where data is sent in small packets.
The CRC used is the 16-bit CCITT type and it should be calculated across all bytes except for the CRC itself.
As indicated, the Class is 16-bits allowing for 65535 classes. Class 0000000x xxxxxxxx is reserved for the Level I classes. A low-end device should ignore all packages with a class > 511.
A packet traveling from a Level I device out to the Level II world should have an address translation done by the master so that a full address will be visible on the level II segment. A packet traveling from a Level II segment to a Level I segment must have a class with a value that is less then 512 in order for it to be recognized. If it has it is aimed for the Level I segment. Classes 512-1023 are reserved for packets that should stay in the Level II segment but in all other aspects (the lower nine bits + type) are defined in the same manner as for the low-end net.
The Level II register abstraction level also has more registers (32-bit address is used) and all registers are 32–bits wide. Registers 0-255 are byte wide and are the same as for level 1. If these registers are read at level 2 they still is read as 32-bit but have the unused bits set to zero.
This document is licensed under Creative Commons BY 4.0 and can be freely copied, redistributed, remixed, transformed, built upon as long as you give credits to the author.