|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
Go to the source code of this file.
Data Structures | |
| struct | MqttInFlightMsg |
| MqttInFlightMsg. More... | |
| struct | MqttWillMsg |
| Optional MQTT Will Message; used when calling function SharkMQTT_connect. More... | |
| struct | MqttCredentials |
| Optional credentials used when calling function SharkMQTT_connect. More... | |
| struct | SharkMQTT |
| SharkMQTT structure. More... | |
Macros | |
| #define | SMQTTE_SOCKET -1 |
| Error codes received from the TCP/IP stack are sent "as is". More... | |
| #define | SMQTTE_ERRORBASE -10000 |
| This code is not used. More... | |
| #define | SMQTTE_TIMEOUT -10001 |
| Similar to SMQTT_TIMEOUT, but returned when a timeout was not expected. More... | |
| #define | SMQTTE_PONGTIMEOUT -10002 |
| The client sent a PING to the broker but did not receive a PONG response. More... | |
| #define | SMQTTE_PROTOCOL_ERROR -10003 |
| Something's wrong. More... | |
| #define | SMQTTE_OVERFLOW -10005 |
| The SharkSSL output buffer is not sufficiently large for the operation you are attempting. More... | |
| #define | SMQTTE_ALREADYCON -10006 |
| Calling SharkMQ_connect when a connection is already established. More... | |
| #define | SMQTTE_CONREFUSED -10007 |
| Broker refused the connection request. More... | |
| #define | SMQTTE_SERVERNOTTRUSTED -10008 |
| Returned by SharkMQTT_connect if the MQTT broker is not trusted. More... | |
| #define | SMQTTE_NOMEM -10009 |
| A pending QoS operation could not be stored. More... | |
| #define | SMQTT_TIMEOUT -20000 |
| SharkMQTT_getMessage call timed out. More... | |
| #define | SMQTT_SUBACK -20001 |
| Asynchronous SharkMQTT_subscribe response message received via SharkMQTT_getMessage. More... | |
| #define | SMQTT_UNSUBACK -20002 |
| Asynchronous SharkMQTT_unsubscribe response message received via SharkMQTT_getMessage. More... | |
| #define | SharkMQTT_setCtx(o, ctx) SOCKET_constructor(&(o)->sock, ctx) |
| Bare metal configuration. More... | |
| #define | SharkMQTT_msgConsumed(o) (((o)->packetLen - (o)->bytesRead) == 0) |
| Read packet data using SharkMQTT_getMessage until SharkMQTT_msgConsumed returns TRUE. More... | |
| #define | SharkMQTT_connackCode(o) (o)->recPackHeader[3] |
| Connection response (CONNACK) return code. More... | |
| #define | SharkMQTT_sessionPresent(o) ((o)->recPackHeader[2] & 1) |
| Returns TRUE if a session is restored. More... | |
| #define | SharkMQTT_trustInfo(o) ((SharkSslConTrust)(o)->packetLen) |
| Returns SharkSslConTrust when SharkMQTT_connect returns SMQTTE_SERVERNOTTRUSTED. More... | |
| #define | SharkMQTT_pub0(o, topic, msg, msgLen) SharkMQTT_publish(o, topic, msg, msgLen, FALSE, 0) |
| Publish a QOS 0 message and set the retain flag to FALSE. More... | |
| #define | SharkMQTT_packetId(o) (o)->recPacketId |
| Returns packetId when the return value from SharkMQTT_getMessage is SMQTT_SUBACK or SMQTT_UNSUBACK. More... | |
| #define | SharkMQTT_subAckCode(o) ((U16)(o)->recPackHeader[4]) |
| Returns the subscribe response code when the return value from SharkMQTT_getMessage is SMQTT_SUBACK. More... | |
| #define | SharkMQTT_dup(o) (((o)->recPackHeader[0] & 8) ? TRUE : FALSE) |
| Returns the dup flag (TRUE/FALSE) [MQTT-3.3.1.1] for received PUBLISH messages i.e. More... | |
| #define | SharkMQTT_QOS(o) (((o)->recPackHeader[0] >> 1) & 3) |
| Returns QOS (0, 1, or 2) [MQTT-3.3.1.2] for received PUBLISH messages i.e. More... | |
| #define | SharkMQTT_retain(o) ((o)->recPackHeader[0] & 1) |
| Returns the retain flag (TRUE/FALSE) [MQTT-3.3.1.3] for received PUBLISH messages i.e. More... | |
| #define | SharkMQTT_topic(o) ((const char*)((o)->recPackHeader+1)) |
| Returns the topic name for received PUBLISH messages i.e. More... | |
Enumerations | |
| enum | MqttState { MqttState_Invalid , MqttState_Pub , MqttState_PubRel , MqttState_PubRec , MqttState_SubOrUnsub } |
Functions | |
| void | SharkMQTT_constructor (SharkMQTT *o, U8 *buf, U16 bufLen) |
| Create a SharkMQTT client instance. More... | |
| void | SharkMQTT_destructor (SharkMQTT *o) |
| Terminate a SharkMQTT instance. More... | |
| int | SharkMQTT_connect (SharkMQTT *o, SharkSslCon *scon, const char *address, U16 port, const char *clientId, MqttCredentials *cred, BaBool cleanSession, MqttWillMsg *wm) |
| Establish (or re-establish) an MQTT session. More... | |
| int | SharkMQTT_subscribe (SharkMQTT *o, const char *topic, U8 qos, U16 *packetId) |
| Subscribe to topic. More... | |
| int | SharkMQTT_unsubscribe (SharkMQTT *o, const char *topic, U16 *packetId) |
| Requests the broker to unsubscribe the client from a topic. More... | |
| U8 * | SharkMQTT_zeroCopyPub (SharkMQTT *o, const char *topic, U8 qos, int *maxMsgLen) |
| Prepare a zero copy publish by fetching the SharkSSL send buffer pointer and offset the pointer to the MQTT message payload. More... | |
| int | SharkMQTT_publish (SharkMQTT *o, const char *topic, const void *msg, int msgLen, U8 retain, U8 qos) |
| Publish messages to a topic. More... | |
| int | SharkMQTT_getMessage (SharkMQTT *o, U8 **msg) |
| Wait for messages sent from the broker. More... | |
| void | SharkMQTT_disconnect (SharkMQTT *o) |
| Send a disconnect command to the broker and gracefully close the connection. More... | |
| enum MqttState |