public abstract class TaggedTailRecord extends Object
Protocol extension. See https://github.com/dzavalishin/mqtt_udp/wiki/Tagged-Tail
| Modifier and Type | Field and Description |
|---|---|
protected int |
rawLength |
protected byte |
tag |
| Modifier | Constructor and Description |
|---|---|
protected |
TaggedTailRecord(byte tag,
int rawLngth) |
| Modifier and Type | Method and Description |
|---|---|
static TaggedTailRecord |
fromBytes(byte[] raw) |
static Collection<TaggedTailRecord> |
fromBytesAll(byte[] raw,
AtomicReference<Integer> signaturePos)
Decode tail of packet, all the attached TTRs.
|
int |
getRawLength() |
byte |
getTag() |
static int |
htonl(int value) |
abstract byte[] |
toBytes()
Convert this record to bytes to send out.
|
static byte[] |
toBytes(byte tag,
byte[] data)
Used by subclasses to encode selves.
|
public int getRawLength()
public byte getTag()
public static Collection<TaggedTailRecord> fromBytesAll(byte[] raw, AtomicReference<Integer> signaturePos)
Decode tail of packet, all the attached TTRs.
Finds out and returns position of Signature TTR, so that outside code can check if packet signed ok. Outside code must calculate signature locally for part of the packet preceding signature TTR. Including, of course, classic MQTT packet part.
raw - Tail of the packet, everything after the classic MQTT payload size.signaturePos - (Return!) Position of signature TTR in raw.public static TaggedTailRecord fromBytes(byte[] raw)
public abstract byte[] toBytes()
public static byte[] toBytes(byte tag,
byte[] data)
tag - Tag of record.data - Data to putpublic static int htonl(int value)
Copyright © 2019. All rights reserved.