diff --git a/config.h b/config.h index 83d4adb0..280b78d7 100644 --- a/config.h +++ b/config.h @@ -88,7 +88,7 @@ #endif #define WS_IS_LWS 1 -#define WS_IS_WSLAY 2 +#define WS_IS_BUILTIN 2 #ifdef WITH_BROKER # ifdef __GNUC__ diff --git a/lib/http_client.c b/lib/http_client.c index 5b74dcdf..c4a32a58 100644 --- a/lib/http_client.c +++ b/lib/http_client.c @@ -26,6 +26,7 @@ Contributors: #include "mosquitto_internal.h" #include "base64_mosq.h" +#include "http_client.h" #include "memory_mosq.h" #include "mqtt_protocol.h" #include "net_mosq.h" diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h index 5db31bc4..680e879b 100644 --- a/lib/mosquitto_internal.h +++ b/lib/mosquitto_internal.h @@ -243,7 +243,7 @@ struct mosquitto_msg_data{ #define WS_PING 0x09 #define WS_PONG 0x0A -#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN +#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN struct ws_data{ struct mosquitto__packet *out_packet; char *http_path; @@ -281,7 +281,7 @@ struct mosquitto { struct gaicb *adns; /* For getaddrinfo_a */ #endif uint64_t last_cmsg_id; -#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN +#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN struct ws_data wsd; #endif enum mosquitto__protocol protocol; diff --git a/lib/net_ws.c b/lib/net_ws.c index c13f9082..e645f722 100644 --- a/lib/net_ws.c +++ b/lib/net_ws.c @@ -204,7 +204,7 @@ static ssize_t read_ws_payloadlen_extended(struct mosquitto *mosq) } -ssize_t read_ws_mask(struct mosquitto *mosq) +static ssize_t read_ws_mask(struct mosquitto *mosq) { ssize_t len; diff --git a/lib/options.c b/lib/options.c index bbf190ff..f6fdd77b 100644 --- a/lib/options.c +++ b/lib/options.c @@ -504,7 +504,7 @@ int mosquitto_int_option(struct mosquitto *mosq, enum mosq_opt_t option, int val break; case MOSQ_OPT_TRANSPORT: -#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN +#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN if(value == mosq_t_tcp || value == mosq_t_ws){ mosq->transport = (uint8_t)value; }else{ @@ -516,7 +516,7 @@ int mosquitto_int_option(struct mosquitto *mosq, enum mosq_opt_t option, int val break; case MOSQ_OPT_HTTP_HEADER_SIZE: -#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN +#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN if(value < 100){ /* arbitrary limit */ return MOSQ_ERR_INVAL; }else if(mosq->http_request){ diff --git a/plugins/common/plugin_common.c b/plugins/common/plugin_common.c index 198edc43..f6ad3460 100644 --- a/plugins/common/plugin_common.c +++ b/plugins/common/plugin_common.c @@ -1,3 +1,5 @@ +#include "config.h" + #include "plugin_common.h" #include "json_help.h" #include diff --git a/src/context.c b/src/context.c index 1aad869b..75883a19 100644 --- a/src/context.c +++ b/src/context.c @@ -224,7 +224,7 @@ void context__disconnect(struct mosquitto *context) return; } -#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN +#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN if(context->transport == mosq_t_ws){ uint8_t buf[4] = {0x88, 0x02, 0x03, context->wsd.disconnect_reason}; /* Send the disconnect reason, but don't care if it fails */ diff --git a/src/loop.c b/src/loop.c index 51f0acc1..a8b9ce0c 100644 --- a/src/loop.c +++ b/src/loop.c @@ -57,7 +57,7 @@ Contributors: extern int g_run; -#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_WEBSOCKETS && LWS_LIBRARY_VERSION_NUMBER == 3002000 +#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_LWS && LWS_LIBRARY_VERSION_NUMBER == 3002000 void lws__sul_callback(struct lws_sorted_usec_list *l) { } @@ -175,7 +175,7 @@ int mosquitto_main_loop(struct mosquitto__listener_sock *listensock, int listens int rc; -#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_WEBSOCKETS && LWS_LIBRARY_VERSION_NUMBER == 3002000 +#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_LWS && LWS_LIBRARY_VERSION_NUMBER == 3002000 memset(&sul, 0, sizeof(struct lws_sorted_usec_list)); #endif diff --git a/src/mosquitto_broker_internal.h b/src/mosquitto_broker_internal.h index f1e0b2c3..fb864c6a 100644 --- a/src/mosquitto_broker_internal.h +++ b/src/mosquitto_broker_internal.h @@ -977,7 +977,6 @@ int http__context_init(struct mosquitto *context); int http__context_cleanup(struct mosquitto *context); int http__read(struct mosquitto *context); int http__write(struct mosquitto *context); -void ws__context_init(struct mosquitto *context); #endif void do_disconnect(struct mosquitto *context, int reason); diff --git a/src/plugin_public.c b/src/plugin_public.c index 0da33858..1568911b 100644 --- a/src/plugin_public.c +++ b/src/plugin_public.c @@ -323,6 +323,7 @@ BROKER_EXPORT int mosquitto_set_clientid(struct mosquitto *client, const char *c struct mosquitto *found_client; char *id_dup; bool in_by_id; + int clientid_len; if(!client || !clientid) return MOSQ_ERR_INVAL; @@ -343,7 +344,7 @@ BROKER_EXPORT int mosquitto_set_clientid(struct mosquitto *client, const char *c } } - int clientid_len = (int)strlen(clientid); + clientid_len = (int)strlen(clientid); if(mosquitto_validate_utf8(clientid, clientid_len)){ return MOSQ_ERR_INVAL; } @@ -601,7 +602,7 @@ BROKER_EXPORT int mosquitto_persist_client_delete(const char *client_id) } -struct mosquitto_base_msg *find_store_msg(uint64_t store_id) +static struct mosquitto_base_msg *find_store_msg(uint64_t store_id) { struct mosquitto_base_msg *base_msg; diff --git a/src/sys_tree.c b/src/sys_tree.c index 314c80b5..599f5f38 100644 --- a/src/sys_tree.c +++ b/src/sys_tree.c @@ -397,7 +397,7 @@ void sys_tree__update(void) if(out_packet_count != g_out_packet_count){ out_packet_count = g_out_packet_count; - len = (uint32_t)snprintf(buf, BUFLEN, "%llu", out_packet_count); + len = (uint32_t)snprintf(buf, BUFLEN, "%lu", out_packet_count); db__messages_easy_queue(NULL, "$SYS/broker/packet/out/count", SYS_TREE_QOS, len, buf, 1, 60, NULL); }