SNode.C
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
UInt16.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/*
21 * MIT License
22 *
23 * Permission is hereby granted, free of charge, to any person obtaining a copy
24 * of this software and associated documentation files (the "Software"), to deal
25 * in the Software without restriction, including without limitation the rights
26 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27 * copies of the Software, and to permit persons to whom the Software is
28 * furnished to do so, subject to the following conditions:
29 *
30 * The above copyright notice and this permission notice shall be included in
31 * all copies or substantial portions of the Software.
32 *
33 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
39 * THE SOFTWARE.
40 */
41
42#ifndef IOT_MQTT_TYPES_UINT16_H
43#define IOT_MQTT_TYPES_UINT16_H
44
45#include "iot/mqtt/types/TypeBase.h"
46
47// IWYU pragma: no_include "iot/mqtt/types/TypeBase.hpp"
48
49#ifndef DOXYGEN_SHOULD_SKIP_THIS
50
51#include <cstdint>
52
53#endif // DOXYGEN_SHOULD_SKIP_THIS
54
55namespace iot::mqtt::types {
56
57 class UInt16 : public TypeBase<uint16_t> {
58 public:
59 UInt16() = default;
60 UInt16(const UInt16&) = default;
61 UInt16(UInt16&&) noexcept = default;
62
63 UInt16& operator=(const UInt16&) = default;
64 UInt16& operator=(UInt16&&) noexcept = default;
65
66 ~UInt16() override;
67
68 UInt16& operator=(const uint16_t& newValue);
69 operator uint16_t() const;
70 };
71
72 extern template class TypeBase<uint16_t>;
73
74} // namespace iot::mqtt::types
75
76#endif // IOT_MQTT_TYPES_UINT16_H
#define SUBSCRIBTION_MAX_QOS
Definition Broker.h:66
Session & operator=(const Session &)=default
std::set< uint16_t > publishPacketIdentifierSet
Definition Session.h:85
virtual nlohmann::json toJson() const
Definition Session.cpp:59
Session(const nlohmann::json &json)
Definition Session.cpp:55
bool isCleanSession() const
Session(const Session &)=default
virtual ~Session()=default
void fromJson(const nlohmann::json &json)
Definition Session.cpp:89
std::set< uint16_t > pubrelPacketIdentifierSet
Definition Session.h:82
uint8_t getQoS() const
Definition Publish.cpp:85
iot::mqtt::types::StringRaw message
Definition Publish.h:79
std::string getTopic() const
Definition Publish.cpp:93
std::string getMessage() const
Definition Publish.cpp:97
Publish(uint16_t packetIdentifier, const std::string &topic, const std::string &message, uint8_t qoS, bool dup, bool retain)
Definition Publish.cpp:56
iot::mqtt::types::UInt16 packetIdentifier
Definition Publish.h:77
uint16_t getPacketIdentifier() const
Definition Publish.cpp:89
iot::mqtt::types::String topic
Definition Publish.h:78
std::vector< char > serializeVP() const override
Definition Publish.cpp:67
SocketContextFactory(const std::string &sessionStoreFileName)
std::shared_ptr< iot::mqtt::server::broker::Broker > broker
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)
Definition Broker.cpp:165
uint8_t subscribe(const std::string &clientId, const std::string &topic, uint8_t qoS)
Definition Broker.cpp:206
bool hasActiveSession(const std::string &clientId)
Definition Broker.cpp:186
bool isActiveSession(const std::string &clientId, const Mqtt *mqtt)
Definition Broker.cpp:194
iot::mqtt::server::broker::RetainTree retainTree
Definition Broker.h:113
void publish(const std::string &originClientId, const std::string &topic, const std::string &message, uint8_t qoS, bool retain)
Definition Broker.cpp:147
std::list< std::string > getSubscriptions(const std::string &clientId) const
Definition Broker.cpp:229
Broker(uint8_t maxQoS, const std::string &sessionStoreFileName)
Definition Broker.cpp:60
void release(const std::string &topic)
Definition Broker.cpp:202
bool hasSession(const std::string &clientId)
Definition Broker.cpp:182
void appear(const std::string &clientId, const std::string &topic, uint8_t qoS)
Definition Broker.cpp:198
static std::shared_ptr< Broker > instance(uint8_t maxQoS, const std::string &sessionStoreFileName)
Definition Broker.cpp:140
void unsubscribe(const std::string &clientId, const std::string &topic)
Definition Broker.cpp:225
Session * renewSession(const std::string &clientId, iot::mqtt::server::Mqtt *mqtt)
Definition Broker.cpp:161
void deleteSession(const std::string &clientId)
Definition Broker.cpp:177
void unsubscribe(const std::string &clientId)
Definition Broker.cpp:221
bool hasRetainedSession(const std::string &clientId)
Definition Broker.cpp:190
iot::mqtt::server::broker::SubscribtionTree subscribtionTree
Definition Broker.h:112
Session * newSession(const std::string &clientId, iot::mqtt::server::Mqtt *mqtt)
Definition Broker.cpp:155
void sendPublish(const std::string &clientId, Message &message, uint8_t qoS, bool retain)
Definition Broker.cpp:241
void retainSession(const std::string &clientId)
Definition Broker.cpp:173
void setMessage(const std::string &message)
Definition Message.cpp:78
const std::string & getOriginClientId() const
Definition Message.cpp:62
nlohmann::json toJson() const
Definition Message.cpp:94
const std::string & getTopic() const
Definition Message.cpp:66
void setTopic(const std::string &topic)
Definition Message.cpp:70
const std::string & getMessage() const
Definition Message.cpp:74
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)
Definition Message.cpp:53
Message & fromJson(const nlohmann::json &json)
Definition Message.cpp:105
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)
void appear(const std::string &clientId, const std::string &topic, uint8_t qoS)
void fromJson(const nlohmann::json &json)
RetainTree(iot::mqtt::server::broker::Broker *broker)
void release(const std::string &topic)
void sendPublish(iot::mqtt::server::broker::Message &message, uint8_t qoS, bool retain)
Definition Session.cpp:66
std::deque< Message > messageQueue
Definition Session.h:84
nlohmann::json toJson() const final
Definition Session.cpp:121
Session(iot::mqtt::server::Mqtt *mqtt)
Definition Session.cpp:62
void fromJson(const nlohmann::json &json)
Definition Session.cpp:131
Session * renew(iot::mqtt::server::Mqtt *mqtt)
Definition Session.cpp:103
bool isOwnedBy(const iot::mqtt::server::Mqtt *mqtt) const
Definition Session.cpp:117
Definition SNodeC.h:57