Re-enable LTO for gcc builds.

pull/2505/head
Roger A. Light 4 years ago
parent af42640d60
commit c53a53bce0

@ -90,4 +90,14 @@
#define WS_IS_LWS 1 #define WS_IS_LWS 1
#define WS_IS_WSLAY 2 #define WS_IS_WSLAY 2
#ifdef WITH_BROKER
# ifdef __GNUC__
# define BROKER_EXPORT __attribute__((__used__))
# else
# define BROKER_EXPORT
# endif
#else
# define BROKER_EXPORT
#endif
#endif #endif

@ -130,7 +130,7 @@ WITH_OLD_KEEPALIVE=no
# Use link time optimisation - note that enabling this currently prevents # Use link time optimisation - note that enabling this currently prevents
# broker plugins from working. # broker plugins from working.
WITH_LTO=no WITH_LTO=yes
# Build with sqlite3 support - this enables the sqlite persistence plugin. # Build with sqlite3 support - this enables the sqlite persistence plugin.
WITH_SQLITE=yes WITH_SQLITE=yes
@ -164,7 +164,7 @@ ifeq ($(UNAME),SunOS)
CFLAGS?=-Wall -ggdb -O2 CFLAGS?=-Wall -ggdb -O2
endif endif
else else
CFLAGS?=-Wall -ggdb -O2 -Wconversion -Wextra CFLAGS?=-Wall -ggdb -O3 -Wconversion -Wextra
endif endif
STATIC_LIB_DEPS:= STATIC_LIB_DEPS:=

