1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00
Add -Wextra (with -Wno-unused-parameter) to unix builds in addition to
-Wall -Werror.

This can successfully build everything in Sai without warnings / errors.
This commit is contained in:
Andy Green 2021-06-28 11:51:44 +01:00
parent 5432e8ae7b
commit fabe78d222
86 changed files with 200 additions and 197 deletions

View file

@ -769,7 +769,7 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG)
# always warn all and generate debug info
if (UNIX AND NOT LWS_PLAT_FREERTOS)
set(CMAKE_C_FLAGS "-Wall -Wconversion -Wsign-compare -Wstrict-aliasing ${VISIBILITY_FLAG} -Wundef ${GCOV_FLAGS} ${CMAKE_C_FLAGS} ${ASAN_FLAGS}" )
set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wconversion -Wsign-compare -Wstrict-aliasing ${VISIBILITY_FLAG} -Wundef ${GCOV_FLAGS} ${CMAKE_C_FLAGS} ${ASAN_FLAGS}" )
else()
set(CMAKE_C_FLAGS "-Wall -Wsign-compare ${VISIBILITY_FLAG} ${GCOV_FLAGS} ${CMAKE_C_FLAGS}" )
endif()

View file

@ -1308,13 +1308,7 @@ struct lws_http_mount {
/* Add new things just above here ---^
* This is part of the ABI, don't needlessly break compatibility
*
* The below is to ensure later library versions with new
* members added above will see 0 (default) even if the app
* was not built against the newer headers.
*/
void *_unused[2]; /**< dummy */
};
///@}

View file

@ -86,6 +86,8 @@ struct lws_protocols {
* This is part of the ABI, don't needlessly break compatibility */
};
#define LWS_PROTOCOL_LIST_TERM { NULL, NULL, 0, 0, 0, NULL, 0 }
/**
* lws_vhost_name_to_protocol() - get vhost's protocol object from its name
*

View file

@ -184,8 +184,9 @@ __lws_adopt_descriptor_vhost1(struct lws_vhost *vh, lws_adoption_type type,
}
#if defined(LWS_WITH_SERVER)
if (new_wsi->role_ops)
if (new_wsi->role_ops) {
lws_metrics_tag_wsi_add(new_wsi, "role", new_wsi->role_ops->name);
}
#endif
lws_pt_unlock(pt);

View file

@ -433,8 +433,9 @@ ads_known:
*/
#if defined(LWS_WITH_SYS_METRICS)
if (wsi->cal_conn.mt)
if (wsi->cal_conn.mt) {
lws_metrics_caliper_report(wsi->cal_conn, METRES_NOGO);
}
lws_metrics_caliper_bind(wsi->cal_conn, wsi->a.context->mt_conn_tcp);
#endif

View file

@ -267,8 +267,9 @@ __lws_wsi_server_new(struct lws_vhost *vh, struct lws *parent_wsi,
}
#if defined(LWS_WITH_SERVER)
if (lwsi_role_server(parent_wsi))
if (lwsi_role_server(parent_wsi)) {
lws_metrics_caliper_bind(wsi->cal_conn, wsi->a.context->mth_srv);
}
#endif
h2n->highest_sid_opened = sid;

View file

