MQTT and MQTTS with wolfSSL TSL library
Fork of MQTT by
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ライブラリ
MQTTLogging.h@46:d8968fcc21b8, 2015-07-26 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
icraggs | 41:b7e86fa6dbb8 | 1 | #if !defined(MQTT_LOGGING_H) |
icraggs | 41:b7e86fa6dbb8 | 2 | #define MQTT_LOGGING_H |
icraggs | 41:b7e86fa6dbb8 | 3 | |
icraggs | 41:b7e86fa6dbb8 | 4 | #define STREAM stdout |
icraggs | 41:b7e86fa6dbb8 | 5 | #if !defined(DEBUG) |
icraggs | 41:b7e86fa6dbb8 | 6 | #define DEBUG(...) \ |
icraggs | 41:b7e86fa6dbb8 | 7 | {\ |
icraggs | 41:b7e86fa6dbb8 | 8 | fprintf(STREAM, "DEBUG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
icraggs | 41:b7e86fa6dbb8 | 9 | fprintf(STREAM, ##__VA_ARGS__); \ |
icraggs | 41:b7e86fa6dbb8 | 10 | fflush(STREAM); \ |
icraggs | 41:b7e86fa6dbb8 | 11 | } |
icraggs | 41:b7e86fa6dbb8 | 12 | #endif |
icraggs | 41:b7e86fa6dbb8 | 13 | #if !defined(LOG) |
icraggs | 41:b7e86fa6dbb8 | 14 | #define LOG(...) \ |
icraggs | 41:b7e86fa6dbb8 | 15 | {\ |
icraggs | 41:b7e86fa6dbb8 | 16 | fprintf(STREAM, "LOG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
icraggs | 41:b7e86fa6dbb8 | 17 | fprintf(STREAM, ##__VA_ARGS__); \ |
icraggs | 41:b7e86fa6dbb8 | 18 | fflush(STREAM); \ |
icraggs | 41:b7e86fa6dbb8 | 19 | } |
icraggs | 41:b7e86fa6dbb8 | 20 | #endif |
icraggs | 41:b7e86fa6dbb8 | 21 | #if !defined(WARN) |
icraggs | 41:b7e86fa6dbb8 | 22 | #define WARN(...) \ |
icraggs | 41:b7e86fa6dbb8 | 23 | { \ |
icraggs | 41:b7e86fa6dbb8 | 24 | fprintf(STREAM, "WARN: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
icraggs | 41:b7e86fa6dbb8 | 25 | fprintf(STREAM, ##__VA_ARGS__); \ |
icraggs | 41:b7e86fa6dbb8 | 26 | fflush(STREAM); \ |
icraggs | 41:b7e86fa6dbb8 | 27 | } |
icraggs | 41:b7e86fa6dbb8 | 28 | #endif |
icraggs | 41:b7e86fa6dbb8 | 29 | #if !defined(ERROR) |
icraggs | 41:b7e86fa6dbb8 | 30 | #define ERROR(...) \ |
icraggs | 41:b7e86fa6dbb8 | 31 | { \ |
icraggs | 41:b7e86fa6dbb8 | 32 | fprintf(STREAM, "ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
icraggs | 41:b7e86fa6dbb8 | 33 | fprintf(STREAM, ##__VA_ARGS__); \ |
icraggs | 41:b7e86fa6dbb8 | 34 | fflush(STREAM); \ |
icraggs | 41:b7e86fa6dbb8 | 35 | exit(1); \ |
icraggs | 41:b7e86fa6dbb8 | 36 | } |
icraggs | 41:b7e86fa6dbb8 | 37 | #endif |
icraggs | 41:b7e86fa6dbb8 | 38 | |
icraggs | 41:b7e86fa6dbb8 | 39 | #endif |