mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-05 20:02:19 +03:00
Client: Remove (D)TLS / WebSocket startup call-back timing window
Add in new functions coap_new_client_session3() coap_new_client_session_pki3() coap_new_client_session_psk3() coap_new_client_session_oscore3() coap_new_client_session_oscore_pki3() coap_new_client_session_oscore_psk3() which effectively does coap_session_set_app_data2() and coap_ws_set_host_request() early on in the session set up cycle.
This commit is contained in:
1 parent
c9135b6b26
commit
d80fa1497d
25 files changed
+918
-212
No files matched your search
@@ -171,12 +171,12 @@ client_coap_init(int argc, char **argv)
|
||||
coap_context_set_block_mode(main_coap_context, COAP_BLOCK_USE_LIBCOAP);
|
||||
|
||||
if (uri.scheme == COAP_URI_SCHEME_COAP) {
|
||||
session = coap_new_client_session(main_coap_context, NULL, &dst,
|
||||
COAP_PROTO_UDP);
|
||||
session = coap_new_client_session3(main_coap_context, NULL, &dst,
|
||||
COAP_PROTO_UDP, NULL, NULL, NULL);
|
||||
}
|
||||
else if (uri.scheme == COAP_URI_SCHEME_COAP_TCP) {
|
||||
session = coap_new_client_session(main_coap_context, NULL, &dst,
|
||||
COAP_PROTO_TCP);
|
||||
session = coap_new_client_session3(main_coap_context, NULL, &dst,
|
||||
COAP_PROTO_TCP, NULL, NULL, NULL);
|
||||
#if defined (COAP_USE_PSK) && defined(COAP_USE_PSK_ID)
|
||||
}
|
||||
else {
|
||||
@@ -192,8 +192,8 @@ client_coap_init(int argc, char **argv)
|
||||
dtls_psk.psk_info.key.s = (const uint8_t *)COAP_USE_PSK;
|
||||
dtls_psk.psk_info.key.length = strlen(COAP_USE_PSK);
|
||||
|
||||
session = coap_new_client_session_psk2(main_coap_context, NULL, &dst,
|
||||
COAP_PROTO_DTLS, &dtls_psk);
|
||||
session = coap_new_client_session_psk3(main_coap_context, NULL, &dst,
|
||||
COAP_PROTO_DTLS, &dtls_psk, NULL, NULL, NULL);
|
||||
#else /* ! COAP_USE_PSK && ! COAP_USE_PSK_ID */
|
||||
coap_log_err("CONFIG_LIBCOAP_USE_PSK and CONFIG_LIBCOAP_USE_PSK_ID not defined\n");
|
||||
goto fail;
|
||||
|
||||
@@ -205,8 +205,8 @@ coap_client_init(coap_context_t *ctx)
|
||||
}
|
||||
|
||||
if (uri.scheme == COAP_URI_SCHEME_COAP) {
|
||||
session = coap_new_client_session(ctx, NULL, &dst,
|
||||
COAP_PROTO_UDP);
|
||||
session = coap_new_client_session3(ctx, NULL, &dst,
|
||||
COAP_PROTO_UDP, NULL, NULL, NULL);
|
||||
}
|
||||
else if (uri.scheme == COAP_URI_SCHEME_COAP_TCP) {
|
||||
goto fail;
|
||||
@@ -235,8 +235,8 @@ coap_client_init(coap_context_t *ctx)
|
||||
dtls_psk.psk_info.key.s = (const uint8_t *)COAP_USE_PSK;
|
||||
dtls_psk.psk_info.key.length = strlen(COAP_USE_PSK);
|
||||
|
||||
session = coap_new_client_session_psk2(ctx, NULL, &dst,
|
||||
COAP_PROTO_DTLS, &dtls_psk);
|
||||
session = coap_new_client_session_psk3(ctx, NULL, &dst,
|
||||
COAP_PROTO_DTLS, &dtls_psk, NULL, NULL, NULL);
|
||||
#else /* ! COAP_USE_PSK && ! COAP_USE_PSK_ID */
|
||||
coap_log_err("CONFIG_LIBCOAP_USE_PSK and CONFIG_LIBCOAP_USE_PSK_ID not defined\n");
|
||||
goto fail;
|
||||
|
||||
Reference in new issue
Block a user