|
YAACC - UPNP Client and Server
|
Encodes and decodes the binary messages of the Snapcast stream protocol (little endian, the layouts of docs/tech.md, "Binary protocol").
More...

Static Public Member Functions | |
| static byte[] | encode (SnapcastBinaryMessage message, int id, int refersTo, int sentSec, int sentUsec, int receivedSec, int receivedUsec) |
| One complete frame: the 26 byte header and the typed message. | |
| static byte[] | encode (SnapcastBinaryMessage message, int id, int refersTo, long sentMicros) |
| As above with the send time as microseconds (clamped into the range of 32 bit seconds) and no receive time. | |
| static Frame | decode (byte[] frame) throws StreamFormatException |
| Decodes one complete frame held in a byte array. | |
Encodes and decodes the binary messages of the Snapcast stream protocol (little endian, the layouts of docs/tech.md, "Binary protocol").
Everything here is a pure function of bytes; the network is FrameReader.
Rules for what comes from the server (design, "Security rules for Phase B"): the size in the header is checked against its cap before a body is read (MessageHeader#parse), every length inside a message is checked against what is left of the message before anything is reserved for it, JSON goes through the depth and token pre-scan of the control client, and the only failure that leaves this class is a StreamFormatException. Types this client does not handle (and the base type 0) are skipped by size, with no message.
|
static |
Decodes one complete frame held in a byte array.
| StreamFormatException | TRUNCATED when the array ends early, MALFORMED when there are bytes after the frame, and the errors of the header and the body |
|
static |
One complete frame: the 26 byte header and the typed message.
| id | the id of this message (0 to 65535) |
| refersTo | the id of the message this answers (0 when it answers none) |
| sentSec | the time of sending, filled in by the sender |
| receivedSec | the time of receiving, filled in by the receiver (0 when we send) |
Referenced by de.yaacc.snapcast.protocol.SnapcastMessageCodec.encode(), and de.yaacc.snapcast.protocol.SnapcastConnection.sendClientInfo().
