Skip to content

Commit

Permalink
private struct mqtt5__property -> public mosquitto_property.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Nov 1, 2018
1 parent 80f526a commit f77c1ca
Show file tree
Hide file tree
Showing 31 changed files with 118 additions and 118 deletions.
2 changes: 1 addition & 1 deletion lib/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ and the Eclipse Distribution License is available at
#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);


Expand Down
2 changes: 1 addition & 1 deletion lib/handle_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/handle_connack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/handle_pubackcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/handle_publish.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion lib/handle_pubrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/handle_pubrel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion lib/handle_suback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/handle_unsuback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/mosquitto_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
60 changes: 30 additions & 30 deletions lib/property_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ and the Eclipse Distribution License is available at
#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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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){
Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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){
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions lib/property_mosq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/send_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ and the Eclipse Distribution License is available at
#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;
Expand Down
2 changes: 1 addition & 1 deletion lib/send_disconnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ and the Eclipse Distribution License is available at
#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;
Expand Down
2 changes: 1 addition & 1 deletion lib/send_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions lib/send_mosq.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ and the Eclipse Distribution License is available at
#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
Loading

0 comments on commit f77c1ca

Please sign in to comment.