From 457227dcf6b640f97cecb51681d771513409f5dd Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 9 Oct 2019 13:03:14 +0100 Subject: [PATCH 1/6] Remove incorrect line on main www page. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1451. Thanks to Björn Andersson. --- www/pages/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/www/pages/index.html b/www/pages/index.html index 042014f5..a1d2cfad 100644 --- a/www/pages/index.html +++ b/www/pages/index.html @@ -55,7 +55,6 @@ MQTT over TLS, MQTT over TLS (with client certificate, MQTT over WebSockets and MQTT over WebSockets with TLS.

- platforms.

From 432440a918387d31b47e3f705fffbe6a0e60468d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 9 Oct 2019 13:47:33 +0100 Subject: [PATCH 2/6] Add missing bracket. --- www/pages/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/pages/index.html b/www/pages/index.html index a1d2cfad..f76df0c6 100644 --- a/www/pages/index.html +++ b/www/pages/index.html @@ -53,7 +53,7 @@ href="https://test.mosquitto.org/">test.mosquitto.org where you can test your clients in a variety of ways: plain MQTT, MQTT over TLS, MQTT over TLS (with client certificate, + href="https://test.mosquitto.org/ssl/">client certificate), MQTT over WebSockets and MQTT over WebSockets with TLS.

From 27e81e9e13bc884f74ea6a5a75a31fa77ffce75d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 9 Oct 2019 14:11:39 +0100 Subject: [PATCH 3/6] Point libmosquitto documentation at the API pages. --- man/libmosquitto.3.xml | 486 +---------------------------------------- 1 file changed, 3 insertions(+), 483 deletions(-) diff --git a/man/libmosquitto.3.xml b/man/libmosquitto.3.xml index 1aa308ad..3f0ed27e 100644 --- a/man/libmosquitto.3.xml +++ b/man/libmosquitto.3.xml @@ -11,492 +11,12 @@ libmosquitto - MQTT version 3.1.1 client library + MQTT version 5.0/3.1.1 client library - Description - This is an overview of how to use libmosquitto to create MQTT - aware client programs. There may be separate man pages on each of the - functions described here in the future. - This man page is woefully incomplete, please see the comments - in mosquitto.h for missing functions and a description of the - functions. - - - - libmosquitto symbol names - All public functions in libmosquitto have the prefix - "mosquitto_". Any other functions defined in the source code are to be - treated as private functions and may change between any release. Do not - use these functions! - - - - Functions - - - Library version - - int mosquitto_lib_version - int *major - int *minor - int *revision - - Obtain version information about the library. If any of - major, minor or revision are not NULL they will return the - corresponding version numbers. The return value is an integer - representation of the complete version number (e.g. 1009001 for 1.9.1) - that can be used for comparisons. - - - - Library initialisation and cleanup - - int mosquitto_lib_init - - - int mosquitto_lib_cleanup - - Call mosquitto_lib_init() before using any of the other - library functions and mosquitto_lib_cleanup() after finishing - with the library. - - - - Client constructor/destructor - - struct mosquitto *mosquitto_new - const char *id - bool clean_session - void *userdata - - Create a new mosquitto client instance. - - void mosquitto_destroy - struct mosquitto *mosq - - Use to free memory associated with a mosquitto client instance. - - int mosquitto_reinitialise - struct mosquitto *mosq - const char *id - bool clean_session - void *userdata - - - - - Authentication and encryption - - int mosquitto_username_pw_set - struct mosquitto *mosq - const char *username - const char *password - - - int mosquitto_tls_set - struct mosquitto *mosq - const char *cafile - const char *capath - const char *certfile - const char *keyfile - int (*pw_callback)(char *buf, int size, int rwflag, void *userdata) - - - - int mosquitto_tls_opts_set - struct mosquitto *mosq - int cert_reqs - const char *tls_version - const char *ciphers - - - int mosquitto_tls_insecure_set - struct mosquitto *mosq - bool value - - - int mosquitto_tls_psk_set - struct mosquitto *mosq - const char *psk - const char *identity - const char *ciphers - - - - - Wills - - int mosquitto_will_set - struct mosquitto *mosq - const char *topic - int payloadlen - const void *payload - int qos - bool retain - - - int mosquitto_will_clear - struct mosquitto *mosq - - - - - Connect/disconnect - - int mosquitto_connect - struct mosquitto *mosq - const char *host - int port - int keepalive - - - int mosquitto_connect_bind - struct mosquitto *mosq - const char *host - int port - int keepalive - const char *bind_address - - - int mosquitto_connect_async - struct mosquitto *mosq - const char *host - int port - int keepalive - - - int mosquitto_connect_bind_async - struct mosquitto *mosq - const char *host - int port - int keepalive - const char *bind_address - - - int mosquitto_reconnect - struct mosquitto *mosq - - - int mosquitto_reconnect_async - struct mosquitto *mosq - - - int mosquitto_disconnect - struct mosquitto *mosq - - - - - Publish - - int mosquitto_publish - struct mosquitto *mosq - int *mid - const char *topic - int payloadlen - const void *payload - int qos - bool retain - - - - - Subscribe/unsubscribe - - int mosquitto_subscribe - struct mosquitto *mosq - int *mid - const char *sub - int qos - - - int mosquitto_unsubscribe - struct mosquitto *mosq - int *mid - const char *sub - - - - - Network loop - - int mosquitto_loop - struct mosquitto *mosq - int timeout - int max_packets - - - int mosquitto_loop_read - struct mosquitto *mosq - int max_packets - - - int mosquitto_loop_write - struct mosquitto *mosq - int max_packets - - - int mosquitto_loop_misc - struct mosquitto *mosq - - - int mosquitto_loop_forever - struct mosquitto *mosq - int timeout - int max_packets - - - int mosquitto_socket - struct mosquitto *mosq - - - bool mosquitto_want_write - struct mosquitto *mosq - - - - - Threaded network loop - - int mosquitto_loop_start - struct mosquitto *mosq - - - int mosquitto_loop_stop - struct mosquitto *mosq - bool force - - - - - Misc client functions - - int mosquitto_max_inflight_messages_set - struct mosquitto *mosq - unsigned int max_inflight_messages - - - int mosquitto_reconnect_delay_set - struct mosquitto *mosq - unsigned int reconnect_delay - unsigned int reconnect_delay_max - bool reconnect_exponential_backoff - - - int mosquitto_user_data_set - struct mosquitto *mosq - void *userdata - - - - - Callbacks - - int mosquitto_connect_callback_set - struct mosquitto *mosq - void (*on_connect)(struct mosquitto *, void *, int) - - - int mosquitto_disconnect_callback_set - struct mosquitto *mosq - void (*on_disconnect)(struct mosquitto *, void *, int) - - - int mosquitto_publish_callback_set - struct mosquitto *mosq - void (*on_publish)(struct mosquitto *, void *, int) - - - int mosquitto_message_callback_set - struct mosquitto *mosq - void (*on_message)(struct mosquitto *, void *, const struct mosquitto_message *) - - - int mosquitto_subscribe_callback_set - struct mosquitto *mosq - void (*on_subscribe)(struct mosquitto *, void *, int, int, const int *) - - - int mosquitto_unsubscribe_callback_set - struct mosquitto *mosq - void (*on_unsubscribe)(struct mosquitto *, void *, int) - - - int mosquitto_log_callback_set - struct mosquitto *mosq - void (*on_unsubscribe)(struct mosquitto *, void *, int, const char *) - - - - - Utility functions - - const char *mosquitto_connack_string - int connack_code - - - int mosquitto_message_copy - struct mosquitto_message *dst - const struct mosquitto_message *src - - - int mosquitto_message_free - struct mosquitto_message **message - - - const char *mosquitto_strerror - int mosq_errno - - - int mosquitto_sub_topic_tokenise - const char *subtopic - char ***topics - int *count - - - int mosquitto_sub_topic_tokens_free - char ***topics - int count - - - int mosquitto_topic_matches_sub - const char *sub - const char *topic - bool *result - - - - - Helper functions - - int mosquitto_subscribe_simple - struct mosquitto_message **message - int msg_count - bool want_retained - const char *topic - intqos - const char *host - int port - const char *client_id - int keepalive - bool clean_session - const char *username - const char *password - const struct libmosquitto_will *will - const struct libmosquitto_tls *tls - - - int mosquitto_subscribe_callback - int (*callback)(struct mosquitto *, void *, const struct mosquitto_message *) - void *userdata - const char *topic - int qos - const char *host - int port - const char *client_id - int keepalive - bool clean_session - const char *username - const char *password - const struct libmosquitto_will *will - const struct libmosquitto_tls *tls - - - - - - Examples - -#include <stdio.h> -#include <mosquitto.h> - -void my_message_callback(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *message) -{ - if(message->payloadlen){ - printf("%s %s\n", message->topic, message->payload); - }else{ - printf("%s (null)\n", message->topic); - } - fflush(stdout); -} - -void my_connect_callback(struct mosquitto *mosq, void *userdata, int result) -{ - int i; - if(!result){ - /* Subscribe to broker information topics on successful connect. */ - mosquitto_subscribe(mosq, NULL, "$SYS/#", 2); - }else{ - fprintf(stderr, "Connect failed\n"); - } -} - -void my_subscribe_callback(struct mosquitto *mosq, void *userdata, int mid, int qos_count, const int *granted_qos) -{ - int i; - - printf("Subscribed (mid: %d): %d", mid, granted_qos[0]); - for(i=1; i<qos_count; i++){ - printf(", %d", granted_qos[i]); - } - printf("\n"); -} - -void my_log_callback(struct mosquitto *mosq, void *userdata, int level, const char *str) -{ - /* Pring all log messages regardless of level. */ - printf("%s\n", str); -} - -int main(int argc, char *argv[]) -{ - int i; - char *host = "localhost"; - int port = 1883; - int keepalive = 60; - bool clean_session = true; - struct mosquitto *mosq = NULL; - - mosquitto_lib_init(); - mosq = mosquitto_new(NULL, clean_session, NULL); - if(!mosq){ - fprintf(stderr, "Error: Out of memory.\n"); - return 1; - } - mosquitto_log_callback_set(mosq, my_log_callback); - mosquitto_connect_callback_set(mosq, my_connect_callback); - mosquitto_message_callback_set(mosq, my_message_callback); - mosquitto_subscribe_callback_set(mosq, my_subscribe_callback); - - if(mosquitto_connect(mosq, host, port, keepalive)){ - fprintf(stderr, "Unable to connect.\n"); - return 1; - } - - mosquitto_loop_forever(mosq, -1, 1); - - mosquitto_destroy(mosq); - mosquitto_lib_cleanup(); - return 0; -} - - - - See Also - - - - mosquitto - 8 - - - mqtt - 7 - - - + Documentation + See From eaab1799337ef33594d165b179d20b1c6305f9f3 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 6 Nov 2019 14:15:11 +0000 Subject: [PATCH 4/6] Docker: Add ca-certificates to images. --- docker/1.4.12/Dockerfile | 2 +- docker/1.5/Dockerfile | 2 +- docker/1.6/Dockerfile | 2 ++ docker/generic/Dockerfile | 1 + docker/local/Dockerfile | 2 ++ 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/1.4.12/Dockerfile b/docker/1.4.12/Dockerfile index a8ab47d0..fb662061 100644 --- a/docker/1.4.12/Dockerfile +++ b/docker/1.4.12/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER David Audet LABEL Description="Eclipse Mosquitto MQTT Broker" -RUN apk --no-cache add mosquitto=1.4.12-r0 && \ +RUN apk --no-cache add mosquitto=1.4.12-r0 ca-certificates && \ mkdir -p /mosquitto/config /mosquitto/data /mosquitto/log && \ cp /etc/mosquitto/mosquitto.conf /mosquitto/config && \ chown -R mosquitto:mosquitto /mosquitto diff --git a/docker/1.5/Dockerfile b/docker/1.5/Dockerfile index 6e224636..70e78e81 100644 --- a/docker/1.5/Dockerfile +++ b/docker/1.5/Dockerfile @@ -75,7 +75,7 @@ RUN set -x && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ chown -R mosquitto:mosquitto /mosquitto && \ apk --no-cache add \ - libuuid && \ + ca-certificates libuuid && \ apk del build-deps && \ rm -rf /build diff --git a/docker/1.6/Dockerfile b/docker/1.6/Dockerfile index 72c6b377..da2da3b8 100644 --- a/docker/1.6/Dockerfile +++ b/docker/1.6/Dockerfile @@ -78,6 +78,8 @@ RUN set -x && \ install -s -m755 /build/mosq/src/mosquitto_passwd /usr/bin/mosquitto_passwd && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ chown -R mosquitto:mosquitto /mosquitto && \ + apk --no-cache add \ + ca-certificates && \ apk del build-deps && \ rm -rf /build diff --git a/docker/generic/Dockerfile b/docker/generic/Dockerfile index 01f8d266..da26a798 100644 --- a/docker/generic/Dockerfile +++ b/docker/generic/Dockerfile @@ -46,6 +46,7 @@ LABEL maintainer="Jonathan Hanson " \ # Install the run-time dependencies RUN apk --no-cache add \ busybox \ + ca-certificates \ libcrypto1.0 \ libssl1.0 \ libuuid \ diff --git a/docker/local/Dockerfile b/docker/local/Dockerfile index 1d7517ab..ffb17c21 100644 --- a/docker/local/Dockerfile +++ b/docker/local/Dockerfile @@ -59,6 +59,8 @@ RUN set -x && \ install -s -m755 /build/mosq/src/mosquitto_passwd /usr/bin/mosquitto_passwd && \ install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ chown -R mosquitto:mosquitto /mosquitto && \ + apk --no-cache add \ + ca-certificates && \ apk del build-deps && \ rm -rf /build From a26157643d01a9a985ae125df5031d3433ebe216 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 14 Nov 2019 11:00:26 +0000 Subject: [PATCH 5/6] Add rr to snap. Add home plug to snap (not autoconnected). --- snap/snapcraft.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 8ff6a528..f662f04f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -16,18 +16,23 @@ apps: command: launcher.sh daemon: simple restart-condition: always - plugs: [network, network-bind] + plugs: [home, network, network-bind] pub: command: usr/bin/mosquitto_pub - plugs: [network] + plugs: [home, network] + + rr: + command: usr/bin/mosquitto_rr + plugs: [home, network] sub: command: usr/bin/mosquitto_sub - plugs: [network] + plugs: [home, network] passwd: command: usr/bin/mosquitto_passwd + plugs: [home] parts: From 7c34ed2eeb66cd44792466090fa9754b82388811 Mon Sep 17 00:00:00 2001 From: Basavesh Shivakumar Date: Sat, 16 Nov 2019 21:39:18 -0500 Subject: [PATCH 6/6] Delete duplicate 'Returns' messages in the comments. Signed-off-by: Basavesh Shivakumar --- lib/mosquitto.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/mosquitto.h b/lib/mosquitto.h index a868f995..7fbb2370 100644 --- a/lib/mosquitto.h +++ b/lib/mosquitto.h @@ -630,10 +630,6 @@ libmosq_EXPORT int mosquitto_connect_srv(struct mosquitto *mosq, const char *hos * MOSQ_ERR_SUCCESS - on success. * MOSQ_ERR_INVAL - if the input parameters were invalid. * MOSQ_ERR_NOMEM - if an out of memory condition occurred. - * - * Returns: - * MOSQ_ERR_SUCCESS - on success. - * MOSQ_ERR_INVAL - if the input parameters were invalid. * MOSQ_ERR_ERRNO - if a system call returned an error. The variable errno * contains the error code, even on Windows. * Use strerror_r() where available or FormatMessage() on @@ -661,10 +657,6 @@ libmosq_EXPORT int mosquitto_reconnect(struct mosquitto *mosq); * MOSQ_ERR_SUCCESS - on success. * MOSQ_ERR_INVAL - if the input parameters were invalid. * MOSQ_ERR_NOMEM - if an out of memory condition occurred. - * - * Returns: - * MOSQ_ERR_SUCCESS - on success. - * MOSQ_ERR_INVAL - if the input parameters were invalid. * MOSQ_ERR_ERRNO - if a system call returned an error. The variable errno * contains the error code, even on Windows. * Use strerror_r() where available or FormatMessage() on