coap_pdu_t: Obfuscate coap_pdu_t for applications

Move coap_pdu_t to coap_pdu_internal.h.

Move internal PDU based function definitions to coap_pdu_internal.h.

Replace most references to "struct coap_pdu_t" with "coap_pdu_t".

Create new enum coap_pdu_type_t, enum coap_pdu_code_t and coap_option_num_t,
using them where appropriate for clarity of documentation.

Provide new functions to allow applications to access/update parts of
coap_pdu_t as appropriate and document as appropriate.

Update examples to use these new access functions where appropriate.
This commit is contained in:
Jon Shallow committed 2021-04-20 10:31:14 +01:00
1 parent b9989ef485
commit e4e067e5fb
42 files changed
+1456 -749

No files matched your search

+13 -13
View File
@@ -536,17 +536,17 @@ t_iterate_option3(void) {
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 1);
CU_ASSERT(oi.number == 1);
CU_ASSERT_PTR_EQUAL(option, teststr + 3);
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 1);
CU_ASSERT(oi.number == 1);
CU_ASSERT_PTR_EQUAL(option, teststr + 7);
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 30);
CU_ASSERT(oi.number == 30);
CU_ASSERT_PTR_EQUAL(option, teststr + 8);
option = coap_option_next(&oi);
@@ -579,17 +579,17 @@ t_iterate_option4(void) {
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 1);
CU_ASSERT(oi.number == 1);
CU_ASSERT_PTR_EQUAL(option, teststr + 3);
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 1);
CU_ASSERT(oi.number == 1);
CU_ASSERT_PTR_EQUAL(option, teststr + 7);
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 30);
CU_ASSERT(oi.number == 30);
CU_ASSERT_PTR_EQUAL(option, teststr + 8);
option = coap_option_next(&oi);
@@ -621,7 +621,7 @@ t_iterate_option5(void) {
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 5);
CU_ASSERT(oi.number == 5);
CU_ASSERT_PTR_EQUAL(option, teststr);
option = coap_option_next(&oi);
@@ -657,17 +657,17 @@ t_iterate_option6(void) {
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 10);
CU_ASSERT(oi.number == 10);
CU_ASSERT_PTR_EQUAL(option, teststr + 1);
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 10);
CU_ASSERT(oi.number == 10);
CU_ASSERT_PTR_EQUAL(option, teststr + 2);
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 10);
CU_ASSERT(oi.number == 10);
CU_ASSERT_PTR_EQUAL(option, teststr + 3);
option = coap_option_next(&oi);
@@ -704,17 +704,17 @@ t_iterate_option7(void) {
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 8);
CU_ASSERT(oi.number == 8);
CU_ASSERT_PTR_EQUAL(option, teststr);
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 22);
CU_ASSERT(oi.number == 22);
CU_ASSERT_PTR_EQUAL(option, teststr + 4);
option = coap_option_next(&oi);
CU_ASSERT(oi.bad == 0);
CU_ASSERT(oi.type == 22);
CU_ASSERT(oi.number == 22);
CU_ASSERT_PTR_EQUAL(option, teststr + 5);
option = coap_option_next(&oi);