Minor build fixes.

This commit is contained in:
Roger Light 2021-03-21 09:17:53 +00:00
parent cca41d176d
commit 2de8c15bc9
41 changed files with 123 additions and 162 deletions

View File

@ -9,6 +9,10 @@ Clients:
- Set `receive-maximum` to not exceed the `-C` message count in mosquitto_sub
and mosquitto_rr, to avoid potentially lost messages. Closes #2134.
Build:
- A variety of minor build related fixes, like functions not having previous
declarations.
2.0.9 - 2021-03-11
==================

View File

@ -27,6 +27,7 @@ Contributors:
#include <sys/stat.h>
#include <time.h>
#include "db_dump.h"
#include <mosquitto_broker_internal.h>
#include <memory_mosq.h>
#include <persist.h>

View File

@ -19,6 +19,7 @@ Contributors:
#include <inttypes.h>
#include <stdio.h>
#include "db_dump.h"
#include <mosquitto_broker_internal.h>
#include <memory_mosq.h>
#include <mqtt_protocol.h>
@ -142,7 +143,7 @@ static void print__properties(mosquitto_property *properties)
}
void print__client(struct P_client *chunk, int length)
void print__client(struct P_client *chunk, uint32_t length)
{
printf("DB_CHUNK_CLIENT:\n");
printf("\tLength: %d\n", length);
@ -159,7 +160,7 @@ void print__client(struct P_client *chunk, int length)
}
void print__client_msg(struct P_client_msg *chunk, int length)
void print__client_msg(struct P_client_msg *chunk, uint32_t length)
{
printf("DB_CHUNK_CLIENT_MSG:\n");
printf("\tLength: %d\n", length);
@ -175,8 +176,10 @@ void print__client_msg(struct P_client_msg *chunk, int length)
}
void print__msg_store(struct P_msg_store *chunk, int length)
void print__msg_store(struct P_msg_store *chunk, uint32_t length)
{
uint8_t *payload;
printf("DB_CHUNK_MSG_STORE:\n");
printf("\tLength: %d\n", length);
printf("\tStore ID: %" PRIu64 "\n", chunk->F.store_id);
@ -190,8 +193,6 @@ void print__msg_store(struct P_msg_store *chunk, int length)
printf("\tPayload Length: %d\n", chunk->F.payloadlen);
printf("\tExpiry Time: %" PRIu64 "\n", chunk->F.expiry_time);
uint8_t *payload;
payload = chunk->payload;
if(chunk->F.payloadlen < 256){
/* Print payloads with UTF-8 data below an arbitrary limit of 256 bytes */

View File

@ -1,8 +1,10 @@
#include <stdlib.h>
#include <string.h>
#include "misc_mosq.h"
#include "mosquitto_broker_internal.h"
#include "mosquitto_internal.h"
#include "util_mosq.h"
struct mosquitto *context__init(mosq_sock_t sock)
{

View File

@ -12,7 +12,7 @@ LIBMOSQ:=../../lib/libmosquitto.a
endif
endif
LOCAL_CPPFLAGS:=-I../mosquitto_passwd
LOCAL_CPPFLAGS:=-I../mosquitto_passwd -DWITH_CJSON
OBJS= mosquitto_ctrl.o \
client.o \

View File

@ -689,7 +689,7 @@ static cJSON *init_create(const char *username, const char *password, const char
}
/* mosquitto_ctrl dynsec init <filename> <admin-user> <admin-password> [role-name] */
int dynsec_init(int argc, char *argv[])
static int dynsec_init(int argc, char *argv[])
{
char *filename;
char *admin_user;

View File

@ -28,7 +28,7 @@ Contributors:
#include "mosquitto.h"
#include "mosquitto_ctrl.h"
void print_version(void)
static void print_version(void)
{
int major, minor, revision;
@ -36,7 +36,7 @@ void print_version(void)
printf("mosquitto_ctrl version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
}
void print_usage(void)
static void print_usage(void)
{
printf("mosquitto_ctrl is a tool for administering certain Mosquitto features.\n");
print_version();
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
{
struct mosq_ctrl ctrl;
int rc = MOSQ_ERR_SUCCESS;
FUNC_ctrl_main ctrl_main = NULL;
FUNC_ctrl_main l_ctrl_main = NULL;
void *lib = NULL;
char lib_name[200];
@ -76,22 +76,22 @@ int main(int argc, char *argv[])
/* In built modules */
if(!strcasecmp(argv[0], "dynsec")){
ctrl_main = dynsec__main;
l_ctrl_main = dynsec__main;
}else{
/* Attempt external module */
snprintf(lib_name, sizeof(lib_name), "mosquitto_ctrl_%s.so", argv[0]);
lib = LIB_LOAD(lib_name);
if(lib){
ctrl_main = (FUNC_ctrl_main)LIB_SYM(lib, "ctrl_main");
l_ctrl_main = (FUNC_ctrl_main)LIB_SYM(lib, "ctrl_main");
}
}
if(ctrl_main == NULL){
if(l_ctrl_main == NULL){
fprintf(stderr, "Error: Module '%s' not supported.\n", argv[0]);
rc = MOSQ_ERR_NOT_SUPPORTED;
}
if(ctrl_main){
rc = ctrl_main(argc-1, &argv[1], &ctrl);
if(l_ctrl_main){
rc = l_ctrl_main(argc-1, &argv[1], &ctrl);
if(rc < 0){
/* Usage print */
rc = 0;

View File

@ -35,7 +35,9 @@ Contributors:
# include <sys/stat.h>
#endif
#define MAX_BUFFER_LEN 65536
#include "get_password.h"
#define MAX_BUFFER_LEN 65500
#define SALT_LEN 12
void get_password__reset_term(void)

View File

@ -52,7 +52,7 @@ Contributors:
# include <sys/stat.h>
#endif
#define MAX_BUFFER_LEN 65536
#define MAX_BUFFER_LEN 65500
#define SALT_LEN 12
#include "misc_mosq.h"
@ -107,7 +107,7 @@ static FILE *mpw_tmpfile(void)
#endif
void print_usage(void)
static void print_usage(void)
{
printf("mosquitto_passwd is a tool for managing password files for mosquitto.\n\n");
printf("Usage: mosquitto_passwd [-H sha512 | -H sha512-pbkdf2] [-c | -D] passwordfile username\n");
@ -122,7 +122,7 @@ void print_usage(void)
printf("\nSee https://mosquitto.org/ for more information.\n\n");
}
int output_new_password(FILE *fptr, const char *username, const char *password, int iterations)
static int output_new_password(FILE *fptr, const char *username, const char *password, int iterations)
{
int rc;
char *salt64 = NULL, *hash64 = NULL;
@ -255,7 +255,7 @@ static int delete_pwuser_cb(FILE *fptr, FILE *ftmp, const char *username, const
return 0;
}
int delete_pwuser(FILE *fptr, FILE *ftmp, const char *username)
static int delete_pwuser(FILE *fptr, FILE *ftmp, const char *username)
{
struct cb_helper helper;
int rc;
@ -288,7 +288,7 @@ static int update_file_cb(FILE *fptr, FILE *ftmp, const char *username, const ch
}
}
int update_file(FILE *fptr, FILE *ftmp)
static int update_file(FILE *fptr, FILE *ftmp)
{
return pwfile_iterate(fptr, ftmp, update_file_cb, NULL);
}
@ -315,7 +315,7 @@ static int update_pwuser_cb(FILE *fptr, FILE *ftmp, const char *username, const
return rc;
}
int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *password, int iterations)
static int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *password, int iterations)
{
struct cb_helper helper;
int rc;
@ -334,7 +334,7 @@ int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *pass
}
int copy_contents(FILE *src, FILE *dest)
static int copy_contents(FILE *src, FILE *dest)
{
char buf[MAX_BUFFER_LEN];
size_t len;
@ -361,7 +361,7 @@ int copy_contents(FILE *src, FILE *dest)
return 0;
}
int create_backup(const char *backup_file, FILE *fptr)
static int create_backup(const char *backup_file, FILE *fptr)
{
FILE *fbackup;
@ -380,7 +380,7 @@ int create_backup(const char *backup_file, FILE *fptr)
return 0;
}
void handle_sigint(int signal)
static void handle_sigint(int signal)
{
get_password__reset_term();

View File

@ -183,7 +183,7 @@ static int check_format(const char *str)
}
void init_config(struct mosq_config *cfg, int pub_or_sub)
static void init_config(struct mosq_config *cfg, int pub_or_sub)
{
memset(cfg, 0, sizeof(*cfg));
cfg->port = PORT_UNDEFINED;
@ -485,7 +485,7 @@ int client_config_load(struct mosq_config *cfg, int pub_or_sub, int argc, char *
return MOSQ_ERR_SUCCESS;
}
int cfg_add_topic(struct mosq_config *cfg, int type, char *topic, const char *arg)
static int cfg_add_topic(struct mosq_config *cfg, int type, char *topic, const char *arg)
{
if(mosquitto_validate_utf8(topic, (int )strlen(topic))){
fprintf(stderr, "Error: Malformed UTF-8 in %s argument.\n\n", arg);

View File

@ -232,7 +232,7 @@ int pub_shared_init(void)
}
int pub_stdin_line_loop(struct mosquitto *mosq)
static int pub_stdin_line_loop(struct mosquitto *mosq)
{
char *buf2;
int buf_len_actual = 0;
@ -334,7 +334,7 @@ int pub_stdin_line_loop(struct mosquitto *mosq)
}
int pub_other_loop(struct mosquitto *mosq)
static int pub_other_loop(struct mosquitto *mosq)
{
int rc;
int loop_delay = 1000;
@ -387,7 +387,7 @@ void pub_shared_cleanup(void)
}
void print_version(void)
static void print_version(void)
{
int major, minor, revision;
@ -395,7 +395,7 @@ void print_version(void)
printf("mosquitto_pub version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
}
void print_usage(void)
static void print_usage(void)
{
int major, minor, revision;

View File

@ -50,8 +50,6 @@ enum rr__state {
static enum rr__state client_state = rr_s_new;
extern struct mosq_config cfg;
bool process_messages = true;
int msg_count = 0;
struct mosquitto *g_mosq = NULL;
@ -59,7 +57,7 @@ static bool timed_out = false;
static int connack_result = 0;
#ifndef WIN32
void my_signal_handler(int signum)
static void my_signal_handler(int signum)
{
if(signum == SIGALRM){
process_messages = false;
@ -80,7 +78,7 @@ int my_publish(struct mosquitto *mosq, int *mid, const char *topic, int payloadl
}
void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message, const mosquitto_property *properties)
static void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message, const mosquitto_property *properties)
{
UNUSED(mosq);
UNUSED(obj);
@ -151,7 +149,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
}
void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
static void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
{
UNUSED(obj);
UNUSED(mid);
@ -179,7 +177,7 @@ void my_publish_callback(struct mosquitto *mosq, void *obj, int mid, int reason_
}
void print_version(void)
static void print_version(void)
{
int major, minor, revision;
@ -187,7 +185,7 @@ void print_version(void)
printf("mosquitto_rr version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
}
void print_usage(void)
static void print_usage(void)
{
int major, minor, revision;

View File

@ -48,7 +48,7 @@ static int connack_result = 0;
bool connack_received = false;
#ifndef WIN32
void my_signal_handler(int signum)
static void my_signal_handler(int signum)
{
if(signum == SIGALRM || signum == SIGTERM || signum == SIGINT){
if(connack_received){
@ -65,19 +65,7 @@ void my_signal_handler(int signum)
#endif
void my_publish_callback(struct mosquitto *mosq, void *obj, int mid, int reason_code, const mosquitto_property *properties)
{
UNUSED(obj);
UNUSED(reason_code);
UNUSED(properties);
if(process_messages == false && (mid == last_mid || last_mid == 0)){
mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props);
}
}
void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message, const mosquitto_property *properties)
static void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message, const mosquitto_property *properties)
{
int i;
bool res;
@ -120,7 +108,7 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit
}
}
void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flags, const mosquitto_property *properties)
static void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flags, const mosquitto_property *properties)
{
int i;
@ -153,7 +141,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
}
}
void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
static void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
{
int i;
bool some_sub_allowed = (granted_qos[0] < 128);
@ -177,7 +165,7 @@ void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_c
}
}
void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *str)
static void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *str)
{
UNUSED(mosq);
UNUSED(obj);
@ -186,7 +174,7 @@ void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *s
printf("%s\n", str);
}
void print_version(void)
static void print_version(void)
{
int major, minor, revision;
@ -194,7 +182,7 @@ void print_version(void)
printf("mosquitto_sub version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
}
void print_usage(void)
static void print_usage(void)
{
int major, minor, revision;

View File

@ -148,7 +148,7 @@ ifeq ($(UNAME),SunOS)
CFLAGS?=-Wall -ggdb -O2
endif
else
CFLAGS?=-Wall -ggdb -O2 -Wconversion
CFLAGS?=-Wall -ggdb -O2 -Wconversion -Wextra
endif
STATIC_LIB_DEPS:=

View File

@ -26,6 +26,7 @@ Contributors:
#include "mqtt_protocol.h"
#include "packet_mosq.h"
#include "property_mosq.h"
#include "read_handle.h"
int handle__auth(struct mosquitto *mosq)

View File

@ -27,6 +27,7 @@ Contributors:
#include "net_mosq.h"
#include "packet_mosq.h"
#include "property_mosq.h"
#include "read_handle.h"
#include "send_mosq.h"
#include "util_mosq.h"

View File

@ -29,6 +29,7 @@ Contributors:
#include "messages_mosq.h"
#include "packet_mosq.h"
#include "property_mosq.h"
#include "read_handle.h"
#include "send_mosq.h"
#include "time_mosq.h"
#include "util_mosq.h"

View File

@ -31,6 +31,7 @@ Contributors:
#include "mqtt_protocol.h"
#include "packet_mosq.h"
#include "property_mosq.h"
#include "read_handle.h"
#include "util_mosq.h"

View File

@ -36,6 +36,8 @@ Contributors:
# include <sys/stat.h>
#endif
#include "misc_mosq.h"
FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
{

View File

@ -19,6 +19,7 @@ Contributors:
#define MISC_MOSQ_H
#include <stdbool.h>
#include <stdio.h>
FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read);
char *misc__trimblanks(char *str);

View File

@ -64,10 +64,11 @@ int mosquitto__verify_ocsp_status_cb(SSL * ssl, void *arg)
OCSP_BASICRESP *br = NULL;
X509_STORE *st = NULL;
STACK_OF(X509) *ch = NULL;
long len;
UNUSED(ssl);
long len = SSL_get_tlsext_status_ocsp_resp(mosq->ssl, &p);
len = SSL_get_tlsext_status_ocsp_resp(mosq->ssl, &p);
log__printf(mosq, MOSQ_LOG_DEBUG, "OCSP: SSL_get_tlsext_status_ocsp_resp returned %ld bytes", len);
/* the following functions expect a const pointer */

View File

@ -33,7 +33,7 @@ Contributors:
#include "property_mosq.h"
int property__read(struct mosquitto__packet *packet, uint32_t *len, mosquitto_property *property)
static int property__read(struct mosquitto__packet *packet, uint32_t *len, mosquitto_property *property)
{
int rc;
uint32_t property_identifier;
@ -355,7 +355,7 @@ unsigned int property__get_remaining_length(const mosquitto_property *props)
}
int property__write(struct mosquitto__packet *packet, const mosquitto_property *property)
static int property__write(struct mosquitto__packet *packet, const mosquitto_property *property)
{
int rc;
@ -975,7 +975,7 @@ int mosquitto_property_check_all(int command, const mosquitto_property *properti
return MOSQ_ERR_SUCCESS;
}
const mosquitto_property *property__get_property(const mosquitto_property *proplist, int identifier, bool skip_first)
static const mosquitto_property *property__get_property(const mosquitto_property *proplist, int identifier, bool skip_first)
{
const mosquitto_property *p;
bool is_first = true;

View File

@ -32,6 +32,7 @@ Contributors:
#include "mqtt_protocol.h"
#include "packet_mosq.h"
#include "property_mosq.h"
#include "send_mosq.h"
int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session, const mosquitto_property *properties)
{

View File

@ -32,10 +32,11 @@ Contributors:
#include "mqtt_protocol.h"
#include "packet_mosq.h"
#include "property_mosq.h"
#include "send_mosq.h"
#include "util_mosq.h"
int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, const char **topic, int topic_qos, const mosquitto_property *properties)
int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, char *const *const topic, int topic_qos, const mosquitto_property *properties)
{
struct mosquitto__packet *packet = NULL;
uint32_t packetlen;

View File

@ -23,7 +23,7 @@ Contributors:
#include <limits.h>
#ifdef WIN32
# include <ws2tcpip.h>
#elif __QNX__
#elif defined(__QNX__)
# include <sys/socket.h>
# include <arpa/inet.h>
# include <netinet/in.h>
@ -40,6 +40,7 @@ Contributors:
#include "net_mosq.h"
#include "packet_mosq.h"
#include "send_mosq.h"
#include "socks_mosq.h"
#include "util_mosq.h"
#define SOCKS_AUTH_NONE 0x00U

View File

@ -84,7 +84,7 @@ int mosquitto__server_certificate_verify(int preverify_ok, X509_STORE_CTX *ctx)
}
}
int mosquitto__cmp_hostname_wildcard(char *certname, const char *hostname)
static int mosquitto__cmp_hostname_wildcard(char *certname, const char *hostname)
{
size_t i;
size_t len;

View File

@ -32,7 +32,7 @@ Contributors:
*
* Note that this only works on Mosquitto 2.0 or later.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
@ -49,6 +49,9 @@ static int basic_auth_callback(int event, void *event_data, void *userdata)
struct mosquitto_evt_basic_auth *ed = event_data;
const char *ip_address;
UNUSED(event);
UNUSED(userdata);
ip_address = mosquitto_client_address(ed->client);
if(!strcmp(ip_address, "127.0.0.1")){
/* Only allow connections from localhost */
@ -72,11 +75,19 @@ int mosquitto_plugin_version(int supported_version_count, const int *supported_v
int mosquitto_plugin_init(mosquitto_plugin_id_t *identifier, void **user_data, struct mosquitto_opt *opts, int opt_count)
{
UNUSED(user_data);
UNUSED(opts);
UNUSED(opt_count);
mosq_pid = identifier;
return mosquitto_callback_register(mosq_pid, MOSQ_EVT_BASIC_AUTH, basic_auth_callback, NULL, NULL);
}
int mosquitto_plugin_cleanup(void *user_data, struct mosquitto_opt *opts, int opt_count)
{
UNUSED(user_data);
UNUSED(opts);
UNUSED(opt_count);
return mosquitto_callback_unregister(mosq_pid, MOSQ_EVT_BASIC_AUTH, basic_auth_callback, NULL);
}

View File

@ -527,7 +527,7 @@ int config__parse_args(struct mosquitto__config *config, int argc, char *argv[])
return config__check(config);
}
void config__copy(struct mosquitto__config *src, struct mosquitto__config *dest)
static void config__copy(struct mosquitto__config *src, struct mosquitto__config *dest)
{
mosquitto__free(dest->security_options.acl_file);
dest->security_options.acl_file = src->security_options.acl_file;
@ -721,7 +721,7 @@ int config__read(struct mosquitto__config *config, bool reload)
}
int config__read_file_core(struct mosquitto__config *config, bool reload, struct config_recurse *cr, int level, int *lineno, FILE *fptr, char **buf, int *buflen)
static int config__read_file_core(struct mosquitto__config *config, bool reload, struct config_recurse *cr, int level, int *lineno, FILE *fptr, char **buf, int *buflen)
{
int rc;
char *token;

View File

@ -50,7 +50,7 @@ Contributors:
#include "mqtt_protocol.h"
int scmp_p(const void *p1, const void *p2)
static int scmp_p(const void *p1, const void *p2)
{
const char *s1 = *(const char **)p1;
const char *s2 = *(const char **)p2;

View File

@ -580,7 +580,7 @@ int db__message_update_outgoing(struct mosquitto *context, uint16_t mid, enum mo
}
void db__messages_delete_list(struct mosquitto_client_msg **head)
static void db__messages_delete_list(struct mosquitto_client_msg **head)
{
struct mosquitto_client_msg *tail, *tmp;
@ -624,7 +624,7 @@ int db__messages_delete(struct mosquitto *context, bool force_free)
int db__messages_easy_queue(struct mosquitto *context, const char *topic, uint8_t qos, uint32_t payloadlen, const void *payload, int retain, uint32_t message_expiry_interval, mosquitto_property **properties)
{
struct mosquitto_msg_store *stored;
char *source_id;
const char *source_id;
enum mosquitto_msg_origin origin;
if(!topic) return MOSQ_ERR_INVAL;
@ -752,7 +752,7 @@ int db__message_store_find(struct mosquitto *context, uint16_t mid, struct mosqu
/* Called on reconnect to set outgoing messages to a sensible state and force a
* retry, and to set incoming messages to expect an appropriate retry. */
int db__message_reconnect_reset_outgoing(struct mosquitto *context)
static int db__message_reconnect_reset_outgoing(struct mosquitto *context)
{
struct mosquitto_client_msg *msg, *tmp;
@ -821,7 +821,7 @@ int db__message_reconnect_reset_outgoing(struct mosquitto *context)
/* Called on reconnect to set incoming messages to expect an appropriate retry. */
int db__message_reconnect_reset_incoming(struct mosquitto *context)
static int db__message_reconnect_reset_incoming(struct mosquitto *context)
{
struct mosquitto_client_msg *msg, *tmp;
@ -975,63 +975,6 @@ int db__message_release_incoming(struct mosquitto *context, uint16_t mid)
}
}
int db__message_write_inflight_in(struct mosquitto *context)
{
struct mosquitto_client_msg *tail, *tmp;
int rc;
if(context->state != mosq_cs_active){
return MOSQ_ERR_SUCCESS;
}
DL_FOREACH_SAFE(context->msgs_in.inflight, tail, tmp){
if(tail->store->message_expiry_time){
if(db.now_real_s > tail->store->message_expiry_time){
/* Message is expired, must not send. */
db__message_remove(&context->msgs_in, tail);
if(tail->qos > 0){
util__increment_receive_quota(context);
}
continue;
}
}
switch(tail->state){
case mosq_ms_send_pubrec:
rc = send__pubrec(context, tail->mid, 0, NULL);
if(!rc){
tail->state = mosq_ms_wait_for_pubrel;
}else{
return rc;
}
break;
case mosq_ms_resend_pubcomp:
rc = send__pubcomp(context, tail->mid, NULL);
if(!rc){
tail->state = mosq_ms_wait_for_pubrel;
}else{
return rc;
}
break;
case mosq_ms_invalid:
case mosq_ms_publish_qos0:
case mosq_ms_publish_qos1:
case mosq_ms_publish_qos2:
case mosq_ms_resend_pubrel:
case mosq_ms_wait_for_puback:
case mosq_ms_wait_for_pubrec:
case mosq_ms_wait_for_pubrel:
case mosq_ms_wait_for_pubcomp:
case mosq_ms_queued:
break;
}
}
return MOSQ_ERR_SUCCESS;
}
static int db__message_write_inflight_out_single(struct mosquitto *context, struct mosquitto_client_msg *msg)
{
mosquitto_property *cmsg_props = NULL, *store_props = NULL;

View File

@ -83,7 +83,7 @@ static char *client_id_gen(uint16_t *idlen, const char *auto_id_prefix, uint16_t
/* Remove any queued messages that are no longer allowed through ACL,
* assuming a possible change of username. */
void connection_check_acl(struct mosquitto *context, struct mosquitto_client_msg **head)
static void connection_check_acl(struct mosquitto *context, struct mosquitto_client_msg **head)
{
struct mosquitto_client_msg *msg_tail, *tmp;

View File

@ -187,7 +187,7 @@ DltLogLevelType get_dlt_level(unsigned int priority)
}
#endif
int log__vprintf(unsigned int priority, const char *fmt, va_list va)
static int log__vprintf(unsigned int priority, const char *fmt, va_list va)
{
const char *topic;
int syslog_priority;

View File

@ -133,7 +133,7 @@ static void read_message_expiry_interval(mosquitto_property **proplist, uint32_t
}
}
void queue_plugin_msgs(void)
static void queue_plugin_msgs(void)
{
struct mosquitto_message_v5 *msg, *tmp;
struct mosquitto *context;
@ -279,7 +279,7 @@ int mosquitto_main_loop(struct mosquitto__listener_sock *listensock, int listens
void do_disconnect(struct mosquitto *context, int reason)
{
char *id;
const char *id;
#ifdef WITH_WEBSOCKETS
bool is_duplicate = false;
#endif

View File

@ -74,13 +74,6 @@ int allow_severity = LOG_INFO;
int deny_severity = LOG_INFO;
#endif
void handle_sigint(int signal);
void handle_sigusr1(int signal);
void handle_sigusr2(int signal);
#ifdef SIGHUP
void handle_sighup(int signal);
#endif
/* mosquitto shouldn't run as root.
* This function will attempt to change to an unprivileged user and group if
* running as root. The user is given in config->user.
@ -146,7 +139,7 @@ int drop_privileges(struct mosquitto__config *config)
return MOSQ_ERR_SUCCESS;
}
void mosquitto__daemonise(void)
static void mosquitto__daemonise(void)
{
#ifndef WIN32
char *err;
@ -208,7 +201,7 @@ void listeners__reload_all_certificates(void)
}
int listeners__start_single_mqtt(struct mosquitto__listener *listener)
static int listeners__start_single_mqtt(struct mosquitto__listener *listener)
{
int i;
struct mosquitto__listener_sock *listensock_new;
@ -275,7 +268,7 @@ void listeners__add_websockets(struct lws_context *ws_context, mosq_sock_t fd)
}
#endif
int listeners__add_local(const char *host, uint16_t port)
static int listeners__add_local(const char *host, uint16_t port)
{
struct mosquitto__listener *listeners;
listeners = db.config->listeners;
@ -296,7 +289,7 @@ int listeners__add_local(const char *host, uint16_t port)
return MOSQ_ERR_SUCCESS;
}
int listeners__start_local_only(void)
static int listeners__start_local_only(void)
{
/* Attempt to open listeners bound to 127.0.0.1 and ::1 only */
int i;
@ -336,7 +329,7 @@ int listeners__start_local_only(void)
}
int listeners__start(void)
static int listeners__start(void)
{
int i;
@ -380,7 +373,7 @@ int listeners__start(void)
}
void listeners__stop(void)
static void listeners__stop(void)
{
int i;
@ -407,7 +400,7 @@ void listeners__stop(void)
}
void signal__setup(void)
static void signal__setup(void)
{
signal(SIGINT, handle_sigint);
signal(SIGTERM, handle_sigint);
@ -425,7 +418,7 @@ void signal__setup(void)
}
int pid__write(void)
static int pid__write(void)
{
FILE *pid;

View File

@ -819,6 +819,16 @@ void session_expiry__remove_all(void);
void session_expiry__check(void);
void session_expiry__send_all(void);
/* ============================================================
* Signals
* ============================================================ */
void handle_sigint(int signal);
void handle_sigusr1(int signal);
void handle_sigusr2(int signal);
#ifdef SIGHUP
void handle_sighup(int signal);
#endif
/* ============================================================
* Window service and signal related functions
* ============================================================ */
@ -855,4 +865,3 @@ void xtreport(void);
#endif
#endif

View File

@ -106,12 +106,6 @@ int mux_epoll__init(struct mosquitto__listener_sock *listensock, int listensock_
return MOSQ_ERR_SUCCESS;
}
int mux_epoll__loop_setup(void)
{
return MOSQ_ERR_SUCCESS;
}
int mux_epoll__add_out(struct mosquitto *context)
{
struct epoll_event ev;

View File

@ -427,7 +427,7 @@ int net__tls_server_ctx(struct mosquitto__listener *listener)
#endif
int net__load_crl_file(struct mosquitto__listener *listener)
static int net__load_crl_file(struct mosquitto__listener *listener)
{
#ifdef WITH_TLS
X509_STORE *store;

View File

@ -19,6 +19,8 @@ Contributors:
#ifndef PERSIST_H
#define PERSIST_H
#include "mosquitto_broker_internal.h"
#define MOSQ_DB_VERSION 6
/* DB read/write */

View File

@ -47,7 +47,7 @@ void LIB_ERROR(void)
}
int security__load_v2(struct mosquitto__auth_plugin *plugin, struct mosquitto_auth_opt *auth_options, int auth_option_count, void *lib)
static int security__load_v2(struct mosquitto__auth_plugin *plugin, struct mosquitto_auth_opt *auth_options, int auth_option_count, void *lib)
{
int rc;
@ -121,7 +121,7 @@ int security__load_v2(struct mosquitto__auth_plugin *plugin, struct mosquitto_au
}
int security__load_v3(struct mosquitto__auth_plugin *plugin, struct mosquitto_opt *auth_options, int auth_option_count, void *lib)
static int security__load_v3(struct mosquitto__auth_plugin *plugin, struct mosquitto_opt *auth_options, int auth_option_count, void *lib)
{
int rc;
@ -194,7 +194,7 @@ int security__load_v3(struct mosquitto__auth_plugin *plugin, struct mosquitto_op
}
int security__load_v4(struct mosquitto__auth_plugin *plugin, struct mosquitto_opt *auth_options, int auth_option_count, void *lib)
static int security__load_v4(struct mosquitto__auth_plugin *plugin, struct mosquitto_opt *auth_options, int auth_option_count, void *lib)
{
int rc;

View File

@ -202,7 +202,7 @@ int mosquitto_security_cleanup_default(bool reload)
}
int add__acl(struct mosquitto__security_options *security_opts, const char *user, const char *topic, int access)
static int add__acl(struct mosquitto__security_options *security_opts, const char *user, const char *topic, int access)
{
struct mosquitto__acl_user *acl_user=NULL, *user_tail;
struct mosquitto__acl *acl, *acl_tail;
@ -298,7 +298,7 @@ int add__acl(struct mosquitto__security_options *security_opts, const char *user
return MOSQ_ERR_SUCCESS;
}
int add__acl_pattern(struct mosquitto__security_options *security_opts, const char *topic, int access)
static int add__acl_pattern(struct mosquitto__security_options *security_opts, const char *topic, int access)
{
struct mosquitto__acl *acl, *acl_tail;
char *local_topic;

View File

@ -29,6 +29,8 @@ Contributors:
#include <stdbool.h>
#include <signal.h>
#include "mosquitto_broker_internal.h"
#ifdef WITH_PERSISTENCE
extern bool flag_db_backup;
#endif