SNode.C
Loading...
Searching...
No Matches
ControlPacketDeserializer.h
Go to the documentation of this file.
1/*
2 * SNode.C - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef IOT_MQTT_CONTROLPACKETRECEIVER_H
21#define IOT_MQTT_CONTROLPACKETRECEIVER_H
22
23namespace iot::mqtt {
24 class MqttContext;
25} // namespace iot::mqtt
26
27#ifndef DOXYGEN_SHOULD_SKIP_THIS
28
29#include <cstddef>
30#include <cstdint>
31
32#endif // DOXYGEN_SHOULD_SKIP_THIS
33
34namespace iot::mqtt {
35
37 public:
39
40 ControlPacketDeserializer(uint32_t remainingLength, uint8_t flags, uint8_t mustFlags);
41
43
45
46 std::size_t deserialize(iot::mqtt::MqttContext* mqttContext);
47
48 private:
49 virtual std::size_t deserializeVP(iot::mqtt::MqttContext* mqttContext) = 0;
50
51 public:
52 uint32_t getRemainingLength() const;
53
54 bool isComplete() const;
55 bool isError() const;
56
57 std::size_t getConsumed() const;
58
59 protected:
60 bool complete = false;
61 bool error = false;
62
63 uint32_t remainingLength = 0;
64
65 std::size_t consumed = 0;
66 };
67
68} // namespace iot::mqtt
69
70#endif // IOT_MQTT_CONTROLPACKETRECEIVER_H
std::size_t deserialize(iot::mqtt::MqttContext *mqttContext)
virtual std::size_t deserializeVP(iot::mqtt::MqttContext *mqttContext)=0
ControlPacketDeserializer & operator=(const ControlPacketDeserializer &)=default
ControlPacketDeserializer(uint32_t remainingLength, uint8_t flags, uint8_t mustFlags)
virtual void deliverPacket(iot::mqtt::client::Mqtt *mqtt)=0
std::size_t deserializeVP(iot::mqtt::MqttContext *mqttContext) override
Definition Connack.cpp:35
Connack(uint32_t remainingLength, uint8_t flags)
Definition Connack.cpp:30
void deliverPacket(iot::mqtt::client::Mqtt *mqtt) override
Definition Connack.cpp:65
#define MQTT_CONNACK_FLAGS