SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
SMQ.h File Reference
#include "selib.h"

Go to the source code of this file.

Data Structures

struct  SharkMQ
 SharkMQ structure. More...
 

Macros

#define SMQ_SEC
 
#define SMQE_BUF_OVERFLOW   -10000
 The receive buffer, TLS send buffer, or 16-bit SMQ frame capacity is insufficient for the requested operation. More...
 
#define SMQE_ONACK_DENIED   -10000
 Subscribe, Create, or Createsub denied. More...
 
#define SMQE_INVALID_URL   -10002
 The URL provided is invalid. More...
 
#define SMQE_PROTOCOL_ERROR   -10003
 Invalid SMQ protocol data or invalid argument lengths/pointer pairs. More...
 
#define SMQE_DISCONNECT   -10004
 Server sent a disconnect message. More...
 
#define SMQE_PONGTIMEOUT   -10005
 No PONG response to PING: timeout. More...
 
#define SMQE_TLS_AUTH_FAILED   -10006
 The TLS server certificate or reference name was not fully authenticated. More...
 
#define SMQ_SUBACK   -20000
 Asynchronous SharkMQ_subscribe response message received via SharkMQ_getMessage. More...
 
#define SMQ_CREATEACK   -20001
 Asynchronous SharkMQ_create response message received via SharkMQ_getMessage. More...
 
#define SMQ_CREATESUBACK   -20002
 Asynchronous SharkMQ_createsub response message received via SharkMQ_getMessage. More...
 
#define SMQ_SUBCHANGE   -20003
 Change notification event (from observed tid). More...
 
#define SMQ_TIMEOUT   -20004
 A receive operation timed out. More...
 
#define SMQSTR(str)   str, (sizeof(str)-1)
 
#define SharkMQ_setProxy(o, proxyMA)   (o)->proxy=proxyMA
 
#define SharkMQ_setCtx(o, ctx)   SOCKET_constructor(&(o)->sock, ctx)
 Bare metal configuration. More...
 
#define SharkMQ_getSendBufPtr(o)   (SharkSslCon_getEncBufPtr((o)->scon) + 15)
 Zero copy API: Get start of send buffer. More...
 
#define SharkMQ_getSendBufSize(o)   (SharkSslCon_getEncBufSize((o)->scon) - 15)
 Zero copy API: Get max buffer length. More...
 
#define SharkMQ_getMsgSize(o)   ((o)->frameLen-15)
 Returns the message size, which is SharkMQ::frameLen - 15. More...
 

Typedefs

typedef struct SharkMQ SharkMQ
 SharkMQ structure. More...
 

Functions

void SharkMQ_constructor (SharkMQ *o, U8 *buf, U16 bufLen)
 Create a secure SMQ client instance. More...
 
int SharkMQ_init (SharkMQ *o, SharkSslCon *scon, const char *url, U32 *rnd)
 Initiate the SharkMQ server connection. More...
 
int SharkMQ_connect (SharkMQ *o, 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 (SharkMQ *o)
 Gracefully close the connection. More...
 
void SharkMQ_destructor (SharkMQ *o)
 Terminate an SMQ instance. More...
 
int SharkMQ_create (SharkMQ *o, const char *topic)
 Create a topic an fetch the topic ID (tid). More...
 
int SharkMQ_createsub (SharkMQ *o, const char *subtopic)
 Create a sub-topic and fetch the subtopic ID. More...
 
int SharkMQ_subscribe (SharkMQ *o, const char *topic)
 Subscribe to topic. More...
 
int SharkMQ_unsubscribe (SharkMQ *o, U32 tid)
 Requests the broker to unsubscribe the client from a topic. More...
 
int SharkMQ_publish (SharkMQ *o, const void *data, int len, U32 tid, U32 subtid)
 Publish messages to a topic and optionally to a sub-topic. More...
 
int SharkMQ_wrtstr (SharkMQ *o, 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 (SharkMQ *o, 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 (SharkMQ *o, U32 tid, U32 subtid)
 Flush the internal buffer and request the broker to assemble all stored fragments as one message. More...
 
int SharkMQ_observe (SharkMQ *o, U32 tid)
 Request the broker to provide change notification events when the number of subscribers to a specific topic changes. More...
 
int SharkMQ_unobserve (SharkMQ *o, U32 tid)
 Stop receiving change notifications for a topic ID or ephemeral topic ID. More...
 
int SharkMQ_getMessage (SharkMQ *o, U8 **msg)
 Wait for messages sent from the broker. More...
 

Macro Definition Documentation

◆ SMQ_SEC

#define SMQ_SEC