diff --git a/client/client_shared.c b/client/client_shared.c index fb1ba310..13972770 100644 --- a/client/client_shared.c +++ b/client/client_shared.c @@ -944,7 +944,7 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg) mosquitto_opts_set(mosq, MOSQ_OPT_PROTOCOL_VERSION, &(cfg->protocol_version)); - if(cfg->will_topic && mosquitto_will_set_with_properties(mosq, cfg->will_topic, + if(cfg->will_topic && mosquitto_will_set_v5(mosq, cfg->will_topic, cfg->will_payloadlen, cfg->will_payload, cfg->will_qos, cfg->will_retain, cfg->will_props)){ @@ -1058,10 +1058,10 @@ int client_connect(struct mosquitto *mosq, struct mosq_config *cfg) if(cfg->use_srv){ rc = mosquitto_connect_srv(mosq, cfg->host, cfg->keepalive, cfg->bind_address); }else{ - rc = mosquitto_connect_bind_with_properties(mosq, cfg->host, port, cfg->keepalive, cfg->bind_address, cfg->connect_props); + rc = mosquitto_connect_bind_v5(mosq, cfg->host, port, cfg->keepalive, cfg->bind_address, cfg->connect_props); } #else - rc = mosquitto_connect_bind_with_properties(mosq, cfg->host, port, cfg->keepalive, cfg->bind_address, cfg->connect_props); + rc = mosquitto_connect_bind_v5(mosq, cfg->host, port, cfg->keepalive, cfg->bind_address, cfg->connect_props); #endif if(rc>0){ if(!cfg->quiet){ diff --git a/client/pub_client.c b/client/pub_client.c index 80609f84..139bb3aa 100644 --- a/client/pub_client.c +++ b/client/pub_client.c @@ -40,10 +40,10 @@ static bool first_publish = true; int my_publish(struct mosquitto *mosq, int *mid, const char *topic, int payloadlen, void *payload, int qos, bool retain) { if(cfg.protocol_version == MQTT_PROTOCOL_V5 && cfg.have_topic_alias && first_publish == false){ - return mosquitto_publish_with_properties(mosq, mid, NULL, payloadlen, payload, qos, retain, cfg.publish_props); + return mosquitto_publish_v5(mosq, mid, NULL, payloadlen, payload, qos, retain, cfg.publish_props); }else{ first_publish = false; - return mosquitto_publish_with_properties(mosq, mid, topic, payloadlen, payload, qos, retain, cfg.publish_props); + return mosquitto_publish_v5(mosq, mid, topic, payloadlen, payload, qos, retain, cfg.publish_props); } } @@ -86,7 +86,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result) break; } } - mosquitto_disconnect_with_properties(mosq, 0, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props); } }else{ if(result && !cfg.quiet){ diff --git a/client/pub_shared.c b/client/pub_shared.c index bcfc2b53..9f10d5ec 100644 --- a/client/pub_shared.c +++ b/client/pub_shared.c @@ -57,11 +57,11 @@ void my_publish_callback(struct mosquitto *mosq, void *obj, int mid) last_mid_sent = mid; if(cfg.pub_mode == MSGMODE_STDIN_LINE){ if(mid == last_mid){ - mosquitto_disconnect_with_properties(mosq, 0, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props); disconnect_sent = true; } }else if(disconnect_sent == false){ - mosquitto_disconnect_with_properties(mosq, 0, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props); disconnect_sent = true; } } @@ -184,7 +184,7 @@ int pub_shared_loop(struct mosquitto *mosq) rc2 = my_publish(mosq, &mid_sent, cfg.topic, buf_len_actual-1, buf, cfg.qos, cfg.retain); if(rc2){ if(!cfg.quiet) fprintf(stderr, "Error: Publish returned %d, disconnecting.\n", rc2); - mosquitto_disconnect_with_properties(mosq, MQTT_RC_DISCONNECT_WITH_WILL_MSG, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, MQTT_RC_DISCONNECT_WITH_WILL_MSG, cfg.disconnect_props); } break; }else{ @@ -202,7 +202,7 @@ int pub_shared_loop(struct mosquitto *mosq) if(feof(stdin)){ if(last_mid == -1){ /* Empty file */ - mosquitto_disconnect_with_properties(mosq, 0, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props); disconnect_sent = true; status = STATUS_DISCONNECTING; }else{ @@ -212,7 +212,7 @@ int pub_shared_loop(struct mosquitto *mosq) } }else if(status == STATUS_WAITING){ if(last_mid_sent == last_mid && disconnect_sent == false){ - mosquitto_disconnect_with_properties(mosq, 0, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props); disconnect_sent = true; } #ifdef WIN32 diff --git a/client/sub_client.c b/client/sub_client.c index 36ec4a0c..cd297b0b 100644 --- a/client/sub_client.c +++ b/client/sub_client.c @@ -45,7 +45,7 @@ void my_signal_handler(int signum) { if(signum == SIGALRM){ process_messages = false; - mosquitto_disconnect_with_properties(mosq, MQTT_RC_DISCONNECT_WITH_WILL_MSG, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, MQTT_RC_DISCONNECT_WITH_WILL_MSG, cfg.disconnect_props); } } #endif @@ -62,7 +62,7 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit if(cfg.retained_only && !message->retain && process_messages){ process_messages = false; - mosquitto_disconnect_with_properties(mosq, 0, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props); return; } @@ -80,7 +80,7 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit msg_count++; if(cfg.msg_count == msg_count){ process_messages = false; - mosquitto_disconnect_with_properties(mosq, 0, cfg.disconnect_props); + mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props); } } } @@ -93,7 +93,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag mosquitto_subscribe_multiple(mosq, NULL, cfg.topic_count, cfg.topics, cfg.qos, cfg.subscribe_props); for(i=0; i by adding the bind_address parameter. Use this function @@ -491,7 +491,7 @@ libmosq_EXPORT int mosquitto_connect_bind(struct mosquitto *mosq, const char *ho * See Also: * , , */ -libmosq_EXPORT int mosquitto_connect_bind_with_properties(struct mosquitto *mosq, const char *host, int port, int keepalive, const char *bind_address, const mosquitto_property *properties); +libmosq_EXPORT int mosquitto_connect_bind_v5(struct mosquitto *mosq, const char *host, int port, int keepalive, const char *bind_address, const mosquitto_property *properties); /* * Function: mosquitto_connect_async @@ -675,7 +675,7 @@ libmosq_EXPORT int mosquitto_reconnect_async(struct mosquitto *mosq); libmosq_EXPORT int mosquitto_disconnect(struct mosquitto *mosq); /* - * Function: mosquitto_disconnect_with_properties + * Function: mosquitto_disconnect_v5 * * Disconnect from the broker, with attached MQTT properties. * @@ -695,7 +695,7 @@ libmosq_EXPORT int mosquitto_disconnect(struct mosquitto *mosq); * MOSQ_ERR_DUPLICATE_PROPERTY - if a property is duplicated where it is forbidden. * MOSQ_ERR_PROTOCOL - if any property is invalid for use with DISCONNECT. */ -libmosq_EXPORT int mosquitto_disconnect_with_properties(struct mosquitto *mosq, int reason_code, const mosquitto_property *properties); +libmosq_EXPORT int mosquitto_disconnect_v5(struct mosquitto *mosq, int reason_code, const mosquitto_property *properties); /* ====================================================================== @@ -743,7 +743,7 @@ libmosq_EXPORT int mosquitto_publish(struct mosquitto *mosq, int *mid, const cha /* - * Function: mosquitto_publish_with_properties + * Function: mosquitto_publish_v5 * * Publish a message on a given topic, with attached MQTT properties. * @@ -784,7 +784,7 @@ libmosq_EXPORT int mosquitto_publish(struct mosquitto *mosq, int *mid, const cha * MOSQ_ERR_DUPLICATE_PROPERTY - if a property is duplicated where it is forbidden. * MOSQ_ERR_PROTOCOL - if any property is invalid for use with PUBLISH. */ -libmosq_EXPORT int mosquitto_publish_with_properties( +libmosq_EXPORT int mosquitto_publish_v5( struct mosquitto *mosq, int *mid, const char *topic, @@ -819,7 +819,7 @@ libmosq_EXPORT int mosquitto_publish_with_properties( libmosq_EXPORT int mosquitto_subscribe(struct mosquitto *mosq, int *mid, const char *sub, int qos); /* - * Function: mosquitto_subscribe_with_properties + * Function: mosquitto_subscribe_v5 * * Subscribe to a topic, with attached MQTT properties. * @@ -849,7 +849,7 @@ libmosq_EXPORT int mosquitto_subscribe(struct mosquitto *mosq, int *mid, const c * MOSQ_ERR_DUPLICATE_PROPERTY - if a property is duplicated where it is forbidden. * MOSQ_ERR_PROTOCOL - if any property is invalid for use with SUBSCRIBE. */ -libmosq_EXPORT int mosquitto_subscribe_with_properties(struct mosquitto *mosq, int *mid, const char *sub, int qos, const mosquitto_property *properties); +libmosq_EXPORT int mosquitto_subscribe_v5(struct mosquitto *mosq, int *mid, const char *sub, int qos, const mosquitto_property *properties); /* * Function: mosquitto_subscribe_multiple @@ -904,7 +904,7 @@ int mosquitto_subscribe_multiple(struct mosquitto *mosq, int *mid, int sub_count libmosq_EXPORT int mosquitto_unsubscribe(struct mosquitto *mosq, int *mid, const char *sub); /* - * Function: mosquitto_unsubscribe_with_properties + * Function: mosquitto_unsubscribe_v5 * * Unsubscribe from a topic, with attached MQTT properties. * @@ -927,7 +927,7 @@ libmosq_EXPORT int mosquitto_unsubscribe(struct mosquitto *mosq, int *mid, const * MOSQ_ERR_DUPLICATE_PROPERTY - if a property is duplicated where it is forbidden. * MOSQ_ERR_PROTOCOL - if any property is invalid for use with UNSUBSCRIBE. */ -libmosq_EXPORT int mosquitto_unsubscribe_with_properties(struct mosquitto *mosq, int *mid, const char *sub, const mosquitto_property *properties); +libmosq_EXPORT int mosquitto_unsubscribe_v5(struct mosquitto *mosq, int *mid, const char *sub, const mosquitto_property *properties); /* ====================================================================== diff --git a/lib/options.c b/lib/options.c index 4a66f309..7f18993e 100644 --- a/lib/options.c +++ b/lib/options.c @@ -32,11 +32,11 @@ Contributors: int mosquitto_will_set(struct mosquitto *mosq, const char *topic, int payloadlen, const void *payload, int qos, bool retain) { - return mosquitto_will_set_with_properties(mosq, topic, payloadlen, payload, qos, retain, NULL); + return mosquitto_will_set_v5(mosq, topic, payloadlen, payload, qos, retain, NULL); } -int mosquitto_will_set_with_properties(struct mosquitto *mosq, const char *topic, int payloadlen, const void *payload, int qos, bool retain, mosquitto_property *properties) +int mosquitto_will_set_v5(struct mosquitto *mosq, const char *topic, int payloadlen, const void *payload, int qos, bool retain, mosquitto_property *properties) { int rc; diff --git a/test/lib/c/03-request-response-1.c b/test/lib/c/03-request-response-1.c index 5c7b5bf5..1cdd4079 100644 --- a/test/lib/c/03-request-response-1.c +++ b/test/lib/c/03-request-response-1.c @@ -21,7 +21,7 @@ void on_subscribe(struct mosquitto *mosq, void *obj, int mid, int qos_count, con { mosquitto_property *props = NULL; mosquitto_property_add_string(&props, MQTT_PROP_RESPONSE_TOPIC, "response/topic"); - mosquitto_publish_with_properties(mosq, NULL, "request/topic", 6, "action", 0, 0, props); + mosquitto_publish_v5(mosq, NULL, "request/topic", 6, "action", 0, 0, props); mosquitto_property_free_all(&props); } diff --git a/test/lib/c/03-request-response-2.c b/test/lib/c/03-request-response-2.c index 8763496f..0f16f1ef 100644 --- a/test/lib/c/03-request-response-2.c +++ b/test/lib/c/03-request-response-2.c @@ -28,7 +28,7 @@ void on_message_v5(struct mosquitto *mosq, void *obj, const struct mosquitto_mes if(p_resp){ p_corr = mosquitto_property_get_property(props, MQTT_PROP_CORRELATION_DATA, false); if(mosquitto_property_read_string(p_resp, &resp_topic) == MOSQ_ERR_SUCCESS){ - rc = mosquitto_publish_with_properties(mosq, NULL, resp_topic, strlen("a response"), "a response", 0, false, p_corr); + rc = mosquitto_publish_v5(mosq, NULL, resp_topic, strlen("a response"), "a response", 0, false, p_corr); free(resp_topic); } } diff --git a/test/lib/c/03-request-response-correlation-1.c b/test/lib/c/03-request-response-correlation-1.c index 77245256..35190af5 100644 --- a/test/lib/c/03-request-response-correlation-1.c +++ b/test/lib/c/03-request-response-correlation-1.c @@ -22,7 +22,7 @@ void on_subscribe(struct mosquitto *mosq, void *obj, int mid, int qos_count, con mosquitto_property *props = NULL; mosquitto_property_add_string(&props, MQTT_PROP_RESPONSE_TOPIC, "response/topic"); mosquitto_property_add_binary(&props, MQTT_PROP_CORRELATION_DATA, "corridor", 8); - mosquitto_publish_with_properties(mosq, NULL, "request/topic", 6, "action", 0, 0, props); + mosquitto_publish_v5(mosq, NULL, "request/topic", 6, "action", 0, 0, props); mosquitto_property_free_all(&props); } diff --git a/test/lib/c/11-prop-send-payload-format.c b/test/lib/c/11-prop-send-payload-format.c index 198ef72f..516d86d4 100644 --- a/test/lib/c/11-prop-send-payload-format.c +++ b/test/lib/c/11-prop-send-payload-format.c @@ -17,7 +17,7 @@ void on_connect(struct mosquitto *mosq, void *obj, int rc) exit(1); }else{ rc2 = mosquitto_property_add_byte(&proplist, MQTT_PROP_PAYLOAD_FORMAT_INDICATOR, 1); - mosquitto_publish_with_properties(mosq, &sent_mid, "prop/qos0", strlen("message"), "message", 0, false, proplist); + mosquitto_publish_v5(mosq, &sent_mid, "prop/qos0", strlen("message"), "message", 0, false, proplist); } }