From 2e36d523c8e07d7391847ed6ecfe26a1aa5eadb9 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 22 Dec 2022 16:03:52 +0000 Subject: [PATCH] Rename mosquitto_base_msg -> mosquitto__base_msg --- apps/db_dump/db_dump.c | 6 ++--- apps/db_dump/stubs.c | 6 ++--- src/control.c | 2 +- src/database.c | 28 +++++++++++----------- src/handle_publish.c | 4 ++-- src/loop.c | 4 ++-- src/mosquitto_broker_internal.h | 42 ++++++++++++++++----------------- src/persist_read.c | 8 +++---- src/persist_write.c | 2 +- src/plugin_message.c | 4 ++-- src/plugin_persist.c | 8 +++---- src/plugin_public.c | 12 +++++----- src/retain.c | 8 +++---- src/subs.c | 10 ++++---- src/xtreport.c | 2 +- test/unit/persist_read_stubs.c | 20 ++++++++-------- test/unit/persist_write_stubs.c | 10 ++++---- test/unit/stubs.c | 8 +++---- test/unit/subs_stubs.c | 10 ++++---- 19 files changed, 97 insertions(+), 97 deletions(-) diff --git a/apps/db_dump/db_dump.c b/apps/db_dump/db_dump.c index 29135cd1..cc46ef19 100644 --- a/apps/db_dump/db_dump.c +++ b/apps/db_dump/db_dump.c @@ -227,7 +227,7 @@ static int dump__client_msg_chunk_process(FILE *db_fd, uint32_t length) static int dump__base_msg_chunk_process(FILE *db_fptr, uint32_t length) { struct P_base_msg chunk; - struct mosquitto_base_msg *stored = NULL; + struct mosquitto__base_msg *stored = NULL; int64_t message_expiry_interval64; uint32_t message_expiry_interval; int rc = 0; @@ -258,7 +258,7 @@ static int dump__base_msg_chunk_process(FILE *db_fptr, uint32_t length) message_expiry_interval = 0; } - stored = mosquitto__calloc(1, sizeof(struct mosquitto_base_msg)); + stored = mosquitto__calloc(1, sizeof(struct mosquitto__base_msg)); if(stored == NULL){ fclose(db_fptr); mosquitto__free(chunk.source.id); @@ -377,7 +377,7 @@ static int dump__sub_chunk_process(FILE *db_fd, uint32_t length) static void cleanup_msg_store() { - struct mosquitto_base_msg *msg, *msg_tmp; + struct mosquitto__base_msg *msg, *msg_tmp; HASH_ITER(hh, db.msg_store, msg, msg_tmp){ HASH_DELETE(hh, db.msg_store, msg); diff --git a/apps/db_dump/stubs.c b/apps/db_dump/stubs.c index 1acc6b7f..8062cc82 100644 --- a/apps/db_dump/stubs.c +++ b/apps/db_dump/stubs.c @@ -14,15 +14,15 @@ struct mosquitto *context__init(void) { return NULL; } void context__add_to_by_id(struct mosquitto *context) { UNUSED(context); } -int db__message_store(const struct mosquitto *source, struct mosquitto_base_msg *base_msg, uint32_t message_expiry_interval, dbid_t store_id, enum mosquitto_msg_origin origin) { UNUSED(source); UNUSED(base_msg); UNUSED(message_expiry_interval); UNUSED(store_id); UNUSED(origin); return 0; } +int db__message_store(const struct mosquitto *source, struct mosquitto__base_msg *base_msg, uint32_t message_expiry_interval, dbid_t store_id, enum mosquitto_msg_origin origin) { UNUSED(source); UNUSED(base_msg); UNUSED(message_expiry_interval); UNUSED(store_id); UNUSED(origin); return 0; } -void db__msg_store_ref_inc(struct mosquitto_base_msg *base_msg) { UNUSED(base_msg); } +void db__msg_store_ref_inc(struct mosquitto__base_msg *base_msg) { UNUSED(base_msg); } int log__printf(struct mosquitto *mosq, unsigned int level, const char *fmt, ...) { UNUSED(mosq); UNUSED(level); UNUSED(fmt); return 0; } FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read) { UNUSED(path); UNUSED(mode); UNUSED(restrict_read); return NULL; } -int retain__store(const char *topic, struct mosquitto_base_msg *base_msg, char **split_topics, bool persist) { UNUSED(topic); UNUSED(base_msg); UNUSED(split_topics); UNUSED(persist); return 0; } +int retain__store(const char *topic, struct mosquitto__base_msg *base_msg, char **split_topics, bool persist) { UNUSED(topic); UNUSED(base_msg); UNUSED(split_topics); UNUSED(persist); return 0; } int sub__add(struct mosquitto *context, const char *sub, uint8_t qos, uint32_t identifier, int options) { UNUSED(context); UNUSED(sub); UNUSED(qos); UNUSED(identifier); UNUSED(options); return 0; } diff --git a/src/control.c b/src/control.c index 33937ee1..5f42dd4d 100644 --- a/src/control.c +++ b/src/control.c @@ -29,7 +29,7 @@ Contributors: #ifdef WITH_CONTROL /* Process messages coming in on $CONTROL/. These messages aren't * passed on to other clients. */ -int control__process(struct mosquitto *context, struct mosquitto_base_msg *base_msg) +int control__process(struct mosquitto *context, struct mosquitto__base_msg *base_msg) { struct mosquitto__callback *cb_found; struct mosquitto_evt_control event_data; diff --git a/src/database.c b/src/database.c index 5f4e5309..f7f2f482 100644 --- a/src/database.c +++ b/src/database.c @@ -245,9 +245,9 @@ int db__close(void) } -int db__msg_store_add(struct mosquitto_base_msg *base_msg) +int db__msg_store_add(struct mosquitto__base_msg *base_msg) { - struct mosquitto_base_msg *found; + struct mosquitto__base_msg *found; HASH_FIND(hh, db.msg_store, &base_msg->db_id, sizeof(base_msg->db_id), found); if(found == NULL){ @@ -259,7 +259,7 @@ int db__msg_store_add(struct mosquitto_base_msg *base_msg) } -void db__msg_store_free(struct mosquitto_base_msg *base_msg) +void db__msg_store_free(struct mosquitto__base_msg *base_msg) { int i; @@ -277,7 +277,7 @@ void db__msg_store_free(struct mosquitto_base_msg *base_msg) mosquitto__FREE(base_msg); } -void db__msg_store_remove(struct mosquitto_base_msg *base_msg, bool notify) +void db__msg_store_remove(struct mosquitto__base_msg *base_msg, bool notify) { if(base_msg == NULL) return; HASH_DELETE(hh, db.msg_store, base_msg); @@ -292,19 +292,19 @@ void db__msg_store_remove(struct mosquitto_base_msg *base_msg, bool notify) void db__msg_store_clean(void) { - struct mosquitto_base_msg *base_msg, *base_msg_tmp; + struct mosquitto__base_msg *base_msg, *base_msg_tmp; HASH_ITER(hh, db.msg_store, base_msg, base_msg_tmp){ db__msg_store_remove(base_msg, false); } } -void db__msg_store_ref_inc(struct mosquitto_base_msg *base_msg) +void db__msg_store_ref_inc(struct mosquitto__base_msg *base_msg) { base_msg->ref_count++; } -void db__msg_store_ref_dec(struct mosquitto_base_msg **base_msg) +void db__msg_store_ref_dec(struct mosquitto__base_msg **base_msg) { (*base_msg)->ref_count--; if((*base_msg)->ref_count == 0){ @@ -316,7 +316,7 @@ void db__msg_store_ref_dec(struct mosquitto_base_msg **base_msg) void db__msg_store_compact(void) { - struct mosquitto_base_msg *base_msg, *base_msg_tmp; + struct mosquitto__base_msg *base_msg, *base_msg_tmp; HASH_ITER(hh, db.msg_store, base_msg, base_msg_tmp){ if(base_msg->ref_count < 1){ @@ -442,7 +442,7 @@ int db__message_delete_outgoing(struct mosquitto *context, uint16_t mid, enum mo /* Only for QoS 2 messages */ -int db__message_insert_incoming(struct mosquitto *context, uint64_t cmsg_id, struct mosquitto_base_msg *base_msg, bool persist) +int db__message_insert_incoming(struct mosquitto *context, uint64_t cmsg_id, struct mosquitto__base_msg *base_msg, bool persist) { struct mosquitto_client_msg *msg; struct mosquitto_msg_data *msg_data; @@ -524,7 +524,7 @@ int db__message_insert_incoming(struct mosquitto *context, uint64_t cmsg_id, str return rc; } -int db__message_insert_outgoing(struct mosquitto *context, uint64_t cmsg_id, uint16_t mid, uint8_t qos, bool retain, struct mosquitto_base_msg *base_msg, uint32_t subscription_identifier, bool update, bool persist) +int db__message_insert_outgoing(struct mosquitto *context, uint64_t cmsg_id, uint16_t mid, uint8_t qos, bool retain, struct mosquitto__base_msg *base_msg, uint32_t subscription_identifier, bool update, bool persist) { struct mosquitto_client_msg *msg; struct mosquitto_msg_data *msg_data; @@ -793,13 +793,13 @@ 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_base_msg *base_msg; + struct mosquitto__base_msg *base_msg; const char *source_id; enum mosquitto_msg_origin origin; if(!topic) return MOSQ_ERR_INVAL; - base_msg = mosquitto__calloc(1, sizeof(struct mosquitto_base_msg)); + base_msg = mosquitto__calloc(1, sizeof(struct mosquitto__base_msg)); if(base_msg == NULL) return MOSQ_ERR_NOMEM; base_msg->topic = mosquitto__strdup(topic); @@ -910,7 +910,7 @@ uint64_t db__new_msg_id(void) /* This function requires topic to be allocated on the heap. Once called, it owns topic and will free it on error. Likewise payload and properties. */ -int db__message_store(const struct mosquitto *source, struct mosquitto_base_msg *base_msg, uint32_t message_expiry_interval, dbid_t base_msg_id, enum mosquitto_msg_origin origin) +int db__message_store(const struct mosquitto *source, struct mosquitto__base_msg *base_msg, uint32_t message_expiry_interval, dbid_t base_msg_id, enum mosquitto_msg_origin origin) { int rc; @@ -964,7 +964,7 @@ int db__message_store(const struct mosquitto *source, struct mosquitto_base_msg return MOSQ_ERR_SUCCESS; } -int db__message_store_find(struct mosquitto *context, uint16_t mid, struct mosquitto_base_msg **base_msg) +int db__message_store_find(struct mosquitto *context, uint16_t mid, struct mosquitto__base_msg **base_msg) { struct mosquitto_client_msg *tail; diff --git a/src/handle_publish.c b/src/handle_publish.c index d09a9bd3..8cad4125 100644 --- a/src/handle_publish.c +++ b/src/handle_publish.c @@ -41,7 +41,7 @@ int handle__publish(struct mosquitto *context) int rc2; uint8_t header = context->in_packet.command; int res = 0; - struct mosquitto_base_msg *msg, *stored = NULL; + struct mosquitto__base_msg *msg, *stored = NULL; size_t len; uint16_t slen; char *topic_mount; @@ -59,7 +59,7 @@ int handle__publish(struct mosquitto *context) context->stats.messages_received++; - msg = mosquitto__calloc(1, sizeof(struct mosquitto_base_msg)); + msg = mosquitto__calloc(1, sizeof(struct mosquitto__base_msg)); if(msg == NULL){ return MOSQ_ERR_NOMEM; } diff --git a/src/loop.c b/src/loop.c index f6133d1a..7a3baf28 100644 --- a/src/loop.c +++ b/src/loop.c @@ -67,10 +67,10 @@ static struct lws_sorted_usec_list sul; static int single_publish(struct mosquitto *context, struct mosquitto__message_v5 *msg, uint32_t message_expiry) { - struct mosquitto_base_msg *base_msg; + struct mosquitto__base_msg *base_msg; uint16_t mid; - base_msg = mosquitto__calloc(1, sizeof(struct mosquitto_base_msg)); + base_msg = mosquitto__calloc(1, sizeof(struct mosquitto__base_msg)); if(base_msg == NULL) return MOSQ_ERR_NOMEM; base_msg->topic = msg->topic; diff --git a/src/mosquitto_broker_internal.h b/src/mosquitto_broker_internal.h index a6929ffe..64dd43a1 100644 --- a/src/mosquitto_broker_internal.h +++ b/src/mosquitto_broker_internal.h @@ -403,12 +403,12 @@ struct mosquitto__retainhier { UT_hash_handle hh; struct mosquitto__retainhier *parent; struct mosquitto__retainhier *children; - struct mosquitto_base_msg *retained; + struct mosquitto__base_msg *retained; uint16_t topic_len; char topic[]; }; -struct mosquitto_base_msg{ +struct mosquitto__base_msg{ UT_hash_handle hh; dbid_t db_id; char *source_id; @@ -432,7 +432,7 @@ struct mosquitto_base_msg{ struct mosquitto_client_msg{ struct mosquitto_client_msg *prev; struct mosquitto_client_msg *next; - struct mosquitto_base_msg *base_msg; + struct mosquitto__base_msg *base_msg; uint64_t cmsg_id; uint32_t subscription_identifier; uint16_t mid; @@ -501,7 +501,7 @@ struct mosquitto_db{ int bridge_count; #endif struct clientid__index_hash *clientid_index_hash; - struct mosquitto_base_msg *msg_store; + struct mosquitto__base_msg *msg_store; time_t now_s; /* Monotonic clock, where possible */ time_t now_real_s; /* Read clock, for measuring session/message expiry */ uint64_t node_id; /* for unique db ids */ @@ -727,8 +727,8 @@ int persist__restore(void); /* Return the number of in-flight messages in count. */ int db__message_count(int *count); int db__message_delete_outgoing(struct mosquitto *context, uint16_t mid, enum mosquitto_msg_state expect_state, int qos); -int db__message_insert_outgoing(struct mosquitto *context, uint64_t cmsg_id, uint16_t mid, uint8_t qos, bool retain, struct mosquitto_base_msg *base_msg, uint32_t subscription_identifier, bool update, bool persist); -int db__message_insert_incoming(struct mosquitto *context, uint64_t cmsg_id, struct mosquitto_base_msg *base_msg, bool persist); +int db__message_insert_outgoing(struct mosquitto *context, uint64_t cmsg_id, uint16_t mid, uint8_t qos, bool retain, struct mosquitto__base_msg *base_msg, uint32_t subscription_identifier, bool update, bool persist); +int db__message_insert_incoming(struct mosquitto *context, uint64_t cmsg_id, struct mosquitto__base_msg *base_msg, bool persist); int db__message_remove_incoming(struct mosquitto* context, uint16_t mid); int db__message_release_incoming(struct mosquitto *context, uint16_t mid); int db__message_update_outgoing(struct mosquitto *context, uint16_t mid, enum mosquitto_msg_state state, int qos, bool persist); @@ -737,15 +737,15 @@ int db__messages_delete(struct mosquitto *context, bool force_free); int db__messages_delete_incoming(struct mosquitto *context); int db__messages_delete_outgoing(struct mosquitto *context); 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); -int db__message_store(const struct mosquitto *source, struct mosquitto_base_msg *base_msg, uint32_t message_expiry_interval, dbid_t store_id, enum mosquitto_msg_origin origin); -int db__message_store_find(struct mosquitto *context, uint16_t mid, struct mosquitto_base_msg **base_msg); -int db__msg_store_add(struct mosquitto_base_msg *base_msg); -void db__msg_store_remove(struct mosquitto_base_msg *base_msg, bool notify); -void db__msg_store_ref_inc(struct mosquitto_base_msg *base_msg); -void db__msg_store_ref_dec(struct mosquitto_base_msg **base_msg); +int db__message_store(const struct mosquitto *source, struct mosquitto__base_msg *base_msg, uint32_t message_expiry_interval, dbid_t store_id, enum mosquitto_msg_origin origin); +int db__message_store_find(struct mosquitto *context, uint16_t mid, struct mosquitto__base_msg **base_msg); +int db__msg_store_add(struct mosquitto__base_msg *base_msg); +void db__msg_store_remove(struct mosquitto__base_msg *base_msg, bool notify); +void db__msg_store_ref_inc(struct mosquitto__base_msg *base_msg); +void db__msg_store_ref_dec(struct mosquitto__base_msg **base_msg); void db__msg_store_clean(void); void db__msg_store_compact(void); -void db__msg_store_free(struct mosquitto_base_msg *base_msg); +void db__msg_store_free(struct mosquitto__base_msg *base_msg); int db__message_reconnect_reset(struct mosquitto *context); bool db__ready_for_flight(struct mosquitto *context, enum mosquitto_msg_direction dir, int qos); bool db__ready_for_queue(struct mosquitto *context, int qos, struct mosquitto_msg_data *msg_data); @@ -768,7 +768,7 @@ struct mosquitto__subhier *sub__add_hier_entry(struct mosquitto__subhier *parent int sub__remove(struct mosquitto *context, const char *sub, uint8_t *reason); void sub__tree_print(struct mosquitto__subhier *root, int level); int sub__clean_session(struct mosquitto *context); -int sub__messages_queue(const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto_base_msg **base_msg); +int sub__messages_queue(const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto__base_msg **base_msg); int sub__topic_tokenise(const char *subtopic, char **local_sub, char ***topics, const char **sharename); void sub__topic_tokens_free(struct sub__token *tokens); @@ -792,7 +792,7 @@ int connect__on_authorised(struct mosquitto *context, void *auth_data_out, uint1 * Control functions * ============================================================ */ #ifdef WITH_CONTROL -int control__process(struct mosquitto *context, struct mosquitto_base_msg *base_msg); +int control__process(struct mosquitto *context, struct mosquitto__base_msg *base_msg); void control__cleanup(void); #endif int control__register_callback(mosquitto_plugin_id_t *pid, MOSQ_FUNC_generic_callback cb_func, const char *topic, void *userdata); @@ -867,7 +867,7 @@ int acl__pre_check(mosquitto_plugin_id_t *plugin, struct mosquitto *context, int void plugin__handle_connect(struct mosquitto *context); void plugin__handle_disconnect(struct mosquitto *context, int reason); -int plugin__handle_message(struct mosquitto *context, struct mosquitto_base_msg *base_msg); +int plugin__handle_message(struct mosquitto *context, struct mosquitto__base_msg *base_msg); int plugin__handle_subscribe(struct mosquitto *context, const char *topic, uint8_t qos, uint8_t subscription_options, uint32_t subscription_identifier, const mosquitto_property *properties); int plugin__handle_unsubscribe(struct mosquitto *context, const char *topic, const mosquitto_property *properties); void LIB_ERROR(void); @@ -882,10 +882,10 @@ void plugin_persist__handle_subscription_delete(struct mosquitto *context, const void plugin_persist__handle_client_msg_add(struct mosquitto *context, const struct mosquitto_client_msg *cmsg); void plugin_persist__handle_client_msg_delete(struct mosquitto *context, const struct mosquitto_client_msg *cmsg); void plugin_persist__handle_client_msg_update(struct mosquitto *context, const struct mosquitto_client_msg *cmsg); -void plugin_persist__handle_base_msg_add(struct mosquitto_base_msg *base_msg); -void plugin_persist__handle_base_msg_delete(struct mosquitto_base_msg *base_msg); -void plugin_persist__handle_retain_msg_set(struct mosquitto_base_msg *base_msg); -void plugin_persist__handle_retain_msg_delete(struct mosquitto_base_msg *base_msg); +void plugin_persist__handle_base_msg_add(struct mosquitto__base_msg *base_msg); +void plugin_persist__handle_base_msg_delete(struct mosquitto__base_msg *base_msg); +void plugin_persist__handle_retain_msg_set(struct mosquitto__base_msg *base_msg); +void plugin_persist__handle_retain_msg_delete(struct mosquitto__base_msg *base_msg); /* ============================================================ * Property related functions @@ -910,7 +910,7 @@ int property__process_disconnect(struct mosquitto *context, mosquitto_property * int retain__init(void); void retain__clean(struct mosquitto__retainhier **retainhier); int retain__queue(struct mosquitto *context, const char *sub, uint8_t sub_qos, uint32_t subscription_identifier); -int retain__store(const char *topic, struct mosquitto_base_msg *base_msg, char **split_topics, bool persist); +int retain__store(const char *topic, struct mosquitto__base_msg *base_msg, char **split_topics, bool persist); /* ============================================================ * Security related functions diff --git a/src/persist_read.c b/src/persist_read.c index 8aeea3e2..d7a32893 100644 --- a/src/persist_read.c +++ b/src/persist_read.c @@ -117,7 +117,7 @@ int persist__read_string(FILE *db_fptr, char **str) static int persist__client_msg_restore(struct P_client_msg *chunk) { struct mosquitto_client_msg *cmsg; - struct mosquitto_base_msg *msg; + struct mosquitto__base_msg *msg; struct mosquitto *context; struct mosquitto_msg_data *msg_data; @@ -252,7 +252,7 @@ static int persist__client_msg_chunk_restore(FILE *db_fptr, uint32_t length) static int persist__base_msg_chunk_restore(FILE *db_fptr, uint32_t length) { struct P_base_msg chunk; - struct mosquitto_base_msg *base_msg = NULL; + struct mosquitto__base_msg *base_msg = NULL; int64_t message_expiry_interval64; uint32_t message_expiry_interval; int rc = 0; @@ -289,7 +289,7 @@ static int persist__base_msg_chunk_restore(FILE *db_fptr, uint32_t length) message_expiry_interval = 0; } - base_msg = mosquitto__calloc(1, sizeof(struct mosquitto_base_msg)); + base_msg = mosquitto__calloc(1, sizeof(struct mosquitto__base_msg)); if(base_msg == NULL){ log__printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory."); rc = MOSQ_ERR_NOMEM; @@ -327,7 +327,7 @@ cleanup: static int persist__retain_chunk_restore(FILE *db_fptr) { - struct mosquitto_base_msg *msg; + struct mosquitto__base_msg *msg; struct P_retain chunk; int rc; char **split_topics; diff --git a/src/persist_write.c b/src/persist_write.c index bac72b9f..fb70a9e4 100644 --- a/src/persist_write.c +++ b/src/persist_write.c @@ -86,7 +86,7 @@ static int persist__client_messages_save(FILE *db_fptr, struct mosquitto *contex static int persist__message_store_save(FILE *db_fptr) { struct P_base_msg chunk; - struct mosquitto_base_msg *base_msg, *base_msg_tmp; + struct mosquitto__base_msg *base_msg, *base_msg_tmp; int rc; assert(db_fptr); diff --git a/src/plugin_message.c b/src/plugin_message.c index 0717f18f..0b0d503b 100644 --- a/src/plugin_message.c +++ b/src/plugin_message.c @@ -23,7 +23,7 @@ Contributors: #include "utlist.h" -static int plugin__handle_message_single(struct mosquitto__security_options *opts, struct mosquitto *context, struct mosquitto_base_msg *stored) +static int plugin__handle_message_single(struct mosquitto__security_options *opts, struct mosquitto *context, struct mosquitto__base_msg *stored) { struct mosquitto_evt_message event_data; struct mosquitto__callback *cb_base; @@ -57,7 +57,7 @@ static int plugin__handle_message_single(struct mosquitto__security_options *opt return rc; } -int plugin__handle_message(struct mosquitto *context, struct mosquitto_base_msg *stored) +int plugin__handle_message(struct mosquitto *context, struct mosquitto__base_msg *stored) { int rc = MOSQ_ERR_SUCCESS; diff --git a/src/plugin_persist.c b/src/plugin_persist.c index 0b5ffc00..a2bc8f37 100644 --- a/src/plugin_persist.c +++ b/src/plugin_persist.c @@ -275,7 +275,7 @@ void plugin_persist__handle_client_msg_update(struct mosquitto *context, const s } -void plugin_persist__handle_base_msg_add(struct mosquitto_base_msg *msg) +void plugin_persist__handle_base_msg_add(struct mosquitto__base_msg *msg) { struct mosquitto_evt_persist_base_msg event_data; struct mosquitto__callback *cb_base; @@ -310,7 +310,7 @@ void plugin_persist__handle_base_msg_add(struct mosquitto_base_msg *msg) } -void plugin_persist__handle_base_msg_delete(struct mosquitto_base_msg *msg) +void plugin_persist__handle_base_msg_delete(struct mosquitto__base_msg *msg) { struct mosquitto_evt_persist_base_msg event_data; struct mosquitto__callback *cb_base; @@ -330,7 +330,7 @@ void plugin_persist__handle_base_msg_delete(struct mosquitto_base_msg *msg) } -void plugin_persist__handle_retain_msg_set(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_msg_set(struct mosquitto__base_msg *msg) { struct mosquitto_evt_persist_retain_msg event_data; struct mosquitto__callback *cb_base; @@ -350,7 +350,7 @@ void plugin_persist__handle_retain_msg_set(struct mosquitto_base_msg *msg) } -void plugin_persist__handle_retain_msg_delete(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_msg_delete(struct mosquitto__base_msg *msg) { struct mosquitto_evt_persist_retain_msg event_data; struct mosquitto__callback *cb_base; diff --git a/src/plugin_public.c b/src/plugin_public.c index d4bc2c19..1ce5bbf5 100644 --- a/src/plugin_public.c +++ b/src/plugin_public.c @@ -603,9 +603,9 @@ BROKER_EXPORT int mosquitto_persist_client_delete(const char *client_id) } -static struct mosquitto_base_msg *find_store_msg(uint64_t store_id) +static struct mosquitto__base_msg *find_store_msg(uint64_t store_id) { - struct mosquitto_base_msg *base_msg; + struct mosquitto__base_msg *base_msg; HASH_FIND(hh, db.msg_store, &store_id, sizeof(store_id), base_msg); return base_msg; @@ -614,7 +614,7 @@ static struct mosquitto_base_msg *find_store_msg(uint64_t store_id) BROKER_EXPORT int mosquitto_persist_client_msg_add(struct mosquitto_evt_persist_client_msg *client_msg) { struct mosquitto *context; - struct mosquitto_base_msg *base_msg; + struct mosquitto__base_msg *base_msg; if(client_msg == NULL || client_msg->client_id == NULL){ return MOSQ_ERR_INVAL; @@ -748,7 +748,7 @@ BROKER_EXPORT int mosquitto_subscription_delete(const char *client_id, const cha BROKER_EXPORT int mosquitto_persist_base_msg_add(struct mosquitto_evt_persist_base_msg *msg) { struct mosquitto context; - struct mosquitto_base_msg *base_msg; + struct mosquitto__base_msg *base_msg; uint32_t message_expiry_interval; time_t message_expiry_interval_tt; int i; @@ -774,7 +774,7 @@ BROKER_EXPORT int mosquitto_persist_base_msg_add(struct mosquitto_evt_persist_ba } } - base_msg = mosquitto_calloc(1, sizeof(struct mosquitto_base_msg)); + base_msg = mosquitto_calloc(1, sizeof(struct mosquitto__base_msg)); if(base_msg == NULL){ goto error; } @@ -815,7 +815,7 @@ error: BROKER_EXPORT int mosquitto_persist_base_msg_delete(uint64_t store_id) { - struct mosquitto_base_msg *base_msg; + struct mosquitto__base_msg *base_msg; base_msg = find_store_msg(store_id); if(base_msg && base_msg->ref_count == 0){ diff --git a/src/retain.c b/src/retain.c index 41dee75c..0579207b 100644 --- a/src/retain.c +++ b/src/retain.c @@ -65,7 +65,7 @@ int retain__init(void) BROKER_EXPORT int mosquitto_persist_retain_msg_set(const char *topic, uint64_t base_msg_id) { - struct mosquitto_base_msg *base_msg; + struct mosquitto__base_msg *base_msg; int rc = MOSQ_ERR_UNKNOWN; char **split_topics = NULL; char *local_topic = NULL; @@ -88,7 +88,7 @@ BROKER_EXPORT int mosquitto_persist_retain_msg_set(const char *topic, uint64_t b BROKER_EXPORT int mosquitto_persist_retain_msg_delete(const char *topic) { - struct mosquitto_base_msg base_msg; + struct mosquitto__base_msg base_msg; int rc = MOSQ_ERR_UNKNOWN; char **split_topics = NULL; char *local_topic = NULL; @@ -126,7 +126,7 @@ void retain__clean_empty_hierarchy(struct mosquitto__retainhier *retainhier) } -int retain__store(const char *topic, struct mosquitto_base_msg *base_msg, char **split_topics, bool persist) +int retain__store(const char *topic, struct mosquitto__base_msg *base_msg, char **split_topics, bool persist) { struct mosquitto__retainhier *retainhier; struct mosquitto__retainhier *branch; @@ -199,7 +199,7 @@ static int retain__process(struct mosquitto__retainhier *branch, struct mosquitt int rc = 0; uint8_t qos; uint16_t mid; - struct mosquitto_base_msg *retained; + struct mosquitto__base_msg *retained; if(branch->retained->message_expiry_time > 0 && db.now_real_s >= branch->retained->message_expiry_time){ plugin_persist__handle_retain_msg_delete(branch->retained); diff --git a/src/subs.c b/src/subs.c index 33c118c4..f7ef3b1c 100644 --- a/src/subs.c +++ b/src/subs.c @@ -60,7 +60,7 @@ Contributors: #include "utlist.h" -static int subs__send(struct mosquitto__subleaf *leaf, const char *topic, uint8_t qos, int retain, struct mosquitto_base_msg *stored) +static int subs__send(struct mosquitto__subleaf *leaf, const char *topic, uint8_t qos, int retain, struct mosquitto__base_msg *stored) { bool client_retain; uint16_t mid; @@ -103,7 +103,7 @@ static int subs__send(struct mosquitto__subleaf *leaf, const char *topic, uint8_ } -static int subs__shared_process(struct mosquitto__subhier *hier, const char *topic, uint8_t qos, int retain, struct mosquitto_base_msg *stored) +static int subs__shared_process(struct mosquitto__subhier *hier, const char *topic, uint8_t qos, int retain, struct mosquitto__base_msg *stored) { int rc = 0, rc2; struct mosquitto__subshared *shared, *shared_tmp; @@ -122,7 +122,7 @@ static int subs__shared_process(struct mosquitto__subhier *hier, const char *top return rc; } -static int subs__process(struct mosquitto__subhier *hier, const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto_base_msg *stored) +static int subs__process(struct mosquitto__subhier *hier, const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto__base_msg *stored) { int rc = 0; int rc2; @@ -456,7 +456,7 @@ static int sub__remove_recurse(struct mosquitto *context, struct mosquitto__subh } -static int sub__search(struct mosquitto__subhier *subhier, char **split_topics, const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto_base_msg *stored) +static int sub__search(struct mosquitto__subhier *subhier, char **split_topics, const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto__base_msg *stored) { /* FIXME - need to take into account source_id if the client is a bridge */ struct mosquitto__subhier *branch; @@ -613,7 +613,7 @@ int sub__remove(struct mosquitto *context, const char *sub, uint8_t *reason) return rc; } -int sub__messages_queue(const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto_base_msg **stored) +int sub__messages_queue(const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto__base_msg **stored) { int rc = MOSQ_ERR_SUCCESS, rc2; struct mosquitto__subhier *subhier; diff --git a/src/xtreport.c b/src/xtreport.c index 67334abf..f4b00899 100644 --- a/src/xtreport.c +++ b/src/xtreport.c @@ -172,7 +172,7 @@ void xtreport(void) fprintf(fptr, "\nfn=(%d) messages\n", fn_index_max); fprintf(fptr, "1 0 0 0 0 0 0 0 0 0 0 0\n"); - struct mosquitto_base_msg *base_msg, *base_msg_tmp; + struct mosquitto__base_msg *base_msg, *base_msg_tmp; HASH_ITER(hh, db.msg_store, base_msg, base_msg_tmp){ if(base_msg->ref_count > 1){ diff --git a/test/unit/persist_read_stubs.c b/test/unit/persist_read_stubs.c index d73ae7b3..55131e3f 100644 --- a/test/unit/persist_read_stubs.c +++ b/test/unit/persist_read_stubs.c @@ -26,7 +26,7 @@ struct mosquitto *context__init(void) return m; } -void db__msg_store_free(struct mosquitto_base_msg *store) +void db__msg_store_free(struct mosquitto__base_msg *store) { int i; @@ -44,7 +44,7 @@ void db__msg_store_free(struct mosquitto_base_msg *store) mosquitto__free(store); } -int db__message_store(const struct mosquitto *source, struct mosquitto_base_msg *stored, uint32_t message_expiry_interval, dbid_t store_id, enum mosquitto_msg_origin origin) +int db__message_store(const struct mosquitto *source, struct mosquitto__base_msg *stored, uint32_t message_expiry_interval, dbid_t store_id, enum mosquitto_msg_origin origin) { int rc = MOSQ_ERR_SUCCESS; @@ -162,7 +162,7 @@ int sub__add(struct mosquitto *context, const char *sub, uint8_t qos, uint32_t i return MOSQ_ERR_SUCCESS; } -int db__message_insert_incoming(struct mosquitto *context, uint64_t cmsg_id, struct mosquitto_base_msg *msg, bool persist) +int db__message_insert_incoming(struct mosquitto *context, uint64_t cmsg_id, struct mosquitto__base_msg *msg, bool persist) { UNUSED(context); UNUSED(cmsg_id); @@ -172,7 +172,7 @@ int db__message_insert_incoming(struct mosquitto *context, uint64_t cmsg_id, str return MOSQ_ERR_SUCCESS; } -int db__message_insert_outgoing(struct mosquitto *context, uint64_t cmsg_id, uint16_t mid, uint8_t qos, bool retain, struct mosquitto_base_msg *stored, uint32_t subscription_identifier, bool update, bool persist) +int db__message_insert_outgoing(struct mosquitto *context, uint64_t cmsg_id, uint16_t mid, uint8_t qos, bool retain, struct mosquitto__base_msg *stored, uint32_t subscription_identifier, bool update, bool persist) { UNUSED(context); UNUSED(cmsg_id); @@ -187,12 +187,12 @@ int db__message_insert_outgoing(struct mosquitto *context, uint64_t cmsg_id, uin return MOSQ_ERR_SUCCESS; } -void db__msg_store_ref_dec(struct mosquitto_base_msg **store) +void db__msg_store_ref_dec(struct mosquitto__base_msg **store) { UNUSED(store); } -void db__msg_store_ref_inc(struct mosquitto_base_msg *store) +void db__msg_store_ref_inc(struct mosquitto__base_msg *store) { store->ref_count++; } @@ -229,15 +229,15 @@ void context__send_will(struct mosquitto *context) UNUSED(context); } -void plugin_persist__handle_retain_msg_set(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_msg_set(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_retain_msg_delete(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_msg_delete(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_base_msg_add(struct mosquitto_base_msg *msg) +void plugin_persist__handle_base_msg_add(struct mosquitto__base_msg *msg) { UNUSED(msg); } @@ -247,7 +247,7 @@ void plugin_persist__process_retain_events(bool force) UNUSED(force); } -void plugin_persist__queue_retain_event(struct mosquitto_base_msg *msg, int event) +void plugin_persist__queue_retain_event(struct mosquitto__base_msg *msg, int event) { UNUSED(msg); UNUSED(event); diff --git a/test/unit/persist_write_stubs.c b/test/unit/persist_write_stubs.c index 826d5a89..efc28f74 100644 --- a/test/unit/persist_write_stubs.c +++ b/test/unit/persist_write_stubs.c @@ -209,19 +209,19 @@ void plugin_persist__handle_client_msg_clear(struct mosquitto *context, uint8_t UNUSED(context); UNUSED(direction); } -void plugin_persist__handle_base_msg_add(struct mosquitto_base_msg *msg) +void plugin_persist__handle_base_msg_add(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_base_msg_delete(struct mosquitto_base_msg *msg) +void plugin_persist__handle_base_msg_delete(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_retain_msg_set(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_msg_set(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_retain_msg_delete(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_msg_delete(struct mosquitto__base_msg *msg) { UNUSED(msg); } @@ -236,7 +236,7 @@ void plugin_persist__process_retain_events(bool force) UNUSED(force); } -void plugin_persist__queue_retain_event(struct mosquitto_base_msg *msg, int event) +void plugin_persist__queue_retain_event(struct mosquitto__base_msg *msg, int event) { UNUSED(msg); UNUSED(event); diff --git a/test/unit/stubs.c b/test/unit/stubs.c index 60bbd8fa..2164227d 100644 --- a/test/unit/stubs.c +++ b/test/unit/stubs.c @@ -13,7 +13,7 @@ struct mosquitto_db{ }; -struct mosquitto_base_msg{ +struct mosquitto__base_msg{ }; @@ -95,12 +95,12 @@ ssize_t net__write(struct mosquitto *mosq, const void *buf, size_t count) return 1; } -void plugin_persist__handle_retain_set(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_set(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_retain_remove(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_remove(struct mosquitto__base_msg *msg) { UNUSED(msg); } @@ -110,7 +110,7 @@ void plugin_persist__process_retain_events(bool force) UNUSED(force); } -void plugin_persist__queue_retain_event(struct mosquitto_base_msg *msg, int event) +void plugin_persist__queue_retain_event(struct mosquitto__base_msg *msg, int event) { UNUSED(msg); UNUSED(event); diff --git a/test/unit/subs_stubs.c b/test/unit/subs_stubs.c index 64bd8a16..2226ebc0 100644 --- a/test/unit/subs_stubs.c +++ b/test/unit/subs_stubs.c @@ -144,7 +144,7 @@ int retain__queue(struct mosquitto *context, const char *sub, uint8_t sub_qos, u return MOSQ_ERR_SUCCESS; } -int retain__store(const char *topic, struct mosquitto_base_msg *stored, char **split_topics, bool persist) +int retain__store(const char *topic, struct mosquitto__base_msg *stored, char **split_topics, bool persist) { UNUSED(topic); UNUSED(stored); @@ -208,19 +208,19 @@ void plugin_persist__handle_client_msg_clear(struct mosquitto *context, uint8_t UNUSED(context); UNUSED(direction); } -void plugin_persist__handle_base_msg_add(struct mosquitto_base_msg *msg) +void plugin_persist__handle_base_msg_add(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_base_msg_delete(struct mosquitto_base_msg *msg) +void plugin_persist__handle_base_msg_delete(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_retain_msg_add(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_msg_add(struct mosquitto__base_msg *msg) { UNUSED(msg); } -void plugin_persist__handle_retain_msg_delete(struct mosquitto_base_msg *msg) +void plugin_persist__handle_retain_msg_delete(struct mosquitto__base_msg *msg) { UNUSED(msg); }