summaryrefslogtreecommitdiffstats
path: root/pickles/mqtt.pk
blob: 864e4f8f33e0288a85167816e66889a8aec5bf1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

/* Copyright (C) 2020-2021, Mohammad-Reza Nabipoor */
/* SPDX-License-Identifier: GPL-3.0-or-later */

/* Work in progress */

type MQTT_String = struct
  {
    big uint16 length;
    byte[length] data;
  };

/* Control packet types */
var MQTT_CTLPKT_TYPE_CONNECT = 1UN, /* Client request to connect to Server */
    MQTT_CTLPKT_TYPE_CONNACK = 2UN, /* Connect acknowledgment */
    MQTT_CTLPKT_TYPE_PUBLISH = 3UN, /* Publish message */
    MQTT_CTLPKT_TYPE_PUBACK = 4UN,  /* Publish acknowledgment */
    MQTT_CTLPKT_TYPE_PUBREC = 5UN,  /* Publish received (assured delivery part 1) */
    MQTT_CTLPKT_TYPE_PUBREL = 6UN,
    MQTT_CTLPKT_TYPE_ = UN,
    MQTT_CTLPKT_TYPE_ = UN,
    MQTT_CTLPKT_TYPE_ = UN,

/* Control packet flags */
var MQTT_CTLPKT_FLAG_CONNECT = 0UN;

type MQTT_FixedHeader = struct
  {
    struct byte
    {
      uint<4> pkt_type;
      uint<4> flags;
    }
    //offset<byte,B> remaining_length : remaining_length < 128;
    ULEB128 remaining_length : remaining_length.value <= 0xffff_ff7fUL;

    byte[0] @ remaining_length - 2#UB; /* CHKME */
  };

type MQTT_VariableHeader = struct
  {
    big uint16 pkt_id;
  };

type MQTT_ControlPacket = struct
  {
    
  };

// fun mqtt_verify_string = (MQTT_String s) int: { return 1; }

Generated by cgit on ageinghacker.net.
I am Luca Saiu. If you have reason to request commit access to one of these repositories please contact me. You may also send me patches by email.