Formatting: Double space before functions.

This commit is contained in:
Roger A. Light
2025-09-14 22:08:07 +01:00
parent a9fe4037ea
commit 67ad22df0a
328 changed files with 1806 additions and 26 deletions

View File

@@ -87,6 +87,7 @@ static void free__sub(struct P_sub *chunk)
free(chunk->topic);
}
static void free__client(struct P_client *chunk)
{
free(chunk->username);
@@ -431,8 +432,12 @@ static void cleanup_msg_store()
}
#ifdef WITH_FUZZING
int db_dump_fuzz_main(int argc, char *argv[])
#else
int main(int argc, char *argv[])
#endif
{

View File

@@ -47,6 +47,7 @@ cJSON *j_client_msgs = NULL;
cJSON *j_retained_msgs = NULL;
cJSON *j_subscriptions = NULL;
void json_init(void)
{
j_tree = cJSON_CreateObject();
@@ -67,6 +68,7 @@ void json_init(void)
}
}
void json_print(void)
{
char *jstr = cJSON_Print(j_tree);
@@ -74,11 +76,13 @@ void json_print(void)
free(jstr);
}
void json_cleanup(void)
{
cJSON_Delete(j_tree);
}
void json_add_base_msg(struct P_base_msg *chunk)
{
cJSON *j_base_msg = NULL;
@@ -114,6 +118,7 @@ void json_add_base_msg(struct P_base_msg *chunk)
}
}
void json_add_client(struct P_client *chunk)
{
cJSON *j_client;
@@ -132,6 +137,7 @@ void json_add_client(struct P_client *chunk)
}
void json_add_client_msg(struct P_client_msg *chunk)
{
cJSON *j_client_msg;
@@ -149,6 +155,7 @@ void json_add_client_msg(struct P_client_msg *chunk)
cJSON_AddNumberToObject(j_client_msg, "subscription-identifier", chunk->subscription_identifier);
}
void json_add_subscription(struct P_sub *chunk)
{
cJSON *j_subscription;
@@ -163,6 +170,7 @@ void json_add_subscription(struct P_sub *chunk)
cJSON_AddNumberToObject(j_subscription, "identifier", chunk->F.identifier);
}
void json_add_retained_msg(struct P_retain *chunk)
{
cJSON *j_retained_msg;

View File

@@ -28,6 +28,7 @@ Contributors:
#include "mosquitto_ctrl.h"
#include "mosquitto.h"
void broker__print_usage(void)
{
printf("\nBroker Control module\n");
@@ -37,12 +38,14 @@ void broker__print_usage(void)
printf("List listeners : listListeners\n");
}
/* ################################################################
* #
* # Payload callback
* #
* ################################################################ */
static void print_listeners(cJSON *j_response)
{
cJSON *j_data, *j_listeners, *j_listener, *jtmp;
@@ -189,6 +192,7 @@ static void broker__payload_callback(struct mosq_ctrl *ctrl, long payloadlen, co
cJSON_Delete(tree);
}
static int broker__list_plugins(int argc, char *argv[], cJSON *j_command)
{
UNUSED(argc);
@@ -203,6 +207,7 @@ static int broker__list_plugins(int argc, char *argv[], cJSON *j_command)
return MOSQ_ERR_SUCCESS;
}
static int broker__list_listeners(int argc, char *argv[], cJSON *j_command)
{
UNUSED(argc);
@@ -217,12 +222,14 @@ static int broker__list_listeners(int argc, char *argv[], cJSON *j_command)
return MOSQ_ERR_SUCCESS;
}
/* ################################################################
* #
* # Main
* #
* ################################################################ */
int broker__main(int argc, char *argv[], struct mosq_ctrl *ctrl)
{
int rc = -1;

View File

@@ -32,6 +32,7 @@ Contributors:
static int run = 1;
static void on_message(struct mosquitto *mosq, void *obj, const struct mosquitto_message *msg, const mosquitto_property *properties)
{
struct mosq_ctrl *ctrl = obj;

View File

@@ -87,12 +87,14 @@ struct ctrl_shell data;
static int generator_arg = -1;
struct completion_tree_cmd *current_cmd_match = NULL;
static void signal_winch(int signal)
{
UNUSED(signal);
rl_resize_terminal();
}
static void signal_term(int signal)
{
UNUSED(signal);
@@ -113,16 +115,19 @@ static void term_set_flag(bool set, unsigned int flag)
tcsetattr(0, TCSANOW, &ts);
}
static void term_set_echo(bool echo)
{
term_set_flag(echo, ECHO);
}
static void term_set_canon(bool canon)
{
term_set_flag(canon, ICANON);
}
void ctrl_shell_rtrim(char *buf)
{
size_t slen = strlen(buf);
@@ -205,6 +210,7 @@ int ctrl_shell_publish_blocking(cJSON *j_command)
return rc;
}
void ctrl_shell__connect_blocking(const char *hostname, int port)
{
pthread_mutex_lock(&data.response_mutex);
@@ -219,11 +225,13 @@ void ctrl_shell__connect_blocking(const char *hostname, int port)
pthread_mutex_unlock(&data.response_mutex);
}
void ctrl_shell_line_callback_set(void (*callback)(char *line))
{
data.line_callback = callback;
}
int ctrl_shell_command_generic_arg0(const char *command)
{
cJSON *j_command = cJSON_CreateObject();
@@ -232,6 +240,7 @@ int ctrl_shell_command_generic_arg0(const char *command)
return ctrl_shell_publish_blocking(j_command);
}
int ctrl_shell_command_generic_arg1(const char *command, const char *itemlabel, char **saveptr)
{
const char *item;
@@ -249,6 +258,7 @@ int ctrl_shell_command_generic_arg1(const char *command, const char *itemlabel,
return ctrl_shell_publish_blocking(j_command);
}
int ctrl_shell_command_generic_int_arg1(const char *command, const char *itemlabel, char **saveptr)
{
const char *item;
@@ -267,6 +277,7 @@ int ctrl_shell_command_generic_int_arg1(const char *command, const char *itemlab
return ctrl_shell_publish_blocking(j_command);
}
int ctrl_shell_command_generic_arg2(const char *command, const char *itemlabel1, const char *itemlabel2, char **saveptr)
{
const char *item1, *item2;
@@ -286,6 +297,7 @@ int ctrl_shell_command_generic_arg2(const char *command, const char *itemlabel1,
return ctrl_shell_publish_blocking(j_command);
}
static int ctrl_shell__subscribe_blocking(const char *topic, void (*module_on_subscribe)(void))
{
int rc = 0;
@@ -452,6 +464,7 @@ char **completion_matcher(const char *text, int start, int end)
return matches;
}
int my_get_address(int sock, char *buf, size_t len, uint16_t *remote_port)
{
struct sockaddr_storage addr;
@@ -485,6 +498,7 @@ int my_get_address(int sock, char *buf, size_t len, uint16_t *remote_port)
return 1;
}
static void on_connect_reconnect(struct mosquitto *mosq, void *userdata, int rc)
{
UNUSED(userdata);
@@ -501,6 +515,7 @@ static void on_connect_reconnect(struct mosquitto *mosq, void *userdata, int rc)
ctrl_shell_printf("%s\n", buf);
}
void ctrl_shell__on_connect(struct mosquitto *mosq, void *userdata, int rc)
{
UNUSED(userdata);
@@ -514,6 +529,7 @@ void ctrl_shell__on_connect(struct mosquitto *mosq, void *userdata, int rc)
pthread_cond_signal(&data.response_cond);
}
void ctrl_shell__on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *msg)
{
UNUSED(mosq);
@@ -541,6 +557,7 @@ void ctrl_shell__on_message(struct mosquitto *mosq, void *userdata, const struct
pthread_cond_signal(&data.response_cond);
}
void ctrl_shell__on_publish(struct mosquitto *mosq, void *userdata, int mid, int reason_code, const mosquitto_property *props)
{
UNUSED(mosq);
@@ -558,6 +575,7 @@ void ctrl_shell__on_publish(struct mosquitto *mosq, void *userdata, int mid, int
pthread_cond_signal(&data.response_cond);
}
void ctrl_shell__on_subscribe(struct mosquitto *mosq, void *userdata, int mid, int qos_count, const int *granted_qos)
{
UNUSED(mosq);
@@ -574,6 +592,7 @@ void ctrl_shell__on_subscribe(struct mosquitto *mosq, void *userdata, int mid, i
pthread_cond_signal(&data.response_cond);
}
void ctrl_shell__load_module(void (*mod_init)(struct ctrl_shell__module *mod))
{
struct ctrl_shell__module mod;
@@ -603,6 +622,7 @@ void set_no_colour(void)
ANSI_NEGATIVE = "";
}
static void set_bg_light(void)
{
ANSI_URL = ANSI_URL_light;
@@ -615,6 +635,7 @@ static void set_bg_light(void)
ANSI_NEGATIVE = ANSI_NEGATIVE_light;
}
static void set_bg_dark(void)
{
ANSI_URL = ANSI_URL_dark;
@@ -706,6 +727,7 @@ void ctrl_shell__cleanup(void)
FREE(data.tls_keyfile);
}
void ctrl_shell__main(struct mosq_config *config)
{
memset(&data, 0, sizeof(data));
@@ -790,6 +812,7 @@ void ctrl_shell__main(struct mosq_config *config)
ctrl_shell__cleanup();
}
static void print_label(unsigned int level, const char *label)
{
char *str = calloc(1, level*2 + strlen(label) + 30);
@@ -808,12 +831,14 @@ static void print_label(unsigned int level, const char *label)
free(str);
}
void ctrl_shell_print_label(unsigned int level, const char *label)
{
print_label(level, label);
ctrl_shell_printf("\n");
}
void ctrl_shell_print_label_value(unsigned int level, const char *label, int align, const char *fmt, ...)
{
va_list va;
@@ -834,6 +859,7 @@ void ctrl_shell_print_label_value(unsigned int level, const char *label, int ali
free(str);
}
void ctrl_shell_print_value(unsigned int level, const char *fmt, ...)
{
va_list va;
@@ -849,11 +875,13 @@ void ctrl_shell_print_value(unsigned int level, const char *fmt, ...)
free(str);
}
void ctrl_shell_print_help_command(const char *cmd)
{
ctrl_shell_printf("%s%s%s\n", ANSI_INPUT, cmd, ANSI_RESET);
}
void ctrl_shell_print_help_desc(const char *desc)
{
ctrl_shell_printf(" %s\n", desc);

View File

@@ -73,6 +73,7 @@ static void print_help(char **saveptr)
}
}
static void line_callback(char *line)
{
if(!line){
@@ -110,6 +111,7 @@ static void line_callback(char *line)
free(line);
}
static void print_plugins(cJSON *j_data)
{
cJSON *j_plugins, *j_plugin;
@@ -138,6 +140,7 @@ static void print_plugins(cJSON *j_data)
}
}
static void print_listeners(cJSON *j_data)
{
cJSON *j_listeners, *j_listener;
@@ -168,6 +171,7 @@ static void print_listeners(cJSON *j_data)
}
static void handle_response(const char *command, cJSON *j_data, const char *payload)
{
if(!strcmp(command, "listPlugins")){

View File

@@ -27,6 +27,7 @@ Contributors:
#define UNUSED(A) (void)(A)
int ctrl_shell__connect(void)
{
if(data.port == PORT_UNDEFINED){

View File

@@ -41,6 +41,7 @@ void completion_tree_arg_list_args_free(struct completion_tree_arg_list *arg_lis
arg_list->args = NULL;
}
void completion_tree_arg_list_free(struct completion_tree_arg_list *arg_list)
{
if(!arg_list) return;
@@ -50,6 +51,7 @@ void completion_tree_arg_list_free(struct completion_tree_arg_list *arg_list)
free(arg_list);
}
void completion_tree_cmd_free(struct completion_tree_cmd *cmd)
{
if(!cmd) return;
@@ -61,6 +63,7 @@ void completion_tree_cmd_free(struct completion_tree_cmd *cmd)
free(cmd);
}
void completion_tree_free(struct completion_tree_root *tree)
{
struct completion_tree_cmd *cmd, *next;

View File

@@ -35,6 +35,7 @@ static struct completion_tree_arg_list *tree_groups = NULL;
static struct completion_tree_arg_list *tree_roles = NULL;
static bool do_print_list = false;
static void command_tree_create(void)
{
struct completion_tree_cmd *cmd;
@@ -353,6 +354,7 @@ static void print_help(char **saveptr)
}
}
static int send_set_default_acl_access(char **saveptr)
{
const char *acltype, *allow_s;
@@ -388,6 +390,7 @@ static int send_set_default_acl_access(char **saveptr)
return ctrl_shell_publish_blocking(j_command);
}
static int list_update(const char *command)
{
cJSON *j_command = cJSON_CreateObject();
@@ -398,6 +401,7 @@ static int list_update(const char *command)
return ctrl_shell_publish_blocking(j_command);
}
static int list_generic(const char *command, char **saveptr)
{
const char *count, *offset;
@@ -417,6 +421,7 @@ static int list_generic(const char *command, char **saveptr)
return ctrl_shell_publish_blocking(j_command);
}
static int send_create_client(char **saveptr)
{
char *username = strtok_r(NULL, " ", saveptr);
@@ -459,6 +464,7 @@ static int send_create_client(char **saveptr)
return MOSQ_ERR_SUCCESS;
}
static int send_add_role_acl(char **saveptr)
{
char *rolename = strtok_r(NULL, " ", saveptr);
@@ -511,6 +517,7 @@ static int send_add_role_acl(char **saveptr)
return ctrl_shell_publish_blocking(j_command);
}
static int send_remove_role_acl(char **saveptr)
{
char *rolename = strtok_r(NULL, " ", saveptr);
@@ -546,6 +553,7 @@ static int send_remove_role_acl(char **saveptr)
}
static int send_modify(const char *command, const char *objectname, char **saveptr)
{
char *name = strtok_r(NULL, " ", saveptr);
@@ -582,6 +590,7 @@ static int send_modify(const char *command, const char *objectname, char **savep
return ctrl_shell_publish_blocking(j_command);
}
static int send_set_client_password(char **saveptr)
{
char *username, *password;
@@ -730,6 +739,7 @@ static void line_callback(char *line)
free(line);
}
static void print_json_value(cJSON *value, const char *null_value)
{
if(value){
@@ -747,6 +757,7 @@ static void print_json_value(cJSON *value, const char *null_value)
}
}
static void print_json_array(cJSON *j_list, const char *label, const char *element_name, const char *optional_element_name, const char *optional_element_null_value)
{
cJSON *j_elem;
@@ -839,6 +850,7 @@ static void print_client(cJSON *j_data)
print_json_array(cJSON_GetObjectItem(j_client, "groups"), "Groups:", "groupname", "priority", "-1");
}
static void print_group(cJSON *j_data)
{
cJSON *j_group;
@@ -934,6 +946,7 @@ static void print_role(cJSON *j_data)
}
}
static void print_default_acls(cJSON *j_data)
{
cJSON *j_acls = cJSON_GetObjectItem(j_data, "acls");
@@ -954,6 +967,7 @@ static void print_default_acls(cJSON *j_data)
}
}
static void response_callback(const char *command, cJSON *j_data, const char *payload)
{
UNUSED(payload);

View File

@@ -20,11 +20,13 @@ Contributors:
#include <stdio.h>
#include "ctrl_shell.h"
void ctrl_shell__output(const char *buf)
{
printf("%s", buf);
}
char *ctrl_shell_fgets(char *s, int size, FILE *stream)
{
return fgets(s, size, stream);

View File

@@ -28,6 +28,7 @@ Contributors:
static struct completion_tree_root *commands_post_connect = NULL;
static void command_tree_create(void)
{
struct completion_tree_cmd *cmd;
@@ -46,6 +47,7 @@ static void command_tree_create(void)
completion_tree_cmd_add(commands_post_connect, help_arg_list, "exit");
}
static void print_help(char **saveptr)
{
char *command = strtok_r(NULL, " ", saveptr);
@@ -86,6 +88,7 @@ const struct module_data mod_data[] = {
{ "dynsec", ctrl_shell__dynsec_init },
};
static void line_callback(char *line)
{
if(!line){

View File

@@ -29,6 +29,7 @@ Contributors:
static struct completion_tree_root *commands_pre_connect = NULL;
static void command_tree_create(void)
{
struct completion_tree_cmd *cmd;

View File

@@ -22,6 +22,7 @@ Contributors:
#include "ctrl_shell_internal.h"
void ctrl_shell_vprintf(const char *fmt, va_list va)
{
char buf[2000];
@@ -29,6 +30,7 @@ void ctrl_shell_vprintf(const char *fmt, va_list va)
ctrl_shell__output(buf);
}
void ctrl_shell_printf(const char *fmt, ...)
{
va_list va;

View File

@@ -37,6 +37,7 @@ Contributors:
#define MAX_STRING_LEN 4096
void dynsec__print_usage(void)
{
printf("\nDynamic Security module\n");
@@ -95,12 +96,14 @@ void dynsec__print_usage(void)
printf(" https://mosquitto.org/documentation/dynamic-security/\n\n");
}
/* ################################################################
* #
* # Payload callback
* #
* ################################################################ */
static void print_list(cJSON *j_response, const char *arrayname, const char *keyname)
{
cJSON *j_data, *j_array, *j_elem;
@@ -129,6 +132,7 @@ static void print_list(cJSON *j_response, const char *arrayname, const char *key
}
}
static void print_json_value(cJSON *value, const char *null_value)
{
if(value){
@@ -146,6 +150,7 @@ static void print_json_value(cJSON *value, const char *null_value)
}
}
static void print_json_array(cJSON *j_list, int slen, const char *label, const char *element_name, const char *optional_element_name, const char *optional_element_null_value)
{
cJSON *j_elem;
@@ -331,6 +336,7 @@ static void print_anonymous_group(cJSON *j_response)
printf("%s\n", groupname);
}
static void print_default_acl_access(cJSON *j_response)
{
cJSON *j_data, *j_acls, *j_acl;
@@ -361,6 +367,7 @@ static void print_default_acl_access(cJSON *j_response)
}
}
static void dynsec__payload_callback(struct mosq_ctrl *ctrl, long payloadlen, const void *payload)
{
cJSON *tree, *j_responses, *j_response;
@@ -425,12 +432,14 @@ static void dynsec__payload_callback(struct mosq_ctrl *ctrl, long payloadlen, co
cJSON_Delete(tree);
}
/* ################################################################
* #
* # Default ACL access
* #
* ################################################################ */
static int dynsec__set_default_acl_access(int argc, char *argv[], cJSON *j_command)
{
char *acltype, *access;
@@ -483,6 +492,7 @@ static int dynsec__set_default_acl_access(int argc, char *argv[], cJSON *j_comma
return MOSQ_ERR_SUCCESS;
}
static int dynsec__get_default_acl_access(int argc, char *argv[], cJSON *j_command)
{
UNUSED(argc);
@@ -497,6 +507,7 @@ static int dynsec__get_default_acl_access(int argc, char *argv[], cJSON *j_comma
return MOSQ_ERR_SUCCESS;
}
/* ################################################################
* #
* # Init
@@ -522,6 +533,7 @@ static cJSON *init_add_acl_to_role(cJSON *j_acls, const char *type, const char *
return j_acl;
}
static cJSON *init_add_role(const char *rolename)
{
cJSON *j_role, *j_acls;
@@ -557,6 +569,7 @@ static cJSON *init_add_role(const char *rolename)
return j_role;
}
static cJSON *init_add_client(const char *username, const char *password, const char *rolename)
{
cJSON *j_client, *j_roles, *j_role;
@@ -610,6 +623,7 @@ static cJSON *init_add_client(const char *username, const char *password, const
return j_client;
}
static cJSON *init_create(const char *username, const char *password, const char *rolename)
{
cJSON *tree, *j_clients, *j_client, *j_roles, *j_role;
@@ -660,6 +674,7 @@ static cJSON *init_create(const char *username, const char *password, const char
return tree;
}
/* mosquitto_ctrl dynsec init <filename> <admin-user> <admin-password> [role-name] */
static int dynsec_init(int argc, char *argv[])
{
@@ -741,12 +756,14 @@ static int dynsec_init(int argc, char *argv[])
return -1; /* Suppress client connection */
}
/* ################################################################
* #
* # Main
* #
* ################################################################ */
int dynsec__main(int argc, char *argv[], struct mosq_ctrl *ctrl)
{
int rc = -1;

View File

@@ -26,6 +26,7 @@ Contributors:
#include "json_help.h"
#include "dynamic_security.h"
int dynsec_client__create(int argc, char *argv[], cJSON *j_command)
{
char *username = NULL, *password = NULL, *clientid = NULL;
@@ -86,6 +87,7 @@ int dynsec_client__create(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_client__delete(int argc, char *argv[], cJSON *j_command)
{
char *username = NULL;
@@ -106,6 +108,7 @@ int dynsec_client__delete(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_client__enable_disable(int argc, char *argv[], cJSON *j_command, const char *command)
{
char *username = NULL;
@@ -126,6 +129,7 @@ int dynsec_client__enable_disable(int argc, char *argv[], cJSON *j_command, cons
}
}
int dynsec_client__set_id(int argc, char *argv[], cJSON *j_command)
{
char *username = NULL, *clientid = NULL;
@@ -150,6 +154,7 @@ int dynsec_client__set_id(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_client__file_set_password(int argc, char *argv[], const char *file)
{
char *username = NULL, *password = NULL;
@@ -293,6 +298,7 @@ int dynsec_client__file_set_password(int argc, char *argv[], const char *file)
return MOSQ_ERR_SUCCESS;
}
int dynsec_client__set_password(int argc, char *argv[], cJSON *j_command)
{
char *username = NULL, *password = NULL;
@@ -328,6 +334,7 @@ int dynsec_client__set_password(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_client__get(int argc, char *argv[], cJSON *j_command)
{
char *username = NULL;
@@ -348,6 +355,7 @@ int dynsec_client__get(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_client__add_remove_role(int argc, char *argv[], cJSON *j_command, const char *command)
{
char *username = NULL, *rolename = NULL;
@@ -376,6 +384,7 @@ int dynsec_client__add_remove_role(int argc, char *argv[], cJSON *j_command, con
}
}
int dynsec_client__list_all(int argc, char *argv[], cJSON *j_command)
{
int count = -1, offset = -1;

View File

@@ -26,6 +26,7 @@ Contributors:
#include "mosquitto_ctrl.h"
#include "json_help.h"
int dynsec_group__create(int argc, char *argv[], cJSON *j_command)
{
char *groupname = NULL;
@@ -46,6 +47,7 @@ int dynsec_group__create(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_group__delete(int argc, char *argv[], cJSON *j_command)
{
char *groupname = NULL;
@@ -66,6 +68,7 @@ int dynsec_group__delete(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_group__get_anonymous(int argc, char *argv[], cJSON *j_command)
{
UNUSED(argc);
@@ -80,6 +83,7 @@ int dynsec_group__get_anonymous(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_group__set_anonymous(int argc, char *argv[], cJSON *j_command)
{
char *groupname = NULL;
@@ -100,6 +104,7 @@ int dynsec_group__set_anonymous(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_group__get(int argc, char *argv[], cJSON *j_command)
{
char *groupname = NULL;
@@ -120,6 +125,7 @@ int dynsec_group__get(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_group__add_remove_role(int argc, char *argv[], cJSON *j_command, const char *command)
{
char *groupname = NULL, *rolename = NULL;
@@ -148,6 +154,7 @@ int dynsec_group__add_remove_role(int argc, char *argv[], cJSON *j_command, cons
}
}
int dynsec_group__list_all(int argc, char *argv[], cJSON *j_command)
{
int count = -1, offset = -1;
@@ -174,6 +181,7 @@ int dynsec_group__list_all(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_group__add_remove_client(int argc, char *argv[], cJSON *j_command, const char *command)
{
char *username, *groupname;

View File

@@ -30,6 +30,7 @@ Contributors:
#include "mosquitto_ctrl.h"
#include "json_help.h"
int dynsec_role__create(int argc, char *argv[], cJSON *j_command)
{
char *rolename = NULL;
@@ -50,6 +51,7 @@ int dynsec_role__create(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_role__delete(int argc, char *argv[], cJSON *j_command)
{
char *rolename = NULL;
@@ -70,6 +72,7 @@ int dynsec_role__delete(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_role__get(int argc, char *argv[], cJSON *j_command)
{
char *rolename = NULL;
@@ -90,6 +93,7 @@ int dynsec_role__get(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_role__list_all(int argc, char *argv[], cJSON *j_command)
{
int count = -1, offset = -1;
@@ -116,6 +120,7 @@ int dynsec_role__list_all(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_role__add_acl(int argc, char *argv[], cJSON *j_command)
{
char *rolename, *acltype, *topic, *action;
@@ -168,6 +173,7 @@ int dynsec_role__add_acl(int argc, char *argv[], cJSON *j_command)
}
}
int dynsec_role__remove_acl(int argc, char *argv[], cJSON *j_command)
{
char *rolename, *acltype, *topic;

View File

@@ -28,6 +28,7 @@ Contributors:
#include "mosquitto_ctrl.h"
void ctrl_help(void)
{
printf("\nExample module\n");
@@ -35,6 +36,7 @@ void ctrl_help(void)
printf(" mosquitto_ctrl example help\n");
}
int ctrl_main(int argc, char *argv[], struct mosq_ctrl *ctrl)
{
UNUSED(argc);

View File

@@ -33,6 +33,7 @@ Contributors:
#include "mosquitto_ctrl.h"
#include "ctrl_shell_internal.h"
static void print_version(void)
{
int major, minor, revision;
@@ -41,6 +42,7 @@ static void print_version(void)
printf("mosquitto_ctrl version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
}
static void print_usage(void)
{
printf("mosquitto_ctrl is a tool for administering certain Mosquitto features.\n");

View File

@@ -51,6 +51,7 @@ void init_config(struct mosq_config *cfg)
cfg->protocol_version = MQTT_PROTOCOL_V5;
}
void client_config_cleanup(struct mosq_config *cfg)
{
free(cfg->id);
@@ -83,6 +84,7 @@ void client_config_cleanup(struct mosq_config *cfg)
free(cfg->data_file);
}
int ctrl_config_parse(struct mosq_config *cfg, int *argc, char **argv[])
{
int rc;
@@ -133,6 +135,7 @@ int ctrl_config_parse(struct mosq_config *cfg, int *argc, char **argv[])
return MOSQ_ERR_SUCCESS;
}
/* Process a tokenised single line from a file or set of real argc/argv */
static int client_config_line_proc(struct mosq_config *cfg, int *argc, char **argvp[])
{
@@ -475,6 +478,7 @@ unknown_option:
return 1;
}
static char *get_default_cfg_location(void)
{
char *loc = NULL;
@@ -527,6 +531,7 @@ static char *get_default_cfg_location(void)
return loc;
}
int client_config_load(struct mosq_config *cfg)
{
int rc;
@@ -715,6 +720,8 @@ int client_connect(struct mosquitto *mosq, struct mosq_config *cfg)
}
#ifdef WITH_SOCKS
/* Convert %25 -> %, %3a, %3A -> :, %40 -> @ */
static int mosquitto__urldecode(char *str)
{
@@ -759,6 +766,7 @@ static int mosquitto__urldecode(char *str)
return 0;
}
static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url)
{
char *str;

View File

@@ -39,6 +39,7 @@ Contributors:
#define MAX_BUFFER_LEN 65500
void get_password__reset_term(void)
{
#ifndef WIN32
@@ -104,6 +105,7 @@ static int gets_quiet(char *s, int len)
#endif
}
int get_password(const char *prompt, const char *verify_prompt, bool quiet, char *password, size_t len)
{
char pw1[MAX_BUFFER_LEN], pw2[MAX_BUFFER_LEN];

View File

@@ -65,6 +65,8 @@ struct cb_helper {
static enum mosquitto_pwhash_type hashtype = MOSQ_PW_SHA512_PBKDF2;
#ifdef WIN32
static FILE *mpw_tmpfile(void)
{
return tmpfile();
@@ -74,6 +76,8 @@ static FILE *mpw_tmpfile(void)
static char unsigned alphanum[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static unsigned char tmpfile_path[36];
static FILE *mpw_tmpfile(void)
{
int fd;
@@ -103,6 +107,7 @@ static FILE *mpw_tmpfile(void)
}
#endif
static void print_usage(void)
{
printf("mosquitto_passwd is a tool for managing password files for mosquitto.\n\n");
@@ -119,6 +124,7 @@ static void print_usage(void)
printf("\nSee https://mosquitto.org/ for more information.\n\n");
}
static int output_new_password(FILE *fptr, const char *username, const char *password, int iterations)
{
int rc;
@@ -236,6 +242,7 @@ static int delete_pwuser_cb(FILE *fptr, FILE *ftmp, const char *username, const
return 0;
}
static int delete_pwuser(FILE *fptr, FILE *ftmp, const char *username)
{
struct cb_helper helper;
@@ -253,7 +260,6 @@ static int delete_pwuser(FILE *fptr, FILE *ftmp, const char *username)
}
/* ======================================================================
* Update a plain text password file to use hashes
* ====================================================================== */
@@ -269,6 +275,7 @@ static int update_file_cb(FILE *fptr, FILE *ftmp, const char *username, const ch
}
}
static int update_file(FILE *fptr, FILE *ftmp)
{
return pwfile_iterate(fptr, ftmp, update_file_cb, NULL);
@@ -296,6 +303,7 @@ static int update_pwuser_cb(FILE *fptr, FILE *ftmp, const char *username, const
return rc;
}
static int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *password, int iterations)
{
struct cb_helper helper;
@@ -344,6 +352,7 @@ static int copy_contents(FILE *src, FILE *dest)
return 0;
}
static int create_backup(char *backup_file, FILE *fptr)
{
FILE *fbackup;
@@ -375,6 +384,7 @@ static int create_backup(char *backup_file, FILE *fptr)
return 0;
}
static void handle_sigint(int signal)
{
get_password__reset_term();
@@ -413,8 +423,12 @@ static bool is_username_valid(const char *username)
}
#ifdef WITH_FUZZING
int mosquitto_passwd_fuzz_main(int argc, char *argv[])
#else
int main(int argc, char *argv[])
#endif
{

View File

@@ -21,6 +21,7 @@ Contributors:
#include "mosquitto_signal.h"
static void print_usage(void)
{
printf("mosquitto_signal is a tool for sending control signals to mosquitto.\n");
@@ -45,6 +46,7 @@ static void print_usage(void)
printf("\nSee https://mosquitto.org/ for more information.\n\n");
}
int main(int argc, char *argv[])
{
int idx;

View File

@@ -28,6 +28,7 @@ Contributors:
# define PATH_MAX 4096
#endif
void signal_all(enum mosq_signal sig)
{
DIR *dir;

View File

@@ -33,6 +33,7 @@ Contributors:
#undef WITH_TLS
#include "config.h"
static const char *msig_to_string(enum mosq_sig msig)
{
switch(msig){
@@ -51,6 +52,7 @@ static const char *msig_to_string(enum mosq_sig msig)
}
}
void signal_all(enum mosq_signal msig)
{
DWORD processes[2048], cbneeded, count;
@@ -81,6 +83,7 @@ void signal_all(enum mosq_signal msig)
}
}
void send_signal(int pid, enum mosq_signal msig)
{
HANDLE evt;

View File

@@ -46,6 +46,7 @@ enum prop_type
PROP_TYPE_STRING_PAIR
};
/* This parses property inputs. It should work for any command type, but is limited at the moment.
*
* Format:
@@ -59,6 +60,7 @@ enum prop_type
* connect user-property key value
*/
int cfg_parse_property(struct mosq_config *cfg, int argc, char *argv[], int *idx)
{
char *cmdname = NULL, *propname = NULL;

View File

@@ -54,6 +54,7 @@ const char hexseplist[32] = {
'^', '_', '`', '{', '|', '}', '~', ' ',
};
static int check_format(const char *str)
{
size_t i;
@@ -229,6 +230,7 @@ static void init_config(struct mosq_config *cfg, int pub_or_sub)
cfg->transport = MOSQ_T_TCP;
}
void client_config_cleanup(struct mosq_config *cfg)
{
int i;
@@ -293,6 +295,7 @@ void client_config_cleanup(struct mosq_config *cfg)
free(cfg->options_file);
}
/* Find if there is "-o" in the options */
static int client_config_options_file(struct mosq_config *cfg, int argc, char *argv[])
{
@@ -514,6 +517,7 @@ int client_config_load(struct mosq_config *cfg, int pub_or_sub, int argc, char *
return MOSQ_ERR_SUCCESS;
}
static int cfg_add_topic(struct mosq_config *cfg, int type, char *topic, const char *arg)
{
if(mosquitto_validate_utf8(topic, (int )strlen(topic))){
@@ -1332,6 +1336,8 @@ unknown_option:
#ifdef WITH_TLS
static int client_tls_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
{
int rc;
@@ -1457,6 +1463,7 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
return MOSQ_ERR_SUCCESS;
}
int clientid_generate(struct mosq_config *cfg)
{
if(cfg->id_prefix){
@@ -1470,6 +1477,7 @@ int clientid_generate(struct mosq_config *cfg)
return MOSQ_ERR_SUCCESS;
}
int client_connect(struct mosquitto *mosq, struct mosq_config *cfg)
{
#ifndef WIN32
@@ -1528,6 +1536,8 @@ int client_connect(struct mosquitto *mosq, struct mosq_config *cfg)
}
#ifdef WITH_SOCKS
/* Convert %25 -> %, %3a, %3A -> :, %40 -> @ */
static int mosquitto__urldecode(char *str)
{
@@ -1572,6 +1582,7 @@ static int mosquitto__urldecode(char *str)
return 0;
}
static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url)
{
char *str;
@@ -1770,6 +1781,8 @@ void err_printf(const struct mosq_config *cfg, const char *fmt, ...)
}
#ifdef WITH_TLS
static void tls_keylog_callback(const SSL *ssl, const char *line)
{
struct mosq_config *cfg;

View File

@@ -52,12 +52,14 @@ static int connack_result = 0;
#ifdef WIN32
static uint64_t next_publish_tv;
static void set_repeat_time(void)
{
uint64_t ticks = GetTickCount64();
next_publish_tv = ticks + cfg.repeat_delay.tv_sec*1000 + cfg.repeat_delay.tv_usec/1000;
}
static int check_repeat_time(void)
{
uint64_t ticks = GetTickCount64();
@@ -72,6 +74,7 @@ static int check_repeat_time(void)
static struct timeval next_publish_tv;
static void set_repeat_time(void)
{
gettimeofday(&next_publish_tv, NULL);
@@ -82,6 +85,7 @@ static void set_repeat_time(void)
next_publish_tv.tv_usec = next_publish_tv.tv_usec%1000000;
}
static int check_repeat_time(void)
{
struct timeval tv;
@@ -99,6 +103,7 @@ static int check_repeat_time(void)
}
#endif
void my_disconnect_callback(struct mosquitto *mosq, void *obj, int rc, const mosquitto_property *properties)
{
UNUSED(mosq);
@@ -111,6 +116,7 @@ void my_disconnect_callback(struct mosquitto *mosq, void *obj, int rc, const mos
}
}
int my_publish(struct mosquitto *mosq, int *mid, const char *topic, int payloadlen, void *payload, int qos, bool retain)
{
ready_for_repeat = false;
@@ -396,6 +402,7 @@ static void print_version(void)
printf("mosquitto_pub version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
}
static void print_usage(void)
{
int major, minor, revision;
@@ -520,6 +527,7 @@ static void print_usage(void)
printf("\nSee https://mosquitto.org/ for more information.\n\n");
}
int main(int argc, char *argv[])
{
struct mosquitto *mosq = NULL;

View File

@@ -40,6 +40,7 @@ Contributors:
int mid_sent = -1;
struct mosq_config cfg;
void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *str)
{
UNUSED(mosq);
@@ -49,6 +50,7 @@ void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *s
printf("%s\n", str);
}
int load_stdin(void)
{
size_t pos = 0, rlen;
@@ -85,6 +87,7 @@ int load_stdin(void)
return 0;
}
int load_file(const char *filename)
{
size_t buflen;

View File

@@ -57,6 +57,8 @@ static struct timespec publish_send_time;
static struct timespec publish_recv_time;
#ifndef WIN32
static void my_signal_handler(int signum)
{
if(signum == SIGALRM){
@@ -100,12 +102,14 @@ static void my_message_callback(struct mosquitto *mosq, void *obj, const struct
case MSGMODE_NULL:
client_state = rr_s_disconnect;
break;
case MSGMODE_STDIN_LINE:
client_state = rr_s_ready_to_publish;
break;
}
}
void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flags, const mosquitto_property *properties)
{
UNUSED(obj);
@@ -150,6 +154,7 @@ static void print_version(void)
printf("mosquitto_rr version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
}
static void print_usage(void)
{
int major, minor, revision;
@@ -273,6 +278,7 @@ static void print_usage(void)
printf("\nSee https://mosquitto.org/ for more information.\n\n");
}
static void report_latency(void)
{
if(cfg.measure_latency){
@@ -300,6 +306,7 @@ static void report_latency(void)
}
}
int main(int argc, char *argv[])
{
int rc;

View File

@@ -69,6 +69,8 @@ void CALLBACK timeout_cb(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
timeout_h = NULL;
}
#else
static void my_signal_handler(int signum)
{
if(signum == SIGALRM || signum == SIGTERM || signum == SIGINT){
@@ -135,6 +137,7 @@ static void my_message_callback(struct mosquitto *mosq, void *obj, const struct
}
}
static void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flags, const mosquitto_property *properties)
{
int i;
@@ -168,6 +171,7 @@ static void my_connect_callback(struct mosquitto *mosq, void *obj, int result, i
}
}
static void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
{
int i;
@@ -192,6 +196,7 @@ static void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, in
}
}
static void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *str)
{
UNUSED(mosq);
@@ -201,6 +206,7 @@ static void my_log_callback(struct mosquitto *mosq, void *obj, int level, const
printf("%s\n", str);
}
static void print_version(void)
{
int major, minor, revision;
@@ -209,6 +215,7 @@ static void print_version(void)
printf("mosquitto_sub version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
}
static void print_usage(void)
{
int major, minor, revision;
@@ -348,6 +355,7 @@ static void print_usage(void)
printf("\nSee https://mosquitto.org/ for more information.\n\n");
}
int main(int argc, char *argv[])
{
int rc;

View File

@@ -71,6 +71,7 @@ struct watch_topic{
static int watch_max = 2;
static struct watch_topic *watch_items = NULL;
static int get_time(struct tm **ti, long *ns)
{
#ifdef WIN32
@@ -114,6 +115,7 @@ static const signed char nibble_to_hex[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
static void hexsep(int xpos, int precision, char sepchar)
{
if(precision > 0 && xpos%precision == (precision-1)){
@@ -121,6 +123,7 @@ static void hexsep(int xpos, int precision, char sepchar)
}
}
static void write_payload(const unsigned char *payload, int payloadlen, int hex, struct fieldoptions *fopts)
{
int i;
@@ -285,6 +288,7 @@ static void format_time_8601(const struct tm *ti, int ns, char *buf, size_t len)
buf[strlen("2020-05-06T21:48:00.000000")] = c;
}
static int json_print(const struct mosquitto_message *message, const mosquitto_property *properties, const struct tm *ti, int ns, bool escaped, bool pretty)
{
char buf[100];
@@ -369,6 +373,8 @@ static void formatted_print_blank(struct fieldoptions *fopts)
#ifdef __STDC_IEC_559__
static int formatted_print_float(const unsigned char *payload, int payloadlen, char format, struct fieldoptions *fopts)
{
float float_value;
@@ -450,6 +456,7 @@ static void formatted_print_str(const char *value, struct fieldoptions *fopts)
}
}
static void formatted_print_percent(const struct mosq_config *lcfg, const struct mosquitto_message *message, const mosquitto_property *properties, char format, struct fieldoptions *fopts)
{
struct tm *ti = NULL;
@@ -803,6 +810,8 @@ static void rand_init(void)
}
#ifndef WIN32
static void watch_print(const struct mosquitto_message *message)
{
struct watch_topic *item = NULL;
@@ -883,6 +892,7 @@ void print_message(struct mosq_config *lcfg, const struct mosquitto_message *mes
#endif
}
void output_init(struct mosq_config *lcfg)
{
rand_init();

View File

@@ -26,15 +26,18 @@
static int run = 1;
static MYSQL_STMT *stmt = NULL;
void handle_signal(int s)
{
run = 0;
}
void connect_callback(struct mosquitto *mosq, void *obj, int result)
{
}
void message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
{
MYSQL_BIND bind[2];
@@ -55,6 +58,7 @@ void message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_
mysql_stmt_execute(stmt);
}
int main(int argc, char *argv[])
{
MYSQL *connection;

View File

@@ -12,6 +12,7 @@
# define UNUSED(A) (void)(A)
#endif
/* Callback called when the client receives a CONNACK message from the broker. */
void on_connect(struct mosquitto *mosq, void *obj, int reason_code)
{
@@ -54,6 +55,7 @@ int get_temperature(void)
return (int)random()%100;
}
/* This function pretends to read some data from a sensor and publish it.*/
void publish_sensor_data(struct mosquitto *mosq)
{

View File

@@ -14,6 +14,7 @@
# define UNUSED(A) (void)(A)
#endif
/* Callback called when the client receives a CONNACK message from the broker. */
void on_connect(struct mosquitto *mosq, void *obj, int reason_code)
{
@@ -56,6 +57,7 @@ int get_temperature(void)
return (int)random()%100;
}
/* This function pretends to read some data from a sensor and publish it.*/
void publish_sensor_data(struct mosquitto *mosq)
{

View File

@@ -2,6 +2,7 @@
#include <stdio.h>
#include "mosquitto.h"
int on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *msg)
{
printf("%s %s (%d)\n", msg->topic, (const char *)msg->payload, msg->payloadlen);

View File

@@ -4,6 +4,7 @@
#define COUNT 3
int main(int argc, char *argv[])
{
int rc;

View File

@@ -2,6 +2,7 @@
#include <stdio.h>
#include "mosquitto.h"
int main(int argc, char *argv[])
{
int rc;

View File

@@ -27,6 +27,7 @@ extern "C" {
#define kMinInputLength 3
#define kMaxInputLength 268435455U
int fuzz_packet_read_base(const uint8_t *data, size_t size, int (*packet_func)(struct mosquitto *))
{
struct mosquitto *context = NULL;

View File

@@ -36,6 +36,7 @@ int mosquitto_publish(struct mosquitto *mosq, int *mid, const char *topic, int p
return mosquitto_publish_v5(mosq, mid, topic, payloadlen, payload, qos, retain, NULL);
}
int mosquitto_publish_v5(struct mosquitto *mosq, int *mid, const char *topic, int payloadlen, const void *payload, int qos, bool retain, const mosquitto_property *properties)
{
struct mosquitto_message_all *message;

View File

@@ -162,6 +162,7 @@ static void alias__free_l2r(struct mosquitto *mosq)
mosq->alias_count_l2r = 0;
}
void alias__free_all(struct mosquitto *mosq)
{
alias__free_r2l(mosq);

View File

@@ -30,6 +30,7 @@ void mosquitto_connect_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_connect o
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_connect_with_flags_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_connect_with_flags on_connect)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -37,6 +38,7 @@ void mosquitto_connect_with_flags_callback_set(struct mosquitto *mosq, LIBMOSQ_C
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_connect_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_connect_v5 on_connect)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -44,6 +46,7 @@ void mosquitto_connect_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_connec
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_pre_connect_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_pre_connect on_pre_connect)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -51,6 +54,7 @@ void mosquitto_pre_connect_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_pre_c
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_disconnect_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_disconnect on_disconnect)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -58,6 +62,7 @@ void mosquitto_disconnect_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_discon
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_disconnect_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_disconnect_v5 on_disconnect)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -65,6 +70,7 @@ void mosquitto_disconnect_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_dis
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_publish_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_publish on_publish)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -72,6 +78,7 @@ void mosquitto_publish_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_publish o
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_publish_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_publish_v5 on_publish)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -79,6 +86,7 @@ void mosquitto_publish_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_publis
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_message_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_message on_message)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -86,6 +94,7 @@ void mosquitto_message_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_message o
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_message_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_message_v5 on_message)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -93,6 +102,7 @@ void mosquitto_message_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_messag
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_subscribe_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_subscribe on_subscribe)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -100,6 +110,7 @@ void mosquitto_subscribe_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_subscri
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_subscribe_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_subscribe_v5 on_subscribe)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -107,6 +118,7 @@ void mosquitto_subscribe_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_subs
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_unsubscribe_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_unsubscribe on_unsubscribe)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -114,6 +126,7 @@ void mosquitto_unsubscribe_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_unsub
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_unsubscribe_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_unsubscribe_v5 on_unsubscribe)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -121,6 +134,7 @@ void mosquitto_unsubscribe_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_un
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_unsubscribe2_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_unsubscribe2_v5 on_unsubscribe)
{
COMPAT_pthread_mutex_lock(&mosq->callback_mutex);
@@ -128,6 +142,7 @@ void mosquitto_unsubscribe2_v5_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_u
COMPAT_pthread_mutex_unlock(&mosq->callback_mutex);
}
void mosquitto_log_callback_set(struct mosquitto *mosq, LIBMOSQ_CB_log on_log)
{
COMPAT_pthread_mutex_lock(&mosq->log_callback_mutex);
@@ -295,6 +310,7 @@ void callback__on_disconnect(struct mosquitto *mosq, int rc, const mosquitto_pro
mosq->callback_depth--;
}
int callback__on_ext_auth(struct mosquitto *mosq, const char *auth_method, uint16_t auth_data_len, const void *auth_data, const mosquitto_property *properties)
{
int rc = MOSQ_ERR_AUTH;

View File

@@ -101,6 +101,7 @@ int mosquitto_connect_bind(struct mosquitto *mosq, const char *host, int port, i
return mosquitto_connect_bind_v5(mosq, host, port, keepalive, bind_address, NULL);
}
int mosquitto_connect_bind_v5(struct mosquitto *mosq, const char *host, int port, int keepalive, const char *bind_address, const mosquitto_property *properties)
{
int rc;
@@ -162,6 +163,7 @@ int mosquitto_reconnect(struct mosquitto *mosq)
return mosquitto__reconnect(mosq, true);
}
int get_address(int sock, char *buf, size_t len, uint16_t *remote_port)
{
struct sockaddr_storage addr;
@@ -279,6 +281,7 @@ int mosquitto_disconnect(struct mosquitto *mosq)
return mosquitto_disconnect_v5(mosq, 0, NULL);
}
int mosquitto_disconnect_v5(struct mosquitto *mosq, int reason_code, const mosquitto_property *properties)
{
const mosquitto_property *outgoing_properties = NULL;

View File

@@ -23,6 +23,7 @@ Contributors:
#include "property_mosq.h"
#include "util_mosq.h"
int mosquitto_ext_auth_continue(struct mosquitto *context, const char *auth_method, uint16_t auth_data_len, const void *auth_data, const mosquitto_property *input_props)
{
struct mosquitto__packet *packet = NULL;

View File

@@ -30,6 +30,7 @@ Contributors:
#include "read_handle.h"
#include "util_mosq.h"
int handle__connack(struct mosquitto *mosq)
{
uint8_t connect_flags;

View File

@@ -30,6 +30,7 @@ Contributors:
#include "send_mosq.h"
#include "util_mosq.h"
int handle__disconnect(struct mosquitto *mosq)
{
int rc;

View File

@@ -36,6 +36,7 @@ Contributors:
#include "send_mosq.h"
#include "util_mosq.h"
int handle__pingreq(struct mosquitto *mosq)
{
assert(mosq);
@@ -55,6 +56,7 @@ int handle__pingreq(struct mosquitto *mosq)
#endif
}
int handle__pingresp(struct mosquitto *mosq)
{
assert(mosq);

View File

@@ -34,6 +34,7 @@ Contributors:
#include "send_mosq.h"
#include "util_mosq.h"
static int property__process_publish(struct mosquitto *mosq, mosquitto_property *props, struct mosquitto_message_all *message, uint16_t *topic_alias)
{
while(props){

View File

@@ -37,6 +37,7 @@ Contributors:
#include "send_mosq.h"
#include "util_mosq.h"
int handle__pubrec(struct mosquitto *mosq)
{
uint8_t reason_code = 0;

View File

@@ -60,6 +60,7 @@ static void on_message_callback(struct mosquitto *mosq, void *obj, const struct
}
}
static int on_message_simple(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
{
struct userdata__simple *userdata = obj;

Some files were not shown because too many files have changed in this diff Show More