MQTT and MQTTS with wolfSSL TSL library

Dependencies:   FP MQTTPacket

Dependents:   YoPlegma

Fork of MQTT by MQTT

MQTT is light weight publish/subscribe based messaging protocol for M2M, IoT. This library was forked from MQTT https://developer.mbed.org/teams/mqtt for adding MQTTS security layer on the protocol. TLS(SSL) part of the library is by wolfSSL.https://developer.mbed.org/users/wolfSSL/code/wolfSSL/

"connect" method was extended for TLS. Rest of API's stay compatible with MQTT.

connect methode

 int connect(char* hostname, int port,  const char *certName = NULL, int timeout=1000)

The 3rd argument certName can be following values.

  • NULL: connecting with MQTT
  • pointer to certificate file: connecting with MQTTS. PEM or DER for server verification.
  • pointer to NULL string: connecting with MQTTS without server verification. This option is for prototyping only, not recommended in security perspective.

日本語:https://developer.mbed.org/users/wolfSSL/code/MQTTS/wiki/MQTTSライブラリ

Committer:
wolfSSL
Date:
Sun Jul 26 09:50:40 2015 +0000
Revision:
46:d8968fcc21b8
Parent:
43:21da1f744243
Verify Server Cert

Who changed what in which revision?

UserRevisionLine numberNew contents of line
icraggs 29:833386b16f3e 1 #if !defined(MQTT_MBED_H)
icraggs 29:833386b16f3e 2 #define MQTT_MBED_H
icraggs 29:833386b16f3e 3
icraggs 29:833386b16f3e 4 #include "mbed.h"
icraggs 29:833386b16f3e 5
icraggs 29:833386b16f3e 6 class Countdown
icraggs 29:833386b16f3e 7 {
icraggs 29:833386b16f3e 8 public:
icraggs 29:833386b16f3e 9 Countdown()
icraggs 29:833386b16f3e 10 {
icraggs 29:833386b16f3e 11 t = Timer();
icraggs 29:833386b16f3e 12 }
icraggs 29:833386b16f3e 13
icraggs 29:833386b16f3e 14 Countdown(int ms)
icraggs 29:833386b16f3e 15 {
icraggs 29:833386b16f3e 16 t = Timer();
icraggs 29:833386b16f3e 17 countdown_ms(ms);
icraggs 29:833386b16f3e 18 }
icraggs 29:833386b16f3e 19
icraggs 29:833386b16f3e 20
icraggs 29:833386b16f3e 21 bool expired()
icraggs 29:833386b16f3e 22 {
icraggs 29:833386b16f3e 23 return t.read_ms() >= interval_end_ms;
icraggs 29:833386b16f3e 24 }
icraggs 29:833386b16f3e 25
icraggs 43:21da1f744243 26 void countdown_ms(unsigned long ms)
icraggs 29:833386b16f3e 27 {
icraggs 29:833386b16f3e 28 t.stop();
icraggs 29:833386b16f3e 29 interval_end_ms = ms;
icraggs 29:833386b16f3e 30 t.reset();
icraggs 29:833386b16f3e 31 t.start();
icraggs 29:833386b16f3e 32 }
icraggs 29:833386b16f3e 33
icraggs 29:833386b16f3e 34 void countdown(int seconds)
icraggs 29:833386b16f3e 35 {
icraggs 43:21da1f744243 36 countdown_ms((unsigned long)seconds * 1000L);
icraggs 29:833386b16f3e 37 }
icraggs 29:833386b16f3e 38
icraggs 29:833386b16f3e 39 int left_ms()
icraggs 29:833386b16f3e 40 {
icraggs 29:833386b16f3e 41 return interval_end_ms - t.read_ms();
icraggs 29:833386b16f3e 42 }
icraggs 29:833386b16f3e 43
icraggs 29:833386b16f3e 44 private:
icraggs 29:833386b16f3e 45 Timer t;
icraggs 43:21da1f744243 46 unsigned long interval_end_ms;
icraggs 29:833386b16f3e 47 };
icraggs 29:833386b16f3e 48
icraggs 29:833386b16f3e 49 #endif