Merge branch 'develop' of ssh://git.eclipse.org:29418/mosquitto/org.eclipse.mosquitto into develop

pull/139/head
Roger A. Light 10 years ago
commit f6939d4cbb

@ -25,15 +25,26 @@ Broker:
- Minimum supported libwebsockets version is now 1.3.
- Support for Windows XP has been dropped.
- Miscellaneous fixes on Windows.
- Bridge connections now default to using MQTT v3.1.1.
Client library:
- Outgoing messages with QoS>1 are no longer retried after a timeout period.
Messages will be retried when a client reconnects.
- DNS-SRV support is now disabled by default.
- Add mosquitto_subscribe_simple() This is a helper function to make
retrieving messages from a broker very straightforward. Examples of its use
are in examples/subscribe_simple.
- Add mosquitto_subscribe_callback() This is a helper function to make
processing messages from a broker very straightforward. An example of its use
is in examples/subscribe_simple.
- Connections now default to using MQTT v3.1.1.
Client:
- Add -x to mosquitto_sub for printing the payload in hexadecimal format.
- Add -U to mosquitto_sub for unsubscribing from topics.
- Add --retained-only to mosquitto_sub to exit after receiving all retained
messages.
- Connections now default to using MQTT v3.1.1.
1.4.7 - 20151221

