mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-19 22:37:46 +08:00
private struct mqtt5__property -> public mosquitto_property.
This commit is contained in:
+1
-1
@@ -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);
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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){
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
+30
-30
@@ -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;
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+6
-6
@@ -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
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
+1
-1
@@ -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){
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+18
-18
@@ -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;
|
||||
|
||||
+23
-23
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user