#include <SubscribtionTree.h>
Definition at line 39 of file SubscribtionTree.h.
◆ SubscribtionTree()
◆ appear()
void iot::mqtt::server::broker::SubscribtionTree::appear |
( |
const std::string & | clientId | ) |
|
Definition at line 44 of file SubscribtionTree.cpp.
44 {
46 }
void appear(const std::string &clientId, const std::string &topic)
◆ clear()
void iot::mqtt::server::broker::SubscribtionTree::clear |
( |
| ) |
|
◆ fromJson()
void iot::mqtt::server::broker::SubscribtionTree::fromJson |
( |
const nlohmann::json & | json | ) |
|
Definition at line 261 of file SubscribtionTree.cpp.
261 {
262 if (!json.empty()) {
264 }
265 }
TopicLevel & fromJson(const nlohmann::json &json)
◆ publish()
void iot::mqtt::server::broker::SubscribtionTree::publish |
( |
Message && | message | ) |
|
Definition at line 63 of file SubscribtionTree.cpp.
63 {
64 auto hashCount = std::ranges::count(message.getTopic(), '#');
65 if (!message.getTopic().empty() && (hashCount == 0 || (hashCount == 1 && message.getTopic().ends_with('#')))) {
67 } else {
68 LOG(ERROR) << "MQTT Broker: Publish: Wrong '#' placement: " << message.getTopic();
69 }
70 }
void publish(Message &message, std::string topic)
◆ subscribe()
bool iot::mqtt::server::broker::SubscribtionTree::subscribe |
( |
const std::string & | topic, |
|
|
const std::string & | clientId, |
|
|
uint8_t | qoS ) |
Definition at line 48 of file SubscribtionTree.cpp.
48 {
49 bool success = false;
50
51 auto hashCount = std::ranges::count(topic, '#');
52 if (!topic.empty() && (hashCount == 0 || (hashCount == 1 && topic.ends_with('#')))) {
54
55 success = true;
56 } else {
57 LOG(ERROR) << "MQTT Broker: Subscribe: Wrong '#' placement: " << topic;
58 }
59
60 return success;
61 }
bool subscribe(const std::string &clientId, uint8_t qoS, std::string topic)
◆ toJson()
nlohmann::json iot::mqtt::server::broker::SubscribtionTree::toJson |
( |
| ) |
const |
◆ unsubscribe() [1/2]
void iot::mqtt::server::broker::SubscribtionTree::unsubscribe |
( |
const std::string & | clientId | ) |
|
Definition at line 81 of file SubscribtionTree.cpp.
81 {
83 }
bool unsubscribe(const std::string &clientId, std::string topic)
◆ unsubscribe() [2/2]
void iot::mqtt::server::broker::SubscribtionTree::unsubscribe |
( |
const std::string & | topic, |
|
|
const std::string & | clientId ) |
Definition at line 72 of file SubscribtionTree.cpp.
72 {
73 auto hashCount = std::ranges::count(topic, '#');
74 if (!topic.empty() && (hashCount == 0 || (hashCount == 1 && topic.ends_with('#')))) {
76 } else {
77 LOG(ERROR) << "MQTT Broker: Unsubscribe: Wrong '#' placement: " << topic;
78 }
79 }
◆ head
TopicLevel iot::mqtt::server::broker::SubscribtionTree::head |
|
private |
The documentation for this class was generated from the following files: