SNode.C
|
#include <Mqtt.h>
Public Member Functions | |
Mqtt (const std::string &connectionName, const std::shared_ptr< broker::Broker > &broker) | |
~Mqtt () override | |
void | subscribe (const std::string &topic, uint8_t qoS) const |
void | unsubscribe (const std::string &topic) const |
void | sendConnack (uint8_t returnCode, uint8_t flags) const |
void | sendSuback (uint16_t packetIdentifier, const std::list< uint8_t > &returnCodes) const |
void | sendUnsuback (uint16_t packetIdentifier) const |
void | sendPingresp () const |
std::list< std::string > | getSubscriptions () const |
std::string | getProtocol () const |
uint8_t | getLevel () const |
uint8_t | getConnectFlags () const |
uint16_t | getKeepAlive () const |
std::string | getClientId () const |
std::string | getWillTopic () const |
std::string | getWillMessage () const |
std::string | getUsername () const |
std::string | getPassword () const |
bool | getUsernameFlag () const |
bool | getPasswordFlag () const |
bool | getWillRetain () const |
uint8_t | getWillQoS () const |
bool | getWillFlag () const |
bool | getCleanSession () const |
bool | getReflect () const |
![]() | |
Mqtt (const std::string &connectionName) | |
Mqtt (const std::string &connectionName, const std::string &clientId) | |
Mqtt (Mqtt &&)=delete | |
Mqtt (const Mqtt &)=delete | |
Mqtt & | operator= (Mqtt &&)=delete |
Mqtt & | operator= (const Mqtt &)=delete |
virtual void | onConnected () |
virtual void | onDisconnected () |
const std::string & | getConnectionName () const |
const MqttContext * | getMqttContext () const |
void | sendPublish (const std::string &topic, const std::string &message, uint8_t qoS, bool retain) |
void | sendPuback (uint16_t packetIdentifier) const |
void | sendPubrec (uint16_t packetIdentifier) const |
void | sendPubrel (uint16_t packetIdentifier) const |
void | sendPubcomp (uint16_t packetIdentifier) const |
Protected Attributes | |
std::string | protocol |
uint8_t | level = 0 |
uint8_t | connectFlags = 0 |
uint16_t | keepAlive = 0 |
std::string | willTopic |
std::string | willMessage |
std::string | username |
std::string | password |
bool | usernameFlag = false |
bool | passwordFlag = false |
bool | willRetain = false |
uint8_t | willQoS = 0 |
bool | willFlag = false |
bool | cleanSession = false |
bool | reflect = true |
std::shared_ptr< iot::mqtt::server::broker::Broker > | broker |
![]() | |
std::string | connectionName |
std::string | clientId |
MqttContext * | mqttContext = nullptr |
Private Types | |
using | Super = iot::mqtt::Mqtt |
Additional Inherited Members | |
![]() | |
static std::string | toHexString (const std::vector< char > &data) |
static std::string | toHexString (const std::string &data) |
|
private |
|
explicit |
Definition at line 73 of file Mqtt.cpp.
References iot::mqtt::Mqtt::Mqtt().
|
overridevirtual |
Reimplemented from iot::mqtt::Mqtt.
Definition at line 78 of file Mqtt.cpp.
References iot::mqtt::Mqtt::clientId, iot::mqtt::server::broker::Broker::publish(), releaseSession(), willFlag, willMessage, willQoS, willRetain, and willTopic.
|
private |
Definition at line 221 of file Mqtt.cpp.
References cleanSession, iot::mqtt::Mqtt::clientId, connectFlags, iot::mqtt::Mqtt::connectionName, iot::mqtt::MqttContext::end(), iot::mqtt::packets::Connect::getCleanSession(), iot::mqtt::packets::Connect::getClientId(), iot::mqtt::packets::Connect::getConnectFlags(), iot::mqtt::packets::Connect::getKeepAlive(), iot::mqtt::packets::Connect::getLevel(), iot::mqtt::packets::Connect::getPassword(), iot::mqtt::packets::Connect::getPasswordFlag(), iot::mqtt::packets::Connect::getProtocol(), iot::mqtt::packets::Connect::getReflect(), iot::mqtt::packets::Connect::getUsername(), iot::mqtt::packets::Connect::getUsernameFlag(), iot::mqtt::packets::Connect::getWillFlag(), iot::mqtt::packets::Connect::getWillMessage(), iot::mqtt::packets::Connect::getWillQoS(), iot::mqtt::packets::Connect::getWillRetain(), iot::mqtt::packets::Connect::getWillTopic(), initSession(), iot::mqtt::server::packets::Connect::isFakedClientId(), keepAlive, level, iot::mqtt::Mqtt::mqttContext, onConnect(), password, passwordFlag, protocol, reflect, sendConnack(), username, usernameFlag, willFlag, willMessage, willQoS, willRetain, and willTopic.
Referenced by iot::mqtt::server::packets::Connect::deliverPacket().
|
private |
Definition at line 348 of file Mqtt.cpp.
References onDisconnect(), releaseSession(), and willFlag.
Referenced by iot::mqtt::server::packets::Disconnect::deliverPacket().
|
private |
Definition at line 342 of file Mqtt.cpp.
References onPingreq(), and sendPingresp().
Referenced by iot::mqtt::server::packets::Pingreq::deliverPacket().
|
private |
Definition at line 287 of file Mqtt.cpp.
References iot::mqtt::Mqtt::_onPublish(), iot::mqtt::Mqtt::clientId, iot::mqtt::packets::Publish::getMessage(), iot::mqtt::packets::Publish::getQoS(), iot::mqtt::packets::Publish::getRetain(), iot::mqtt::packets::Publish::getTopic(), iot::mqtt::Mqtt::onPublish(), and iot::mqtt::server::broker::Broker::publish().
Referenced by iot::mqtt::server::packets::Publish::deliverPacket().
|
private |
Definition at line 295 of file Mqtt.cpp.
References iot::mqtt::Mqtt::clientId, iot::mqtt::Mqtt::connectionName, iot::mqtt::MqttContext::end(), iot::mqtt::Topic::getName(), iot::mqtt::packets::Subscribe::getPacketIdentifier(), iot::mqtt::Topic::getQoS(), iot::mqtt::packets::Subscribe::getTopics(), iot::mqtt::Mqtt::mqttContext, onSubscribe(), sendSuback(), and iot::mqtt::server::broker::Broker::subscribe().
Referenced by iot::mqtt::server::packets::Subscribe::deliverPacket().
|
private |
Definition at line 320 of file Mqtt.cpp.
References iot::mqtt::Mqtt::clientId, iot::mqtt::Mqtt::connectionName, iot::mqtt::MqttContext::end(), iot::mqtt::packets::Unsubscribe::getPacketIdentifier(), iot::mqtt::packets::Unsubscribe::getTopics(), iot::mqtt::Mqtt::mqttContext, onUnsubscribe(), sendUnsuback(), and iot::mqtt::server::broker::Broker::unsubscribe().
Referenced by iot::mqtt::server::packets::Unsubscribe::deliverPacket().
|
finalprivatevirtual |
Implements iot::mqtt::Mqtt.
Definition at line 99 of file Mqtt.cpp.
References iot::mqtt::server::packets::Connect::Connect(), iot::mqtt::server::packets::Disconnect::Disconnect(), iot::mqtt::FixedHeader::getFlags(), iot::mqtt::FixedHeader::getRemainingLength(), iot::mqtt::FixedHeader::getType(), iot::mqtt::server::packets::Pingreq::Pingreq(), iot::mqtt::server::packets::Puback::Puback(), iot::mqtt::server::packets::Pubcomp::Pubcomp(), iot::mqtt::server::packets::Publish::Publish(), iot::mqtt::server::packets::Pubrec::Pubrec(), iot::mqtt::server::packets::Pubrel::Pubrel(), iot::mqtt::server::packets::Subscribe::Subscribe(), and iot::mqtt::server::packets::Unsubscribe::Unsubscribe().
|
overrideprivatevirtual |
Implements iot::mqtt::Mqtt.
Definition at line 151 of file Mqtt.cpp.
References iot::mqtt::server::ControlPacketDeserializer::deliverPacket().
bool iot::mqtt::server::Mqtt::getCleanSession | ( | ) | const |
Definition at line 432 of file Mqtt.cpp.
References cleanSession.
std::string iot::mqtt::server::Mqtt::getClientId | ( | ) | const |
Definition at line 392 of file Mqtt.cpp.
References iot::mqtt::Mqtt::clientId.
Referenced by iot::mqtt::server::broker::Session::sendPublish().
uint8_t iot::mqtt::server::Mqtt::getConnectFlags | ( | ) | const |
Definition at line 384 of file Mqtt.cpp.
References connectFlags.
uint16_t iot::mqtt::server::Mqtt::getKeepAlive | ( | ) | const |
uint8_t iot::mqtt::server::Mqtt::getLevel | ( | ) | const |
std::string iot::mqtt::server::Mqtt::getPassword | ( | ) | const |
bool iot::mqtt::server::Mqtt::getPasswordFlag | ( | ) | const |
Definition at line 416 of file Mqtt.cpp.
References passwordFlag.
std::string iot::mqtt::server::Mqtt::getProtocol | ( | ) | const |
bool iot::mqtt::server::Mqtt::getReflect | ( | ) | const |
Definition at line 436 of file Mqtt.cpp.
References reflect.
Referenced by iot::mqtt::server::broker::Session::sendPublish().
std::list< std::string > iot::mqtt::server::Mqtt::getSubscriptions | ( | ) | const |
Definition at line 372 of file Mqtt.cpp.
References iot::mqtt::Mqtt::clientId, and iot::mqtt::server::broker::Broker::getSubscriptions().
std::string iot::mqtt::server::Mqtt::getUsername | ( | ) | const |
bool iot::mqtt::server::Mqtt::getUsernameFlag | ( | ) | const |
Definition at line 412 of file Mqtt.cpp.
References usernameFlag.
bool iot::mqtt::server::Mqtt::getWillFlag | ( | ) | const |
std::string iot::mqtt::server::Mqtt::getWillMessage | ( | ) | const |
Definition at line 400 of file Mqtt.cpp.
References willMessage.
uint8_t iot::mqtt::server::Mqtt::getWillQoS | ( | ) | const |
bool iot::mqtt::server::Mqtt::getWillRetain | ( | ) | const |
std::string iot::mqtt::server::Mqtt::getWillTopic | ( | ) | const |
|
private |
Definition at line 155 of file Mqtt.cpp.
References cleanSession, iot::mqtt::Mqtt::clientId, iot::mqtt::Mqtt::connectionName, iot::mqtt::server::broker::Broker::hasActiveSession(), iot::mqtt::server::broker::Broker::hasRetainedSession(), iot::mqtt::Mqtt::initSession(), iot::mqtt::server::broker::Broker::newSession(), iot::mqtt::server::broker::Broker::renewSession(), iot::mqtt::server::broker::Broker::restartSession(), sendConnack(), iot::mqtt::server::broker::Broker::unsubscribe(), and willFlag.
Referenced by _onConnect().
|
private |
Definition at line 105 of file Mqtt.cpp.
|
privatevirtual |
Definition at line 206 of file Mqtt.cpp.
Referenced by _onConnect().
|
privatevirtual |
Definition at line 218 of file Mqtt.cpp.
Referenced by _onDisconnect().
|
privatevirtual |
Definition at line 215 of file Mqtt.cpp.
Referenced by _onPingreq().
|
overrideprotectedvirtual |
|
privatevirtual |
Definition at line 209 of file Mqtt.cpp.
Referenced by _onSubscribe().
|
privatevirtual |
Definition at line 212 of file Mqtt.cpp.
Referenced by _onUnsubscribe().
|
private |
Definition at line 192 of file Mqtt.cpp.
References cleanSession, iot::mqtt::Mqtt::clientId, iot::mqtt::Mqtt::connectionName, iot::mqtt::server::broker::Broker::deleteSession(), iot::mqtt::server::broker::Broker::isActiveSession(), and iot::mqtt::server::broker::Broker::retainSession().
Referenced by _onDisconnect(), and ~Mqtt().
void iot::mqtt::server::Mqtt::sendConnack | ( | uint8_t | returnCode, |
uint8_t | flags | ||
) | const |
Definition at line 356 of file Mqtt.cpp.
References iot::mqtt::packets::Connack::Connack(), and iot::mqtt::Mqtt::send().
Referenced by _onConnect(), and initSession().
void iot::mqtt::server::Mqtt::sendPingresp | ( | ) | const |
Definition at line 368 of file Mqtt.cpp.
References iot::mqtt::packets::Pingresp::Pingresp(), and iot::mqtt::Mqtt::send().
Referenced by _onPingreq().
void iot::mqtt::server::Mqtt::sendSuback | ( | uint16_t | packetIdentifier, |
const std::list< uint8_t > & | returnCodes | ||
) | const |
Definition at line 360 of file Mqtt.cpp.
References iot::mqtt::Mqtt::send(), and iot::mqtt::packets::Suback::Suback().
Referenced by _onSubscribe().
void iot::mqtt::server::Mqtt::sendUnsuback | ( | uint16_t | packetIdentifier | ) | const |
Definition at line 364 of file Mqtt.cpp.
References iot::mqtt::Mqtt::send(), and iot::mqtt::packets::Unsuback::Unsuback().
Referenced by _onUnsubscribe().
void iot::mqtt::server::Mqtt::subscribe | ( | const std::string & | topic, |
uint8_t | qoS | ||
) | const |
Definition at line 86 of file Mqtt.cpp.
References iot::mqtt::Mqtt::clientId, and iot::mqtt::server::broker::Broker::subscribe().
void iot::mqtt::server::Mqtt::unsubscribe | ( | const std::string & | topic | ) | const |
Definition at line 90 of file Mqtt.cpp.
References iot::mqtt::Mqtt::clientId, and iot::mqtt::server::broker::Broker::unsubscribe().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
Definition at line 165 of file Mqtt.h.
Referenced by _onConnect(), getCleanSession(), initSession(), and releaseSession().
|
protected |
Definition at line 152 of file Mqtt.h.
Referenced by _onConnect(), and getConnectFlags().
|
protected |
Definition at line 153 of file Mqtt.h.
Referenced by _onConnect(), and getKeepAlive().
|
protected |
Definition at line 151 of file Mqtt.h.
Referenced by _onConnect(), and getLevel().
|
protected |
Definition at line 158 of file Mqtt.h.
Referenced by _onConnect(), and getPassword().
|
protected |
Definition at line 161 of file Mqtt.h.
Referenced by _onConnect(), and getPasswordFlag().
|
protected |
Definition at line 150 of file Mqtt.h.
Referenced by _onConnect(), and getProtocol().
|
protected |
Definition at line 166 of file Mqtt.h.
Referenced by _onConnect(), and getReflect().
|
protected |
Definition at line 157 of file Mqtt.h.
Referenced by _onConnect(), and getUsername().
|
protected |
Definition at line 160 of file Mqtt.h.
Referenced by _onConnect(), and getUsernameFlag().
|
protected |
Definition at line 164 of file Mqtt.h.
Referenced by _onConnect(), _onDisconnect(), getWillFlag(), initSession(), onSignal(), and ~Mqtt().
|
protected |
Definition at line 156 of file Mqtt.h.
Referenced by _onConnect(), getWillMessage(), and ~Mqtt().
|
protected |
Definition at line 163 of file Mqtt.h.
Referenced by _onConnect(), getWillQoS(), and ~Mqtt().
|
protected |
Definition at line 162 of file Mqtt.h.
Referenced by _onConnect(), getWillRetain(), and ~Mqtt().
|
protected |
Definition at line 155 of file Mqtt.h.
Referenced by _onConnect(), getWillTopic(), and ~Mqtt().