@ -244,7 +244,7 @@ void property__free(mosquitto_property **property)
} }
void mosquitto_property_free_all(mosquitto_property **property) BROKER_EXPORT void mosquitto_property_free_all(mosquitto_property **property)
{ {
mosquitto_property *p, *next; mosquitto_property *p, *next;
@ -443,7 +443,7 @@ int property__write_all(struct mosquitto__packet *packet, const mosquitto_proper
} }
int mosquitto_property_check_command(int command, int identifier) BROKER_EXPORT int mosquitto_property_check_command(int command, int identifier)
{ {
switch(identifier){ switch(identifier){
case MQTT_PROP_PAYLOAD_FORMAT_INDICATOR: case MQTT_PROP_PAYLOAD_FORMAT_INDICATOR:
@ -537,7 +537,7 @@ int mosquitto_property_check_command(int command, int identifier)
} }
const char *mosquitto_property_identifier_to_string(int identifier) BROKER_EXPORT const char *mosquitto_property_identifier_to_string(int identifier)
{ {
switch(identifier){ switch(identifier){
case MQTT_PROP_PAYLOAD_FORMAT_INDICATOR: case MQTT_PROP_PAYLOAD_FORMAT_INDICATOR:
@ -600,7 +600,7 @@ const char *mosquitto_property_identifier_to_string(int identifier)
} }
int mosquitto_string_to_property_info(const char *propname, int *identifier, int *type) BROKER_EXPORT int mosquitto_string_to_property_info(const char *propname, int *identifier, int *type)
{ {
if(!propname) return MOSQ_ERR_INVAL; if(!propname) return MOSQ_ERR_INVAL;
@ -709,7 +709,7 @@ static void property__add(mosquitto_property **proplist, struct mqtt5__property
} }
int mosquitto_property_add_byte(mosquitto_property **proplist, int identifier, uint8_t value) BROKER_EXPORT int mosquitto_property_add_byte(mosquitto_property **proplist, int identifier, uint8_t value)
{ {
mosquitto_property *prop; mosquitto_property *prop;
@ -737,7 +737,7 @@ int mosquitto_property_add_byte(mosquitto_property **proplist, int identifier, u
} }
int mosquitto_property_add_int16(mosquitto_property **proplist, int identifier, uint16_t value) BROKER_EXPORT int mosquitto_property_add_int16(mosquitto_property **proplist, int identifier, uint16_t value)
{ {
mosquitto_property *prop; mosquitto_property *prop;
@ -761,7 +761,7 @@ int mosquitto_property_add_int16(mosquitto_property **proplist, int identifier,
} }
int mosquitto_property_add_int32(mosquitto_property **proplist, int identifier, uint32_t value) BROKER_EXPORT int mosquitto_property_add_int32(mosquitto_property **proplist, int identifier, uint32_t value)
{ {
mosquitto_property *prop; mosquitto_property *prop;
@ -786,7 +786,7 @@ int mosquitto_property_add_int32(mosquitto_property **proplist, int identifier,
} }
int mosquitto_property_add_varint(mosquitto_property **proplist, int identifier, uint32_t value) BROKER_EXPORT int mosquitto_property_add_varint(mosquitto_property **proplist, int identifier, uint32_t value)
{ {
mosquitto_property *prop; mosquitto_property *prop;
@ -805,7 +805,7 @@ int mosquitto_property_add_varint(mosquitto_property **proplist, int identifier,
} }
int mosquitto_property_add_binary(mosquitto_property **proplist, int identifier, const void *value, uint16_t len) BROKER_EXPORT int mosquitto_property_add_binary(mosquitto_property **proplist, int identifier, const void *value, uint16_t len)
{ {
mosquitto_property *prop; mosquitto_property *prop;
@ -838,7 +838,7 @@ int mosquitto_property_add_binary(mosquitto_property **proplist, int identifier,
} }
int mosquitto_property_add_string(mosquitto_property **proplist, int identifier, const char *value) BROKER_EXPORT int mosquitto_property_add_string(mosquitto_property **proplist, int identifier, const char *value)
{ {
mosquitto_property *prop; mosquitto_property *prop;
size_t slen = 0; size_t slen = 0;
@ -879,7 +879,7 @@ int mosquitto_property_add_string(mosquitto_property **proplist, int identifier,
} }
int mosquitto_property_add_string_pair(mosquitto_property **proplist, int identifier, const char *name, const char *value) BROKER_EXPORT int mosquitto_property_add_string_pair(mosquitto_property **proplist, int identifier, const char *name, const char *value)
{ {
mosquitto_property *prop; mosquitto_property *prop;
size_t slen_name = 0, slen_value = 0; size_t slen_name = 0, slen_value = 0;
@ -923,7 +923,7 @@ int mosquitto_property_add_string_pair(mosquitto_property **proplist, int identi
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
} }
int mosquitto_property_check_all(int command, const mosquitto_property *properties) BROKER_EXPORT int mosquitto_property_check_all(int command, const mosquitto_property *properties)
{ {
const mosquitto_property *p, *tail; const mosquitto_property *p, *tail;
int rc; int rc;
@ -997,7 +997,7 @@ static const mosquitto_property *property__get_property(const mosquitto_property
} }
int mosquitto_property_identifier(const mosquitto_property *property) BROKER_EXPORT int mosquitto_property_identifier(const mosquitto_property *property)
{ {
if(property == NULL) return 0; if(property == NULL) return 0;
@ -1005,7 +1005,7 @@ int mosquitto_property_identifier(const mosquitto_property *property)
} }
const mosquitto_property *mosquitto_property_next(const mosquitto_property *proplist) BROKER_EXPORT const mosquitto_property *mosquitto_property_next(const mosquitto_property *proplist)
{ {
if(proplist == NULL) return NULL; if(proplist == NULL) return NULL;
@ -1013,7 +1013,7 @@ const mosquitto_property *mosquitto_property_next(const mosquitto_property *prop
} }
const mosquitto_property *mosquitto_property_read_byte(const mosquitto_property *proplist, int identifier, uint8_t *value, bool skip_first) BROKER_EXPORT const mosquitto_property *mosquitto_property_read_byte(const mosquitto_property *proplist, int identifier, uint8_t *value, bool skip_first)
{ {
const mosquitto_property *p; const mosquitto_property *p;
if(!proplist) return NULL; if(!proplist) return NULL;
@ -1037,7 +1037,7 @@ const mosquitto_property *mosquitto_property_read_byte(const mosquitto_property
} }
const mosquitto_property *mosquitto_property_read_int16(const mosquitto_property *proplist, int identifier, uint16_t *value, bool skip_first) BROKER_EXPORT const mosquitto_property *mosquitto_property_read_int16(const mosquitto_property *proplist, int identifier, uint16_t *value, bool skip_first)
{ {
const mosquitto_property *p; const mosquitto_property *p;
if(!proplist) return NULL; if(!proplist) return NULL;
@ -1057,7 +1057,7 @@ const mosquitto_property *mosquitto_property_read_int16(const mosquitto_property
} }
const mosquitto_property *mosquitto_property_read_int32(const mosquitto_property *proplist, int identifier, uint32_t *value, bool skip_first) BROKER_EXPORT const mosquitto_property *mosquitto_property_read_int32(const mosquitto_property *proplist, int identifier, uint32_t *value, bool skip_first)
{ {
const mosquitto_property *p; const mosquitto_property *p;
if(!proplist) return NULL; if(!proplist) return NULL;
@ -1078,7 +1078,7 @@ const mosquitto_property *mosquitto_property_read_int32(const mosquitto_property
} }
const mosquitto_property *mosquitto_property_read_varint(const mosquitto_property *proplist, int identifier, uint32_t *value, bool skip_first) BROKER_EXPORT const mosquitto_property *mosquitto_property_read_varint(const mosquitto_property *proplist, int identifier, uint32_t *value, bool skip_first)
{ {
const mosquitto_property *p; const mosquitto_property *p;
if(!proplist) return NULL; if(!proplist) return NULL;
@ -1095,7 +1095,7 @@ const mosquitto_property *mosquitto_property_read_varint(const mosquitto_propert
} }
const mosquitto_property *mosquitto_property_read_binary(const mosquitto_property *proplist, int identifier, void **value, uint16_t *len, bool skip_first) BROKER_EXPORT const mosquitto_property *mosquitto_property_read_binary(const mosquitto_property *proplist, int identifier, void **value, uint16_t *len, bool skip_first)
{ {
const mosquitto_property *p; const mosquitto_property *p;
if(!proplist || (value && !len) || (!value && len)) return NULL; if(!proplist || (value && !len) || (!value && len)) return NULL;
@ -1122,7 +1122,7 @@ const mosquitto_property *mosquitto_property_read_binary(const mosquitto_propert
} }
const mosquitto_property *mosquitto_property_read_string(const mosquitto_property *proplist, int identifier, char **value, bool skip_first) BROKER_EXPORT const mosquitto_property *mosquitto_property_read_string(const mosquitto_property *proplist, int identifier, char **value, bool skip_first)
{ {
const mosquitto_property *p; const mosquitto_property *p;
if(!proplist) return NULL; if(!proplist) return NULL;
@ -1151,7 +1151,7 @@ const mosquitto_property *mosquitto_property_read_string(const mosquitto_propert
} }
const mosquitto_property *mosquitto_property_read_string_pair(const mosquitto_property *proplist, int identifier, char **name, char **value, bool skip_first) BROKER_EXPORT const mosquitto_property *mosquitto_property_read_string_pair(const mosquitto_property *proplist, int identifier, char **name, char **value, bool skip_first)
{ {
const mosquitto_property *p; const mosquitto_property *p;
if(!proplist) return NULL; if(!proplist) return NULL;
@ -1184,7 +1184,7 @@ const mosquitto_property *mosquitto_property_read_string_pair(const mosquitto_pr
} }
int mosquitto_property_copy_all(mosquitto_property **dest, const mosquitto_property *src) BROKER_EXPORT int mosquitto_property_copy_all(mosquitto_property **dest, const mosquitto_property *src)
{ {
mosquitto_property *pnew, *plast = NULL; mosquitto_property *pnew, *plast = NULL;

@ -21,7 +21,7 @@ Contributors:
#include <stdio.h> #include <stdio.h>
#include "mosquitto.h" #include "mosquitto.h"
int mosquitto_validate_utf8(const char *str, int len) BROKER_EXPORT int mosquitto_validate_utf8(const char *str, int len)
{ {
int i; int i;
int j; int j;
@ -108,4 +108,3 @@ int mosquitto_validate_utf8(const char *str, int len)
} }
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
} }

@ -48,7 +48,7 @@ Contributors:
* Also returns MOSQ_ERR_INVAL if the topic string is too long. * Also returns MOSQ_ERR_INVAL if the topic string is too long.
* Returns MOSQ_ERR_SUCCESS if everything is fine. * Returns MOSQ_ERR_SUCCESS if everything is fine.
*/ */
int mosquitto_pub_topic_check(const char *str) BROKER_EXPORT int mosquitto_pub_topic_check(const char *str)
{ {
int len = 0; int len = 0;
#ifdef WITH_BROKER #ifdef WITH_BROKER
@ -79,7 +79,7 @@ int mosquitto_pub_topic_check(const char *str)
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
} }
int mosquitto_pub_topic_check2(const char *str, size_t len) BROKER_EXPORT int mosquitto_pub_topic_check2(const char *str, size_t len)
{ {
size_t i; size_t i;
#ifdef WITH_BROKER #ifdef WITH_BROKER
@ -114,7 +114,7 @@ int mosquitto_pub_topic_check2(const char *str, size_t len)
* Also returns MOSQ_ERR_INVAL if the topic string is too long. * Also returns MOSQ_ERR_INVAL if the topic string is too long.
* Returns MOSQ_ERR_SUCCESS if everything is fine. * Returns MOSQ_ERR_SUCCESS if everything is fine.
*/ */
int mosquitto_sub_topic_check(const char *str) BROKER_EXPORT int mosquitto_sub_topic_check(const char *str)
{ {
char c = '\0'; char c = '\0';
int len = 0; int len = 0;
@ -153,7 +153,7 @@ int mosquitto_sub_topic_check(const char *str)
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
} }
int mosquitto_sub_topic_check2(const char *str, size_t len) BROKER_EXPORT int mosquitto_sub_topic_check2(const char *str, size_t len)
{ {
char c = '\0'; char c = '\0';
size_t i; size_t i;
@ -523,28 +523,28 @@ static int sub_matches_acl(const char *acl, const char *sub, const char *clienti
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
} }
int mosquitto_sub_matches_acl(const char *acl, const char *sub, bool *result) BROKER_EXPORT int mosquitto_sub_matches_acl(const char *acl, const char *sub, bool *result)
{ {
return sub_matches_acl(acl, sub, NULL, NULL, false, result); return sub_matches_acl(acl, sub, NULL, NULL, false, result);
} }
int mosquitto_sub_matches_acl_with_pattern(const char *acl, const char *sub, const char *clientid, const char *username, bool *result) BROKER_EXPORT int mosquitto_sub_matches_acl_with_pattern(const char *acl, const char *sub, const char *clientid, const char *username, bool *result)
{ {
return sub_matches_acl(acl, sub, clientid, username, true, result); return sub_matches_acl(acl, sub, clientid, username, true, result);
} }
int mosquitto_topic_matches_sub(const char *sub, const char *topic, bool *result) BROKER_EXPORT int mosquitto_topic_matches_sub(const char *sub, const char *topic, bool *result)
{ {
return topic_matches_sub(sub, topic, NULL, NULL, false, result); return topic_matches_sub(sub, topic, NULL, NULL, false, result);
} }
int mosquitto_topic_matches_sub_with_pattern(const char *sub, const char *topic, const char *clientid, const char *username, bool *result) BROKER_EXPORT int mosquitto_topic_matches_sub_with_pattern(const char *sub, const char *topic, const char *clientid, const char *username, bool *result)
{ {
return topic_matches_sub(sub, topic, clientid, username, true, result); return topic_matches_sub(sub, topic, clientid, username, true, result);
} }
/* Does a topic match a subscription? */ /* Does a topic match a subscription? */
int mosquitto_topic_matches_sub2(const char *sub, size_t sublen, const char *topic, size_t topiclen, bool *result) BROKER_EXPORT int mosquitto_topic_matches_sub2(const char *sub, size_t sublen, const char *topic, size_t topiclen, bool *result)
{ {
size_t spos, tpos; size_t spos, tpos;

@ -21,6 +21,7 @@ _mosquitto_free
_mosquitto_kick_client_by_clientid _mosquitto_kick_client_by_clientid
_mosquitto_kick_client_by_username _mosquitto_kick_client_by_username
_mosquitto_log_printf _mosquitto_log_printf
_mosquitto_log_vprintf
_mosquitto_malloc _mosquitto_malloc
_mosquitto_persist_base_msg_add _mosquitto_persist_base_msg_add
_mosquitto_persist_base_msg_delete _mosquitto_persist_base_msg_delete
@ -31,8 +32,8 @@ _mosquitto_persist_client_msg_clear
_mosquitto_persist_client_msg_delete _mosquitto_persist_client_msg_delete
_mosquitto_persist_client_msg_update _mosquitto_persist_client_msg_update
_mosquitto_persist_client_update _mosquitto_persist_client_update
_mosquitto_persist_retain_msg_set
_mosquitto_persist_retain_msg_delete _mosquitto_persist_retain_msg_delete
_mosquitto_persist_retain_msg_set
_mosquitto_plugin_set_info _mosquitto_plugin_set_info
_mosquitto_property_add_binary _mosquitto_property_add_binary
_mosquitto_property_add_byte _mosquitto_property_add_byte
@ -41,6 +42,9 @@ _mosquitto_property_add_int32
_mosquitto_property_add_string _mosquitto_property_add_string
_mosquitto_property_add_string_pair _mosquitto_property_add_string_pair
_mosquitto_property_add_varint _mosquitto_property_add_varint
_mosquitto_property_check_all
_mosquitto_property_check_command
_mosquitto_property_copy_all
_mosquitto_property_free_all _mosquitto_property_free_all
_mosquitto_property_identifier _mosquitto_property_identifier
_mosquitto_property_identifier_to_string _mosquitto_property_identifier_to_string
@ -53,16 +57,19 @@ _mosquitto_property_read_string
_mosquitto_property_read_string_pair _mosquitto_property_read_string_pair
_mosquitto_property_read_varint _mosquitto_property_read_varint
_mosquitto_pub_topic_check _mosquitto_pub_topic_check
_mosquitto_pub_topic_check2
_mosquitto_realloc _mosquitto_realloc
_mosquitto_set_username
_mosquitto_set_clientid _mosquitto_set_clientid
_mosquitto_set_username
_mosquitto_strdup _mosquitto_strdup
_mosquitto_string_to_property_info _mosquitto_string_to_property_info
_mosquitto_sub_matches_acl _mosquitto_sub_matches_acl
_mosquitto_sub_matches_acl_with_pattern _mosquitto_sub_matches_acl_with_pattern
_mosquitto_sub_topic_check _mosquitto_sub_topic_check
_mosquitto_sub_topic_check2
_mosquitto_subscription_add _mosquitto_subscription_add
_mosquitto_subscription_delete _mosquitto_subscription_delete
_mosquitto_topic_matches_sub _mosquitto_topic_matches_sub
_mosquitto_topic_matches_sub2
_mosquitto_topic_matches_sub_with_pattern _mosquitto_topic_matches_sub_with_pattern
_mosquitto_validate_utf8 _mosquitto_validate_utf8

@ -22,6 +22,7 @@
mosquitto_kick_client_by_clientid; mosquitto_kick_client_by_clientid;
mosquitto_kick_client_by_username; mosquitto_kick_client_by_username;
mosquitto_log_printf; mosquitto_log_printf;
mosquitto_log_vprintf;
mosquitto_malloc; mosquitto_malloc;
mosquitto_persist_base_msg_add; mosquitto_persist_base_msg_add;
mosquitto_persist_base_msg_delete; mosquitto_persist_base_msg_delete;
@ -32,8 +33,8 @@
mosquitto_persist_client_msg_delete; mosquitto_persist_client_msg_delete;
mosquitto_persist_client_msg_update; mosquitto_persist_client_msg_update;
mosquitto_persist_client_update; mosquitto_persist_client_update;
mosquitto_persist_retain_msg_set;
mosquitto_persist_retain_msg_delete; mosquitto_persist_retain_msg_delete;
mosquitto_persist_retain_msg_set;
mosquitto_plugin_set_info; mosquitto_plugin_set_info;
mosquitto_property_add_binary; mosquitto_property_add_binary;
mosquitto_property_add_byte; mosquitto_property_add_byte;
@ -42,6 +43,9 @@
mosquitto_property_add_string; mosquitto_property_add_string;
mosquitto_property_add_string_pair; mosquitto_property_add_string_pair;
mosquitto_property_add_varint; mosquitto_property_add_varint;
mosquitto_property_check_all;
mosquitto_property_check_command;
mosquitto_property_copy_all;
mosquitto_property_free_all; mosquitto_property_free_all;
mosquitto_property_identifier; mosquitto_property_identifier;
mosquitto_property_identifier_to_string; mosquitto_property_identifier_to_string;
@ -53,17 +57,20 @@
mosquitto_property_read_string; mosquitto_property_read_string;
mosquitto_property_read_string_pair; mosquitto_property_read_string_pair;
mosquitto_property_read_varint; mosquitto_property_read_varint;
mosquitto_pub_topic_check2;
mosquitto_pub_topic_check; mosquitto_pub_topic_check;
mosquitto_realloc; mosquitto_realloc;
mosquitto_set_username;
mosquitto_set_clientid; mosquitto_set_clientid;
mosquitto_set_username;
mosquitto_strdup; mosquitto_strdup;
mosquitto_string_to_property_info; mosquitto_string_to_property_info;
mosquitto_sub_matches_acl; mosquitto_sub_matches_acl;
mosquitto_sub_matches_acl_with_pattern; mosquitto_sub_matches_acl_with_pattern;
mosquitto_sub_topic_check2;
mosquitto_sub_topic_check; mosquitto_sub_topic_check;
mosquitto_subscription_add; mosquitto_subscription_add;
mosquitto_subscription_delete; mosquitto_subscription_delete;
mosquitto_topic_matches_sub2;
mosquitto_topic_matches_sub; mosquitto_topic_matches_sub;
mosquitto_topic_matches_sub_with_pattern; mosquitto_topic_matches_sub_with_pattern;
mosquitto_validate_utf8; mosquitto_validate_utf8;

@ -375,12 +375,12 @@ void log__internal(const char *fmt, ...)
#endif #endif
} }
int mosquitto_log_vprintf(int level, const char *fmt, va_list va) BROKER_EXPORT int mosquitto_log_vprintf(int level, const char *fmt, va_list va)
{ {
return log__vprintf((unsigned int)level, fmt, va); return log__vprintf((unsigned int)level, fmt, va);
} }
void mosquitto_log_printf(int level, const char *fmt, ...) BROKER_EXPORT void mosquitto_log_printf(int level, const char *fmt, ...)
{ {
va_list va; va_list va;

@ -15,31 +15,32 @@ SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
Contributors: Contributors:
Roger Light - initial implementation and documentation. Roger Light - initial implementation and documentation.
*/ */
#include "config.h"
#include "mosquitto_broker.h" #include "mosquitto_broker.h"
#include "memory_mosq.h" #include "memory_mosq.h"
void *mosquitto_calloc(size_t nmemb, size_t size) BROKER_EXPORT void *mosquitto_calloc(size_t nmemb, size_t size)
{ {
return mosquitto__calloc(nmemb, size); return mosquitto__calloc(nmemb, size);
} }
void mosquitto_free(void *mem) BROKER_EXPORT void mosquitto_free(void *mem)
{ {
mosquitto__free(mem); mosquitto__free(mem);
} }
void *mosquitto_malloc(size_t size) BROKER_EXPORT void *mosquitto_malloc(size_t size)
{ {
return mosquitto__malloc(size); return mosquitto__malloc(size);
} }
void *mosquitto_realloc(void *ptr, size_t size) BROKER_EXPORT void *mosquitto_realloc(void *ptr, size_t size)
{ {
return mosquitto__realloc(ptr, size); return mosquitto__realloc(ptr, size);
} }
char *mosquitto_strdup(const char *s) BROKER_EXPORT char *mosquitto_strdup(const char *s)
{ {
return mosquitto__strdup(s); return mosquitto__strdup(s);
} }

@ -181,7 +181,7 @@ static int remove_callback(mosquitto_plugin_id_t *identifier, int event, struct
} }
int mosquitto_callback_register( BROKER_EXPORT int mosquitto_callback_register(
mosquitto_plugin_id_t *identifier, mosquitto_plugin_id_t *identifier,
int event, int event,
MOSQ_FUNC_generic_callback cb_func, MOSQ_FUNC_generic_callback cb_func,
@ -267,7 +267,7 @@ int plugin__callback_unregister_all(mosquitto_plugin_id_t *identifier)
} }
int mosquitto_callback_unregister( BROKER_EXPORT int mosquitto_callback_unregister(
mosquitto_plugin_id_t *identifier, mosquitto_plugin_id_t *identifier,
int event, int event,
MOSQ_FUNC_generic_callback cb_func, MOSQ_FUNC_generic_callback cb_func,

@ -31,7 +31,7 @@ Contributors:
# include <openssl/ssl.h> # include <openssl/ssl.h>
#endif #endif
int mosquitto_plugin_set_info(mosquitto_plugin_id_t *identifier, BROKER_EXPORT int mosquitto_plugin_set_info(mosquitto_plugin_id_t *identifier,
const char *plugin_name, const char *plugin_name,
const char *plugin_version) const char *plugin_version)
{ {
@ -50,7 +50,7 @@ int mosquitto_plugin_set_info(mosquitto_plugin_id_t *identifier,
} }
const char *mosquitto_client_address(const struct mosquitto *client) BROKER_EXPORT const char *mosquitto_client_address(const struct mosquitto *client)
{ {
if(client){ if(client){
return client->address; return client->address;
@ -60,7 +60,7 @@ const char *mosquitto_client_address(const struct mosquitto *client)
} }
struct mosquitto *mosquitto_client(const char *client_id) BROKER_EXPORT struct mosquitto *mosquitto_client(const char *client_id)
{ {
size_t len; size_t len;
struct mosquitto *context; struct mosquitto *context;
@ -75,7 +75,7 @@ struct mosquitto *mosquitto_client(const char *client_id)
} }
int mosquitto_client_port(const struct mosquitto *client) BROKER_EXPORT int mosquitto_client_port(const struct mosquitto *client)
{ {
if(client && client->listener){ if(client && client->listener){
return client->listener->port; return client->listener->port;
@ -85,7 +85,7 @@ int mosquitto_client_port(const struct mosquitto *client)
} }
bool mosquitto_client_clean_session(const struct mosquitto *client) BROKER_EXPORT bool mosquitto_client_clean_session(const struct mosquitto *client)
{ {
if(client){ if(client){
return client->clean_start; return client->clean_start;
@ -95,7 +95,7 @@ bool mosquitto_client_clean_session(const struct mosquitto *client)
} }
const char *mosquitto_client_id(const struct mosquitto *client) BROKER_EXPORT const char *mosquitto_client_id(const struct mosquitto *client)
{ {
if(client){ if(client){
return client->id; return client->id;
@ -105,7 +105,7 @@ const char *mosquitto_client_id(const struct mosquitto *client)
} }
int mosquitto_client_keepalive(const struct mosquitto *client) BROKER_EXPORT int mosquitto_client_keepalive(const struct mosquitto *client)
{ {
if(client){ if(client){
return client->keepalive; return client->keepalive;
@ -115,7 +115,7 @@ int mosquitto_client_keepalive(const struct mosquitto *client)
} }
void *mosquitto_client_certificate(const struct mosquitto *client) BROKER_EXPORT void *mosquitto_client_certificate(const struct mosquitto *client)
{ {
#ifdef WITH_TLS #ifdef WITH_TLS
if(client && client->ssl){ if(client && client->ssl){
@ -131,7 +131,7 @@ void *mosquitto_client_certificate(const struct mosquitto *client)
} }
int mosquitto_client_protocol(const struct mosquitto *client) BROKER_EXPORT int mosquitto_client_protocol(const struct mosquitto *client)
{ {
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_LWS #if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_LWS
if(client && client->wsi){ if(client && client->wsi){
@ -150,7 +150,7 @@ int mosquitto_client_protocol(const struct mosquitto *client)
} }
int mosquitto_client_protocol_version(const struct mosquitto *client) BROKER_EXPORT int mosquitto_client_protocol_version(const struct mosquitto *client)
{ {
if(client){ if(client){
switch(client->protocol){ switch(client->protocol){
@ -169,7 +169,7 @@ int mosquitto_client_protocol_version(const struct mosquitto *client)
} }
int mosquitto_client_sub_count(const struct mosquitto *client) BROKER_EXPORT int mosquitto_client_sub_count(const struct mosquitto *client)
{ {
if(client){ if(client){
return client->sub_count; return client->sub_count;
@ -179,7 +179,7 @@ int mosquitto_client_sub_count(const struct mosquitto *client)
} }
const char *mosquitto_client_username(const struct mosquitto *client) BROKER_EXPORT const char *mosquitto_client_username(const struct mosquitto *client)
{ {
if(client){ if(client){
#ifdef WITH_BRIDGE #ifdef WITH_BRIDGE
@ -196,7 +196,7 @@ const char *mosquitto_client_username(const struct mosquitto *client)
} }
int mosquitto_broker_publish( BROKER_EXPORT int mosquitto_broker_publish(
const char *clientid, const char *clientid,
const char *topic, const char *topic,
int payloadlen, int payloadlen,
@ -247,7 +247,7 @@ int mosquitto_broker_publish(
} }
int mosquitto_broker_publish_copy( BROKER_EXPORT int mosquitto_broker_publish_copy(
const char *clientid, const char *clientid,
const char *topic, const char *topic,
int payloadlen, int payloadlen,
@ -289,7 +289,7 @@ int mosquitto_broker_publish_copy(
} }
int mosquitto_set_username(struct mosquitto *client, const char *username) BROKER_EXPORT int mosquitto_set_username(struct mosquitto *client, const char *username)
{ {
char *u_dup; char *u_dup;
char *old; char *old;
@ -318,7 +318,7 @@ int mosquitto_set_username(struct mosquitto *client, const char *username)
} }
} }
int mosquitto_set_clientid(struct mosquitto *client, const char *clientid) BROKER_EXPORT int mosquitto_set_clientid(struct mosquitto *client, const char *clientid)
{ {
struct mosquitto *found_client; struct mosquitto *found_client;
char *id_dup; char *id_dup;
@ -404,7 +404,7 @@ static void disconnect_client(struct mosquitto *context, bool with_will)
do_disconnect(context, MOSQ_ERR_ADMINISTRATIVE_ACTION); do_disconnect(context, MOSQ_ERR_ADMINISTRATIVE_ACTION);
} }
int mosquitto_kick_client_by_clientid(const char *clientid, bool with_will) BROKER_EXPORT int mosquitto_kick_client_by_clientid(const char *clientid, bool with_will)
{ {
struct mosquitto *ctxt, *ctxt_tmp; struct mosquitto *ctxt, *ctxt_tmp;
@ -424,7 +424,7 @@ int mosquitto_kick_client_by_clientid(const char *clientid, bool with_will)
} }
} }
int mosquitto_kick_client_by_username(const char *username, bool with_will) BROKER_EXPORT int mosquitto_kick_client_by_username(const char *username, bool with_will)
{ {
struct mosquitto *ctxt, *ctxt_tmp; struct mosquitto *ctxt, *ctxt_tmp;
@ -444,7 +444,7 @@ int mosquitto_kick_client_by_username(const char *username, bool with_will)
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
} }
int mosquitto_apply_on_all_clients(int (*FUNC_client_functor)(const struct mosquitto *, void *), void *functor_context) BROKER_EXPORT int mosquitto_apply_on_all_clients(int (*FUNC_client_functor)(const struct mosquitto *, void *), void *functor_context)
{ {
int rc = MOSQ_ERR_SUCCESS; int rc = MOSQ_ERR_SUCCESS;
struct mosquitto *ctxt, *ctxt_tmp; struct mosquitto *ctxt, *ctxt_tmp;
@ -459,7 +459,7 @@ int mosquitto_apply_on_all_clients(int (*FUNC_client_functor)(const struct mosqu
return rc; return rc;
} }
int mosquitto_persist_client_add(struct mosquitto_evt_persist_client *client) BROKER_EXPORT int mosquitto_persist_client_add(struct mosquitto_evt_persist_client *client)
{ {
struct mosquitto *context; struct mosquitto *context;
int i; int i;
@ -524,7 +524,7 @@ error:
} }
int mosquitto_persist_client_update(struct mosquitto_evt_persist_client *client) BROKER_EXPORT int mosquitto_persist_client_update(struct mosquitto_evt_persist_client *client)
{ {
struct mosquitto *context; struct mosquitto *context;
int i; int i;
@ -575,7 +575,7 @@ error:
} }
int mosquitto_persist_client_delete(const char *client_id) BROKER_EXPORT int mosquitto_persist_client_delete(const char *client_id)
{ {
struct mosquitto *context; struct mosquitto *context;
@ -609,7 +609,7 @@ struct mosquitto_base_msg *find_store_msg(uint64_t store_id)
return base_msg; return base_msg;
} }
int mosquitto_persist_client_msg_add(struct mosquitto_evt_persist_client_msg *client_msg) BROKER_EXPORT int mosquitto_persist_client_msg_add(struct mosquitto_evt_persist_client_msg *client_msg)
{ {
struct mosquitto *context; struct mosquitto *context;
struct mosquitto_base_msg *base_msg; struct mosquitto_base_msg *base_msg;
@ -642,7 +642,7 @@ int mosquitto_persist_client_msg_add(struct mosquitto_evt_persist_client_msg *cl
} }
int mosquitto_persist_client_msg_delete(struct mosquitto_evt_persist_client_msg *client_msg) BROKER_EXPORT int mosquitto_persist_client_msg_delete(struct mosquitto_evt_persist_client_msg *client_msg)
{ {
struct mosquitto *context; struct mosquitto *context;
@ -664,7 +664,7 @@ int mosquitto_persist_client_msg_delete(struct mosquitto_evt_persist_client_msg
} }
int mosquitto_persist_client_msg_update(struct mosquitto_evt_persist_client_msg *client_msg) BROKER_EXPORT int mosquitto_persist_client_msg_update(struct mosquitto_evt_persist_client_msg *client_msg)
{ {
struct mosquitto *context; struct mosquitto *context;
@ -686,7 +686,7 @@ int mosquitto_persist_client_msg_update(struct mosquitto_evt_persist_client_msg
} }
int mosquitto_persist_client_msg_clear(struct mosquitto_evt_persist_client_msg *client_msg) BROKER_EXPORT int mosquitto_persist_client_msg_clear(struct mosquitto_evt_persist_client_msg *client_msg)
{ {
struct mosquitto *context; struct mosquitto *context;
@ -706,7 +706,7 @@ int mosquitto_persist_client_msg_clear(struct mosquitto_evt_persist_client_msg *
} }
int mosquitto_subscription_add(const char *client_id, const char *topic, uint8_t subscription_options, uint32_t subscription_identifier) BROKER_EXPORT int mosquitto_subscription_add(const char *client_id, const char *topic, uint8_t subscription_options, uint32_t subscription_identifier)
{ {
struct mosquitto *context; struct mosquitto *context;
@ -724,7 +724,7 @@ int mosquitto_subscription_add(const char *client_id, const char *topic, uint8_t
} }
int mosquitto_subscription_delete(const char *client_id, const char *topic) BROKER_EXPORT int mosquitto_subscription_delete(const char *client_id, const char *topic)
{ {
struct mosquitto *context; struct mosquitto *context;
uint8_t reason; uint8_t reason;
@ -743,7 +743,7 @@ int mosquitto_subscription_delete(const char *client_id, const char *topic)
} }
int mosquitto_persist_base_msg_add(struct mosquitto_evt_persist_base_msg *msg) BROKER_EXPORT int mosquitto_persist_base_msg_add(struct mosquitto_evt_persist_base_msg *msg)
{ {
struct mosquitto context; struct mosquitto context;
struct mosquitto_base_msg *base_msg; struct mosquitto_base_msg *base_msg;
@ -809,7 +809,7 @@ error:
} }
int mosquitto_persist_base_msg_delete(uint64_t store_id) BROKER_EXPORT int mosquitto_persist_base_msg_delete(uint64_t store_id)
{ {
struct mosquitto_base_msg *base_msg; struct mosquitto_base_msg *base_msg;
@ -820,7 +820,7 @@ int mosquitto_persist_base_msg_delete(uint64_t store_id)
} }
void mosquitto_complete_basic_auth(const char *client_id, int result) BROKER_EXPORT void mosquitto_complete_basic_auth(const char *client_id, int result)
{ {
struct mosquitto *context; struct mosquitto *context;
@ -845,7 +845,7 @@ void mosquitto_complete_basic_auth(const char *client_id, int result)
} }
} }
int mosquitto_broker_node_id_set(uint16_t id) BROKER_EXPORT int mosquitto_broker_node_id_set(uint16_t id)
{ {
if(id > 1023){ if(id > 1023){
return MOSQ_ERR_INVAL; return MOSQ_ERR_INVAL;

@ -71,7 +71,7 @@ int retain__init(void)
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
} }
int mosquitto_persist_retain_msg_set(const char *topic, uint64_t base_msg_id) BROKER_EXPORT int mosquitto_persist_retain_msg_set(const char *topic, uint64_t base_msg_id)
{ {
struct mosquitto_base_msg *base_msg; struct mosquitto_base_msg *base_msg;
int rc = MOSQ_ERR_UNKNOWN; int rc = MOSQ_ERR_UNKNOWN;
@ -94,7 +94,7 @@ int mosquitto_persist_retain_msg_set(const char *topic, uint64_t base_msg_id)
int mosquitto_persist_retain_msg_delete(const char *topic) BROKER_EXPORT int mosquitto_persist_retain_msg_delete(const char *topic)
{ {
struct mosquitto_base_msg base_msg; struct mosquitto_base_msg base_msg;
int rc = MOSQ_ERR_UNKNOWN; int rc = MOSQ_ERR_UNKNOWN;

Loading…
Cancel
Save