mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-02-22 21:43:07 +01:00
Formatting: Misc automatic formatting changes
This commit is contained in:
parent
883fdb2ad2
commit
48b76e49f8
|
|
@ -42,8 +42,7 @@ Contributors:
|
|||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
struct client_data
|
||||
{
|
||||
struct client_data {
|
||||
UT_hash_handle hh_id;
|
||||
char *id;
|
||||
uint32_t subscriptions;
|
||||
|
|
@ -52,8 +51,7 @@ struct client_data
|
|||
long message_size;
|
||||
};
|
||||
|
||||
struct base_msg_chunk
|
||||
{
|
||||
struct base_msg_chunk {
|
||||
UT_hash_handle hh;
|
||||
dbid_t store_id;
|
||||
uint32_t length;
|
||||
|
|
|
|||
|
|
@ -9,22 +9,61 @@
|
|||
# define UNUSED(A) (void)(A)
|
||||
#endif
|
||||
|
||||
struct mosquitto *context__init(void) { return NULL; }
|
||||
struct mosquitto *context__init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void context__add_to_by_id(struct mosquitto *context) { UNUSED(context); }
|
||||
|
||||
int db__message_store(const struct mosquitto *source, struct mosquitto__base_msg *base_msg, uint32_t *message_expiry_interval, enum mosquitto_msg_origin origin) { UNUSED(source); UNUSED(base_msg); UNUSED(message_expiry_interval); UNUSED(origin); return 0; }
|
||||
void context__add_to_by_id(struct mosquitto *context)
|
||||
{
|
||||
UNUSED(context);
|
||||
}
|
||||
|
||||
void db__msg_store_ref_inc(struct mosquitto__base_msg *base_msg) { UNUSED(base_msg); }
|
||||
|
||||
int log__printf(struct mosquitto *mosq, unsigned int level, const char *fmt, ...) { UNUSED(mosq); UNUSED(level); UNUSED(fmt); return 0; }
|
||||
int db__message_store(const struct mosquitto *source, struct mosquitto__base_msg *base_msg, uint32_t *message_expiry_interval, enum mosquitto_msg_origin origin)
|
||||
{
|
||||
UNUSED(source); UNUSED(base_msg); UNUSED(message_expiry_interval); UNUSED(origin); return 0;
|
||||
}
|
||||
|
||||
int retain__store(const char *topic, struct mosquitto__base_msg *base_msg, char **split_topics, bool persist) { UNUSED(topic); UNUSED(base_msg); UNUSED(split_topics); UNUSED(persist); return 0; }
|
||||
|
||||
int sub__add(struct mosquitto *context, const struct mosquitto_subscription *sub) { UNUSED(context); UNUSED(sub); return 0; }
|
||||
void db__msg_store_ref_inc(struct mosquitto__base_msg *base_msg)
|
||||
{
|
||||
UNUSED(base_msg);
|
||||
}
|
||||
|
||||
void db__msg_add_to_inflight_stats(struct mosquitto_msg_data *msg_data, struct mosquitto__client_msg *msg) { UNUSED(msg_data); UNUSED(msg); }
|
||||
|
||||
void db__msg_add_to_queued_stats(struct mosquitto_msg_data *msg_data, struct mosquitto__client_msg *msg) { UNUSED(msg_data); UNUSED(msg); }
|
||||
int log__printf(struct mosquitto *mosq, unsigned int level, const char *fmt, ...)
|
||||
{
|
||||
UNUSED(mosq); UNUSED(level); UNUSED(fmt); return 0;
|
||||
}
|
||||
|
||||
int session_expiry__add_from_persistence(struct mosquitto *context, time_t expiry_time) { UNUSED(context); UNUSED(expiry_time); return 0; }
|
||||
|
||||
int retain__store(const char *topic, struct mosquitto__base_msg *base_msg, char **split_topics, bool persist)
|
||||
{
|
||||
UNUSED(topic); UNUSED(base_msg); UNUSED(split_topics); UNUSED(persist); return 0;
|
||||
}
|
||||
|
||||
|
||||
int sub__add(struct mosquitto *context, const struct mosquitto_subscription *sub)
|
||||
{
|
||||
UNUSED(context); UNUSED(sub); return 0;
|
||||
}
|
||||
|
||||
|
||||
void db__msg_add_to_inflight_stats(struct mosquitto_msg_data *msg_data, struct mosquitto__client_msg *msg)
|
||||
{
|
||||
UNUSED(msg_data); UNUSED(msg);
|
||||
}
|
||||
|
||||
|
||||
void db__msg_add_to_queued_stats(struct mosquitto_msg_data *msg_data, struct mosquitto__client_msg *msg)
|
||||
{
|
||||
UNUSED(msg_data); UNUSED(msg);
|
||||
}
|
||||
|
||||
|
||||
int session_expiry__add_from_persistence(struct mosquitto *context, time_t expiry_time)
|
||||
{
|
||||
UNUSED(context); UNUSED(expiry_time); return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,20 +360,22 @@ static int send_set_default_acl_access(char **saveptr)
|
|||
const char *acltype, *allow_s;
|
||||
|
||||
acltype = strtok_r(NULL, " ", saveptr);
|
||||
if(!acltype || (
|
||||
strcasecmp(acltype, "publishClientReceive")
|
||||
&& strcasecmp(acltype, "publishClientSend")
|
||||
&& strcasecmp(acltype, "subscribe")
|
||||
&& strcasecmp(acltype, "unsubscribe")
|
||||
if(!acltype ||
|
||||
(
|
||||
strcasecmp(acltype, "publishClientReceive")
|
||||
&& strcasecmp(acltype, "publishClientSend")
|
||||
&& strcasecmp(acltype, "subscribe")
|
||||
&& strcasecmp(acltype, "unsubscribe")
|
||||
)){
|
||||
ctrl_shell_printf("setDefaultACLAccess acltype allow|deny\n");
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
|
||||
allow_s = strtok_r(NULL, " ", saveptr);
|
||||
if(!allow_s || (
|
||||
strcasecmp(allow_s, "allow")
|
||||
&& strcasecmp(allow_s, "deny")
|
||||
if(!allow_s ||
|
||||
(
|
||||
strcasecmp(allow_s, "allow")
|
||||
&& strcasecmp(allow_s, "deny")
|
||||
)){
|
||||
ctrl_shell_printf("setDefaultACLAccess acltype allow|deny\n");
|
||||
return MOSQ_ERR_INVAL;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static void print_help(char **saveptr)
|
|||
}
|
||||
}
|
||||
|
||||
struct module_data{
|
||||
struct module_data {
|
||||
const char *name;
|
||||
void (*mod_init)(struct ctrl_shell__module *mod);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ Contributors:
|
|||
#include "mosquitto.h"
|
||||
#include "client_shared.h"
|
||||
|
||||
enum prop_type
|
||||
{
|
||||
enum prop_type {
|
||||
PROP_TYPE_BYTE,
|
||||
PROP_TYPE_INT16,
|
||||
PROP_TYPE_INT32,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Contributors:
|
|||
#include "config.h"
|
||||
|
||||
#ifdef WIN32
|
||||
/* For rand_s on Windows */
|
||||
/* For rand_s on Windows */
|
||||
# define _CRT_RAND_S
|
||||
# include <fcntl.h>
|
||||
# include <io.h>
|
||||
|
|
@ -55,7 +55,7 @@ Contributors:
|
|||
|
||||
extern struct mosq_config cfg;
|
||||
|
||||
struct fieldoptions{
|
||||
struct fieldoptions {
|
||||
int field_width;
|
||||
int precision;
|
||||
char hexsepchar;
|
||||
|
|
@ -63,7 +63,7 @@ struct fieldoptions{
|
|||
char pad;
|
||||
};
|
||||
|
||||
struct watch_topic{
|
||||
struct watch_topic {
|
||||
UT_hash_handle hh;
|
||||
char *topic;
|
||||
int line;
|
||||
|
|
|
|||
|
|
@ -194,9 +194,11 @@ static int interruptible_sleep(struct mosquitto *mosq, time_t reconnect_delay)
|
|||
int maxfd = 0;
|
||||
|
||||
#ifndef WIN32
|
||||
while(mosq->sockpairR != INVALID_SOCKET && read(mosq->sockpairR, &pairbuf, 1) > 0);
|
||||
while(mosq->sockpairR != INVALID_SOCKET && read(mosq->sockpairR, &pairbuf, 1) > 0){
|
||||
}
|
||||
#else
|
||||
while(mosq->sockpairR != INVALID_SOCKET && recv(mosq->sockpairR, &pairbuf, 1, 0) > 0);
|
||||
while(mosq->sockpairR != INVALID_SOCKET && recv(mosq->sockpairR, &pairbuf, 1, 0) > 0){
|
||||
}
|
||||
#endif
|
||||
|
||||
local_timeout.tv_sec = reconnect_delay;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ int send__disconnect(struct mosquitto *mosq, uint8_t reason_code, const mosquitt
|
|||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending DISCONNECT", SAFE_PRINT(mosq->id));
|
||||
#endif
|
||||
assert(mosq);
|
||||
|
||||
if(mosq->protocol == mosq_p_mqtt5 && (reason_code != 0 || properties)){
|
||||
remaining_length = 1;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,11 @@ void free(void *ptr)
|
|||
|
||||
#define ALLOC_MARKER_SIZE 0
|
||||
|
||||
static void set_alloc_marker(char* mem, size_t size) { UNUSED(mem); UNUSED(size); }
|
||||
|
||||
static void set_alloc_marker(char *mem, size_t size)
|
||||
{
|
||||
UNUSED(mem); UNUSED(size);
|
||||
}
|
||||
|
||||
#endif /* defined(ALLOC_MISMATCH_INVALID_READ) */
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Contributors:
|
|||
#ifdef WITH_TLS
|
||||
# define HASH_LEN EVP_MAX_MD_SIZE
|
||||
#else
|
||||
/* 64 bytes big enough for SHA512 */
|
||||
/* 64 bytes big enough for SHA512 */
|
||||
# define HASH_LEN 64
|
||||
#endif
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ Contributors:
|
|||
#define PW_DEFAULT_ITERATIONS 1000
|
||||
static int pw__encode(struct mosquitto_pw *pw);
|
||||
|
||||
struct mosquitto_pw{
|
||||
struct mosquitto_pw {
|
||||
union {
|
||||
struct {
|
||||
unsigned char password_hash[HASH_LEN]; /* For SHA512 */
|
||||
|
|
|
|||
|
|
@ -263,8 +263,7 @@ static int topic_matches_sub(const char *sub, const char *topic, const char *cli
|
|||
&& spos > 0
|
||||
&& sub[-1] == '+'
|
||||
&& sub[0] == '/'
|
||||
&& sub[1] == '#')
|
||||
{
|
||||
&& sub[1] == '#'){
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
|
@ -361,10 +360,11 @@ static int sub_matches_acl(const char *acl, const char *sub, const char *clienti
|
|||
/* no match */
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
if(pattern_check[1] == '\0' && (
|
||||
pattern_check[0] == '+' ||
|
||||
pattern_check[0] == '#' ||
|
||||
pattern_check[0] == '/')
|
||||
if(pattern_check[1] == '\0' &&
|
||||
(
|
||||
pattern_check[0] == '+' ||
|
||||
pattern_check[0] == '#' ||
|
||||
pattern_check[0] == '/')
|
||||
){
|
||||
|
||||
/* username/client id of just + / # not allowed */
|
||||
|
|
@ -435,8 +435,7 @@ static int sub_matches_acl(const char *acl, const char *sub, const char *clienti
|
|||
&& apos > 0
|
||||
&& acl[-1] == '+'
|
||||
&& acl[0] == '/'
|
||||
&& acl[1] == '#')
|
||||
{
|
||||
&& acl[1] == '#'){
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
|
@ -593,8 +592,7 @@ BROKER_EXPORT int mosquitto_topic_matches_sub2(const char *sub, size_t sublen, c
|
|||
&& sub[spos-1] == '+'
|
||||
&& sub[spos] == '/'
|
||||
&& spos+1 < sublen
|
||||
&& sub[spos+1] == '#')
|
||||
{
|
||||
&& sub[spos+1] == '#'){
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ Contributors:
|
|||
#include "dynamic_security.h"
|
||||
#include "json_help.h"
|
||||
|
||||
struct connection_array_context{
|
||||
struct connection_array_context {
|
||||
const char *username;
|
||||
cJSON *j_connections;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static int dynsec__handle_command(struct mosquitto_control_cmd *cmd, void *userd
|
|||
}else if(!strcasecmp(cmd->command_name, "getDetails")){
|
||||
rc = dynsec_details__process_get(data, cmd);
|
||||
|
||||
/* Clients */
|
||||
/* Clients */
|
||||
}else if(!strcasecmp(cmd->command_name, "createClient")){
|
||||
rc = dynsec_clients__process_create(data, cmd);
|
||||
}else if(!strcasecmp(cmd->command_name, "deleteClient")){
|
||||
|
|
@ -68,7 +68,7 @@ static int dynsec__handle_command(struct mosquitto_control_cmd *cmd, void *userd
|
|||
}else if(!strcasecmp(cmd->command_name, "disableClient")){
|
||||
rc = dynsec_clients__process_disable(data, cmd);
|
||||
|
||||
/* Groups */
|
||||
/* Groups */
|
||||
}else if(!strcasecmp(cmd->command_name, "addGroupClient")){
|
||||
rc = dynsec_groups__process_add_client(data, cmd);
|
||||
}else if(!strcasecmp(cmd->command_name, "createGroup")){
|
||||
|
|
@ -92,7 +92,7 @@ static int dynsec__handle_command(struct mosquitto_control_cmd *cmd, void *userd
|
|||
}else if(!strcasecmp(cmd->command_name, "getAnonymousGroup")){
|
||||
rc = dynsec_groups__process_get_anonymous_group(data, cmd);
|
||||
|
||||
/* Roles */
|
||||
/* Roles */
|
||||
}else if(!strcasecmp(cmd->command_name, "createRole")){
|
||||
rc = dynsec_roles__process_create(data, cmd);
|
||||
}else if(!strcasecmp(cmd->command_name, "getRole")){
|
||||
|
|
@ -108,7 +108,7 @@ static int dynsec__handle_command(struct mosquitto_control_cmd *cmd, void *userd
|
|||
}else if(!strcasecmp(cmd->command_name, "removeRoleACL")){
|
||||
rc = dynsec_roles__process_remove_acl(data, cmd);
|
||||
|
||||
/* Unknown */
|
||||
/* Unknown */
|
||||
}else{
|
||||
mosquitto_control_command_reply(cmd, "Unknown command");
|
||||
rc = MOSQ_ERR_INVAL;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ MOSQUITTO_PLUGIN_DECLARE_VERSION(5);
|
|||
|
||||
static mosquitto_plugin_id_t *mosq_pid = NULL;
|
||||
|
||||
struct lifetime_s{
|
||||
struct lifetime_s {
|
||||
UT_hash_handle hh;
|
||||
char *id;
|
||||
time_t connect;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ Contributors:
|
|||
|
||||
MOSQUITTO_PLUGIN_DECLARE_VERSION(5);
|
||||
|
||||
struct client_list{
|
||||
struct client_list {
|
||||
UT_hash_handle hh;
|
||||
char *id;
|
||||
time_t request_time;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ Contributors:
|
|||
#define PLUGIN_NAME "payload-ban"
|
||||
#define PLUGIN_VERSION "1.0"
|
||||
|
||||
struct banlist{
|
||||
struct banlist {
|
||||
UT_hash_handle hh_by_address;
|
||||
UT_hash_handle hh_by_id;
|
||||
char ip_address[50];
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ Contributors:
|
|||
|
||||
MOSQUITTO_PLUGIN_DECLARE_VERSION(5);
|
||||
|
||||
struct plugin_data{
|
||||
struct plugin_data {
|
||||
mosquitto_plugin_id_t *pid;
|
||||
int interval;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ Contributors:
|
|||
|
||||
MOSQUITTO_PLUGIN_DECLARE_VERSION(5);
|
||||
|
||||
struct client_list{
|
||||
struct client_list {
|
||||
UT_hash_handle hh;
|
||||
struct client_list *next, *prev;
|
||||
time_t sub_end;
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ static int broker__handle_control(struct mosquitto_control_cmd *cmd, void *userd
|
|||
}else if(!strcasecmp(cmd->command_name, "listListeners")){
|
||||
rc = broker__process_list_listeners(cmd);
|
||||
|
||||
/* Unknown */
|
||||
/* Unknown */
|
||||
}else{
|
||||
mosquitto_control_command_reply(cmd, "Unknown command");
|
||||
rc = MOSQ_ERR_INVAL;
|
||||
|
|
|
|||
128
src/conf.c
128
src/conf.c
|
|
@ -63,91 +63,91 @@ extern SERVICE_STATUS_HANDLE service_handle;
|
|||
|
||||
|
||||
#define REQUIRE_LISTENER(A) \
|
||||
do{ \
|
||||
if(cur_listener == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires a listener to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
do{ \
|
||||
if(cur_listener == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires a listener to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define REQUIRE_LISTENER_OR_DEFAULT_LISTENER(A) \
|
||||
do{ \
|
||||
if(cur_listener == NULL){ \
|
||||
if(config__create_default_listener(config, (A))){ \
|
||||
return MOSQ_ERR_NOMEM; \
|
||||
do{ \
|
||||
if(cur_listener == NULL){ \
|
||||
if(config__create_default_listener(config, (A))){ \
|
||||
return MOSQ_ERR_NOMEM; \
|
||||
} \
|
||||
cur_listener = config->default_listener; \
|
||||
} \
|
||||
cur_listener = config->default_listener; \
|
||||
} \
|
||||
}while(0)
|
||||
}while(0)
|
||||
|
||||
#define REQUIRE_LISTENER_IF_PER_LISTENER(A) \
|
||||
do{ \
|
||||
if(config->per_listener_settings == true && cur_listener == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires a listener to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
do{ \
|
||||
if(config->per_listener_settings == true && cur_listener == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires a listener to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define REQUIRE_NON_DEFAULT_LISTENER(A) \
|
||||
do{ \
|
||||
if(cur_listener == config->default_listener || cur_listener == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires a listener to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
do{ \
|
||||
if(cur_listener == config->default_listener || cur_listener == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires a listener to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define REQUIRE_BRIDGE(A) \
|
||||
do{ \
|
||||
if(cur_bridge == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires a bridge to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
do{ \
|
||||
if(cur_bridge == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires a bridge to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define REQUIRE_PLUGIN(A) \
|
||||
do{ \
|
||||
if(cur_plugin == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires plugin/global_plugin/plugin_load to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
do{ \
|
||||
if(cur_plugin == NULL){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: The '%s' option requires plugin/global_plugin/plugin_load to be defined first.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define OPTION_DEPRECATED(A, B) \
|
||||
log__printf(NULL, MOSQ_LOG_NOTICE, "The '%s' option is now deprecated and will be removed in version 3.0. %s", (A), (B))
|
||||
log__printf(NULL, MOSQ_LOG_NOTICE, "The '%s' option is now deprecated and will be removed in version 3.0. %s", (A), (B))
|
||||
|
||||
#define OPTION_UNAVAILABLE(A) \
|
||||
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: The '%s' option is no longer available.", (A));
|
||||
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: The '%s' option is no longer available.", (A));
|
||||
|
||||
#define REQUIRE_NON_EMPTY_OPTION(A, B) \
|
||||
do{ \
|
||||
if(!(A)){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty '%s' value in configuration.", (B)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
do{ \
|
||||
if(!(A)){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty '%s' value in configuration.", (B)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define PER_LISTENER_ALTERNATIVE(A, B) \
|
||||
if(config->per_listener_settings){ \
|
||||
log__printf(NULL, MOSQ_LOG_NOTICE, "You are using the '%s' option with 'per_listener_settings true'. Please replace this with '%s'.", A, B); \
|
||||
} \
|
||||
if(config->per_listener_settings){ \
|
||||
log__printf(NULL, MOSQ_LOG_NOTICE, "You are using the '%s' option with 'per_listener_settings true'. Please replace this with '%s'.", A, B); \
|
||||
} \
|
||||
|
||||
|
||||
#ifdef FINAL_WITH_TLS_PSK
|
||||
# define REQUIRE_BRIDGE_NO_TLS_PSK(A) \
|
||||
do{ \
|
||||
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: '%s': Cannot use both certificate and psk encryption in a single bridge.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
do{ \
|
||||
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: '%s': Cannot use both certificate and psk encryption in a single bridge.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
# define REQUIRE_BRIDGE_NO_X509(A) \
|
||||
do{ \
|
||||
if(cur_bridge->tls_cafile || cur_bridge->tls_capath || cur_bridge->tls_certfile || cur_bridge->tls_keyfile){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: '%s': Cannot use both certificate and identity encryption in a single bridge.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
do{ \
|
||||
if(cur_bridge->tls_cafile || cur_bridge->tls_capath || cur_bridge->tls_certfile || cur_bridge->tls_keyfile){ \
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: '%s': Cannot use both certificate and identity encryption in a single bridge.", (A)); \
|
||||
return MOSQ_ERR_INVAL; \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#else
|
||||
# define REQUIRE_BRIDGE_NO_TLS_PSK(A)
|
||||
|
|
@ -2183,10 +2183,10 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
|
|||
|
||||
if(!strcmp(token, "mqtt")){
|
||||
cur_listener->protocol = mp_mqtt;
|
||||
/*
|
||||
}else if(!strcmp(token, "mqttsn")){
|
||||
cur_listener->protocol = mp_mqttsn;
|
||||
*/
|
||||
/*
|
||||
}else if(!strcmp(token, "mqttsn")){
|
||||
cur_listener->protocol = mp_mqttsn;
|
||||
*/
|
||||
}else if(!strcmp(token, "websockets")){
|
||||
#ifdef WITH_WEBSOCKETS
|
||||
cur_listener->protocol = mp_websockets;
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ int db__message_insert_outgoing(struct mosquitto *context, uint64_t cmsg_id, uin
|
|||
|
||||
|
||||
static inline int db__message_update_outgoing_state(struct mosquitto *context, struct mosquitto__client_msg *head,
|
||||
uint16_t mid, enum mosquitto_msg_state state, int qos, bool persist)
|
||||
uint16_t mid, enum mosquitto_msg_state state, int qos, bool persist)
|
||||
{
|
||||
struct mosquitto__client_msg *client_msg;
|
||||
|
||||
|
|
@ -1260,7 +1260,7 @@ void db__expire_all_messages(struct mosquitto *context)
|
|||
|
||||
|
||||
static void db__client_messages_check_acl(struct mosquitto *context, struct mosquitto_msg_data *msg_data, struct mosquitto__client_msg **head,
|
||||
void (*decrement_stats_fn)(struct mosquitto_msg_data *msg_data, struct mosquitto__client_msg *client_msg))
|
||||
void (*decrement_stats_fn)(struct mosquitto_msg_data *msg_data, struct mosquitto__client_msg *client_msg))
|
||||
{
|
||||
struct mosquitto__client_msg *client_msg, *tmp;
|
||||
struct mosquitto__base_msg *base_msg;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Contributors:
|
|||
# define HTTP_API_DIR ""
|
||||
#endif
|
||||
|
||||
struct metric{
|
||||
struct metric {
|
||||
int64_t current;
|
||||
int64_t next;
|
||||
const char *topic, *topic_alias;
|
||||
|
|
|
|||
|
|
@ -171,32 +171,32 @@ int mux_epoll__handle(void)
|
|||
db.now_real_s = time(NULL);
|
||||
|
||||
switch(event_count){
|
||||
case -1:
|
||||
if(errno != EINTR){
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error in epoll waiting: %s.", strerror(errno));
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
for(int i=0; i<event_count; i++){
|
||||
context = ep_events[i].data.ptr;
|
||||
if(context->ident == id_client){
|
||||
loop_handle_reads_writes(context, ep_events[i].events);
|
||||
}else if(context->ident == id_listener){
|
||||
listensock = ep_events[i].data.ptr;
|
||||
|
||||
if (ep_events[i].events & (EPOLLIN | EPOLLPRI)){
|
||||
while((context = net__socket_accept(listensock)) != NULL){
|
||||
}
|
||||
}
|
||||
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_LWS
|
||||
}else if(context->ident == id_listener_ws){
|
||||
/* Nothing needs to happen here, because we always call lws_service in the loop.
|
||||
* The important point is we've been woken up for this listener. */
|
||||
#endif
|
||||
case -1:
|
||||
if(errno != EINTR){
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error in epoll waiting: %s.", strerror(errno));
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
for(int i=0; i<event_count; i++){
|
||||
context = ep_events[i].data.ptr;
|
||||
if(context->ident == id_client){
|
||||
loop_handle_reads_writes(context, ep_events[i].events);
|
||||
}else if(context->ident == id_listener){
|
||||
listensock = ep_events[i].data.ptr;
|
||||
|
||||
if(ep_events[i].events & (EPOLLIN | EPOLLPRI)){
|
||||
while((context = net__socket_accept(listensock)) != NULL){
|
||||
}
|
||||
}
|
||||
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_LWS
|
||||
}else if(context->ident == id_listener_ws){
|
||||
/* Nothing needs to happen here, because we always call lws_service in the loop.
|
||||
* The important point is we've been woken up for this listener. */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,32 +174,32 @@ int mux_kqueue__handle(void)
|
|||
db.now_real_s = time(NULL);
|
||||
|
||||
switch(event_count){
|
||||
case -1:
|
||||
if(errno != EINTR){
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error in kqueue waiting: %s.", strerror(errno));
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
for(int i=0; i<event_count; i++){
|
||||
context = event_list[i].udata;
|
||||
if(context->ident == id_client){
|
||||
loop_handle_reads_writes(context, event_list[i].filter);
|
||||
}else if(context->ident == id_listener){
|
||||
listensock = event_list[i].udata;
|
||||
|
||||
if(event_list[i].filter == EVFILT_READ){
|
||||
while((context = net__socket_accept(listensock)) != NULL){
|
||||
}
|
||||
}
|
||||
#ifdef WITH_WEBSOCKETS
|
||||
}else if(context->ident == id_listener_ws){
|
||||
/* Nothing needs to happen here, because we always call lws_service in the loop.
|
||||
* The important point is we've been woken up for this listener. */
|
||||
#endif
|
||||
case -1:
|
||||
if(errno != EINTR){
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error in kqueue waiting: %s.", strerror(errno));
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
for(int i=0; i<event_count; i++){
|
||||
context = event_list[i].udata;
|
||||
if(context->ident == id_client){
|
||||
loop_handle_reads_writes(context, event_list[i].filter);
|
||||
}else if(context->ident == id_listener){
|
||||
listensock = event_list[i].udata;
|
||||
|
||||
if(event_list[i].filter == EVFILT_READ){
|
||||
while((context = net__socket_accept(listensock)) != NULL){
|
||||
}
|
||||
}
|
||||
#ifdef WITH_WEBSOCKETS
|
||||
}else if(context->ident == id_listener_ws){
|
||||
/* Nothing needs to happen here, because we always call lws_service in the loop.
|
||||
* The important point is we've been woken up for this listener. */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ static const char *get_event_name(enum mosquitto_plugin_event event)
|
|||
return "auth-start";
|
||||
case MOSQ_EVT_EXT_AUTH_CONTINUE:
|
||||
return "auth-continue";
|
||||
case MOSQ_EVT_CONTROL:
|
||||
case MOSQ_EVT_CONTROL:
|
||||
return "control";
|
||||
case MOSQ_EVT_MESSAGE_IN:
|
||||
return "message-in";
|
||||
|
|
@ -82,9 +82,9 @@ static const char *get_event_name(enum mosquitto_plugin_event event)
|
|||
return "persist-client-msg-delete";
|
||||
case MOSQ_EVT_PERSIST_CLIENT_MSG_UPDATE:
|
||||
return "persist-client-msg-update";
|
||||
case MOSQ_EVT_PERSIST_WILL_ADD:
|
||||
case MOSQ_EVT_PERSIST_WILL_ADD:
|
||||
return "persist-will-add";
|
||||
case MOSQ_EVT_PERSIST_WILL_DELETE:
|
||||
case MOSQ_EVT_PERSIST_WILL_DELETE:
|
||||
return "persist-will-delete";
|
||||
}
|
||||
return "";
|
||||
|
|
@ -162,9 +162,9 @@ static struct mosquitto__callback **plugin__get_callback_base(struct mosquitto__
|
|||
return &security_options->plugin_callbacks.persist_retain_msg_delete;
|
||||
case MOSQ_EVT_MESSAGE_OUT:
|
||||
return &security_options->plugin_callbacks.message_out;
|
||||
case MOSQ_EVT_PERSIST_WILL_ADD:
|
||||
case MOSQ_EVT_PERSIST_WILL_ADD:
|
||||
return &security_options->plugin_callbacks.persist_will_add;
|
||||
case MOSQ_EVT_PERSIST_WILL_DELETE:
|
||||
case MOSQ_EVT_PERSIST_WILL_DELETE:
|
||||
return &security_options->plugin_callbacks.persist_will_delete;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -44,32 +44,32 @@ struct proxy_hdr_v2 {
|
|||
uint16_t len; /* number of following bytes part of the header */
|
||||
};
|
||||
|
||||
union proxy_addr{
|
||||
struct{ /* for TCP/UDP over IPv4, len = 12 */
|
||||
union proxy_addr {
|
||||
struct { /* for TCP/UDP over IPv4, len = 12 */
|
||||
uint32_t src_addr;
|
||||
uint32_t dst_addr;
|
||||
uint16_t src_port;
|
||||
uint16_t dst_port;
|
||||
} ipv4_addr;
|
||||
struct{ /* for TCP/UDP over IPv6, len = 36 */
|
||||
struct { /* for TCP/UDP over IPv6, len = 36 */
|
||||
uint8_t src_addr[16];
|
||||
uint8_t dst_addr[16];
|
||||
uint16_t src_port;
|
||||
uint16_t dst_port;
|
||||
} ipv6_addr;
|
||||
struct{ /* for AF_UNIX sockets, len = 216 */
|
||||
struct { /* for AF_UNIX sockets, len = 216 */
|
||||
uint8_t src_addr[108];
|
||||
uint8_t dst_addr[108];
|
||||
} unix_addr;
|
||||
};
|
||||
|
||||
struct pp2_tlv{
|
||||
struct pp2_tlv {
|
||||
uint8_t type;
|
||||
uint8_t length_h;
|
||||
uint8_t length_l;
|
||||
};
|
||||
|
||||
struct pp2_tlv_ssl{
|
||||
struct pp2_tlv_ssl {
|
||||
uint8_t client;
|
||||
uint32_t verify;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ void __stdcall service_handler(DWORD fdwControl)
|
|||
/* Pause service. */
|
||||
break;
|
||||
case SERVICE_CONTROL_SHUTDOWN:
|
||||
/* System is shutting down. */
|
||||
/* System is shutting down. */
|
||||
case SERVICE_CONTROL_STOP:
|
||||
/* Service should stop. */
|
||||
service_status.dwCurrentState = SERVICE_STOP_PENDING;
|
||||
|
|
|
|||
|
|
@ -37,14 +37,14 @@ Contributors:
|
|||
#define METRIC_LOAD_5MIN 2
|
||||
#define METRIC_LOAD_15MIN 3
|
||||
|
||||
struct metric{
|
||||
struct metric {
|
||||
int64_t current;
|
||||
int64_t next;
|
||||
const char *topic, *topic_alias;
|
||||
bool is_max;
|
||||
};
|
||||
|
||||
struct metric_load{
|
||||
struct metric_load {
|
||||
double current;
|
||||
const char *topic;
|
||||
int load_ref;
|
||||
|
|
|
|||
|
|
@ -72,40 +72,40 @@ struct libws_http_data {
|
|||
static struct lws_protocols protocols[] = {
|
||||
/* first protocol must always be HTTP handler */
|
||||
{
|
||||
"http-only", /* name */
|
||||
callback_http, /* lws_callback_function */
|
||||
sizeof (struct libws_http_data), /* per_session_data_size */
|
||||
0, /* rx_buffer_size */
|
||||
0, /* id */
|
||||
NULL, /* user v1.4 on */
|
||||
WS_TX_BUF_SIZE /* tx_packet_size v2.3.0 */
|
||||
"http-only", /* name */
|
||||
callback_http, /* lws_callback_function */
|
||||
sizeof (struct libws_http_data), /* per_session_data_size */
|
||||
0, /* rx_buffer_size */
|
||||
0, /* id */
|
||||
NULL, /* user v1.4 on */
|
||||
WS_TX_BUF_SIZE /* tx_packet_size v2.3.0 */
|
||||
},
|
||||
{
|
||||
"mqtt",
|
||||
callback_mqtt,
|
||||
sizeof(struct libws_mqtt_data),
|
||||
0, /* rx_buffer_size */
|
||||
1, /* id */
|
||||
NULL, /* user v1.4 on */
|
||||
WS_TX_BUF_SIZE /* tx_packet_size v2.3.0 */
|
||||
0, /* rx_buffer_size */
|
||||
1, /* id */
|
||||
NULL, /* user v1.4 on */
|
||||
WS_TX_BUF_SIZE /* tx_packet_size v2.3.0 */
|
||||
},
|
||||
{
|
||||
"mqttv3.1",
|
||||
callback_mqtt,
|
||||
sizeof(struct libws_mqtt_data),
|
||||
0, /* rx_buffer_size */
|
||||
2, /* id */
|
||||
NULL, /* user v1.4 on */
|
||||
WS_TX_BUF_SIZE /* tx_packet_size v2.3.0 */
|
||||
0, /* rx_buffer_size */
|
||||
2, /* id */
|
||||
NULL, /* user v1.4 on */
|
||||
WS_TX_BUF_SIZE /* tx_packet_size v2.3.0 */
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0, /* rx_buffer_size */
|
||||
0, /* id */
|
||||
NULL, /* user v1.4 on */
|
||||
0 /* tx_packet_size v2.3.0 */
|
||||
0, /* rx_buffer_size */
|
||||
0, /* id */
|
||||
NULL, /* user v1.4 on */
|
||||
0 /* tx_packet_size v2.3.0 */
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
#include "read_handle.h"
|
||||
#include "send_mosq.h"
|
||||
|
||||
struct mosquitto_db{
|
||||
struct mosquitto_db {
|
||||
|
||||
};
|
||||
|
||||
struct mosquitto__base_msg{
|
||||
struct mosquitto__base_msg {
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
#include "read_handle.h"
|
||||
#include "send_mosq.h"
|
||||
|
||||
struct mosquitto_db{
|
||||
struct mosquitto_db {
|
||||
|
||||
};
|
||||
|
||||
struct mosquitto__base_msg{
|
||||
struct mosquitto__base_msg {
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "mosquitto.h"
|
||||
|
||||
struct prop_id{
|
||||
struct prop_id {
|
||||
const char *name;
|
||||
int proptype;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <mosquitto.h>
|
||||
|
||||
struct topic_test{
|
||||
struct topic_test {
|
||||
const char *topic_filter;
|
||||
const char *topic;
|
||||
const char *clientid;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
int tls_ex_index_mosq;
|
||||
|
||||
struct mosquitto_db{
|
||||
struct mosquitto_db {
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue