From 6334a78d0c475ebfa76a739577a561bded135086 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 10 Jan 2021 09:42:54 +0100 Subject: Subscribe to input channels --- backends/mqtt.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'backends/mqtt.h') diff --git a/backends/mqtt.h b/backends/mqtt.h index a0f5356..c9bce81 100644 --- a/backends/mqtt.h +++ b/backends/mqtt.h @@ -16,6 +16,8 @@ static int mqtt_shutdown(size_t n, instance** inst); #define MQTT_KEEPALIVE 10 #define MQTT_VERSION_DEFAULT 0x05 +#define MQTT5_NO_LOCAL 0x04 + enum { MSG_RESERVED = 0x00, MSG_CONNECT = 0x10, @@ -25,7 +27,7 @@ enum { MSG_PUBREC = 0x50, MSG_PUBREL = 0x60, MSG_PUBCOMP = 0x70, - MSG_SUBSCRIBE = 0x80, + MSG_SUBSCRIBE = 0x82, MSG_SUBACK = 0x90, MSG_UNSUBSCRIBE = 0xA0, MSG_UNSUBACK = 0xB0, @@ -35,6 +37,13 @@ enum { MSG_AUTH = 0xF0 }; +//qos, subscribe +typedef struct /*_mqtt_channel*/ { + char* topic; + uint16_t topic_alias; + uint8_t flags; +} mqtt_channel_data; + typedef struct /*_mqtt_instance_data*/ { uint8_t tls; char* host; @@ -46,14 +55,12 @@ typedef struct /*_mqtt_instance_data*/ { char* client_id; size_t nchannels; - char** channel; + mqtt_channel_data* channel; int fd; uint8_t receive_buffer[MQTT_BUFFER_LENGTH]; size_t receive_offset; uint64_t last_control; + uint16_t packet_identifier; } mqtt_instance_data; - -//per-channel -//qos, subscribe -- cgit v1.2.3