@ -1074,8 +1074,7 @@ malformed:
const struct lws_protocols protocol_secstream_h1 = {
"lws-secstream-h1",
secstream_h1,
0,
0,
0, 0, 0, NULL, 0
};
/*
@ -1140,5 +1139,5 @@ const struct ss_pcols ss_pcol_h1 = {
"http/1.1",
&protocol_secstream_h1,
secstream_connect_munge_h1,
NULL
NULL, NULL
};

View file

@ -120,8 +120,7 @@ secstream_h2(struct lws *wsi, enum lws_callback_reasons reason, void *user,
const struct lws_protocols protocol_secstream_h2 = {
"lws-secstream-h2",
secstream_h2,
0,
0,
0, 0, 0, NULL, 0
};
/*

View file

@ -390,8 +390,7 @@ secstream_mqtt(struct lws *wsi, enum lws_callback_reasons reason, void *user,
const struct lws_protocols protocol_secstream_mqtt = {
"lws-secstream-mqtt",
secstream_mqtt,
0,
0,
0, 0, 0, NULL, 0
};
/*
* Munge connect info according to protocol-specific considerations... this
@ -575,5 +574,6 @@ const struct ss_pcols ss_pcol_mqtt = {
"MQTT",
"x-amzn-mqtt-ca", //"mqtt/3.1.1",
&protocol_secstream_mqtt,
secstream_connect_munge_mqtt
secstream_connect_munge_mqtt,
NULL, NULL
};

View file

@ -177,6 +177,7 @@ const struct lws_protocols protocol_secstream_raw = {
secstream_raw,
0,
0,
0, NULL, 0
};
const struct ss_pcols ss_pcol_raw = {
@ -184,5 +185,5 @@ const struct ss_pcols ss_pcol_raw = {
"",
&protocol_secstream_raw,
secstream_connect_munge_raw,
NULL
NULL, NULL
};

View file

@ -186,8 +186,7 @@ secstream_ws(struct lws *wsi, enum lws_callback_reasons reason, void *user,
const struct lws_protocols protocol_secstream_ws = {
"lws-secstream-ws",
secstream_ws,
0,
0,
0, 0, 0, NULL, 0
};
/*
* Munge connect info according to protocol-specific considerations... this
@ -238,5 +237,5 @@ secstream_connect_munge_ws(lws_ss_handle_t *h, char *buf, size_t len,
}
const struct ss_pcols ss_pcol_ws = {
"ws", "http/1.1", &protocol_secstream_ws, secstream_connect_munge_ws
"ws", "http/1.1", &protocol_secstream_ws, secstream_connect_munge_ws, 0, 0
};

View file

@ -833,8 +833,9 @@ _lws_ss_client_connect(lws_ss_handle_t *h, int is_retry, void *conn_if_sspc_onw)
#if defined(LWS_WITH_SYS_METRICS)
/* possibly already hanging connect retry... */
if (!h->cal_txn.mt)
if (!h->cal_txn.mt) {
lws_metrics_caliper_bind(h->cal_txn, h->context->mth_ss_conn);
}
lws_metrics_tag_add(&h->cal_txn.mtags_owner, "ss", h->policy->streamtype);
#endif

View file

@ -327,7 +327,7 @@ callback_async_dns(struct lws *wsi, enum lws_callback_reasons reason,
}
struct lws_protocols lws_async_dns_protocol = {
"lws-async-dns", callback_async_dns, 0, 0
"lws-async-dns", callback_async_dns, 0, 0, 0, NULL, 0
};
int

View file

@ -282,7 +282,7 @@ retry_conn:
}
struct lws_protocols lws_system_protocol_dhcpc4 =
{ "lws-dhcp4client", callback_dhcpc4, 0, 128, };
{ "lws-dhcp4client", callback_dhcpc4, 0, 128, 0, NULL, 0 };
void
lws_dhcpc4_retry_conn(struct lws_sorted_usec_list *sul)

View file

@ -306,5 +306,5 @@ lws_ntpc_trigger(struct lws_context *ctx)
}
struct lws_protocols lws_system_protocol_ntpc =
{ "lws-ntpclient", callback_ntpc, 0, 128, };
{ "lws-ntpclient", callback_ntpc, 0, 128, 0, NULL, 0 };

View file

