2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
20#ifndef IOT_MQTT_TYPES_TYPEBASE_H
21#define IOT_MQTT_TYPES_TYPEBASE_H
27#ifndef DOXYGEN_SHOULD_SKIP_THIS
34namespace iot::mqtt::types {
36 template <
typename ValueTypeT>
39 using ValueType = ValueTypeT;
42 explicit TypeBase(std::size_t size =
sizeof(ValueType));
43 TypeBase(
const TypeBase&) =
default;
44 TypeBase(TypeBase&&)
noexcept =
default;
46 virtual ~TypeBase() =
default;
48 TypeBase& operator=(
const TypeBase&) =
default;
49 TypeBase& operator=(TypeBase&&)
noexcept =
default;
51 virtual std::size_t deserialize(iot::mqtt::MqttContext* mqttContext);
52 virtual std::vector<
char> serialize()
const;
54 void setSize(std::size_t size);
58 bool isComplete()
const;
60 virtual void reset(std::size_t size =
sizeof(ValueType));
63 std::vector<
char> value;
65 std::size_t length = 0;
66 std::size_t needed = 0;
68 bool complete =
false;
#define SUBSCRIBTION_MAX_QOS
Session & operator=(const Session &)=default
std::set< uint16_t > publishPacketIdentifierSet
virtual nlohmann::json toJson() const
Session(const nlohmann::json &json)
bool isCleanSession() const
Session(const Session &)=default
virtual ~Session()=default
void fromJson(const nlohmann::json &json)
std::set< uint16_t > pubrelPacketIdentifierSet
SocketContextFactory()=default
virtual core::socket::stream::SocketContext * create(core::socket::stream::SocketConnection *socketConnection, std::shared_ptr< iot::mqtt::server::broker::Broker > broker)=0
core::socket::stream::SocketContext * create(core::socket::stream::SocketConnection *socketConnection) final
void restartSession(const std::string &clientId)
std::string sessionStoreFileName
uint8_t subscribe(const std::string &clientId, const std::string &topic, uint8_t qoS)
bool hasActiveSession(const std::string &clientId)
static std::shared_ptr< Broker > instance(uint8_t maxQoS)
bool isActiveSession(const std::string &clientId, const Mqtt *mqtt)
iot::mqtt::server::broker::RetainTree retainTree
void publish(const std::string &originClientId, const std::string &topic, const std::string &message, uint8_t qoS, bool retain)
bool hasSession(const std::string &clientId)
void appear(const std::string &clientId, const std::string &topic, uint8_t qoS)
void unsubscribe(const std::string &clientId, const std::string &topic)
Session * renewSession(const std::string &clientId, iot::mqtt::server::Mqtt *mqtt)
void deleteSession(const std::string &clientId)
void unsubscribe(const std::string &clientId)
bool hasRetainedSession(const std::string &clientId)
iot::mqtt::server::broker::SubscribtionTree subscribtionTree
Session * newSession(const std::string &clientId, iot::mqtt::server::Mqtt *mqtt)
void sendPublish(const std::string &clientId, Message &message, uint8_t qoS, bool retain)
void retainSession(const std::string &clientId)
void setMessage(const std::string &message)
const std::string & getOriginClientId() const
std::string originClientId
nlohmann::json toJson() const
const std::string & getTopic() const
void setTopic(const std::string &topic)
bool getOriginRetain() const
const std::string & getMessage() const
Message & operator=(const Message &)=default
Message(const Message &message)=default
Message(const std::string &originClientId, const std::string &topic, const std::string &message, uint8_t qoS, bool originRetain)
Message & fromJson(const nlohmann::json &json)
void retain(const Message &message, std::string topic)
void appear(const std::string &clientId, uint8_t clientQoS)
TopicLevel(iot::mqtt::server::broker::Broker *broker)
TopicLevel & fromJson(const nlohmann::json &json)
void appear(const std::string &clientId, std::string topic, uint8_t qoS)
nlohmann::json toJson() const
bool release(std::string topic)
void appear(const std::string &clientId, const std::string &topic, uint8_t qoS)
void retain(Message &&message)
void fromJson(const nlohmann::json &json)
RetainTree(iot::mqtt::server::broker::Broker *broker)
nlohmann::json toJson() const
void sendPublish(iot::mqtt::server::broker::Message &message, uint8_t qoS, bool retain)
std::deque< Message > messageQueue
nlohmann::json toJson() const final
Session(iot::mqtt::server::Mqtt *mqtt)
void fromJson(const nlohmann::json &json)
Session * renew(iot::mqtt::server::Mqtt *mqtt)
bool isOwnedBy(const iot::mqtt::server::Mqtt *mqtt) const