#include <SocketContext.h>
Public Member Functions | |
| SocketContext (core::socket::stream::SocketConnection *socketConnection) | |
| void | sendConnect (const std::string &clientId) |
| void | sendConnack (uint8_t returnCode, uint8_t flags) |
| void | sendPublish (const std::string &topic, const std::string &message, bool dup=false, uint8_t qoS=0, bool retain=false) |
| void | sendPuback (uint16_t packetIdentifier) |
| void | sendPubrec (uint16_t packetIdentifier) |
| void | sendPubrel (uint16_t packetIdentifier) |
| void | sendPubcomp (uint16_t packetIdentifier) |
| void | sendSubscribe (std::list< Topic > &topics) |
| void | sendSuback (uint16_t packetIdentifier, const std::list< uint8_t > &returnCodes) |
| void | sendUnsubscribe (const std::list< std::string > &topics) |
| void | sendUnsuback (uint16_t packetIdentifier) |
| void | sendPingreq () |
| void | sendPingresp () |
| void | sendDisconnect () |
| Public Member Functions inherited from core::socket::stream::SocketContext | |
| SocketContext (core::socket::stream::SocketConnection *socketConnection) | |
| void | sendToPeer (const char *chunk, std::size_t chunkLen) const final |
| bool | streamToPeer (core::pipe::Source *source) const |
| void | streamEof () |
| std::size_t | readFromPeer (char *chunk, std::size_t chunklen) const final |
| void | setTimeout (const utils::Timeval &timeout) final |
| void | shutdownRead () |
| void | shutdownWrite (bool forceClose=false) |
| void | close () override |
| std::size_t | getTotalSent () const override |
| std::size_t | getTotalQueued () const override |
| std::size_t | getTotalRead () const override |
| std::size_t | getTotalProcessed () const override |
| std::string | getOnlineSince () const override |
| std::string | getOnlineDuration () const override |
| SocketConnection * | getSocketConnection () const |
| void | sendToPeer (const std::string &data) const |
| Public Member Functions inherited from core::socket::SocketContext | |
| SocketContext (const SocketContext &)=delete | |
| SocketContext (SocketContext &&)=delete | |
| SocketContext & | operator= (const SocketContext &)=delete |
| SocketContext & | operator= (SocketContext &&)=delete |
| void | sendToPeer (const std::string &data) const |
Static Private Member Functions | |
| static void | printData (const std::vector< char > &data) |
Private Attributes | |
| iot::mqtt_fast::ControlPacketFactory | controlPacketFactory |
| uint16_t | _packetIdentifier = 0 |
Additional Inherited Members | |
| Protected Member Functions inherited from core::socket::stream::SocketContext | |
| void | onWriteError (int errnum) override |
| void | onReadError (int errnum) override |
| std::size_t | readFromPeer () |
| Protected Member Functions inherited from core::socket::SocketContext | |
| SocketContext ()=default | |
| virtual | ~SocketContext () |
| virtual bool | onSignal (int sig)=0 |
Definition at line 85 of file SocketContext.h.
|
explicit |
Definition at line 60 of file SocketContext.cpp.
References iot::mqtt_fast::ControlPacketFactory::ControlPacketFactory(), controlPacketFactory, and core::socket::stream::SocketContext::SocketContext().
|
inlineprivate |
Definition at line 127 of file SocketContext.h.
References _packetIdentifier.
Referenced by sendPublish(), sendSubscribe(), and sendUnsubscribe().
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
finalprivatevirtual |
Implements core::socket::SocketContext.
Definition at line 163 of file SocketContext.cpp.
References core::socket::stream::SocketContext::close(), iot::mqtt_fast::packets::Connack::Connack(), iot::mqtt_fast::packets::Connect::Connect(), iot::mqtt_fast::ControlPacketFactory::construct(), controlPacketFactory, iot::mqtt_fast::packets::Disconnect::Disconnect(), iot::mqtt_fast::ControlPacketFactory::getPacket(), iot::mqtt_fast::ControlPacketFactory::getPacketFlags(), iot::mqtt_fast::ControlPacketFactory::getPacketType(), iot::mqtt_fast::ControlPacketFactory::getRemainingLength(), iot::mqtt_fast::types::Binary::getValue(), iot::mqtt_fast::ControlPacketFactory::isComplete(), iot::mqtt_fast::ControlPacketFactory::isError(), onConnack(), onConnect(), onDisconnect(), onPingreq(), onPingresp(), onPuback(), onPubcomp(), onPublish(), onPubrec(), onPubrel(), onSuback(), onSubscribe(), onUnsuback(), onUnsubscribe(), iot::mqtt_fast::packets::Pingreq::Pingreq(), iot::mqtt_fast::packets::Pingresp::Pingresp(), printData(), iot::mqtt_fast::packets::Puback::Puback(), iot::mqtt_fast::packets::Pubcomp::Pubcomp(), iot::mqtt_fast::packets::Publish::Publish(), iot::mqtt_fast::packets::Pubrec::Pubrec(), iot::mqtt_fast::packets::Pubrel::Pubrel(), iot::mqtt_fast::ControlPacketFactory::reset(), iot::mqtt_fast::packets::Suback::Suback(), iot::mqtt_fast::packets::Subscribe::Subscribe(), iot::mqtt_fast::packets::Unsuback::Unsuback(), and iot::mqtt_fast::packets::Unsubscribe::Unsubscribe().
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
privatepure virtual |
|
staticprivate |
Definition at line 244 of file SocketContext.cpp.
Referenced by onReceivedFromPeer(), and send().
|
private |
Definition at line 231 of file SocketContext.cpp.
References iot::mqtt_fast::ControlPacket::getPacket(), and send().
Referenced by sendConnack(), sendConnect(), sendDisconnect(), sendPingreq(), sendPingresp(), sendPuback(), sendPubcomp(), sendPublish(), sendPubrec(), sendPubrel(), sendSuback(), sendSubscribe(), sendUnsuback(), and sendUnsubscribe().
|
private |
Definition at line 235 of file SocketContext.cpp.
References iot::mqtt_fast::ControlPacket::getPacket(), and send().
|
private |
Definition at line 239 of file SocketContext.cpp.
References printData(), and core::socket::stream::SocketContext::sendToPeer().
Referenced by send(), and send().
| void iot::mqtt_fast::SocketContext::sendConnack | ( | uint8_t | returnCode, |
| uint8_t | flags ) |
Definition at line 72 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Connack::Connack(), and send().
| void iot::mqtt_fast::SocketContext::sendConnect | ( | const std::string & | clientId | ) |
Definition at line 65 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Connect::Connect(), and send().
| void iot::mqtt_fast::SocketContext::sendDisconnect | ( | ) |
Definition at line 156 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Disconnect::Disconnect(), and send().
| void iot::mqtt_fast::SocketContext::sendPingreq | ( | ) |
Definition at line 142 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Pingreq::Pingreq(), and send().
| void iot::mqtt_fast::SocketContext::sendPingresp | ( | ) |
Definition at line 149 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Pingresp::Pingresp(), and send().
| void iot::mqtt_fast::SocketContext::sendPuback | ( | uint16_t | packetIdentifier | ) |
Definition at line 86 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Puback::Puback(), and send().
| void iot::mqtt_fast::SocketContext::sendPubcomp | ( | uint16_t | packetIdentifier | ) |
Definition at line 107 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Pubcomp::Pubcomp(), and send().
| void iot::mqtt_fast::SocketContext::sendPublish | ( | const std::string & | topic, |
| const std::string & | message, | ||
| bool | dup = false, | ||
| uint8_t | qoS = 0, | ||
| bool | retain = false ) |
Definition at line 79 of file SocketContext.cpp.
References getPacketIdentifier(), iot::mqtt_fast::packets::Publish::Publish(), and send().
| void iot::mqtt_fast::SocketContext::sendPubrec | ( | uint16_t | packetIdentifier | ) |
Definition at line 93 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Pubrec::Pubrec(), and send().
| void iot::mqtt_fast::SocketContext::sendPubrel | ( | uint16_t | packetIdentifier | ) |
Definition at line 100 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Pubrel::Pubrel(), and send().
| void iot::mqtt_fast::SocketContext::sendSuback | ( | uint16_t | packetIdentifier, |
| const std::list< uint8_t > & | returnCodes ) |
Definition at line 121 of file SocketContext.cpp.
References send(), and iot::mqtt_fast::packets::Suback::Suback().
| void iot::mqtt_fast::SocketContext::sendSubscribe | ( | std::list< Topic > & | topics | ) |
Definition at line 114 of file SocketContext.cpp.
References getPacketIdentifier(), send(), and iot::mqtt_fast::packets::Subscribe::Subscribe().
| void iot::mqtt_fast::SocketContext::sendUnsuback | ( | uint16_t | packetIdentifier | ) |
Definition at line 135 of file SocketContext.cpp.
References send(), and iot::mqtt_fast::packets::Unsuback::Unsuback().
| void iot::mqtt_fast::SocketContext::sendUnsubscribe | ( | const std::list< std::string > & | topics | ) |
Definition at line 128 of file SocketContext.cpp.
References getPacketIdentifier(), send(), and iot::mqtt_fast::packets::Unsubscribe::Unsubscribe().
|
private |
Definition at line 139 of file SocketContext.h.
Referenced by getPacketIdentifier().
|
private |
Definition at line 137 of file SocketContext.h.
Referenced by onReceivedFromPeer(), and SocketContext().