|
|
|
@ -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,83 @@ 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.
|
|
|
|
|
* topic - the subscription topic to use (wildcards are allowed).
|
|
|
|
|
* qos - the qos to use for the subscription.
|
|
|
|
|
* 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.
|
|
|
|
|
* 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,
|
|
|
|
|
const char *topic,
|
|
|
|
|
int qos,
|
|
|
|
|
bool retained,
|
|
|
|
|
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
|
|
|
|
|