SharkSSL™ Embedded SSL/TLS Stack
SharkMQ Struct Reference

Detailed Description

SharkMQ structure.

#include <SMQ.h>

Public Member Functions

 SharkMQ (U8 *buf, U16 bufLen)
 Create a secure SMQ client instance. More...
 
int init (SharkSslCon *scon, const char *url, U32 *rnd)
 Initiate the SMQ server connection. More...
 
int connect (const char *uid, int uidLen, const char *credentials, U8 credLen, const char *info, int infoLen, U16 maxTlsFrameSize)
 Connect/establish a persistent SMQ connection. More...
 
void disconnect ()
 Gracefully close the connection. More...
 
 ~SharkMQ ()
 Terminate an SMQ instance. More...
 
int create (const char *topic)
 Create a topic an fetch the topic ID (tid). More...
 
int createsub (const char *subtopic)
 Create a sub-topic and fetch the subtopic ID. More...
 
int subscribe (const char *topic)
 The response to SharkMQ_subscribe is asynchronous and returned as status SMQ_SUBACK via SharkMQ_getMessage. More...
 
int unsubscribe (U32 tid)
 Requests the broker to unsubscribe the server from a topic. More...
 
int publish (const void *data, int len, U32 tid, U32 subtid)
 Publish messages to a topic and optionally to a sub-topic. More...
 
int wrtstr (const char *str)
 Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s). More...
 
int write (const void *data, int len)
 Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s). More...
 
int pubflush (U32 tid, U32 subtid)
 Flush the internal buffer and request the broker to assemble all stored fragments as one message. More...
 
int observe (U32 tid)
 Request the broker to provide change notification events when the number of subscribers to a specific topic changes. More...
 
int unobserve (U32 tid)
 Stop receiving change notifications for a topic ID or ephemeral topic ID. More...
 
int getMessage (U8 **msg)
 Wait for messages sent from the broker. More...
 
int getMsgSize ()
 Returns the message size, which is SMQ::frameLen - 15. More...
 

Data Fields

U32 timeout
 Timeout in milliseconds to wait in functions waiting for server data.
 
U32 clientTid
 Client's unique topic ID.
 
U32 tid
 Topic: set when receiving MSG_PUBLISH from broker.
 
U32 ptid
 Publisher's tid: Set when receiving MSG_PUBLISH from broker.
 
U32 subtid
 Sub-tid: set when receiving MSG_PUBLISH from broker.
 
int status
 Last known error code.
 
U16 frameLen
 The SMQ frame size for the incomming data.
 
U16 bytesRead
 Read frame data using SharkMQ_getMessage until: frameLen-bytesRead = 0.