SharkSSL™ Embedded SSL/TLS Stack

Detailed Description

A secure SimpleMQ client designed for SharkSSL.

SimpleMQ is an easy to use IoT Message Queues architecture solution that follows the publish subscribe broadcast design pattern.

SharkMQ is a secure SimpleMQ client implementation delivered with SharkSSL standalone.

The SharkMQ C library comes with a C++ wrapper API, which includes a brief description of the API. See the C API for the full documentation.

Modules

 Error codes returned by function SharkMQ_getMessage
 
 Response codes returned by function SharkMQ_getMessage
 
 C API
 

Data Structures

struct  SharkMQ
 SharkMQ structure. More...
 

Typedefs

typedef struct SharkMQ SharkMQ
 SharkMQ structure.
 

Functions

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

Function Documentation

◆ connect()

int SharkMQ::connect ( const char *  uid,
int  uidLen,
const char *  credentials,
U8  credLen,
const char *  info,
int  infoLen,
U16  maxTlsFrameSize 
)

Connect/establish a persistent SMQ connection.

See also
SharkMQ_connect

◆ create()

int SharkMQ::create ( const char *  topic)

Create a topic an fetch the topic ID (tid).

See also
SharkMQ_create

◆ createsub()

int SharkMQ::createsub ( const char *  subtopic)

Create a sub-topic and fetch the subtopic ID.

See also
SMQ:createsub

◆ disconnect()

void SharkMQ::disconnect ( )

Gracefully close the connection.

See also
SharkMQ_disconnect

◆ getMessage()

int SharkMQ::getMessage ( U8 **  msg)

Wait for messages sent from the broker.

See also
SharkMQ_getMessage

◆ getMsgSize()

int SharkMQ::getMsgSize ( )

Returns the message size, which is SMQ::frameLen - 15.

See also
SharkMQ_getMsgSize

◆ init()

int SharkMQ::init ( SharkSslCon scon,
const char *  url,
U32 *  rnd 
)

Initiate the SMQ server connection.

See also
SharkMQ_init

◆ observe()

int SharkMQ::observe ( U32  tid)

Request the broker to provide change notification events when the number of subscribers to a specific topic changes.

Ephemeral topic IDs can also be observed.

See also
SharkMQ_observe

◆ pubflush()

int SharkMQ::pubflush ( U32  tid,
U32  subtid 
)

Flush the internal buffer and request the broker to assemble all stored fragments as one message.

See also
SharkMQ_pubflush

◆ publish()

int SharkMQ::publish ( const void *  data,
int  len,
U32  tid,
U32  subtid 
)

Publish messages to a topic and optionally to a sub-topic.

Topic name must have previosly been been resolved by SharkMQ_create and sub-topic should preferably have been created by SharkMQ_createsub.

See also
SharkMQ_publish

◆ SharkMQ()

SharkMQ::SharkMQ ( U8 *  buf,
U16  bufLen 
)

Create a secure SMQ client instance.

See also
SharkMQ_constructor

◆ subscribe()

int SharkMQ::subscribe ( const char *  topic)

The response to SharkMQ_subscribe is asynchronous and returned as status SMQ_SUBACK via SharkMQ_getMessage.

See also
SharkMQ_subscribe

◆ unobserve()

int SharkMQ::unobserve ( U32  tid)

Stop receiving change notifications for a topic ID or ephemeral topic ID.

See also
SharkMQ_unobserve

◆ unsubscribe()

int SharkMQ::unsubscribe ( U32  tid)

Requests the broker to unsubscribe the server from a topic.

See also
SharkMQ_unsubscribe

◆ write()

int SharkMQ::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).

See also
SharkMQ_write

◆ wrtstr()

int SharkMQ::wrtstr ( const char *  str)

Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s).

See also
SharkMQ_wrtstr

◆ ~SharkMQ()

SharkMQ::~SharkMQ ( )

Terminate an SMQ instance.

See also
SharkMQ_destructor