From f77c1ca91b54ed706b07af00e2d171107bc9cda2 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 1 Nov 2018 23:50:54 +0000 Subject: [PATCH] private struct mqtt5__property -> public mosquitto_property. --- lib/connect.c | 2 +- lib/handle_auth.c | 2 +- lib/handle_connack.c | 2 +- lib/handle_pubackcomp.c | 2 +- lib/handle_publish.c | 2 +- lib/handle_pubrec.c | 2 +- lib/handle_pubrel.c | 2 +- lib/handle_suback.c | 2 +- lib/handle_unsuback.c | 2 +- lib/mosquitto_internal.h | 2 +- lib/property_mosq.c | 60 ++++++++++++++++----------------- lib/property_mosq.h | 10 +++--- lib/send_connect.c | 2 +- lib/send_disconnect.c | 2 +- lib/send_mosq.c | 2 +- lib/send_mosq.h | 12 +++---- lib/send_publish.c | 4 +-- lib/send_subscribe.c | 2 +- src/database.c | 8 ++--- src/handle_auth.c | 2 +- src/handle_connack.c | 2 +- src/handle_connect.c | 4 +-- src/handle_publish.c | 6 ++-- src/handle_subscribe.c | 2 +- src/handle_unsubscribe.c | 2 +- src/mosquitto_broker_internal.h | 8 ++--- src/send_connack.c | 2 +- src/send_suback.c | 2 +- src/send_unsuback.c | 2 +- test/unit/property_read.c | 36 ++++++++++---------- test/unit/property_write.c | 46 ++++++++++++------------- 31 files changed, 118 insertions(+), 118 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index 100d7e9f..f0f36914 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -27,7 +27,7 @@ Contributors: #include "send_mosq.h" #include "socks_mosq.h" -static int mosquitto__reconnect(struct mosquitto *mosq, bool blocking, const struct mqtt5__property *properties); +static int mosquitto__reconnect(struct mosquitto *mosq, bool blocking, const mosquitto_property *properties); static int mosquitto__connect_init(struct mosquitto *mosq, const char *host, int port, int keepalive, const char *bind_address); diff --git a/lib/handle_auth.c b/lib/handle_auth.c index fa798ee3..5b84d3de 100644 --- a/lib/handle_auth.c +++ b/lib/handle_auth.c @@ -30,7 +30,7 @@ int handle__auth(struct mosquitto *mosq) { int rc = 0; uint8_t reason_code; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; if(!mosq) return MOSQ_ERR_INVAL; log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received AUTH", mosq->id); diff --git a/lib/handle_connack.c b/lib/handle_connack.c index 0c96fdf9..ba110883 100644 --- a/lib/handle_connack.c +++ b/lib/handle_connack.c @@ -33,7 +33,7 @@ int handle__connack(struct mosquitto *mosq) uint8_t connect_flags; uint8_t reason_code; int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; assert(mosq); rc = packet__read_byte(&mosq->in_packet, &connect_flags); diff --git a/lib/handle_pubackcomp.c b/lib/handle_pubackcomp.c index 3f8ae22f..2169df70 100644 --- a/lib/handle_pubackcomp.c +++ b/lib/handle_pubackcomp.c @@ -44,7 +44,7 @@ int handle__pubackcomp(struct mosquitto *mosq, const char *type) { uint16_t mid; int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; assert(mosq); rc = packet__read_uint16(&mosq->in_packet, &mid); diff --git a/lib/handle_publish.c b/lib/handle_publish.c index 3bfd19fb..c3c53b58 100644 --- a/lib/handle_publish.c +++ b/lib/handle_publish.c @@ -38,7 +38,7 @@ int handle__publish(struct mosquitto *mosq) int rc = 0; uint16_t mid; int slen; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; assert(mosq); diff --git a/lib/handle_pubrec.c b/lib/handle_pubrec.c index 778db6aa..4bd58029 100644 --- a/lib/handle_pubrec.c +++ b/lib/handle_pubrec.c @@ -39,7 +39,7 @@ int handle__pubrec(struct mosquitto *mosq) { uint16_t mid; int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; assert(mosq); rc = packet__read_uint16(&mosq->in_packet, &mid); diff --git a/lib/handle_pubrel.c b/lib/handle_pubrel.c index 440791e8..d9d5dda5 100644 --- a/lib/handle_pubrel.c +++ b/lib/handle_pubrel.c @@ -43,7 +43,7 @@ int handle__pubrel(struct mosquitto_db *db, struct mosquitto *mosq) struct mosquitto_message_all *message = NULL; #endif int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; assert(mosq); if(mosq->protocol != mosq_p_mqtt31){ diff --git a/lib/handle_suback.c b/lib/handle_suback.c index c41297b8..65b71e52 100644 --- a/lib/handle_suback.c +++ b/lib/handle_suback.c @@ -39,7 +39,7 @@ int handle__suback(struct mosquitto *mosq) int qos_count; int i = 0; int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; assert(mosq); #ifdef WITH_BROKER diff --git a/lib/handle_unsuback.c b/lib/handle_unsuback.c index 83050f65..72ca3d58 100644 --- a/lib/handle_unsuback.c +++ b/lib/handle_unsuback.c @@ -41,7 +41,7 @@ int handle__unsuback(struct mosquitto *mosq) { uint16_t mid; int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; assert(mosq); #ifdef WITH_BROKER diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h index 2fac25ba..e8fc1b7e 100644 --- a/lib/mosquitto_internal.h +++ b/lib/mosquitto_internal.h @@ -147,7 +147,7 @@ struct mosquitto__packet{ struct mosquitto_message_all{ struct mosquitto_message_all *next; - struct mqtt5__property *properties; + mosquitto_property *properties; time_t timestamp; //enum mosquitto_msg_direction direction; enum mosquitto_msg_state state; diff --git a/lib/property_mosq.c b/lib/property_mosq.c index e932d960..4dd5c22e 100644 --- a/lib/property_mosq.c +++ b/lib/property_mosq.c @@ -27,7 +27,7 @@ Contributors: #include "property_mosq.h" -int property__read(struct mosquitto__packet *packet, int32_t *len, struct mqtt5__property *property) +int property__read(struct mosquitto__packet *packet, int32_t *len, mosquitto_property *property) { int rc; int32_t property_identifier; @@ -43,7 +43,7 @@ int property__read(struct mosquitto__packet *packet, int32_t *len, struct mqtt5_ if(rc) return rc; *len -= 1; - memset(property, 0, sizeof(struct mqtt5__property)); + memset(property, 0, sizeof(mosquitto_property)); property->identifier = property_identifier; @@ -139,11 +139,11 @@ int property__read(struct mosquitto__packet *packet, int32_t *len, struct mqtt5_ } -int property__read_all(int command, struct mosquitto__packet *packet, struct mqtt5__property **properties) +int property__read_all(int command, struct mosquitto__packet *packet, mosquitto_property **properties) { int rc; int32_t proplen; - struct mqtt5__property *p, *tail = NULL; + mosquitto_property *p, *tail = NULL; rc = packet__read_varint(packet, &proplen, NULL); if(rc) return rc; @@ -153,7 +153,7 @@ int property__read_all(int command, struct mosquitto__packet *packet, struct mqt /* The order of properties must be preserved for some types, so keep the * same order for all */ while(proplen > 0){ - p = mosquitto__calloc(1, sizeof(struct mqtt5__property)); + p = mosquitto__calloc(1, sizeof(mosquitto_property)); rc = property__read(packet, &proplen, p); if(rc){ @@ -180,7 +180,7 @@ int property__read_all(int command, struct mosquitto__packet *packet, struct mqt } -void property__free(struct mqtt5__property **property) +void property__free(mosquitto_property **property) { if(!property || !(*property)) return; @@ -231,9 +231,9 @@ void property__free(struct mqtt5__property **property) } -void mosquitto_property_free_all(struct mqtt5__property **property) +void mosquitto_property_free_all(mosquitto_property **property) { - struct mqtt5__property *p, *next; + mosquitto_property *p, *next; if(!property) return; @@ -247,7 +247,7 @@ void mosquitto_property_free_all(struct mqtt5__property **property) } -int property__get_length(const struct mqtt5__property *property) +int property__get_length(const mosquitto_property *property) { if(!property) return 0; @@ -317,9 +317,9 @@ int property__get_length(const struct mqtt5__property *property) } -int property__get_length_all(const struct mqtt5__property *property) +int property__get_length_all(const mosquitto_property *property) { - const struct mqtt5__property *p; + const mosquitto_property *p; int len = 0; p = property; @@ -331,7 +331,7 @@ int property__get_length_all(const struct mqtt5__property *property) } -int property__write(struct mosquitto__packet *packet, const struct mqtt5__property *property) +int property__write(struct mosquitto__packet *packet, const mosquitto_property *property) { int rc; @@ -397,10 +397,10 @@ int property__write(struct mosquitto__packet *packet, const struct mqtt5__proper } -int property__write_all(struct mosquitto__packet *packet, const struct mqtt5__property *properties) +int property__write_all(struct mosquitto__packet *packet, const mosquitto_property *properties) { int rc; - const struct mqtt5__property *p; + const mosquitto_property *p; rc = packet__write_varint(packet, property__get_length_all(properties)); if(rc) return rc; @@ -600,9 +600,9 @@ int mosquitto_string_to_property_info(const char *propname, int *identifier, int } -static void property__add(struct mqtt5__property **proplist, struct mqtt5__property *prop) +static void property__add(mosquitto_property **proplist, struct mqtt5__property *prop) { - struct mqtt5__property *p; + mosquitto_property *p; if(!(*proplist)){ *proplist = prop; @@ -619,7 +619,7 @@ static void property__add(struct mqtt5__property **proplist, struct mqtt5__prope int mosquitto_property_add_byte(mosquitto_property **proplist, int identifier, uint8_t value) { - struct mqtt5__property *prop; + mosquitto_property *prop; if(!proplist) return MOSQ_ERR_INVAL; if(identifier != MQTT_PROP_PAYLOAD_FORMAT_INDICATOR @@ -633,7 +633,7 @@ int mosquitto_property_add_byte(mosquitto_property **proplist, int identifier, u return MOSQ_ERR_INVAL; } - prop = mosquitto__calloc(1, sizeof(struct mqtt5__property)); + prop = mosquitto__calloc(1, sizeof(mosquitto_property)); if(!prop) return MOSQ_ERR_NOMEM; prop->identifier = identifier; @@ -646,7 +646,7 @@ int mosquitto_property_add_byte(mosquitto_property **proplist, int identifier, u int mosquitto_property_add_int16(mosquitto_property **proplist, int identifier, uint16_t value) { - struct mqtt5__property *prop; + mosquitto_property *prop; if(!proplist) return MOSQ_ERR_INVAL; if(identifier != MQTT_PROP_SERVER_KEEP_ALIVE @@ -656,7 +656,7 @@ int mosquitto_property_add_int16(mosquitto_property **proplist, int identifier, return MOSQ_ERR_INVAL; } - prop = mosquitto__calloc(1, sizeof(struct mqtt5__property)); + prop = mosquitto__calloc(1, sizeof(mosquitto_property)); if(!prop) return MOSQ_ERR_NOMEM; prop->identifier = identifier; @@ -669,7 +669,7 @@ int mosquitto_property_add_int16(mosquitto_property **proplist, int identifier, int mosquitto_property_add_int32(mosquitto_property **proplist, int identifier, uint32_t value) { - struct mqtt5__property *prop; + mosquitto_property *prop; if(!proplist) return MOSQ_ERR_INVAL; if(identifier != MQTT_PROP_MESSAGE_EXPIRY_INTERVAL @@ -680,7 +680,7 @@ int mosquitto_property_add_int32(mosquitto_property **proplist, int identifier, return MOSQ_ERR_INVAL; } - prop = mosquitto__calloc(1, sizeof(struct mqtt5__property)); + prop = mosquitto__calloc(1, sizeof(mosquitto_property)); if(!prop) return MOSQ_ERR_NOMEM; prop->identifier = identifier; @@ -693,12 +693,12 @@ int mosquitto_property_add_int32(mosquitto_property **proplist, int identifier, int mosquitto_property_add_varint(mosquitto_property **proplist, int identifier, uint32_t value) { - struct mqtt5__property *prop; + mosquitto_property *prop; if(!proplist || value > 268435455) return MOSQ_ERR_INVAL; if(identifier != MQTT_PROP_SUBSCRIPTION_IDENTIFIER) return MOSQ_ERR_INVAL; - prop = mosquitto__calloc(1, sizeof(struct mqtt5__property)); + prop = mosquitto__calloc(1, sizeof(mosquitto_property)); if(!prop) return MOSQ_ERR_NOMEM; prop->identifier = identifier; @@ -711,7 +711,7 @@ int mosquitto_property_add_varint(mosquitto_property **proplist, int identifier, int mosquitto_property_add_binary(mosquitto_property **proplist, int identifier, const void *value, uint16_t len) { - struct mqtt5__property *prop; + mosquitto_property *prop; if(!proplist) return MOSQ_ERR_INVAL; if(identifier != MQTT_PROP_CORRELATION_DATA @@ -720,7 +720,7 @@ int mosquitto_property_add_binary(mosquitto_property **proplist, int identifier, return MOSQ_ERR_INVAL; } - prop = mosquitto__calloc(1, sizeof(struct mqtt5__property)); + prop = mosquitto__calloc(1, sizeof(mosquitto_property)); if(!prop) return MOSQ_ERR_NOMEM; prop->identifier = identifier; @@ -743,7 +743,7 @@ int mosquitto_property_add_binary(mosquitto_property **proplist, int identifier, int mosquitto_property_add_string(mosquitto_property **proplist, int identifier, const char *value) { - struct mqtt5__property *prop; + mosquitto_property *prop; if(!proplist) return MOSQ_ERR_INVAL; if(value){ @@ -761,7 +761,7 @@ int mosquitto_property_add_string(mosquitto_property **proplist, int identifier, return MOSQ_ERR_INVAL; } - prop = mosquitto__calloc(1, sizeof(struct mqtt5__property)); + prop = mosquitto__calloc(1, sizeof(mosquitto_property)); if(!prop) return MOSQ_ERR_NOMEM; prop->identifier = identifier; @@ -782,7 +782,7 @@ int mosquitto_property_add_string(mosquitto_property **proplist, int identifier, int mosquitto_property_add_string_pair(mosquitto_property **proplist, int identifier, const char *name, const char *value) { - struct mqtt5__property *prop; + mosquitto_property *prop; if(!proplist) return MOSQ_ERR_INVAL; if(identifier != MQTT_PROP_USER_PROPERTY) return MOSQ_ERR_INVAL; @@ -793,7 +793,7 @@ int mosquitto_property_add_string_pair(mosquitto_property **proplist, int identi if(mosquitto_validate_utf8(value, strlen(value))) return MOSQ_ERR_MALFORMED_UTF8; } - prop = mosquitto__calloc(1, sizeof(struct mqtt5__property)); + prop = mosquitto__calloc(1, sizeof(mosquitto_property)); if(!prop) return MOSQ_ERR_NOMEM; prop->identifier = identifier; diff --git a/lib/property_mosq.h b/lib/property_mosq.h index dd2ecf95..97c11564 100644 --- a/lib/property_mosq.h +++ b/lib/property_mosq.h @@ -39,11 +39,11 @@ struct mqtt5__property { }; -int property__read_all(int command, struct mosquitto__packet *packet, struct mqtt5__property **property); -int property__write_all(struct mosquitto__packet *packet, const struct mqtt5__property *property); -void property__free(struct mqtt5__property **property); +int property__read_all(int command, struct mosquitto__packet *packet, mosquitto_property **property); +int property__write_all(struct mosquitto__packet *packet, const mosquitto_property *property); +void property__free(mosquitto_property **property); -int property__get_length(const struct mqtt5__property *property); -int property__get_length_all(const struct mqtt5__property *property); +int property__get_length(const mosquitto_property *property); +int property__get_length_all(const mosquitto_property *property); #endif diff --git a/lib/send_connect.c b/lib/send_connect.c index 1c703fd7..a052a398 100644 --- a/lib/send_connect.c +++ b/lib/send_connect.c @@ -31,7 +31,7 @@ Contributors: #include "packet_mosq.h" #include "property_mosq.h" -int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session, const struct mqtt5__property *properties) +int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session, const mosquitto_property *properties) { struct mosquitto__packet *packet = NULL; int payloadlen; diff --git a/lib/send_disconnect.c b/lib/send_disconnect.c index d998c3f6..d29a153e 100644 --- a/lib/send_disconnect.c +++ b/lib/send_disconnect.c @@ -32,7 +32,7 @@ Contributors: #include "send_mosq.h" -int send__disconnect(struct mosquitto *mosq, const struct mqtt5__property *properties) +int send__disconnect(struct mosquitto *mosq, const mosquitto_property *properties) { struct mosquitto__packet *packet = NULL; int rc; diff --git a/lib/send_mosq.c b/lib/send_mosq.c index eb0d6561..3899589c 100644 --- a/lib/send_mosq.c +++ b/lib/send_mosq.c @@ -111,7 +111,7 @@ int send__pubrel(struct mosquitto *mosq, uint16_t mid) } /* For PUBACK, PUBCOMP, PUBREC, and PUBREL */ -int send__command_with_mid(struct mosquitto *mosq, uint8_t command, uint16_t mid, bool dup, uint8_t reason_code, const struct mqtt5__property *properties) +int send__command_with_mid(struct mosquitto *mosq, uint8_t command, uint16_t mid, bool dup, uint8_t reason_code, const mosquitto_property *properties) { struct mosquitto__packet *packet = NULL; int rc; diff --git a/lib/send_mosq.h b/lib/send_mosq.h index 094c782c..fdf3b7ea 100644 --- a/lib/send_mosq.h +++ b/lib/send_mosq.h @@ -20,19 +20,19 @@ Contributors: #include "property_mosq.h" int send__simple_command(struct mosquitto *mosq, uint8_t command); -int send__command_with_mid(struct mosquitto *mosq, uint8_t command, uint16_t mid, bool dup, uint8_t reason_code, const struct mqtt5__property *properties); -int send__real_publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const struct mqtt5__property *properties); +int send__command_with_mid(struct mosquitto *mosq, uint8_t command, uint16_t mid, bool dup, uint8_t reason_code, const mosquitto_property *properties); +int send__real_publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const mosquitto_property *properties); -int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session, const struct mqtt5__property *properties); -int send__disconnect(struct mosquitto *mosq, const struct mqtt5__property *properties); +int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session, const mosquitto_property *properties); +int send__disconnect(struct mosquitto *mosq, const mosquitto_property *properties); int send__pingreq(struct mosquitto *mosq); int send__pingresp(struct mosquitto *mosq); int send__puback(struct mosquitto *mosq, uint16_t mid); int send__pubcomp(struct mosquitto *mosq, uint16_t mid); -int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const struct mqtt5__property *properties); +int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const mosquitto_property *properties); int send__pubrec(struct mosquitto *mosq, uint16_t mid); int send__pubrel(struct mosquitto *mosq, uint16_t mid); -int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, char *const *const topic, int topic_qos, const struct mqtt5__property *properties); +int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, char *const *const topic, int topic_qos, const mosquitto_property *properties); int send__unsubscribe(struct mosquitto *mosq, int *mid, const char *topic, const mosquitto_property *properties); #endif diff --git a/lib/send_publish.c b/lib/send_publish.c index 39878f8d..ee25d3b4 100644 --- a/lib/send_publish.c +++ b/lib/send_publish.c @@ -37,7 +37,7 @@ Contributors: #include "send_mosq.h" -int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const struct mqtt5__property *properties) +int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const mosquitto_property *properties) { #ifdef WITH_BROKER size_t len; @@ -128,7 +128,7 @@ int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint3 } -int send__real_publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const struct mqtt5__property *properties) +int send__real_publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup, const mosquitto_property *properties) { struct mosquitto__packet *packet = NULL; int packetlen; diff --git a/lib/send_subscribe.c b/lib/send_subscribe.c index 7feeb3a9..1fb02b14 100644 --- a/lib/send_subscribe.c +++ b/lib/send_subscribe.c @@ -33,7 +33,7 @@ Contributors: #include "util_mosq.h" -int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, const char **topic, int topic_qos, const struct mqtt5__property *properties) +int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, const char **topic, int topic_qos, const mosquitto_property *properties) { struct mosquitto__packet *packet = NULL; uint32_t packetlen; diff --git a/src/database.c b/src/database.c index 5cf640fc..3de57289 100644 --- a/src/database.c +++ b/src/database.c @@ -559,13 +559,13 @@ int db__messages_delete(struct mosquitto_db *db, struct mosquitto *context) return MOSQ_ERR_SUCCESS; } -int db__messages_easy_queue(struct mosquitto_db *db, struct mosquitto *context, const char *topic, int qos, uint32_t payloadlen, const void *payload, int retain, struct mqtt5__property **properties) +int db__messages_easy_queue(struct mosquitto_db *db, struct mosquitto *context, const char *topic, int qos, uint32_t payloadlen, const void *payload, int retain, mosquitto_property **properties) { struct mosquitto_msg_store *stored; char *source_id; char *topic_heap; mosquitto__payload_uhpa payload_uhpa; - struct mqtt5__property *local_properties = NULL; + mosquitto_property *local_properties = NULL; assert(db); @@ -596,7 +596,7 @@ int db__messages_easy_queue(struct mosquitto_db *db, struct mosquitto *context, } /* 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(struct mosquitto_db *db, const char *source, uint16_t source_mid, char *topic, int qos, uint32_t payloadlen, mosquitto__payload_uhpa *payload, int retain, struct mosquitto_msg_store **stored, uint32_t message_expiry_interval, struct mqtt5__property *properties, dbid_t store_id) +int db__message_store(struct mosquitto_db *db, const char *source, uint16_t source_mid, char *topic, int qos, uint32_t payloadlen, mosquitto__payload_uhpa *payload, int retain, struct mosquitto_msg_store **stored, uint32_t message_expiry_interval, mosquitto_property *properties, dbid_t store_id) { struct mosquitto_msg_store *temp = NULL; int rc = MOSQ_ERR_SUCCESS; @@ -871,7 +871,7 @@ int db__message_write(struct mosquitto_db *db, struct mosquitto *context) uint32_t payloadlen; const void *payload; int msg_count = 0; - struct mqtt5__property *properties; + mosquitto_property *properties; time_t now; if(!context || context->sock == INVALID_SOCKET diff --git a/src/handle_auth.c b/src/handle_auth.c index 529f4e65..dd5b2d73 100644 --- a/src/handle_auth.c +++ b/src/handle_auth.c @@ -29,7 +29,7 @@ int handle__auth(struct mosquitto_db *db, struct mosquitto *context) { int rc = 0; uint8_t reason_code; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; if(!context) return MOSQ_ERR_INVAL; log__printf(NULL, MOSQ_LOG_DEBUG, "Received AUTH from %s", context->id); diff --git a/src/handle_connack.c b/src/handle_connack.c index 038dab0e..20ac526a 100644 --- a/src/handle_connack.c +++ b/src/handle_connack.c @@ -35,7 +35,7 @@ int handle__connack(struct mosquitto_db *db, struct mosquitto *context) char *notification_topic; int notification_topic_len; char notification_payload; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; if(!context){ return MOSQ_ERR_INVAL; diff --git a/src/handle_connect.c b/src/handle_connect.c index b617211f..a6f1ae78 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -131,7 +131,7 @@ int handle__connect(struct mosquitto_db *db, struct mosquitto *context) struct mosquitto__subleaf *leaf; int i; struct mosquitto__security_options *security_opts; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; #ifdef WITH_TLS X509 *client_cert = NULL; X509_NAME *name; @@ -722,7 +722,7 @@ handle_connect_error: int handle__disconnect(struct mosquitto_db *db, struct mosquitto *context) { int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; if(!context){ return MOSQ_ERR_INVAL; diff --git a/src/handle_publish.c b/src/handle_publish.c index 8862394e..31b1df5b 100644 --- a/src/handle_publish.c +++ b/src/handle_publish.c @@ -45,9 +45,9 @@ int handle__publish(struct mosquitto_db *db, struct mosquitto *context) int len; int slen; char *topic_mount; - struct mqtt5__property *properties = NULL; - struct mqtt5__property *p, *p_prev; - struct mqtt5__property *msg_properties = NULL, *msg_properties_last; + mosquitto_property *properties = NULL; + mosquitto_property *p, *p_prev; + mosquitto_property *msg_properties = NULL, *msg_properties_last; uint32_t message_expiry_interval = 0; #ifdef WITH_BRIDGE diff --git a/src/handle_subscribe.c b/src/handle_subscribe.c index b96ad255..0715b475 100644 --- a/src/handle_subscribe.c +++ b/src/handle_subscribe.c @@ -39,7 +39,7 @@ int handle__subscribe(struct mosquitto_db *db, struct mosquitto *context) int len; int slen; char *sub_mount; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; if(!context) return MOSQ_ERR_INVAL; log__printf(NULL, MOSQ_LOG_DEBUG, "Received SUBSCRIBE from %s", context->id); diff --git a/src/handle_unsubscribe.c b/src/handle_unsubscribe.c index d760a5d7..6fb24e2d 100644 --- a/src/handle_unsubscribe.c +++ b/src/handle_unsubscribe.c @@ -31,7 +31,7 @@ int handle__unsubscribe(struct mosquitto_db *db, struct mosquitto *context) char *sub; int slen; int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; if(!context) return MOSQ_ERR_INVAL; log__printf(NULL, MOSQ_LOG_DEBUG, "Received UNSUBSCRIBE from %s", context->id); diff --git a/src/mosquitto_broker_internal.h b/src/mosquitto_broker_internal.h index 8140bb17..06f3d2f6 100644 --- a/src/mosquitto_broker_internal.h +++ b/src/mosquitto_broker_internal.h @@ -315,7 +315,7 @@ struct mosquitto_msg_store{ int dest_id_count; int ref_count; char* topic; - struct mqtt5__property *properties; + mosquitto_property *properties; mosquitto__payload_uhpa payload; time_t message_expiry_time; uint32_t payloadlen; @@ -513,7 +513,7 @@ int restore_privileges(void); * ============================================================ */ int send__connack(struct mosquitto *context, int ack, int result); int send__suback(struct mosquitto *context, uint16_t mid, uint32_t payloadlen, const void *payload); -int send__unsuback(struct mosquitto *context, uint16_t mid, const struct mqtt5__property *properties); +int send__unsuback(struct mosquitto *context, uint16_t mid, const mosquitto_property *properties); /* ============================================================ * Network functions @@ -555,8 +555,8 @@ int db__message_update(struct mosquitto *context, uint16_t mid, enum mosquitto_m int db__message_write(struct mosquitto_db *db, struct mosquitto *context); void db__message_dequeue_first(struct mosquitto *context); int db__messages_delete(struct mosquitto_db *db, struct mosquitto *context); -int db__messages_easy_queue(struct mosquitto_db *db, struct mosquitto *context, const char *topic, int qos, uint32_t payloadlen, const void *payload, int retain, struct mqtt5__property **properties); -int db__message_store(struct mosquitto_db *db, const char *source, uint16_t source_mid, char *topic, int qos, uint32_t payloadlen, mosquitto__payload_uhpa *payload, int retain, struct mosquitto_msg_store **stored, uint32_t message_expiry_interval, struct mqtt5__property *properties, dbid_t store_id); +int db__messages_easy_queue(struct mosquitto_db *db, struct mosquitto *context, const char *topic, int qos, uint32_t payloadlen, const void *payload, int retain, mosquitto_property **properties); +int db__message_store(struct mosquitto_db *db, const char *source, uint16_t source_mid, char *topic, int qos, uint32_t payloadlen, mosquitto__payload_uhpa *payload, int retain, struct mosquitto_msg_store **stored, uint32_t message_expiry_interval, mosquitto_property *properties, dbid_t store_id); int db__message_store_find(struct mosquitto *context, uint16_t mid, struct mosquitto_msg_store **stored); void db__msg_store_add(struct mosquitto_db *db, struct mosquitto_msg_store *store); void db__msg_store_remove(struct mosquitto_db *db, struct mosquitto_msg_store *store); diff --git a/src/send_connack.c b/src/send_connack.c index 7414298a..ac39b636 100644 --- a/src/send_connack.c +++ b/src/send_connack.c @@ -27,7 +27,7 @@ int send__connack(struct mosquitto *context, int ack, int result) { struct mosquitto__packet *packet = NULL; int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; int proplen, varbytes; if(context){ diff --git a/src/send_suback.c b/src/send_suback.c index 20eeb270..49daeebc 100644 --- a/src/send_suback.c +++ b/src/send_suback.c @@ -28,7 +28,7 @@ int send__suback(struct mosquitto *context, uint16_t mid, uint32_t payloadlen, c { struct mosquitto__packet *packet = NULL; int rc; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; int proplen, varbytes; log__printf(NULL, MOSQ_LOG_DEBUG, "Sending SUBACK to %s", context->id); diff --git a/src/send_unsuback.c b/src/send_unsuback.c index e48b6547..59fc50a3 100644 --- a/src/send_unsuback.c +++ b/src/send_unsuback.c @@ -25,7 +25,7 @@ Contributors: #include "property_mosq.h" -int send__unsuback(struct mosquitto *mosq, uint16_t mid, const struct mqtt5__property *properties) +int send__unsuback(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties) { struct mosquitto__packet *packet = NULL; int rc; diff --git a/test/unit/property_read.c b/test/unit/property_read.c index f124ae21..8d9c4433 100644 --- a/test/unit/property_read.c +++ b/test/unit/property_read.c @@ -14,7 +14,7 @@ static void byte_prop_read_helper( uint8_t value_expected) { struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; memset(&packet, 0, sizeof(struct mosquitto__packet)); @@ -70,7 +70,7 @@ static void int32_prop_read_helper( uint32_t value_expected) { struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; memset(&packet, 0, sizeof(struct mosquitto__packet)); @@ -120,7 +120,7 @@ static void int16_prop_read_helper( uint16_t value_expected) { struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; memset(&packet, 0, sizeof(struct mosquitto__packet)); @@ -165,7 +165,7 @@ static void string_prop_read_helper( const char *value_expected) { struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; memset(&packet, 0, sizeof(struct mosquitto__packet)); @@ -230,7 +230,7 @@ static void binary_prop_read_helper( int len_expected) { struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; memset(&packet, 0, sizeof(struct mosquitto__packet)); @@ -279,7 +279,7 @@ static void string_pair_prop_read_helper( bool expect_multiple) { struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; memset(&packet, 0, sizeof(struct mosquitto__packet)); @@ -314,7 +314,7 @@ static void varint_prop_read_helper( uint32_t value_expected) { struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; memset(&packet, 0, sizeof(struct mosquitto__packet)); @@ -340,7 +340,7 @@ static void packet_helper_reason_string_user_property(int command) MQTT_PROP_USER_PROPERTY, 0, 4, 'n', 'a', 'm', 'e', 0, 5, 'v', 'a', 'l', 'u', 'e'}; struct mosquitto__packet packet; - struct mqtt5__property *properties, *p; + mosquitto_property *properties, *p; int rc; memset(&packet, 0, sizeof(struct mosquitto__packet)); @@ -378,7 +378,7 @@ static void packet_helper_reason_string_user_property(int command) static void TEST_no_properties(void) { struct mosquitto__packet packet; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; uint8_t payload[5]; int rc; @@ -395,7 +395,7 @@ static void TEST_no_properties(void) static void TEST_truncated(void) { struct mosquitto__packet packet; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; uint8_t payload[5]; int rc; @@ -440,7 +440,7 @@ static void TEST_truncated(void) static void TEST_invalid_property_id(void) { struct mosquitto__packet packet; - struct mqtt5__property *properties = NULL; + mosquitto_property *properties = NULL; uint8_t payload[5]; int rc; @@ -1209,7 +1209,7 @@ static void TEST_packet_connect(void) MQTT_PROP_AUTHENTICATION_DATA, 0x00, 0x02, 1, 2}; struct mosquitto__packet packet; - struct mqtt5__property *properties, *p; + mosquitto_property *properties, *p; int rc; payload[0] = sizeof(payload)-1; @@ -1298,7 +1298,7 @@ static void TEST_packet_connack(void) MQTT_PROP_AUTHENTICATION_DATA, 0x00, 0x02, 1, 2}; struct mosquitto__packet packet; - struct mqtt5__property *properties, *p; + mosquitto_property *properties, *p; int rc; payload[0] = sizeof(payload)-1; @@ -1422,7 +1422,7 @@ static void TEST_packet_publish(void) MQTT_PROP_CONTENT_TYPE, 0, 5, 'e', 'm', 'p', 't', 'y'}; struct mosquitto__packet packet; - struct mqtt5__property *properties, *p; + mosquitto_property *properties, *p; int rc; payload[0] = sizeof(payload)-1; @@ -1512,7 +1512,7 @@ static void TEST_packet_subscribe(void) MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 0x04}; struct mosquitto__packet packet; - struct mqtt5__property *properties, *p; + mosquitto_property *properties, *p; int rc; payload[0] = sizeof(payload)-1; @@ -1552,7 +1552,7 @@ static void TEST_packet_unsubscribe(void) MQTT_PROP_USER_PROPERTY, 0, 4, 'n', 'a', 'm', 'e', 0, 5, 'v', 'a', 'l', 'u', 'e'}; struct mosquitto__packet packet; - struct mqtt5__property *properties, *p; + mosquitto_property *properties, *p; int rc; payload[0] = sizeof(payload)-1; @@ -1588,7 +1588,7 @@ static void TEST_packet_disconnect(void) MQTT_PROP_USER_PROPERTY, 0, 4, 'n', 'a', 'm', 'e', 0, 5, 'v', 'a', 'l', 'u', 'e'}; struct mosquitto__packet packet; - struct mqtt5__property *properties, *p; + mosquitto_property *properties, *p; int rc; payload[0] = sizeof(payload)-1; @@ -1632,7 +1632,7 @@ static void TEST_packet_auth(void) MQTT_PROP_USER_PROPERTY, 0, 4, 'n', 'a', 'm', 'e', 0, 5, 'v', 'a', 'l', 'u', 'e'}; struct mosquitto__packet packet; - struct mqtt5__property *properties, *p; + mosquitto_property *properties, *p; int rc; payload[0] = sizeof(payload)-1; diff --git a/test/unit/property_write.c b/test/unit/property_write.c index 00533539..6cc341ce 100644 --- a/test/unit/property_write.c +++ b/test/unit/property_write.c @@ -12,12 +12,12 @@ static void byte_prop_write_helper( int identifier, uint8_t value_expected) { - struct mqtt5__property property; + mosquitto_property property; struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; - memset(&property, 0, sizeof(struct mqtt5__property)); + memset(&property, 0, sizeof(mosquitto_property)); property.identifier = identifier; property.value.i8 = value_expected; @@ -52,12 +52,12 @@ static void int32_prop_write_helper( int identifier, uint32_t value_expected) { - struct mqtt5__property property; + mosquitto_property property; struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; - memset(&property, 0, sizeof(struct mqtt5__property)); + memset(&property, 0, sizeof(mosquitto_property)); property.identifier = identifier; property.value.i32 = value_expected; @@ -92,12 +92,12 @@ static void int16_prop_write_helper( int identifier, uint16_t value_expected) { - struct mqtt5__property property; + mosquitto_property property; struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; - memset(&property, 0, sizeof(struct mqtt5__property)); + memset(&property, 0, sizeof(mosquitto_property)); property.identifier = identifier; property.value.i16 = value_expected; @@ -131,12 +131,12 @@ static void string_prop_write_helper( int identifier, const char *value_expected) { - struct mqtt5__property property; + mosquitto_property property; struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; - memset(&property, 0, sizeof(struct mqtt5__property)); + memset(&property, 0, sizeof(mosquitto_property)); property.identifier = identifier; property.value.s.v = strdup(value_expected); @@ -175,12 +175,12 @@ static void binary_prop_write_helper( const uint8_t *value_expected, int len_expected) { - struct mqtt5__property property; + mosquitto_property property; struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; - memset(&property, 0, sizeof(struct mqtt5__property)); + memset(&property, 0, sizeof(mosquitto_property)); property.identifier = identifier; property.value.bin.v = malloc(len_expected); @@ -219,12 +219,12 @@ static void string_pair_prop_write_helper( const char *value_expected, bool expect_multiple) { - struct mqtt5__property property; + mosquitto_property property; struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; - memset(&property, 0, sizeof(struct mqtt5__property)); + memset(&property, 0, sizeof(mosquitto_property)); property.identifier = identifier; property.value.s.v = strdup(value_expected); @@ -269,12 +269,12 @@ static void varint_prop_write_helper( int identifier, uint32_t value_expected) { - struct mqtt5__property property; + mosquitto_property property; struct mosquitto__packet packet; - struct mqtt5__property *properties; + mosquitto_property *properties; int rc; - memset(&property, 0, sizeof(struct mqtt5__property)); + memset(&property, 0, sizeof(mosquitto_property)); property.identifier = identifier; property.value.varint = value_expected; @@ -316,12 +316,12 @@ static void varint_prop_write_helper( static void TEST_bad_identifier(void) { - struct mqtt5__property property; + mosquitto_property property; struct mosquitto__packet packet; uint8_t payload[10]; int rc; - memset(&property, 0, sizeof(struct mqtt5__property)); + memset(&property, 0, sizeof(mosquitto_property)); memset(&packet, 0, sizeof(struct mosquitto__packet)); property.identifier = 0xFFFF; packet.packet_length = 10;