SNode.C
|
#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 () |
![]() | |
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 |
SocketConnection * | getSocketConnection () const |
virtual void | switchSocketContext (SocketContext *newSocketContext) |
void | sendToPeer (const std::string &data) const |
virtual void | sendToPeer (const char *chunk, std::size_t chunkLen) const=0 |
![]() | |
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 | |
![]() | |
void | onWriteError (int errnum) override |
void | onReadError (int errnum) override |
![]() | |
SocketContext ()=default | |
virtual | ~SocketContext () |
virtual bool | onSignal (int sig)=0 |
Definition at line 83 of file SocketContext.h.
|
explicit |
Definition at line 59 of file SocketContext.cpp.
References iot::mqtt_fast::ControlPacketFactory::ControlPacketFactory(), controlPacketFactory, and core::socket::stream::SocketContext::SocketContext().
|
inlineprivate |
Definition at line 125 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 162 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 243 of file SocketContext.cpp.
Referenced by onReceivedFromPeer(), and send().
|
private |
Definition at line 230 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 234 of file SocketContext.cpp.
References iot::mqtt_fast::ControlPacket::getPacket(), and send().
|
private |
Definition at line 238 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 71 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 64 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Connect::Connect(), and send().
void iot::mqtt_fast::SocketContext::sendDisconnect | ( | ) |
Definition at line 155 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Disconnect::Disconnect(), and send().
void iot::mqtt_fast::SocketContext::sendPingreq | ( | ) |
Definition at line 141 of file SocketContext.cpp.
References iot::mqtt_fast::packets::Pingreq::Pingreq(), and send().
void iot::mqtt_fast::SocketContext::sendPingresp | ( | ) |
Definition at line 148 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 85 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 106 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 78 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 92 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 99 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 120 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 113 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 134 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 127 of file SocketContext.cpp.
References getPacketIdentifier(), send(), and iot::mqtt_fast::packets::Unsubscribe::Unsubscribe().
|
private |
Definition at line 137 of file SocketContext.h.
Referenced by getPacketIdentifier().
|
private |
Definition at line 135 of file SocketContext.h.
Referenced by onReceivedFromPeer(), and SocketContext().