@ -460,7 +460,7 @@ static const struct lws_jose_jwe_alg lws_gencrypto_jwe_alg_map[] = {
},
/* list terminator */
{ 0, 0, 0, 0, NULL, NULL }
{ 0, 0, 0, 0, NULL, NULL, 0, 0, 0 }
};
/*

View file

@ -92,7 +92,7 @@ static const oid_x509_ext_t oid_x509_ext[] = {
"Authority Key Identifier" },
LWS_MBEDTLS_OID_X509_EXT_AUTHORITY_KEY_IDENTIFIER,
},
{ { NULL, 0 }, 0 },
{ { NULL, 0, NULL, NULL }, 0 },
};
#define FN_OID_TYPED_FROM_ASN1( TYPE_T, NAME, LIST ) \

View file

@ -181,7 +181,8 @@ system_notify_cb(lws_state_manager_t *mgr, lws_state_notify_link_t *link,
int
main(int argc, const char **argv)
{
lws_state_notify_link_t notifier = { {0}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL },
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
int logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE;
struct lws_context_creation_info info;

View file

@ -24,9 +24,10 @@
#include "protocol_lws_minimal.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0},
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -26,7 +26,7 @@
static int interrupted;
static struct lws_protocols protocols[] = {
LWS_PLUGIN_PROTOCOL_MINIMAL_DBUS_WSPROXY,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
/*

View file

@ -130,7 +130,8 @@ static const struct lws_protocols protocols[] = {
static gpointer
t1_main (gpointer user_data)
{
lws_state_notify_link_t notifier = { {0}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL },
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
GMainContext *t1_mc = (GMainContext *)user_data;
struct lws_context_creation_info info;

View file

@ -106,10 +106,9 @@ static const struct lws_protocols protocols[] = {
{
"http",
callback_http,
0,
0,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
void sigint_handler(int sig)

View file

@ -158,13 +158,13 @@ static const struct lws_protocols protocols[] = {
{
"http",
callback_http,
0,
0,
0, 0, 0, NULL, 0
}, {
"lws-cpd-http",
callback_cpd_http
callback_cpd_http,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
void sigint_handler(int sig)

View file

@ -154,10 +154,9 @@ static const struct lws_protocols protocols[] = {
{
"http",
callback_http,
0,
0,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -128,10 +128,9 @@ static const struct lws_protocols protocols[] = {
{
"http",
callback_http,
0,
0,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -131,9 +131,9 @@ static const struct lws_protocols protocols[] = {
"http",
callback_http,
sizeof(struct pss),
0,
0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void
@ -235,7 +235,8 @@ system_notify_cb(lws_state_manager_t *mgr, lws_state_notify_link_t *link,
int main(int argc, const char **argv)
{
lws_state_notify_link_t notifier = { {0}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL },
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
struct lws_context_creation_info info;
struct lws_context *context;

View file

@ -132,10 +132,9 @@ static const struct lws_protocols protocols[] = {
{
"http",
callback_http,
0,
0,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -407,7 +407,8 @@ static lws_system_ops_t system_ops = {
int main(int argc, const char **argv)
{
lws_state_notify_link_t notifier = { {0}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL },
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
struct lws_context_creation_info info;
struct lws_context *context;

View file

@ -344,8 +344,8 @@ finished:
}
static const struct lws_protocols protocols[] = {
{ "http", callback_http, sizeof(struct pss), 0, },
{ NULL, NULL, 0, 0 }
{ "http", callback_http, sizeof(struct pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
#if defined(LWS_WITH_SYS_METRICS)
@ -512,7 +512,8 @@ stagger_cb(lws_sorted_usec_list_t *sul)
int main(int argc, const char **argv)
{
lws_state_notify_link_t notifier = { {0}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL },
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
struct lws_context_creation_info info;
unsigned long long start;

View file

@ -173,9 +173,9 @@ static const struct lws_protocols protocols[] = {
"http",
callback_http,
sizeof(struct pss),
0,
0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -199,10 +199,9 @@ static const struct lws_protocols protocols[] = {
{
"http",
callback_http,
0,
0,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void
@ -335,7 +334,8 @@ system_notify_cb(lws_state_manager_t *mgr, lws_state_notify_link_t *link,
int main(int argc, const char **argv)
{
lws_state_notify_link_t notifier = { {0}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL },
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
struct lws_context_creation_info info;
struct lws_context *context;

View file

@ -105,8 +105,8 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "http", callback_http, sizeof(struct pss), 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", callback_http, sizeof(struct pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static const struct lws_http_mount mount_dyn = {

View file

@ -23,7 +23,7 @@
static struct lws_protocols protocols[] = {
LWS_PLUGIN_PROTOCOL_DEADDROP,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};

View file

@ -216,8 +216,8 @@ callback_dynamic_http(struct lws *wsi, enum lws_callback_reasons reason,
}
static const struct lws_protocols defprot =
{ "defprot", lws_callback_http_dummy, 0, 0 }, protocol =
{ "http", callback_dynamic_http, sizeof(struct pss), 0 };
{ "defprot", lws_callback_http_dummy, 0, 0, 0, NULL, 0 }, protocol =
{ "http", callback_dynamic_http, sizeof(struct pss), 0, 0, NULL, 0 };
static const struct lws_protocols *pprotocols[] = { &defprot, &protocol, NULL };

View file

@ -29,12 +29,12 @@ static struct lws_context *context;
static struct lws_protocols protocols[] = {
/* first protocol must always be HTTP handler */
{ "http-only", lws_callback_http_dummy, 0, 0, },
{ "http-only", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_DUMB_INCREMENT,
LWS_PLUGIN_PROTOCOL_MIRROR,
LWS_PLUGIN_PROTOCOL_LWS_STATUS,
LWS_PLUGIN_PROTOCOL_POST_DEMO,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
/*
@ -59,8 +59,6 @@ static const struct lws_http_mount mount_ziptest_uncomm = {
LWSMPRO_FILE, /* origin points to a callback */
14, /* strlen("/ziptest"), ie length of the mountpoint */
NULL,
{ NULL, NULL } // sentinel
}, mount_ziptest = {
(struct lws_http_mount *)&mount_ziptest_uncomm, /* linked-list pointer to next*/
"/ziptest", /* mountpoint in URL namespace on this vhost */
@ -80,7 +78,6 @@ static const struct lws_http_mount mount_ziptest_uncomm = {
8, /* strlen("/ziptest"), ie length of the mountpoint */
NULL,
{ NULL, NULL } // sentinel
}, mount_post = {
(struct lws_http_mount *)&mount_ziptest, /* linked-list pointer to next*/
"/formtest", /* mountpoint in URL namespace on this vhost */
@ -100,7 +97,6 @@ static const struct lws_http_mount mount_ziptest_uncomm = {
9, /* strlen("/formtest"), ie length of the mountpoint */
NULL,
{ NULL, NULL } // sentinel
}, mount = {
/* .mount_next */ &mount_post, /* linked-list "next" */
/* .mountpoint */ "/", /* mountpoint URL */

View file

@ -126,8 +126,8 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason,
}
static const struct lws_protocols protocols[] = {
{ "httptest", callback_http, 0, 0, },
{ NULL, NULL, 0, 0 }
{ "httptest", callback_http, 0, 0, 0, NULL, 0},
LWS_PROTOCOL_LIST_TERM
};
static int

View file

@ -73,8 +73,8 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
}
static struct lws_protocols protocols[] = {
{ "http", callback_http, 0, 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", callback_http, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
/* default mount serves the URL space from ./mount-origin */

View file

@ -188,8 +188,8 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
}
static struct lws_protocols protocols[] = {
{ "http", callback_http, sizeof(struct pss), 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", callback_http, sizeof(struct pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
/* default mount serves the URL space from ./mount-origin */

View file

@ -137,8 +137,8 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
}
static struct lws_protocols protocols[] = {
{ "http", callback_http, sizeof(struct pss), 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", callback_http, sizeof(struct pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
/* default mount serves the URL space from ./mount-origin */

View file

@ -134,8 +134,8 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
}
static struct lws_protocols protocols[] = {
{ "http", callback_http, sizeof(struct pss), 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", callback_http, sizeof(struct pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
/* default mount serves the URL space from ./mount-origin */

View file

@ -21,7 +21,7 @@ static int interrupted;
static struct lws_protocols protocols[] = {
LWS_PLUGIN_PROTOCOL_FULLTEXT_DEMO,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static struct lws_protocol_vhost_options pvo_idx = {

View file

@ -101,8 +101,8 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
}
static struct lws_protocols protocols[] = {
{ "http", callback_http, sizeof(struct pss), 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", callback_http, sizeof(struct pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};

View file

@ -306,9 +306,9 @@ callback_sse(struct lws *wsi, enum lws_callback_reasons reason, void *user,
}
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "sse", callback_sse, sizeof(struct pss), 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
{ "sse", callback_sse, sizeof(struct pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
/* override the default mount for /sse in the URL space */

View file

@ -126,9 +126,9 @@ callback_sse(struct lws *wsi, enum lws_callback_reasons reason, void *user,
}
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "sse", callback_sse, sizeof(struct pss), 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
{ "sse", callback_sse, sizeof(struct pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
/* override the default mount for /sse in the URL space */

View file

@ -374,12 +374,13 @@ static const struct lws_protocols protocols[] = {
.callback = callback_mqtt,
.per_session_data_size = sizeof(struct pss)
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
int main(int argc, const char **argv)
{
lws_state_notify_link_t notifier = { {}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL },
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
struct lws_context_creation_info info;
struct lws_context *context;

View file

@ -296,12 +296,13 @@ static const struct lws_protocols protocols[] = {
.callback = callback_mqtt,
.per_session_data_size = sizeof(struct pss)
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
int main(int argc, const char **argv)
{
lws_state_notify_link_t notifier = { {}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL },
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
struct lws_context_creation_info info;
struct lws_context *context;

View file

@ -76,8 +76,8 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "raw-test", callback_raw_test, 0, 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "raw-test", callback_raw_test, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -127,8 +127,8 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "raw-test", callback_raw_test, 0, 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "raw-test", callback_raw_test, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -171,7 +171,7 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,
static struct lws_protocols protocols[] = {
{ "lws-audio-test", callback_raw_test, 0, 0 },
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -83,8 +83,8 @@ callback_raw_echo(struct lws *wsi, enum lws_callback_reasons reason, void *user,
}
static const struct lws_protocols protocols[] = {
{ "raw-echo", callback_raw_echo, sizeof(struct pss__raw_echo), 2048 },
{ NULL, NULL, 0, 0 }
{ "raw-echo", callback_raw_echo, sizeof(struct pss__raw_echo), 2048, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
void sigint_handler(int sig)

View file

@ -98,8 +98,8 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "raw-test", callback_raw_test, 0, 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "raw-test", callback_raw_test, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -128,8 +128,8 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "raw-test", callback_raw_test, 0, 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "raw-test", callback_raw_test, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
void sigint_handler(int sig)

View file

@ -28,7 +28,7 @@
static struct lws_protocols protocols[] = {
LWS_PLUGIN_PROTOCOL_RAW_PROXY,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static const struct lws_http_mount mount = {

View file

@ -22,7 +22,7 @@
static struct lws_protocols protocols[] = {
LWS_PLUGIN_PROTOCOL_RAW_PROXY,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -170,8 +170,8 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "raw-test", callback_raw_test, 0, 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "raw-test", callback_raw_test, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -100,8 +100,8 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "raw-test", callback_raw_test, sizeof(struct raw_pss), 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "raw-test", callback_raw_test, sizeof(struct raw_pss), 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -433,19 +433,22 @@ struct tests_seq {
"h1:80 just get 200",
"t_h1", 5 * LWS_US_PER_SEC, LWSSSCS_QOS_ACK_REMOTE,
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
{
"h1:443 just get 200",
"t_h1_tls", 5 * LWS_US_PER_SEC, LWSSSCS_QOS_ACK_REMOTE,
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
{
"h2:443 just get 200",
"t_h2_tls", 5 * LWS_US_PER_SEC, LWSSSCS_QOS_ACK_REMOTE,
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
/*
@ -458,19 +461,22 @@ struct tests_seq {
"h1:80 timeout after connection",
"d_h1", 5 * LWS_US_PER_SEC, LWSSSCS_TIMEOUT,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
{
"h1:443 timeout after connection",
"d_h1_tls", 5 * LWS_US_PER_SEC, LWSSSCS_TIMEOUT,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
{
"h2:443 timeout after connection",
"d_h2_tls", 5 * LWS_US_PER_SEC, LWSSSCS_TIMEOUT,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
/*
@ -482,19 +488,22 @@ struct tests_seq {
"h1:80 NXDOMAIN",
"nxd_h1", 65 * LWS_US_PER_SEC, LWSSSCS_UNREACHABLE,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
{
"h1:443 NXDOMAIN",
"nxd_h1_tls", 35 * LWS_US_PER_SEC, LWSSSCS_UNREACHABLE,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
{
"h2:443 NXDOMAIN",
"nxd_h2_tls", 35 * LWS_US_PER_SEC, LWSSSCS_UNREACHABLE,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE) |
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_ALL_RETRIES_FAILED)
(1 << LWSSSCS_TIMEOUT) | (1 << LWSSSCS_ALL_RETRIES_FAILED),
0
},
/*
@ -507,17 +516,20 @@ struct tests_seq {
{
"h1:80 NXDOMAIN exhaust retries",
"nxd_h1", 65 * LWS_US_PER_SEC, LWSSSCS_ALL_RETRIES_FAILED,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE)
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE),
0
},
{
"h1:443 NXDOMAIN exhaust retries",
"nxd_h1_tls", 65 * LWS_US_PER_SEC, LWSSSCS_ALL_RETRIES_FAILED,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE)
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE),
0
},
{
"h2:443 NXDOMAIN exhaust retries",
"nxd_h2_tls", 65 * LWS_US_PER_SEC, LWSSSCS_ALL_RETRIES_FAILED,
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE)
(1 << LWSSSCS_QOS_ACK_REMOTE) | (1 << LWSSSCS_QOS_NACK_REMOTE),
0
},
/*
@ -553,17 +565,20 @@ struct tests_seq {
{
"h1:badcert_hostname",
"badcert_hostname", 6 * LWS_US_PER_SEC, LWSSSCS_ALL_RETRIES_FAILED,
(1 << LWSSSCS_QOS_NACK_REMOTE)
(1 << LWSSSCS_QOS_NACK_REMOTE),
0
},
{
"h1:badcert_expired",
"badcert_expired", 6 * LWS_US_PER_SEC, LWSSSCS_ALL_RETRIES_FAILED,
(1 << LWSSSCS_QOS_NACK_REMOTE)
(1 << LWSSSCS_QOS_NACK_REMOTE),
0
},
{
"h1:badcert_selfsigned",
"badcert_selfsigned", 6 * LWS_US_PER_SEC, LWSSSCS_ALL_RETRIES_FAILED,
(1 << LWSSSCS_QOS_NACK_REMOTE)
(1 << LWSSSCS_QOS_NACK_REMOTE),
0
},
};

View file

@ -188,7 +188,8 @@ system_notify_cb(lws_state_manager_t *mgr, lws_state_notify_link_t *link,
int main(int argc, const char **argv)
{
lws_state_notify_link_t notifier = { {0}, system_notify_cb, "app" };
lws_state_notify_link_t notifier = { { NULL, NULL, NULL},
system_notify_cb, "app" };
lws_state_notify_link_t *na[] = { &notifier, NULL };
struct lws_context_creation_info info;

View file

@ -326,8 +326,8 @@ do_retry:
}
static const struct lws_protocols protocols[] = {
{ "lws-minimal-client", callback_minimal, 0, 0, },
{ NULL, NULL, 0, 0 }
{ "lws-minimal-client", callback_minimal, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -19,7 +19,7 @@
static struct lws_protocols protocols[] = {
LWS_PLUGIN_PROTOCOL_MINIMAL_CLIENT_ECHO,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static struct lws_context *context;

View file

@ -87,10 +87,9 @@ static const struct lws_protocols protocols[] = {
{
"lws-ping-test",
callback_minimal_pingtest,
0,
0,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -27,9 +27,9 @@
#include "protocol_lws_minimal_pmd_bulk.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL_PMD_BULK,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted, options;

View file

@ -60,10 +60,9 @@ static const struct lws_protocols protocols[] = {
{
"dumb-increment-protocol",
callback_dumb_increment,
0,
0,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -128,7 +128,7 @@ callback(struct lws *wsi, enum lws_callback_reasons reason,
static const struct lws_protocols protocols[] = {
{ "spam-rx-tx", callback, 4096, 4096, 0, NULL, 0 },
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -175,9 +175,9 @@ static const struct lws_protocols protocols[] = {
"lws-spam-test",
callback_minimal_spam,
sizeof(struct pss),
0,
0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static struct lws_protocol_vhost_options pvo = {

View file

@ -284,10 +284,9 @@ static const struct lws_protocols protocols[] = {
{
"lws-minimal-broker",
callback_minimal_broker,
0,
0,
0, 0, 0, NULL, 0
},
{ NULL, NULL, 0, 0 }
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -137,8 +137,8 @@ do_retry:
}
static const struct lws_protocols protocols[] = {
{ "lws-minimal-client", callback_minimal, 0, 0, },
{ NULL, NULL, 0, 0 }
{ "lws-minimal-client", callback_minimal, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static void

View file

@ -22,9 +22,9 @@
#include "protocol_lws_minimal.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -362,10 +362,10 @@ callback_proxy_raw_client(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "lws-ws-raw-ws", callback_proxy_ws_server, 0, 1024 },
{ "lws-ws-raw-raw", callback_proxy_raw_client, 0, 1024 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
{ "lws-ws-raw-ws", callback_proxy_ws_server, 0, 1024, 0, NULL, 0 },
{ "lws-ws-raw-raw", callback_proxy_raw_client, 0, 1024, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static const lws_retry_bo_t retry = {

View file

@ -19,7 +19,7 @@
static struct lws_protocols protocols[] = {
LWS_PLUGIN_PROTOCOL_MINIMAL_SERVER_ECHO,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted, port = 7681, options;

View file

@ -21,9 +21,9 @@
#include "protocol_lws_minimal_pmd_bulk.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL_PMD_BULK,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted, options;

View file

@ -21,9 +21,9 @@
#include "protocol_lws_minimal.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -21,9 +21,9 @@
#include "protocol_lws_minimal.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -22,9 +22,9 @@
#include "protocol_lws_minimal.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -33,9 +33,9 @@
#include "protocol_lws_minimal_threadpool.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -36,9 +36,9 @@
#include "protocol_lws_minimal.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static struct lws_context *context;

View file

@ -35,9 +35,9 @@
#define COUNT_THREADS 2
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static struct lws_context *context;

View file

@ -33,9 +33,9 @@
#include "protocol_lws_minimal.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static int interrupted;

View file

@ -48,9 +48,9 @@ callback_protocol(struct lws *wsi, enum lws_callback_reasons reason,
}
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "timer", callback_protocol, 0, 0 },
{ NULL, NULL, 0, 0 } /* terminator */
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0 },
{ "timer", callback_protocol, 0, 0, 0, NULL, 0 },
LWS_PROTOCOL_LIST_TERM
};
static const lws_retry_bo_t retry = {

View file

@ -22,9 +22,9 @@
#include "protocol_lws_minimal.c"
static struct lws_protocols protocols[] = {
{ "http", lws_callback_http_dummy, 0, 0 },
{ "http", lws_callback_http_dummy, 0, 0, 0, NULL, 0},
LWS_PLUGIN_PROTOCOL_MINIMAL,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
static const lws_retry_bo_t retry = {

View file

@ -174,6 +174,7 @@ LWS_VISIBLE const struct lws_protocols client_loopback_test_protocols[] = {
callback_client_loopback_test,
sizeof(struct per_session_data__client_loopback_test),
1024, /* rx buf size must be >= permessage-deflate rx size */
0, NULL, 0
},
};

View file

@ -1162,19 +1162,19 @@ LWS_VISIBLE const struct lws_protocols lws_openmetrics_export_protocols[] = {
"lws-openmetrics",
callback_lws_openmetrics_export,
sizeof(struct pss),
1024,
1024, 0, NULL, 0
},
{ /* for scraper via ws proxy: http export on listen socket */
"lws-openmetrics-prox-agg",
callback_lws_openmetrics_prox_agg,
sizeof(struct pss),
1024,
1024, 0, NULL, 0
},
{ /* metrics proxy server side: ws server for clients to connect to */
"lws-openmetrics-prox-server",
callback_lws_openmetrics_prox_server,
sizeof(struct pss),
1024,
1024, 0, NULL, 0
},
#endif
#if defined(LWS_WITH_CLIENT) && defined(LWS_ROLE_WS)
@ -1182,7 +1182,7 @@ LWS_VISIBLE const struct lws_protocols lws_openmetrics_export_protocols[] = {
"lws-openmetrics-prox-client",
callback_lws_openmetrics_prox_client,
sizeof(struct pss),
1024,
1024, 0, NULL, 0
},
#endif
};

View file

@ -278,7 +278,7 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason, void *user,
"protocol-lws-raw-test", \
callback_raw_test, \
sizeof(struct per_session_data__raw_test), \
1024, /* rx buf size must be >= permessage-deflate rx size */ \
1024, /* rx buf size must be >= permessage-deflate rx size */ 0, NULL, 0\
}
#if !defined (LWS_PLUGIN_STATIC)

View file

@ -2067,7 +2067,7 @@ lws_callback_raw_sshd(struct lws *wsi, enum lws_callback_reasons reason,
*
* The RECOMMENDED timeout period is 10 minutes.
*/
lws_set_timeout(wsi,
lws_set_timeout(wsi, (enum pending_timeout)
SSH_PENDING_TIMEOUT_CONNECT_TO_SUCCESSFUL_AUTH, 10 * 60);
break;

View file

@ -515,21 +515,18 @@ static const struct lws_protocols protocols[] = {
{
"dumb-increment-protocol",
callback_dumb_increment,
0,
20,
0, 20, 0, NULL, 0
},
{
"lws-mirror-protocol",
callback_lws_mirror,
0,
4096,
0, 4096, 0, NULL, 0
}, {
"lws-test-raw-client",
callback_test_raw_client,
0,
128
0, 128, 0, NULL, 0
},
{ NULL, NULL, 0, 0 } /* end */
LWS_PROTOCOL_LIST_TERM
};
#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)

View file

@ -187,14 +187,14 @@ lws_callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
static struct lws_protocols protocols[] = {
/* first protocol must always be HTTP handler */
{ "http-only", lws_callback_http, 0, 0, },
{ "http-only", lws_callback_http, 0, 0, 0, NULL, 0 },
#if defined(LWS_ROLE_WS)
LWS_PLUGIN_PROTOCOL_DUMB_INCREMENT,
LWS_PLUGIN_PROTOCOL_MIRROR,
LWS_PLUGIN_PROTOCOL_LWS_STATUS,
#endif
LWS_PLUGIN_PROTOCOL_POST_DEMO,
{ NULL, NULL, 0, 0 } /* terminator */
LWS_PROTOCOL_LIST_TERM
};
@ -278,8 +278,6 @@ static const struct lws_http_mount mount_ziptest_uncomm = {
LWSMPRO_FILE, /* origin points to a callback */
14, /* strlen("/ziptest"), ie length of the mountpoint */
NULL,
{ NULL, NULL } // sentinel
}, mount_ziptest = {
(struct lws_http_mount *)&mount_ziptest_uncomm, /* linked-list pointer to next*/
"/ziptest", /* mountpoint in URL namespace on this vhost */
@ -298,8 +296,6 @@ static const struct lws_http_mount mount_ziptest_uncomm = {
LWSMPRO_FILE, /* origin points to a callback */
8, /* strlen("/ziptest"), ie length of the mountpoint */
NULL,
{ NULL, NULL } // sentinel
}, mount_post = {
(struct lws_http_mount *)&mount_ziptest, /* linked-list pointer to next*/
"/formtest", /* mountpoint in URL namespace on this vhost */
@ -318,8 +314,6 @@ static const struct lws_http_mount mount_ziptest_uncomm = {
LWSMPRO_CALLBACK, /* origin points to a callback */
9, /* strlen("/formtest"), ie length of the mountpoint */
NULL,
{ NULL, NULL } // sentinel
}, mount = {
/* .mount_next */ &mount_post, /* linked-list "next" */
/* .mountpoint */ "/", /* mountpoint URL */