net: coap: define default CoAP version

RFC 7252 (CoAP) specifies value of the Version (Ver) field in the
protocol header to value 1. This patch defines value of the Version
field to make packet initialization easier. All samples and tests
are updated to use the new COAP_VERSION_1 field when initializing
a CoAP packet.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
This commit is contained in:
Hubert Miś 2021-01-27 19:24:18 +01:00 committed by Anas Nashif
commit 22687c34e3
8 changed files with 55 additions and 37 deletions

View file

@ -940,7 +940,8 @@ int lwm2m_init_message(struct lwm2m_message *msg)
}
r = coap_packet_init(&msg->cpkt, msg->msg_data, sizeof(msg->msg_data),
1, msg->type, tokenlen, token, msg->code, msg->mid);
COAP_VERSION_1, msg->type, tokenlen, token,
msg->code, msg->mid);
if (r < 0) {
LOG_ERR("coap packet init error (err:%d)", r);
goto cleanup;