aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/mqtt.h
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-01-10 09:42:54 +0100
committercbdev <cb@cbcdn.com>2021-01-10 09:42:54 +0100
commit6334a78d0c475ebfa76a739577a561bded135086 (patch)
tree6d4ac9b4dcb36ec808098d11bc61d38f16924080 /backends/mqtt.h
parentcbef6a61a92453afba5005c287873001354f5090 (diff)
downloadmidimonster-6334a78d0c475ebfa76a739577a561bded135086.tar.gz
midimonster-6334a78d0c475ebfa76a739577a561bded135086.tar.bz2
midimonster-6334a78d0c475ebfa76a739577a561bded135086.zip
Subscribe to input channels
Diffstat (limited to 'backends/mqtt.h')
-rw-r--r--backends/mqtt.h17
1 files changed, 12 insertions, 5 deletions
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