@ -501,6 +501,11 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c
goto unknown_option;
}
cfg->retain = 1;
}else if(!strcmp(argv[i], "--retained-only")){
if(pub_or_sub == CLIENT_PUB){
goto unknown_option;
}
cfg->retained_only = true;
}else if(!strcmp(argv[i], "-s") || !strcmp(argv[i], "--stdin-file")){
if(pub_or_sub == CLIENT_SUB){
goto unknown_option;

@ -75,6 +75,7 @@ struct mosq_config {
char **topics; /* sub */
int topic_count; /* sub */
bool no_retain; /* sub */
bool retained_only; /* sub */
char **filter_outs; /* sub */
int filter_out_count; /* sub */
char **unsub_topics; /* sub */

@ -57,6 +57,12 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit
assert(obj);
cfg = (struct mosq_config *)obj;
if(cfg->retained_only && !message->retain && process_messages){
process_messages = false;
mosquitto_disconnect(mosq);
return;
}
if(message->retain && cfg->no_retain) return;
if(cfg->filter_outs){
for(i=0; i<cfg->filter_out_count; i++){
@ -146,7 +152,7 @@ void print_usage(void)
printf("mosquitto_sub is a simple mqtt client that will subscribe to a single topic and print all messages it receives.\n");
printf("mosquitto_sub version %s running on libmosquitto %d.%d.%d.\n\n", VERSION, major, minor, revision);
printf("Usage: mosquitto_sub [-c] [-h host] [-k keepalive] [-p port] [-q qos] [-R] {-t topic ... | -U topic ...}\n");
printf(" [-C msg_count] [-T filter_out]\n");
printf(" [-C msg_count] [--retained-only] [-T filter_out]\n");
#ifdef WITH_SRV
printf(" [-A bind_address] [-S]\n");
#else
@ -195,6 +201,8 @@ void print_usage(void)
printf(" -x : print published message payloads as hexadecimal data.\n");
printf(" --help : display this message.\n");
printf(" --quiet : don't print error messages.\n");
printf(" --retained-only : only handle messages with the retained flag set, and exit when the\n");
printf(" first non-retained message is received.\n");
printf(" --will-payload : payload for the client Will, which is sent by the broker in case of\n");
printf(" unexpected disconnection. If not given and will-topic is set, a zero\n");
printf(" length message will be sent.\n");
@ -247,6 +255,11 @@ int main(int argc, char *argv[])
return 1;
}
if(cfg.no_retain && cfg.retained_only){
fprintf(stderr, "\nError: Combining '-R' and '--retained-only' makes no sense.\n");
return 1;
}
mosquitto_lib_init();
if(client_id_generate(&cfg, "mosqsub")){

@ -0,0 +1,29 @@
include ../../config.mk
.PHONY: all
all : sub_callback sub_single sub_multiple
sub_callback : callback.o
${CROSS_COMPILE}${CC} $^ -o $@ ../../lib/libmosquitto.so.${SOVERSION}
sub_single : single.o
${CROSS_COMPILE}${CC} $^ -o $@ ../../lib/libmosquitto.so.${SOVERSION}
sub_multiple : multiple.o
${CROSS_COMPILE}${CC} $^ -o $@ ../../lib/libmosquitto.so.${SOVERSION}
callback.o : callback.c ../../lib/libmosquitto.so.${SOVERSION}
${CROSS_COMPILE}${CC} -c $< -o $@ -I../../lib ${CFLAGS}
single.o : single.c ../../lib/libmosquitto.so.${SOVERSION}
${CROSS_COMPILE}${CC} -c $< -o $@ -I../../lib ${CFLAGS}
multiple.o : multiple.c ../../lib/libmosquitto.so.${SOVERSION}
${CROSS_COMPILE}${CC} -c $< -o $@ -I../../lib ${CFLAGS}
../../lib/libmosquitto.so.${SOVERSION} :
$(MAKE) -C ../../lib
clean :
-rm -f *.o sub_single sub_multiple

@ -0,0 +1,34 @@
#include <stdlib.h>
#include <stdio.h>
#include "mosquitto.h"
int on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *msg)
{
printf("%s %s (%d)\n", msg->topic, (const char *)msg->payload, msg->payloadlen);
return 0;
}
int main(int argc, char *argv[])
{
int rc;
mosquitto_lib_init();
rc = mosquitto_subscribe_callback(
on_message, NULL,
"irc/#", 0,
"test.mosquitto.org", 1883,
NULL, 60, true,
NULL, NULL,
NULL, NULL);
if(rc){
printf("Error: %s\n", mosquitto_strerror(rc));
}
mosquitto_lib_cleanup();
return rc;
}

@ -0,0 +1,39 @@
#include <stdlib.h>
#include <stdio.h>
#include "mosquitto.h"
#define COUNT 3
int main(int argc, char *argv[])
{
int rc;
int i;
struct mosquitto_message *msg;
mosquitto_lib_init();
rc = mosquitto_subscribe_simple(
&msg, COUNT, true,
"irc/#", 0,
"test.mosquitto.org", 1883,
NULL, 60, true,
NULL, NULL,
NULL, NULL);
if(rc){
printf("Error: %s\n", mosquitto_strerror(rc));
mosquitto_lib_cleanup();
return rc;
}
for(i=0; i<COUNT; i++){
printf("%s %s\n", msg[i].topic, (char *)msg[i].payload);
mosquitto_message_free_contents(&msg[i]);
}
free(msg);
mosquitto_lib_cleanup();
return 0;
}

@ -0,0 +1,33 @@
#include <stdlib.h>
#include <stdio.h>
#include "mosquitto.h"
int main(int argc, char *argv[])
{
int rc;
struct mosquitto_message *msg;
mosquitto_lib_init();
rc = mosquitto_subscribe_simple(
&msg, 1, true,
"irc/#", 0,
"test.mosquitto.org", 1883,
NULL, 60, true,
NULL, NULL,
NULL, NULL);
if(rc){
printf("Error: %s\n", mosquitto_strerror(rc));
mosquitto_lib_cleanup();
return rc;
}
printf("%s %s\n", msg->topic, (char *)msg->payload);
mosquitto_message_free(&msg);
mosquitto_lib_cleanup();
return 0;
}

@ -25,6 +25,7 @@ include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/lib
link_directories(${mosquitto_SOURCE_DIR}/lib)
add_library(libmosquitto SHARED
helpers.c
logging_mosq.c logging_mosq.h
memory_mosq.c memory_mosq.h
messages_mosq.c messages_mosq.h

@ -3,6 +3,7 @@ include ../config.mk
.PHONY : really clean install
MOSQ_OBJS=mosquitto.o \
helpers.o \
logging_mosq.o \
memory_mosq.o \
messages_mosq.o \
@ -51,6 +52,9 @@ libmosquitto.a : ${MOSQ_OBJS}
mosquitto.o : mosquitto.c mosquitto.h
${CROSS_COMPILE}$(CC) $(LIB_CFLAGS) -c $< -o $@
helpers.o : helpers.c
${CROSS_COMPILE}$(CC) $(LIB_CFLAGS) -c $< -o $@
logging_mosq.o : logging_mosq.c logging_mosq.h
${CROSS_COMPILE}$(CC) $(LIB_CFLAGS) -c $< -o $@

@ -106,6 +106,54 @@ int topic_matches_sub(const char *sub, const char *topic, bool *result)
return mosquitto_topic_matches_sub(sub, topic, result);
}
int subscribe_simple(
struct mosquitto_message **messages,
int msg_count,
bool retained,
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)
{
return mosquitto_subscribe_simple(
messages, msg_count, retained,
topic, qos,
host, port, client_id, keepalive, clean_session,
username, password,
will, tls);
}
mosqpp_EXPORT int 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)
{
return mosquitto_subscribe_callback(
callback, userdata,
topic, qos,
host, port, client_id, keepalive, clean_session,
username, password,
will, tls);
}
mosquittopp::mosquittopp(const char *id, bool clean_session)
{
m_mosq = mosquitto_new(id, clean_session, this);

@ -41,6 +41,37 @@ mosqpp_EXPORT int lib_version(int *major, int *minor, int *revision);
mosqpp_EXPORT int lib_init();
mosqpp_EXPORT int lib_cleanup();
mosqpp_EXPORT int topic_matches_sub(const char *sub, const char *topic, bool *result);
mosqpp_EXPORT int subscribe_simple(
struct mosquitto_message **messages,
int msg_count,
bool retained,
const char *topic,
int qos=0,
const char *host="localhost",
int port=1883,
const char *client_id=NULL,
int keepalive=60,
bool clean_session=true,
const char *username=NULL,
const char *password=NULL,
const struct libmosquitto_will *will=NULL,
const struct libmosquitto_tls *tls=NULL);
mosqpp_EXPORT int subscribe_callback(
int (*callback)(struct mosquitto *, void *, const struct mosquitto_message *),
void *userdata,
const char *topic,
int qos=0,
bool retained=true,
const char *host="localhost",
int port=1883,
const char *client_id=NULL,
int keepalive=60,
bool clean_session=true,
const char *username=NULL,
const char *password=NULL,
const struct libmosquitto_will *will=NULL,
const struct libmosquitto_tls *tls=NULL);
/*
* Class: mosquittopp

@ -0,0 +1,223 @@
/*
Copyright (c) 2016 Roger Light <roger@atchoo.org>
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v1.0 which accompany this distribution.
The Eclipse Public License is available at
http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
Contributors:
Roger Light - initial implementation and documentation.
*/
#include <errno.h>
#include <stdbool.h>
#include "mosquitto.h"
#include "mosquitto_internal.h"
struct userdata__callback {
const char *topic;
int (*callback)(struct mosquitto *, void *, const struct mosquitto_message *);
void *userdata;
int qos;
int rc;
};
struct userdata__simple {
struct mosquitto_message *messages;
int max_msg_count;
int message_count;
bool want_retained;
};
static void on_connect(struct mosquitto *mosq, void *obj, int rc)
{
struct userdata__callback *userdata = obj;
mosquitto_subscribe(mosq, NULL, userdata->topic, userdata->qos);
}
static void on_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
{
int rc;
struct userdata__callback *userdata = obj;
rc = userdata->callback(mosq, userdata->userdata, message);
if(rc){
mosquitto_disconnect(mosq);
}
}
static int on_message_simple(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
{
struct userdata__simple *userdata = obj;
int rc;
if(userdata->max_msg_count == 0){
return 0;
}
/* Don't process stale retained messages if 'want_retained' was false */
if(!userdata->want_retained && message->retain){
return 0;
}
userdata->max_msg_count--;
rc = mosquitto_message_copy(&userdata->messages[userdata->message_count], message);
if(rc){
return rc;
}
userdata->message_count++;
if(userdata->max_msg_count == 0){
mosquitto_disconnect(mosq);
}
return 0;
}
libmosq_EXPORT int mosquitto_subscribe_simple(
struct mosquitto_message **messages,
int msg_count,
bool want_retained,
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)
{
struct userdata__simple userdata;
int rc;
int i;
if(!topic || msg_count < 1 || !messages){
return MOSQ_ERR_INVAL;
}
*messages = NULL;
userdata.messages = calloc(sizeof(struct mosquitto_message), msg_count);
if(!userdata.messages){
return MOSQ_ERR_NOMEM;
}
userdata.message_count = 0;
userdata.max_msg_count = msg_count;
userdata.want_retained = want_retained;
rc = mosquitto_subscribe_callback(
on_message_simple, &userdata,
topic, qos,
host, port,
client_id, keepalive, clean_session,
username, password,
will, tls);
if(!rc && userdata.max_msg_count == 0){
*messages = userdata.messages;
return MOSQ_ERR_SUCCESS;
}else{
for(i=0; i<msg_count; i++){
mosquitto_message_free_contents(&userdata.messages[i]);
}
free(userdata.messages);
userdata.messages = NULL;
return rc;
}
}
libmosq_EXPORT 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)
{
struct mosquitto *mosq;
struct userdata__callback cb_userdata;
int rc;
if(!callback || !topic){
return MOSQ_ERR_INVAL;
}
cb_userdata.topic = topic;
cb_userdata.qos = qos;
cb_userdata.rc = 0;
cb_userdata.userdata = userdata;
cb_userdata.callback = callback;
mosq = mosquitto_new(client_id, clean_session, &cb_userdata);
if(!mosq){
return MOSQ_ERR_NOMEM;
}
if(will){
rc = mosquitto_will_set(mosq, will->topic, will->payloadlen, will->payload, will->qos, will->retain);
if(rc){
mosquitto_destroy(mosq);
return rc;
}
}
if(username){
rc = mosquitto_username_pw_set(mosq, username, password);
if(rc){
mosquitto_destroy(mosq);
return rc;
}
}
if(tls){
rc = mosquitto_tls_set(mosq, tls->cafile, tls->capath, tls->certfile, tls->keyfile, tls->pw_callback);
if(rc){
mosquitto_destroy(mosq);
return rc;
}
rc = mosquitto_tls_opts_set(mosq, tls->cert_reqs, tls->tls_version, tls->ciphers);
if(rc){
mosquitto_destroy(mosq);
return rc;
}
}
mosquitto_connect_callback_set(mosq, on_connect);
mosquitto_message_callback_set(mosq, on_message_callback);
rc = mosquitto_connect(mosq, host, port, keepalive);
if(rc){
mosquitto_destroy(mosq);
return rc;
}
rc = mosquitto_loop_forever(mosq, -1, 1);
mosquitto_destroy(mosq);
if(cb_userdata.rc){
rc = cb_userdata.rc;
}
//if(!rc && cb_userdata.max_msg_count == 0){
//return MOSQ_ERR_SUCCESS;
//}else{
//return rc;
//}
return MOSQ_ERR_SUCCESS;
}

@ -78,3 +78,10 @@ MOSQ_1.4 {
mosquitto_sub_topic_check;
mosquitto_socks5_set;
} MOSQ_1.3;
MOSQ_1.5 {
global:
mosquitto_subscribe_simple;
mosquitto_subscribe_callback;
mosquitto_message_free_contents;
} MOSQ_1.4;

@ -66,7 +66,7 @@ int mosquitto_message_copy(struct mosquitto_message *dst, const struct mosquitto
dst->qos = src->qos;
dst->retain = src->retain;
if(src->payloadlen){
dst->payload = mosquitto__malloc(src->payloadlen);
dst->payload = mosquitto__calloc(src->payloadlen+1, sizeof(uint8_t));
if(!dst->payload){
mosquitto__free(dst->topic);
return MOSQ_ERR_NOMEM;
@ -106,6 +106,14 @@ void mosquitto_message_free(struct mosquitto_message **message)
mosquitto__free(msg);
}
void mosquitto_message_free_contents(struct mosquitto_message *message)
{
if(!message) return;
mosquitto__free(message->topic);
mosquitto__free(message->payload);
}
int message__queue(struct mosquitto *mosq, struct mosquitto_message_all *message, enum mosquitto_msg_direction dir)
{
int rc = 0;

@ -140,7 +140,7 @@ int mosquitto_reinitialise(struct mosquitto *mosq, const char *id, bool clean_se
}else{
mosq->userdata = mosq;
}
mosq->protocol = mosq_p_mqtt31;
mosq->protocol = mosq_p_mqtt311;
mosq->sock = INVALID_SOCKET;
mosq->sockpairR = INVALID_SOCKET;
mosq->sockpairW = INVALID_SOCKET;

@ -672,10 +672,23 @@ libmosq_EXPORT int mosquitto_message_copy(struct mosquitto_message *dst, const s
* message - pointer to a mosquitto_message pointer to free.
*
* See Also:
* <mosquitto_message_copy>
* <mosquitto_message_copy>, <mosquitto_message_free_contents>
*/
libmosq_EXPORT void mosquitto_message_free(struct mosquitto_message **message);
/*
* Function: mosquitto_message_free_contents
*
* Free a mosquitto_message struct contents, leaving the struct unaffected.
*
* Parameters:
* message - pointer to a mosquitto_message struct to free its contents.
*
* See Also:
* <mosquitto_message_copy>, <mosquitto_message_free>
*/
libmosq_EXPORT void mosquitto_message_free_contents(struct mosquitto_message *message);
/*
* Function: mosquitto_loop
*
@ -1523,6 +1536,135 @@ libmosq_EXPORT int mosquitto_pub_topic_check(const char *topic);
*/
libmosq_EXPORT int mosquitto_sub_topic_check(const char *topic);
struct libmosquitto_will {
char *topic;
void *payload;
int payloadlen;
int qos;
bool retain;
};
struct libmosquitto_auth {
char *username;
char *password;
};
struct libmosquitto_tls {
char *cafile;
char *capath;
char *certfile;
char *keyfile;
char *ciphers;
char *tls_version;
int (*pw_callback)(char *buf, int size, int rwflag, void *userdata);
int cert_reqs;
};
/*
* Function: mosquitto_subscribe_simple
*
* Helper function to make subscribing to a topic and retrieving some messages
* very straightforward.
*
* This connects to a broker, subscribes to a topic, waits for msg_count
* messages to be received, then returns after disconnecting cleanly.
*
* Parameters:
* messages - pointer to a "struct mosquitto_message *". The received
* messages will be returned here. On error, this will be set to
* NULL.
* msg_count - the number of messages to retrieve.
* want_retained - if set to true, stale retained messages will be treated as
* normal messages with regards to msg_count. If set to
* false, they will be ignored.
* topic - the subscription topic to use (wildcards are allowed).
* qos - the qos to use for the subscription.
* host - the broker to connect to.
* port - the network port the broker is listening on.
* client_id - the client id to use, or NULL if a random client id should be
* generated.
* keepalive - the MQTT keepalive value.
* clean_session - the MQTT clean session flag.
* username - the username string, or NULL for no username authentication.
* password - the password string, or NULL for an empty password.
* will - a libmosquitto_will struct containing will information, or NULL for
* no will.
* tls - a libmosquitto_tls struct containing TLS related parameters, or NULL
* for no use of TLS.
*
*
* Returns:
* MOSQ_ERR_SUCCESS - on success
* >0 - on error.
*/
libmosq_EXPORT int mosquitto_subscribe_simple(
struct mosquitto_message **messages,
int msg_count,
bool want_retained,
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);
/*
* Function: mosquitto_subscribe_callback
*
* Helper function to make subscribing to a topic and processing some messages
* very straightforward.
*
* This connects to a broker, subscribes to a topic, then passes received
* messages to a user provided callback. If the callback returns a 1, it then
* disconnects cleanly and returns.
*
* Parameters:
* callback - a callback function in the following form:
* int callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
* Note that this is the same as the normal on_message callback,
* except that it returns an int.
* userdata - user provided pointer that will be passed to the callback.
* topic - the subscription topic to use (wildcards are allowed).
* qos - the qos to use for the subscription.
* host - the broker to connect to.
* port - the network port the broker is listening on.
* client_id - the client id to use, or NULL if a random client id should be
* generated.
* keepalive - the MQTT keepalive value.
* clean_session - the MQTT clean session flag.
* username - the username string, or NULL for no username authentication.
* password - the password string, or NULL for an empty password.
* will - a libmosquitto_will struct containing will information, or NULL for
* no will.
* tls - a libmosquitto_tls struct containing TLS related parameters, or NULL
* for no use of TLS.
*
*
* Returns:
* MOSQ_ERR_SUCCESS - on success
* >0 - on error.
*/
libmosq_EXPORT 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);
#ifdef __cplusplus
}
#endif

@ -368,6 +368,43 @@
<paramdef>bool *<parameter>result</parameter></paramdef>
</funcprototype></funcsynopsis>
</refsect2>
<refsect2>
<title>Helper functions</title>
<funcsynopsis><funcprototype><funcdef>int <function>mosquitto_subscribe_simple</function></funcdef>
<paramdef>struct mosquitto_message **<parameter>message</parameter></paramdef>
<paramdef>int <parameter>msg_count</parameter></paramdef>
<paramdef>bool <parameter>want_retained</parameter></paramdef>
<paramdef>const char *<parameter>topic</parameter></paramdef>
<paramdef>int<parameter>qos</parameter></paramdef>
<paramdef>const char *<parameter>host</parameter></paramdef>
<paramdef>int <parameter>port</parameter></paramdef>
<paramdef>const char *<parameter>client_id</parameter></paramdef>
<paramdef>int <parameter>keepalive</parameter></paramdef>
<paramdef>bool <parameter>clean_session</parameter></paramdef>
<paramdef>const char *<parameter>username</parameter></paramdef>
<paramdef>const char *<parameter>password</parameter></paramdef>
<paramdef>const struct libmosquitto_will *<parameter>will</parameter></paramdef>
<paramdef>const struct libmosquitto_tls *<parameter>tls</parameter></paramdef>
</funcprototype></funcsynopsis>
<funcsynopsis><funcprototype><funcdef>int <function>mosquitto_subscribe_callback</function></funcdef>
<paramdef>int <parameter>(*callback)(struct mosquitto *, void *, const struct mosquitto_message *)</parameter></paramdef>
<paramdef>void *<parameter>userdata</parameter></paramdef>
<paramdef>const char *<parameter>topic</parameter></paramdef>
<paramdef>int <parameter>qos</parameter></paramdef>
<paramdef>const char *<parameter>host</parameter></paramdef>
<paramdef>int <parameter>port</parameter></paramdef>
<paramdef>const char *<parameter>client_id</parameter></paramdef>
<paramdef>int <parameter>keepalive</parameter></paramdef>
<paramdef>bool <parameter>clean_session</parameter></paramdef>
<paramdef>const char *<parameter>username</parameter></paramdef>
<paramdef>const char *<parameter>password</parameter></paramdef>
<paramdef>const struct libmosquitto_will *<parameter>will</parameter></paramdef>
<paramdef>const struct libmosquitto_tls *<parameter>tls</parameter></paramdef>
</funcprototype></funcsynopsis>
</refsect2>
</refsect1>
<refsect1>

@ -383,8 +383,8 @@
<listitem>
<para>Specify which version of the MQTT protocol should be
used when connecting to the rmeote broker. Can be
<option>mqttv31</option> or <option>mqttv311</option>.
Defaults to <option>mqttv31</option>.</para>
<option>mqttv311</option> or <option>mqttv31</option>.
Defaults to <option>mqttv311</option>.</para>
</listitem>
</varlistentry>
<varlistentry>

@ -27,7 +27,10 @@
<arg><option>-k</option> <replaceable>keepalive time</replaceable></arg>
<arg><option>-p</option> <replaceable>port number</replaceable></arg>
<arg><option>-q</option> <replaceable>message QoS</replaceable></arg>
<arg><option>-R</option></arg>
<group choice='opt'>
<arg choice='plain'><option>-R</option></arg>
<arg choice='plain'><option>--retained-only</option></arg>
</group>
<arg><option>-S</option></arg>
<arg><option>-N</option></arg>
<arg><option>--quiet</option></arg>
@ -354,6 +357,17 @@
their display.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--retained-only</option></term>
<listitem>
<para>If this argument is given, only messages that are
received that have the retain bit set will be printed.
Messages with retain set are "stale", in that it is not
known when they were originally published. With this
argument in use, the receipt of the first non-stale
message will cause the client to exit.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-S</option></term>
<listitem>
@ -465,8 +479,8 @@
<listitem>
<para>Specify which version of the MQTT protocol should be
used when connecting to the rmeote broker. Can be
<option>mqttv31</option> or <option>mqttv311</option>.
Defaults to <option>mqttv31</option>.</para>
<option>mqttv311</option> or <option>mqttv31</option>.
Defaults to <option>mqttv311</option>.</para>
</listitem>
</varlistentry>
<varlistentry>

@ -650,8 +650,8 @@
#topic <topic> [[[out | in | both] qos-level] local-prefix remote-prefix]
# Set the version of the MQTT protocol to use with for this bridge. Can be one
# of mqttv31 or mqttv311. Defaults to mqttv31.
#bridge_protocol_version mqttv31
# of mqttv311 or mqttv11. Defaults to mqttv311.
#bridge_protocol_version mqttv311
# If a bridge has topics that have "out" direction, the default behaviour is to
# send an unsubscribe request to the remote broker on that topic. This means

@ -580,9 +580,9 @@ void service_run(void);
* ============================================================ */
#ifdef WITH_WEBSOCKETS
# if defined(LWS_LIBRARY_VERSION_NUMBER)
struct lws_context *mosq_websockets_init(struct _mqtt3_listener *listener, int log_level);
struct lws_context *mosq_websockets_init(struct mosquitto__listener *listener, int log_level);
# else
struct libwebsocket_context *mosq_websockets_init(struct _mqtt3_listener *listener, int log_level);
struct libwebsocket_context *mosq_websockets_init(struct mosquitto__listener *listener, int log_level);
# endif
#endif
void do_disconnect(struct mosquitto_db *db, struct mosquitto *context);

Loading…
Cancel
Save