Rename internal datatypes.
This commit is contained in:
parent
3c703408f2
commit
b67c90ec02
@ -194,13 +194,13 @@ struct mosquitto {
|
|||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
bool is_dropping;
|
bool is_dropping;
|
||||||
bool is_bridge;
|
bool is_bridge;
|
||||||
struct mqtt3__bridge *bridge;
|
struct mosquitto__bridge *bridge;
|
||||||
struct mosquitto_client_msg *msgs;
|
struct mosquitto_client_msg *msgs;
|
||||||
struct mosquitto_client_msg *last_msg;
|
struct mosquitto_client_msg *last_msg;
|
||||||
int msg_count;
|
int msg_count;
|
||||||
int msg_count12;
|
int msg_count12;
|
||||||
struct mosquitto__acl_user *acl_list;
|
struct mosquitto__acl_user *acl_list;
|
||||||
struct mqtt3__listener *listener;
|
struct mosquitto__listener *listener;
|
||||||
time_t disconnect_t;
|
time_t disconnect_t;
|
||||||
struct mosquitto__packet *out_packet_last;
|
struct mosquitto__packet *out_packet_last;
|
||||||
struct mosquitto__subhier **subs;
|
struct mosquitto__subhier **subs;
|
||||||
|
@ -88,7 +88,7 @@ int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint3
|
|||||||
size_t len;
|
size_t len;
|
||||||
#ifdef WITH_BRIDGE
|
#ifdef WITH_BRIDGE
|
||||||
int i;
|
int i;
|
||||||
struct mqtt3__bridge_topic *cur_topic;
|
struct mosquitto__bridge_topic *cur_topic;
|
||||||
bool match;
|
bool match;
|
||||||
int rc;
|
int rc;
|
||||||
char *mapped_topic = NULL;
|
char *mapped_topic = NULL;
|
||||||
|
@ -43,7 +43,7 @@ Contributors:
|
|||||||
|
|
||||||
#ifdef WITH_BRIDGE
|
#ifdef WITH_BRIDGE
|
||||||
|
|
||||||
int bridge__new(struct mosquitto_db *db, struct mqtt3__bridge *bridge)
|
int bridge__new(struct mosquitto_db *db, struct mosquitto__bridge *bridge)
|
||||||
{
|
{
|
||||||
struct mosquitto *new_context = NULL;
|
struct mosquitto *new_context = NULL;
|
||||||
struct mosquitto **bridges;
|
struct mosquitto **bridges;
|
||||||
|
40
src/conf.c
40
src/conf.c
@ -62,7 +62,7 @@ extern SERVICE_STATUS_HANDLE service_handle;
|
|||||||
static int conf__parse_bool(char **token, const char *name, bool *value, char *saveptr);
|
static int conf__parse_bool(char **token, const char *name, bool *value, char *saveptr);
|
||||||
static int conf__parse_int(char **token, const char *name, int *value, char *saveptr);
|
static int conf__parse_int(char **token, const char *name, int *value, char *saveptr);
|
||||||
static int conf__parse_string(char **token, const char *name, char **value, char *saveptr);
|
static int conf__parse_string(char **token, const char *name, char **value, char *saveptr);
|
||||||
static int config__read_file(struct mqtt3_config *config, bool reload, const char *file, struct config_recurse *config_tmp, int level, int *lineno);
|
static int config__read_file(struct mosquitto__config *config, bool reload, const char *file, struct config_recurse *config_tmp, int level, int *lineno);
|
||||||
|
|
||||||
static int conf__attempt_resolve(const char *host, const char *text, int log, const char *msg)
|
static int conf__attempt_resolve(const char *host, const char *text, int log, const char *msg)
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ static int conf__attempt_resolve(const char *host, const char *text, int log, co
|
|||||||
return MOSQ_ERR_SUCCESS;
|
return MOSQ_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void config__init_reload(struct mqtt3_config *config)
|
static void config__init_reload(struct mosquitto__config *config)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
/* Set defaults */
|
/* Set defaults */
|
||||||
@ -168,9 +168,9 @@ static void config__init_reload(struct mqtt3_config *config)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void config__init(struct mqtt3_config *config)
|
void config__init(struct mosquitto__config *config)
|
||||||
{
|
{
|
||||||
memset(config, 0, sizeof(struct mqtt3_config));
|
memset(config, 0, sizeof(struct mosquitto__config));
|
||||||
config__init_reload(config);
|
config__init_reload(config);
|
||||||
config->config_file = NULL;
|
config->config_file = NULL;
|
||||||
config->daemon = false;
|
config->daemon = false;
|
||||||
@ -208,7 +208,7 @@ void config__init(struct mqtt3_config *config)
|
|||||||
config->message_size_limit = 0;
|
config->message_size_limit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void config__cleanup(struct mqtt3_config *config)
|
void config__cleanup(struct mosquitto__config *config)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#ifdef WITH_BRIDGE
|
#ifdef WITH_BRIDGE
|
||||||
@ -320,7 +320,7 @@ static void print_usage(void)
|
|||||||
printf("\nSee http://mosquitto.org/ for more information.\n\n");
|
printf("\nSee http://mosquitto.org/ for more information.\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int config__parse_args(struct mqtt3_config *config, int argc, char *argv[])
|
int config__parse_args(struct mosquitto__config *config, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int port_tmp;
|
int port_tmp;
|
||||||
@ -394,12 +394,12 @@ int config__parse_args(struct mqtt3_config *config, int argc, char *argv[])
|
|||||||
|| config->default_listener.protocol != mp_mqtt){
|
|| config->default_listener.protocol != mp_mqtt){
|
||||||
|
|
||||||
config->listener_count++;
|
config->listener_count++;
|
||||||
config->listeners = mosquitto__realloc(config->listeners, sizeof(struct mqtt3__listener)*config->listener_count);
|
config->listeners = mosquitto__realloc(config->listeners, sizeof(struct mosquitto__listener)*config->listener_count);
|
||||||
if(!config->listeners){
|
if(!config->listeners){
|
||||||
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
||||||
return MOSQ_ERR_NOMEM;
|
return MOSQ_ERR_NOMEM;
|
||||||
}
|
}
|
||||||
memset(&config->listeners[config->listener_count-1], 0, sizeof(struct mqtt3__listener));
|
memset(&config->listeners[config->listener_count-1], 0, sizeof(struct mosquitto__listener));
|
||||||
if(config->default_listener.port){
|
if(config->default_listener.port){
|
||||||
config->listeners[config->listener_count-1].port = config->default_listener.port;
|
config->listeners[config->listener_count-1].port = config->default_listener.port;
|
||||||
}else{
|
}else{
|
||||||
@ -447,7 +447,7 @@ int config__parse_args(struct mqtt3_config *config, int argc, char *argv[])
|
|||||||
return MOSQ_ERR_SUCCESS;
|
return MOSQ_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int config__read(struct mqtt3_config *config, bool reload)
|
int config__read(struct mosquitto__config *config, bool reload)
|
||||||
{
|
{
|
||||||
int rc = MOSQ_ERR_SUCCESS;
|
int rc = MOSQ_ERR_SUCCESS;
|
||||||
struct config_recurse cr;
|
struct config_recurse cr;
|
||||||
@ -495,7 +495,7 @@ int config__read(struct mqtt3_config *config, bool reload)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Default to drop to mosquitto user if no other user specified. This must
|
/* Default to drop to mosquitto user if no other user specified. This must
|
||||||
* remain here even though it is covered in mqtt3_parse_args() because this
|
* remain here even though it is covered in config__parse_args() because this
|
||||||
* function may be called on its own. */
|
* function may be called on its own. */
|
||||||
if(!config->user){
|
if(!config->user){
|
||||||
config->user = "mosquitto";
|
config->user = "mosquitto";
|
||||||
@ -533,7 +533,7 @@ int config__read(struct mqtt3_config *config, bool reload)
|
|||||||
return MOSQ_ERR_SUCCESS;
|
return MOSQ_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int config__read_file_core(struct mqtt3_config *config, bool reload, const char *file, struct config_recurse *cr, int level, int *lineno, FILE *fptr)
|
int config__read_file_core(struct mosquitto__config *config, bool reload, const char *file, struct config_recurse *cr, int level, int *lineno, FILE *fptr)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
@ -541,8 +541,8 @@ int config__read_file_core(struct mqtt3_config *config, bool reload, const char
|
|||||||
int tmp_int;
|
int tmp_int;
|
||||||
char *saveptr = NULL;
|
char *saveptr = NULL;
|
||||||
#ifdef WITH_BRIDGE
|
#ifdef WITH_BRIDGE
|
||||||
struct mqtt3__bridge *cur_bridge = NULL;
|
struct mosquitto__bridge *cur_bridge = NULL;
|
||||||
struct mqtt3__bridge_topic *cur_topic;
|
struct mosquitto__bridge_topic *cur_topic;
|
||||||
#endif
|
#endif
|
||||||
time_t expiration_mult;
|
time_t expiration_mult;
|
||||||
char *key;
|
char *key;
|
||||||
@ -556,7 +556,7 @@ int config__read_file_core(struct mqtt3_config *config, bool reload, const char
|
|||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
#endif
|
#endif
|
||||||
int len;
|
int len;
|
||||||
struct mqtt3__listener *cur_listener = &config->default_listener;
|
struct mosquitto__listener *cur_listener = &config->default_listener;
|
||||||
#ifdef WITH_BRIDGE
|
#ifdef WITH_BRIDGE
|
||||||
char *address;
|
char *address;
|
||||||
int i;
|
int i;
|
||||||
@ -1023,13 +1023,13 @@ int config__read_file_core(struct mqtt3_config *config, bool reload, const char
|
|||||||
token = strtok_r(NULL, " ", &saveptr);
|
token = strtok_r(NULL, " ", &saveptr);
|
||||||
if(token){
|
if(token){
|
||||||
config->bridge_count++;
|
config->bridge_count++;
|
||||||
config->bridges = mosquitto__realloc(config->bridges, config->bridge_count*sizeof(struct mqtt3__bridge));
|
config->bridges = mosquitto__realloc(config->bridges, config->bridge_count*sizeof(struct mosquitto__bridge));
|
||||||
if(!config->bridges){
|
if(!config->bridges){
|
||||||
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
||||||
return MOSQ_ERR_NOMEM;
|
return MOSQ_ERR_NOMEM;
|
||||||
}
|
}
|
||||||
cur_bridge = &(config->bridges[config->bridge_count-1]);
|
cur_bridge = &(config->bridges[config->bridge_count-1]);
|
||||||
memset(cur_bridge, 0, sizeof(struct mqtt3__bridge));
|
memset(cur_bridge, 0, sizeof(struct mosquitto__bridge));
|
||||||
cur_bridge->name = mosquitto__strdup(token);
|
cur_bridge->name = mosquitto__strdup(token);
|
||||||
if(!cur_bridge->name){
|
if(!cur_bridge->name){
|
||||||
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
||||||
@ -1177,7 +1177,7 @@ int config__read_file_core(struct mqtt3_config *config, bool reload, const char
|
|||||||
token = strtok_r(NULL, " ", &saveptr);
|
token = strtok_r(NULL, " ", &saveptr);
|
||||||
if(token){
|
if(token){
|
||||||
config->listener_count++;
|
config->listener_count++;
|
||||||
config->listeners = mosquitto__realloc(config->listeners, sizeof(struct mqtt3__listener)*config->listener_count);
|
config->listeners = mosquitto__realloc(config->listeners, sizeof(struct mosquitto__listener)*config->listener_count);
|
||||||
if(!config->listeners){
|
if(!config->listeners){
|
||||||
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
||||||
return MOSQ_ERR_NOMEM;
|
return MOSQ_ERR_NOMEM;
|
||||||
@ -1188,7 +1188,7 @@ int config__read_file_core(struct mqtt3_config *config, bool reload, const char
|
|||||||
return MOSQ_ERR_INVAL;
|
return MOSQ_ERR_INVAL;
|
||||||
}
|
}
|
||||||
cur_listener = &config->listeners[config->listener_count-1];
|
cur_listener = &config->listeners[config->listener_count-1];
|
||||||
memset(cur_listener, 0, sizeof(struct mqtt3__listener));
|
memset(cur_listener, 0, sizeof(struct mosquitto__listener));
|
||||||
cur_listener->protocol = mp_mqtt;
|
cur_listener->protocol = mp_mqtt;
|
||||||
cur_listener->port = tmp_int;
|
cur_listener->port = tmp_int;
|
||||||
token = strtok_r(NULL, " ", &saveptr);
|
token = strtok_r(NULL, " ", &saveptr);
|
||||||
@ -1699,7 +1699,7 @@ int config__read_file_core(struct mqtt3_config *config, bool reload, const char
|
|||||||
if(token){
|
if(token){
|
||||||
cur_bridge->topic_count++;
|
cur_bridge->topic_count++;
|
||||||
cur_bridge->topics = mosquitto__realloc(cur_bridge->topics,
|
cur_bridge->topics = mosquitto__realloc(cur_bridge->topics,
|
||||||
sizeof(struct mqtt3__bridge_topic)*cur_bridge->topic_count);
|
sizeof(struct mosquitto__bridge_topic)*cur_bridge->topic_count);
|
||||||
if(!cur_bridge->topics){
|
if(!cur_bridge->topics){
|
||||||
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
mosquitto__log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
|
||||||
return MOSQ_ERR_NOMEM;
|
return MOSQ_ERR_NOMEM;
|
||||||
@ -1911,7 +1911,7 @@ int config__read_file_core(struct mqtt3_config *config, bool reload, const char
|
|||||||
return MOSQ_ERR_SUCCESS;
|
return MOSQ_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int config__read_file(struct mqtt3_config *config, bool reload, const char *file, struct config_recurse *cr, int level, int *lineno)
|
int config__read_file(struct mosquitto__config *config, bool reload, const char *file, struct config_recurse *cr, int level, int *lineno)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
FILE *fptr = NULL;
|
FILE *fptr = NULL;
|
||||||
|
@ -28,7 +28,7 @@ Contributors:
|
|||||||
static int max_inflight = 20;
|
static int max_inflight = 20;
|
||||||
static int max_queued = 100;
|
static int max_queued = 100;
|
||||||
|
|
||||||
int db__open(struct mqtt3_config *config, struct mosquitto_db *db)
|
int db__open(struct mosquitto__config *config, struct mosquitto_db *db)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct mosquitto__subhier *child;
|
struct mosquitto__subhier *child;
|
||||||
|
@ -50,7 +50,7 @@ HANDLE syslog_h;
|
|||||||
static int log_destinations = MQTT3_LOG_STDERR;
|
static int log_destinations = MQTT3_LOG_STDERR;
|
||||||
static int log_priorities = MOSQ_LOG_ERR | MOSQ_LOG_WARNING | MOSQ_LOG_NOTICE | MOSQ_LOG_INFO;
|
static int log_priorities = MOSQ_LOG_ERR | MOSQ_LOG_WARNING | MOSQ_LOG_NOTICE | MOSQ_LOG_INFO;
|
||||||
|
|
||||||
int log__init(struct mqtt3_config *config)
|
int log__init(struct mosquitto__config *config)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ int log__init(struct mqtt3_config *config)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int log__close(struct mqtt3_config *config)
|
int log__close(struct mosquitto__config *config)
|
||||||
{
|
{
|
||||||
if(log_destinations & MQTT3_LOG_SYSLOG){
|
if(log_destinations & MQTT3_LOG_SYSLOG){
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
@ -81,7 +81,7 @@ struct mosquitto_db *mosquitto__get_db(void)
|
|||||||
* Note that setting config->user to "root" does not produce an error, but it
|
* Note that setting config->user to "root" does not produce an error, but it
|
||||||
* strongly discouraged.
|
* strongly discouraged.
|
||||||
*/
|
*/
|
||||||
int drop_privileges(struct mqtt3_config *config, bool temporary)
|
int drop_privileges(struct mosquitto__config *config, bool temporary)
|
||||||
{
|
{
|
||||||
#if !defined(__CYGWIN__) && !defined(WIN32)
|
#if !defined(__CYGWIN__) && !defined(WIN32)
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
|||||||
int *listensock = NULL;
|
int *listensock = NULL;
|
||||||
int listensock_count = 0;
|
int listensock_count = 0;
|
||||||
int listensock_index = 0;
|
int listensock_index = 0;
|
||||||
struct mqtt3_config config;
|
struct mosquitto__config config;
|
||||||
#ifdef WITH_SYS_TREE
|
#ifdef WITH_SYS_TREE
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
#endif
|
#endif
|
||||||
|
@ -120,7 +120,7 @@ enum mosquitto_protocol {
|
|||||||
|
|
||||||
typedef uint64_t dbid_t;
|
typedef uint64_t dbid_t;
|
||||||
|
|
||||||
struct mqtt3__listener {
|
struct mosquitto__listener {
|
||||||
int fd;
|
int fd;
|
||||||
char *host;
|
char *host;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
@ -151,7 +151,7 @@ struct mqtt3__listener {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mqtt3_config {
|
struct mosquitto__config {
|
||||||
char *config_file;
|
char *config_file;
|
||||||
char *acl_file;
|
char *acl_file;
|
||||||
bool allow_anonymous;
|
bool allow_anonymous;
|
||||||
@ -164,8 +164,8 @@ struct mqtt3_config {
|
|||||||
char *clientid_prefixes;
|
char *clientid_prefixes;
|
||||||
bool connection_messages;
|
bool connection_messages;
|
||||||
bool daemon;
|
bool daemon;
|
||||||
struct mqtt3__listener default_listener;
|
struct mosquitto__listener default_listener;
|
||||||
struct mqtt3__listener *listeners;
|
struct mosquitto__listener *listeners;
|
||||||
int listener_count;
|
int listener_count;
|
||||||
int log_dest;
|
int log_dest;
|
||||||
int log_facility;
|
int log_facility;
|
||||||
@ -193,7 +193,7 @@ struct mqtt3_config {
|
|||||||
bool have_websockets_listener;
|
bool have_websockets_listener;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_BRIDGE
|
#ifdef WITH_BRIDGE
|
||||||
struct mqtt3__bridge *bridges;
|
struct mosquitto__bridge *bridges;
|
||||||
int bridge_count;
|
int bridge_count;
|
||||||
#endif
|
#endif
|
||||||
char *auth_plugin;
|
char *auth_plugin;
|
||||||
@ -310,7 +310,7 @@ struct mosquitto_db{
|
|||||||
int bridge_count;
|
int bridge_count;
|
||||||
#endif
|
#endif
|
||||||
int msg_store_count;
|
int msg_store_count;
|
||||||
struct mqtt3_config *config;
|
struct mosquitto__config *config;
|
||||||
int persistence_changes;
|
int persistence_changes;
|
||||||
struct mosquitto__auth_plugin auth_plugin;
|
struct mosquitto__auth_plugin auth_plugin;
|
||||||
#ifdef WITH_SYS_TREE
|
#ifdef WITH_SYS_TREE
|
||||||
@ -320,7 +320,7 @@ struct mosquitto_db{
|
|||||||
struct mosquitto *ll_for_free;
|
struct mosquitto *ll_for_free;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum mqtt3_bridge_direction{
|
enum mosquitto__bridge_direction{
|
||||||
bd_out = 0,
|
bd_out = 0,
|
||||||
bd_in = 1,
|
bd_in = 1,
|
||||||
bd_both = 2
|
bd_both = 2
|
||||||
@ -333,10 +333,10 @@ enum mosquitto_bridge_start_type{
|
|||||||
bst_once = 3
|
bst_once = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mqtt3__bridge_topic{
|
struct mosquitto__bridge_topic{
|
||||||
char *topic;
|
char *topic;
|
||||||
int qos;
|
int qos;
|
||||||
enum mqtt3_bridge_direction direction;
|
enum mosquitto__bridge_direction direction;
|
||||||
char *local_prefix;
|
char *local_prefix;
|
||||||
char *remote_prefix;
|
char *remote_prefix;
|
||||||
char *local_topic; /* topic prefixed with local_prefix */
|
char *local_topic; /* topic prefixed with local_prefix */
|
||||||
@ -348,7 +348,7 @@ struct bridge_address{
|
|||||||
int port;
|
int port;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mqtt3__bridge{
|
struct mosquitto__bridge{
|
||||||
char *name;
|
char *name;
|
||||||
struct bridge_address *addresses;
|
struct bridge_address *addresses;
|
||||||
int cur_address;
|
int cur_address;
|
||||||
@ -359,7 +359,7 @@ struct mqtt3__bridge{
|
|||||||
bool try_private_accepted;
|
bool try_private_accepted;
|
||||||
bool clean_session;
|
bool clean_session;
|
||||||
int keepalive;
|
int keepalive;
|
||||||
struct mqtt3__bridge_topic *topics;
|
struct mosquitto__bridge_topic *topics;
|
||||||
int topic_count;
|
int topic_count;
|
||||||
bool topic_remapping;
|
bool topic_remapping;
|
||||||
enum mosquitto__protocol protocol_version;
|
enum mosquitto__protocol protocol_version;
|
||||||
@ -414,18 +414,18 @@ struct mosquitto_db *mosquitto__get_db(void);
|
|||||||
* Config functions
|
* Config functions
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
/* Initialise config struct to default values. */
|
/* Initialise config struct to default values. */
|
||||||
void config__init(struct mqtt3_config *config);
|
void config__init(struct mosquitto__config *config);
|
||||||
/* Parse command line options into config. */
|
/* Parse command line options into config. */
|
||||||
int config__parse_args(struct mqtt3_config *config, int argc, char *argv[]);
|
int config__parse_args(struct mosquitto__config *config, int argc, char *argv[]);
|
||||||
/* Read configuration data from config->config_file into config.
|
/* Read configuration data from config->config_file into config.
|
||||||
* If reload is true, don't process config options that shouldn't be reloaded (listeners etc)
|
* If reload is true, don't process config options that shouldn't be reloaded (listeners etc)
|
||||||
* Returns 0 on success, 1 if there is a configuration error or if a file cannot be opened.
|
* Returns 0 on success, 1 if there is a configuration error or if a file cannot be opened.
|
||||||
*/
|
*/
|
||||||
int config__read(struct mqtt3_config *config, bool reload);
|
int config__read(struct mosquitto__config *config, bool reload);
|
||||||
/* Free all config data. */
|
/* Free all config data. */
|
||||||
void config__cleanup(struct mqtt3_config *config);
|
void config__cleanup(struct mosquitto__config *config);
|
||||||
|
|
||||||
int drop_privileges(struct mqtt3_config *config, bool temporary);
|
int drop_privileges(struct mosquitto__config *config, bool temporary);
|
||||||
int restore_privileges(void);
|
int restore_privileges(void);
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
@ -438,7 +438,7 @@ int send__suback(struct mosquitto *context, uint16_t mid, uint32_t payloadlen, c
|
|||||||
* Network functions
|
* Network functions
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
int net__socket_accept(struct mosquitto_db *db, int listensock);
|
int net__socket_accept(struct mosquitto_db *db, int listensock);
|
||||||
int net__socket_listen(struct mqtt3__listener *listener);
|
int net__socket_listen(struct mosquitto__listener *listener);
|
||||||
int net__socket_get_address(int sock, char *buf, int len);
|
int net__socket_get_address(int sock, char *buf, int len);
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
@ -455,7 +455,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context);
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* Database handling
|
* Database handling
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
int db__open(struct mqtt3_config *config, struct mosquitto_db *db);
|
int db__open(struct mosquitto__config *config, struct mosquitto_db *db);
|
||||||
int db__close(struct mosquitto_db *db);
|
int db__close(struct mosquitto_db *db);
|
||||||
#ifdef WITH_PERSISTENCE
|
#ifdef WITH_PERSISTENCE
|
||||||
int persist__backup(struct mosquitto_db *db, bool shutdown);
|
int persist__backup(struct mosquitto_db *db, bool shutdown);
|
||||||
@ -506,15 +506,15 @@ void context__free_disused(struct mosquitto_db *db);
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* Logging functions
|
* Logging functions
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
int log__init(struct mqtt3_config *config);
|
int log__init(struct mosquitto__config *config);
|
||||||
int log__close(struct mqtt3_config *config);
|
int log__close(struct mosquitto__config *config);
|
||||||
int mosquitto__log_printf(struct mosquitto *mosq, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
|
int mosquitto__log_printf(struct mosquitto *mosq, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
* Bridge functions
|
* Bridge functions
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#ifdef WITH_BRIDGE
|
#ifdef WITH_BRIDGE
|
||||||
int bridge__new(struct mosquitto_db *db, struct mqtt3__bridge *bridge);
|
int bridge__new(struct mosquitto_db *db, struct mosquitto__bridge *bridge);
|
||||||
int bridge__connect(struct mosquitto_db *db, struct mosquitto *context);
|
int bridge__connect(struct mosquitto_db *db, struct mosquitto *context);
|
||||||
void bridge__packet_cleanup(struct mosquitto *context);
|
void bridge__packet_cleanup(struct mosquitto *context);
|
||||||
#endif
|
#endif
|
||||||
@ -552,7 +552,7 @@ void service_run(void);
|
|||||||
* Websockets related functions
|
* Websockets related functions
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#ifdef WITH_WEBSOCKETS
|
#ifdef WITH_WEBSOCKETS
|
||||||
struct libwebsocket_context *mosq_websockets_init(struct mqtt3__listener *listener, int log_level);
|
struct libwebsocket_context *mosq_websockets_init(struct mosquitto__listener *listener, int log_level);
|
||||||
#endif
|
#endif
|
||||||
void do_disconnect(struct mosquitto_db *db, struct mosquitto *context);
|
void do_disconnect(struct mosquitto_db *db, struct mosquitto *context);
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ static unsigned int psk_server_callback(SSL *ssl, const char *identity, unsigned
|
|||||||
{
|
{
|
||||||
struct mosquitto_db *db;
|
struct mosquitto_db *db;
|
||||||
struct mosquitto *context;
|
struct mosquitto *context;
|
||||||
struct mqtt3__listener *listener;
|
struct mosquitto__listener *listener;
|
||||||
char *psk_key = NULL;
|
char *psk_key = NULL;
|
||||||
int len;
|
int len;
|
||||||
const char *psk_hint;
|
const char *psk_hint;
|
||||||
@ -231,7 +231,7 @@ static unsigned int psk_server_callback(SSL *ssl, const char *identity, unsigned
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_TLS
|
#ifdef WITH_TLS
|
||||||
static int mosquitto__tls_server_ctx(struct mqtt3__listener *listener)
|
static int mosquitto__tls_server_ctx(struct mosquitto__listener *listener)
|
||||||
{
|
{
|
||||||
int ssl_options = 0;
|
int ssl_options = 0;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
@ -315,7 +315,7 @@ static int mosquitto__tls_server_ctx(struct mqtt3__listener *listener)
|
|||||||
* Returns 1 on failure
|
* Returns 1 on failure
|
||||||
* Returns 0 on success.
|
* Returns 0 on success.
|
||||||
*/
|
*/
|
||||||
int net__socket_listen(struct mqtt3__listener *listener)
|
int net__socket_listen(struct mosquitto__listener *listener)
|
||||||
{
|
{
|
||||||
int sock = -1;
|
int sock = -1;
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
|
@ -86,7 +86,7 @@ int handle__publish(struct mosquitto_db *db, struct mosquitto *context)
|
|||||||
#ifdef WITH_BRIDGE
|
#ifdef WITH_BRIDGE
|
||||||
char *topic_temp;
|
char *topic_temp;
|
||||||
int i;
|
int i;
|
||||||
struct mqtt3__bridge_topic *cur_topic;
|
struct mosquitto__bridge_topic *cur_topic;
|
||||||
bool match;
|
bool match;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -515,7 +515,7 @@ static void log_wrap(int level, const char *line)
|
|||||||
mosquitto__log_printf(NULL, MOSQ_LOG_WEBSOCKETS, "%s", l);
|
mosquitto__log_printf(NULL, MOSQ_LOG_WEBSOCKETS, "%s", l);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct libwebsocket_context *mosq_websockets_init(struct mqtt3__listener *listener, int log_level)
|
struct libwebsocket_context *mosq_websockets_init(struct mosquitto__listener *listener, int log_level)
|
||||||
{
|
{
|
||||||
struct lws_context_creation_info info;
|
struct lws_context_creation_info info;
|
||||||
struct libwebsocket_protocols *p;
|
struct libwebsocket_protocols *p;
|
||||||
|
Loading…
Reference in New Issue
Block a user