mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-27 14:22:34 +08:00
[111] Add mosquitto_userdata function to libmosquitto.
This allows retrieving mosq->userdata. Bug: https://github.com/eclipse/mosquitto/issues/111
This commit is contained in:
@@ -54,6 +54,8 @@ Client library:
|
|||||||
according to the UTF-8 spec and to the additional restrictions imposed by
|
according to the UTF-8 spec and to the additional restrictions imposed by
|
||||||
the MQTT spec.
|
the MQTT spec.
|
||||||
- Topic inputs are checked for UTF-8 validity.
|
- Topic inputs are checked for UTF-8 validity.
|
||||||
|
- Add mosquitto_userdata function to allow retrieving the client userdata
|
||||||
|
member variable. Closes #111.
|
||||||
|
|
||||||
Client:
|
Client:
|
||||||
- Add -F to mosquitto_sub to allow the user to choose the output format.
|
- Add -F to mosquitto_sub to allow the user to choose the output format.
|
||||||
|
|||||||
@@ -85,4 +85,5 @@ MOSQ_1.5 {
|
|||||||
mosquitto_subscribe_callback;
|
mosquitto_subscribe_callback;
|
||||||
mosquitto_message_free_contents;
|
mosquitto_message_free_contents;
|
||||||
mosquitto_validate_utf8;
|
mosquitto_validate_utf8;
|
||||||
|
mosquitto_userdata;
|
||||||
} MOSQ_1.4;
|
} MOSQ_1.4;
|
||||||
|
|||||||
+17
-2
@@ -1002,7 +1002,8 @@ libmosq_EXPORT int mosquitto_opts_set(struct mosquitto *mosq, enum mosq_opt_t op
|
|||||||
* Your callback must write the password into "buf", which is
|
* Your callback must write the password into "buf", which is
|
||||||
* "size" bytes long. The return value must be the length of the
|
* "size" bytes long. The return value must be the length of the
|
||||||
* password. "userdata" will be set to the calling mosquitto
|
* password. "userdata" will be set to the calling mosquitto
|
||||||
* instance.
|
* instance. The mosquitto userdata member variable can be
|
||||||
|
* retrieved using <mosquitto_userdata>.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* MOSQ_ERR_SUCCESS - on success.
|
* MOSQ_ERR_SUCCESS - on success.
|
||||||
@@ -1010,7 +1011,8 @@ libmosq_EXPORT int mosquitto_opts_set(struct mosquitto *mosq, enum mosq_opt_t op
|
|||||||
* MOSQ_ERR_NOMEM - if an out of memory condition occurred.
|
* MOSQ_ERR_NOMEM - if an out of memory condition occurred.
|
||||||
*
|
*
|
||||||
* See Also:
|
* See Also:
|
||||||
* <mosquitto_tls_opts_set>, <mosquitto_tls_psk_set>, <mosquitto_tls_insecure_set>
|
* <mosquitto_tls_opts_set>, <mosquitto_tls_psk_set>,
|
||||||
|
* <mosquitto_tls_insecure_set>, <mosquitto_userdata>
|
||||||
*/
|
*/
|
||||||
libmosq_EXPORT int mosquitto_tls_set(struct mosquitto *mosq,
|
libmosq_EXPORT int mosquitto_tls_set(struct mosquitto *mosq,
|
||||||
const char *cafile, const char *capath,
|
const char *cafile, const char *capath,
|
||||||
@@ -1692,6 +1694,19 @@ libmosq_EXPORT int mosquitto_subscribe_callback(
|
|||||||
*/
|
*/
|
||||||
libmosq_EXPORT int mosquitto_validate_utf8(const char *str, int len);
|
libmosq_EXPORT int mosquitto_validate_utf8(const char *str, int len);
|
||||||
|
|
||||||
|
|
||||||
|
/* Function: mosquitto_userdata
|
||||||
|
*
|
||||||
|
* Retrieve the "userdata" variable for a mosquitto client.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* mosq - a valid mosquitto instance.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* A pointer to the userdata member variable.
|
||||||
|
*/
|
||||||
|
libmosq_EXPORT void *mosquitto_userdata(struct mosquitto *mosq);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user