/third_party/libcoap/src/ |
D | pdu.c | 37 coap_pdu_clear(coap_pdu_t *pdu, size_t size) { in coap_pdu_clear() argument 38 assert(pdu); in coap_pdu_clear() 39 assert(pdu->token); in coap_pdu_clear() 40 assert(pdu->max_hdr_size >= COAP_PDU_MAX_UDP_HEADER_SIZE); in coap_pdu_clear() 41 if (pdu->alloc_size > size) in coap_pdu_clear() 42 pdu->alloc_size = size; in coap_pdu_clear() 43 pdu->type = 0; in coap_pdu_clear() 44 pdu->code = 0; in coap_pdu_clear() 45 pdu->hdr_size = 0; in coap_pdu_clear() 46 pdu->token_length = 0; in coap_pdu_clear() [all …]
|
D | block.c | 37 coap_get_block(const coap_pdu_t *pdu, coap_option_num_t number, in coap_get_block() argument 45 if (pdu && (option = coap_check_option(pdu, number, &opt_iter)) != NULL) { in coap_get_block() 67 coap_pdu_t *pdu, size_t data_length) { in coap_write_block_opt() argument 71 assert(pdu); in coap_write_block_opt() 79 assert(pdu->max_size > 0); in coap_write_block_opt() 80 avail = pdu->max_size - pdu->used_size - pdu->hdr_size; in coap_write_block_opt() 117 coap_insert_option(pdu, number, coap_encode_var_safe(buf, sizeof(buf), in coap_write_block_opt() 127 coap_add_block(coap_pdu_t *pdu, size_t len, const uint8_t *data, in coap_add_block() argument 135 return coap_add_data(pdu, in coap_add_block() 303 coap_pdu_t * pdu = coap_pdu_duplicate(&cq->pdu, in coap_cancel_observe() local [all …]
|
D | coap_cache.c | 69 const coap_pdu_t *pdu, in coap_cache_derive_key_w_ignore() argument 79 if (!coap_option_iterator_init(pdu, &opt_iter, COAP_OPT_ALL)) { in coap_cache_derive_key_w_ignore() 106 if (pdu->code == COAP_REQUEST_CODE_FETCH) { in coap_cache_derive_key_w_ignore() 109 if (coap_get_data(pdu, &len, &data)) { in coap_cache_derive_key_w_ignore() 130 const coap_pdu_t *pdu, in coap_cache_derive_key() argument 132 return coap_cache_derive_key_w_ignore(session, pdu, session_based, in coap_cache_derive_key() 143 coap_new_cache_entry(coap_session_t *session, const coap_pdu_t *pdu, in coap_new_cache_entry() argument 156 entry->pdu = coap_pdu_init(pdu->type, pdu->code, pdu->mid, pdu->alloc_size); in coap_new_cache_entry() 157 if (entry->pdu) { in coap_new_cache_entry() 158 if (!coap_pdu_resize(entry->pdu, pdu->alloc_size)) { in coap_new_cache_entry() [all …]
|
D | net.c | 235 coap_delete_pdu(node->pdu); in coap_delete_node() 701 coap_pdu_t *pdu, in coap_option_check_critical() argument 707 coap_option_iterator_init(pdu, &opt_iter, COAP_OPT_ALL); in coap_option_check_critical() 766 coap_session_send_pdu(coap_session_t *session, coap_pdu_t *pdu) { in coap_session_send_pdu() argument 768 assert(pdu->hdr_size > 0); in coap_session_send_pdu() 771 bytes_written = coap_session_send(session, pdu->token - pdu->hdr_size, in coap_session_send_pdu() 772 pdu->used_size + pdu->hdr_size); in coap_session_send_pdu() 775 bytes_written = coap_dtls_send(session, pdu->token - pdu->hdr_size, in coap_session_send_pdu() 776 pdu->used_size + pdu->hdr_size); in coap_session_send_pdu() 780 bytes_written = coap_session_write(session, pdu->token - pdu->hdr_size, in coap_session_send_pdu() [all …]
|
D | coap_io_lwip.c | 60 coap_pdu_t *pdu = NULL; in coap_recv() local 83 pdu = coap_pdu_from_pbuf(p); in coap_recv() 84 if (!pdu) in coap_recv() 87 if (!coap_pdu_parse(ep->proto, p->payload, p->len, pdu)) { in coap_recv() 96 coap_dispatch(ep->context, session, pdu); in coap_recv() 98 coap_delete_pdu(pdu); in coap_recv() 108 coap_send_rst(session, pdu); in coap_recv() 109 coap_delete_pdu(pdu); in coap_recv() 156 coap_pdu_t *pdu) { in coap_socket_send_pdu() argument 161 …pbuf_realloc(pdu->pbuf, pdu->used_size + coap_pdu_parse_header_size(session->proto, pdu->pbuf->pay… in coap_socket_send_pdu() [all …]
|
D | async.c | 50 pdu->token_length, request->token_length, in coap_register_async() 51 pdu->token, request->token); in coap_register_async() 68 s->pdu = coap_pdu_duplicate(request, session, request->token_length, in coap_register_async() 70 if (s->pdu == NULL) { in coap_register_async() 75 s->pdu->mid = mid; /* coap_pdu_duplicate() created one */ in coap_register_async() 78 coap_add_data(s->pdu, len, data); in coap_register_async() 113 pdu->token_length, token.length, in coap_find_async() 114 pdu->token, token.s); in coap_find_async() 125 if (s->pdu) { in coap_free_async_sub() 126 coap_delete_pdu(s->pdu); in coap_free_async_sub() [all …]
|
D | option.c | 112 coap_option_iterator_init(const coap_pdu_t *pdu, coap_opt_iterator_t *oi, in coap_option_iterator_init() argument 114 assert(pdu); in coap_option_iterator_init() 118 if (pdu->token == NULL) { in coap_option_iterator_init() 123 oi->next_option = pdu->token + pdu->token_length; in coap_option_iterator_init() 124 if (pdu->token + pdu->used_size <= oi->next_option) { in coap_option_iterator_init() 129 oi->length = pdu->used_size - pdu->token_length; in coap_option_iterator_init() 201 coap_check_option(const coap_pdu_t *pdu, coap_option_num_t number, in coap_check_option() argument 208 coap_option_iterator_init(pdu, oi, &f); in coap_check_option() 552 coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t** options) { in coap_add_optlist_pdu() argument 560 coap_add_option(pdu, opt->number, opt->length, opt->data); in coap_add_optlist_pdu()
|
D | resource.c | 514 coap_delete_pdu(obs->pdu); 695 && (!token || (token->length == s->pdu->token_length 696 && memcmp(token->s, s->pdu->token, token->length) == 0))) 749 coap_binary_t tmp_token = { s->pdu->token_length, s->pdu->token }; 769 s->pdu = coap_pdu_duplicate(request, session, request->token_length, 771 if (s->pdu == NULL) { 777 coap_add_data(s->pdu, len, data); 785 coap_delete_pdu(s->pdu); 825 for ( i = 0; i < s->pdu->token_length; i++ ) 826 snprintf( &outbuf[2 * i], 3, "%02x", s->pdu->token[i] ); [all …]
|
D | coap_session.c | 219 if (q->pdu->type==COAP_MESSAGE_CON && session->context && session->context->nack_handler) in coap_session_mfree() 220 …session->context->nack_handler(session, q->pdu, session->proto == COAP_PROTO_DTLS ? COAP_NACK_TLS_… in coap_session_mfree() 320 coap_session_delay_pdu(coap_session_t *session, coap_pdu_t *pdu, in coap_session_delay_pdu() argument 334 if (q->id == pdu->mid) { in coap_session_delay_pdu() 336 coap_session_str(session), pdu->mid); in coap_session_delay_pdu() 343 node->id = pdu->mid; in coap_session_delay_pdu() 344 node->pdu = pdu; in coap_session_delay_pdu() 345 if (pdu->type == COAP_MESSAGE_CON && COAP_PROTO_NOT_RELIABLE(session->proto)) { in coap_session_delay_pdu() 360 coap_pdu_t *pdu; in coap_session_send_csm() local 368 pdu = coap_pdu_init(COAP_MESSAGE_CON, COAP_SIGNALING_CODE_CSM, 0, 20); in coap_session_send_csm() [all …]
|
D | coap_debug.c | 507 coap_show_pdu(coap_log_t level, const coap_pdu_t *pdu) { in coap_show_pdu() argument 538 COAP_DEFAULT_VERSION, msg_type_string(pdu->type), in coap_show_pdu() 539 msg_code_string(pdu->code), pdu->mid); in coap_show_pdu() 541 for (i = 0; i < pdu->token_length; i++) { in coap_show_pdu() 544 "%02x", pdu->token[i]); in coap_show_pdu() 550 coap_option_iterator_init(pdu, &opt_iter, COAP_OPT_ALL); in coap_show_pdu() 563 if (pdu->code == COAP_SIGNALING_CODE_CSM) switch(opt_iter.number) { in coap_show_pdu() 572 } else if (pdu->code == COAP_SIGNALING_CODE_PING in coap_show_pdu() 573 || pdu->code == COAP_SIGNALING_CODE_PONG) { in coap_show_pdu() 575 } else if (pdu->code == COAP_SIGNALING_CODE_RELEASE) switch(opt_iter.number) { in coap_show_pdu() [all …]
|
/third_party/libcoap/tests/ |
D | test_pdu.c | 19 coap_pdu_t *pdu; /* Holds the parsed PDU for most tests */ variable 30 result = coap_pdu_parse(COAP_PROTO_UDP, teststr, sizeof(teststr), pdu); in t_parse_pdu1() 33 CU_ASSERT(pdu->used_size == sizeof(teststr) - 4); in t_parse_pdu1() 34 CU_ASSERT(pdu->type == COAP_MESSAGE_CON); in t_parse_pdu1() 35 CU_ASSERT(pdu->token_length == 0); in t_parse_pdu1() 36 CU_ASSERT(pdu->code == COAP_REQUEST_CODE_GET); in t_parse_pdu1() 37 CU_ASSERT(pdu->mid == 0x9334); in t_parse_pdu1() 38 CU_ASSERT_PTR_NULL(pdu->data); in t_parse_pdu1() 46 result = coap_pdu_parse(COAP_PROTO_UDP, teststr, sizeof(teststr), pdu); in t_parse_pdu2() 49 CU_ASSERT(pdu->used_size == sizeof(teststr) - 4); in t_parse_pdu2() [all …]
|
D | test_error_response.c | 19 static coap_pdu_t *pdu; /* Holds the request PDU for most tests */ variable 36 coap_pdu_clear(pdu, pdu->max_size); in t_error_response1() 37 pdu->type = COAP_MESSAGE_CON; in t_error_response1() 38 pdu->mid = 0x1234; in t_error_response1() 42 response = coap_new_error_response(pdu, COAP_RESPONSE_CODE(400), &opts); in t_error_response1() 65 coap_pdu_clear(pdu, pdu->max_size); in t_error_response2() 66 pdu->type = COAP_MESSAGE_NON; in t_error_response2() 67 pdu->mid = 0x1234; in t_error_response2() 68 coap_add_token(pdu, 5, (const uint8_t *)"token"); in t_error_response2() 69 coap_add_option(pdu, COAP_OPTION_URI_HOST, 4, (const uint8_t *)"time"); in t_error_response2() [all …]
|
D | test_wellknown.c | 26 static coap_pdu_t *pdu; /* Holds the parsed PDU for most tests */ variable 170 response = coap_wellknown_response(ctx, session, pdu); in t_wellknown4() 194 if (!coap_add_option(pdu, COAP_OPTION_BLOCK2, in t_wellknown5() 203 response = coap_wellknown_response(ctx, session, pdu); in t_wellknown5() 225 coap_pdu_clear(pdu, pdu->max_size); /* clear PDU */ in t_wellknown6() 227 pdu->type = COAP_MESSAGE_NON; in t_wellknown6() 228 pdu->code = COAP_REQUEST_CODE_GET; in t_wellknown6() 229 pdu->mid = 0x1234; in t_wellknown6() 231 CU_ASSERT_PTR_NOT_NULL(pdu); in t_wellknown6() 233 if (!pdu || !coap_add_option(pdu, COAP_OPTION_BLOCK2, in t_wellknown6() [all …]
|
D | test_uri.c | 334 coap_pdu_t pdu = { in t_parse_uri13() local 341 coap_string_t *uri_path = coap_get_uri_path(&pdu); in t_parse_uri13() 435 coap_pdu_t pdu = { in t_parse_uri18() local 442 coap_string_t *uri_path = coap_get_uri_path(&pdu); in t_parse_uri18() 460 coap_pdu_t pdu = { in t_parse_uri19() local 467 coap_string_t *uri_path = coap_get_uri_path(&pdu); in t_parse_uri19() 480 coap_pdu_t pdu = { in t_parse_uri20() local 487 coap_string_t *uri_path = coap_get_uri_path(&pdu); in t_parse_uri20() 501 coap_pdu_t pdu = { in t_parse_uri21() local 508 coap_string_t *uri_path = coap_get_uri_path(&pdu); in t_parse_uri21() [all …]
|
D | test_options.c | 473 coap_pdu_t pdu = { in t_iterate_option1() local 481 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option1() 498 coap_pdu_t pdu = { in t_iterate_option2() local 507 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option2() 525 coap_pdu_t pdu = { in t_iterate_option3() local 534 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option3() 568 coap_pdu_t pdu = { in t_iterate_option4() local 577 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option4() 610 coap_pdu_t pdu = { in t_iterate_option5() local 619 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option5() [all …]
|
/third_party/libcoap/include/coap3/ |
D | coap_pdu_internal.h | 74 #define COAP_PDU_IS_EMPTY(pdu) ((pdu)->code == 0) argument 75 #define COAP_PDU_IS_REQUEST(pdu) (!COAP_PDU_IS_EMPTY(pdu) && (pdu)->code < 32) argument 76 #define COAP_PDU_IS_RESPONSE(pdu) ((pdu)->code >= 64 && (pdu)->code < 224) argument 77 #define COAP_PDU_IS_SIGNALING(pdu) ((pdu)->code >= 224) argument 140 int coap_pdu_resize(coap_pdu_t *pdu, size_t new_size); 151 int coap_pdu_check_resize(coap_pdu_t *pdu, size_t new_size); 187 int coap_pdu_parse_header(coap_pdu_t *pdu, coap_proto_t proto); 200 int coap_pdu_parse_opt(coap_pdu_t *pdu); 219 coap_pdu_t *pdu); 230 void coap_pdu_clear(coap_pdu_t *pdu, size_t size); [all …]
|
D | pdu.h | 383 void coap_delete_pdu(coap_pdu_t *pdu); 418 int coap_add_token(coap_pdu_t *pdu, 443 size_t coap_add_option(coap_pdu_t *pdu, 459 int coap_add_data(coap_pdu_t *pdu, 475 uint8_t *coap_add_data_after(coap_pdu_t *pdu, size_t len); 489 int coap_get_data(const coap_pdu_t *pdu, 510 int coap_get_data_large(const coap_pdu_t *pdu, 523 coap_pdu_code_t coap_pdu_get_code(const coap_pdu_t *pdu); 531 void coap_pdu_set_code(coap_pdu_t *pdu, coap_pdu_code_t code); 540 coap_pdu_type_t coap_pdu_get_type(const coap_pdu_t *pdu); [all …]
|
D | coap_cache.h | 70 const coap_pdu_t *pdu, 100 const coap_pdu_t *pdu, 151 const coap_pdu_t *pdu, 192 const coap_pdu_t *pdu,
|
D | coap_block_internal.h | 89 coap_pdu_t pdu; /**< skeletal PDU */ member 118 coap_pdu_t pdu; /**< skeletal PDU */ member 152 coap_pdu_t *pdu); 167 coap_pdu_t *pdu, 174 coap_pdu_t *pdu, 215 coap_pdu_t *pdu,
|
D | block.h | 98 int coap_get_block(const coap_pdu_t *pdu, coap_option_num_t number, 123 coap_pdu_t *pdu, 138 int coap_add_block(coap_pdu_t *pdu, 241 coap_pdu_t *pdu,
|
D | coap_net_internal.h | 39 coap_pdu_t *pdu; /**< the CoAP PDU to send */ member 279 coap_pdu_t *pdu); 313 coap_pdu_t *pdu, 361 coap_mid_t coap_send_internal(coap_session_t *session, coap_pdu_t *pdu);
|
D | option.h | 195 coap_opt_iterator_t *coap_option_iterator_init(const coap_pdu_t *pdu, 230 coap_opt_t *coap_check_option(const coap_pdu_t *pdu, 362 int coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t** optlist_chain);
|
D | coap_subscribe_internal.h | 57 coap_pdu_t *pdu; /**< PDU to use for additional requests */ member 99 const coap_pdu_t *pdu);
|
/third_party/libcoap/tests/oss-fuzz/ |
D | pdu_parse_target.c | 5 coap_pdu_t *pdu = coap_pdu_init(0, 0, 0, size); in LLVMFuzzerTestOneInput() local 6 if (pdu) { in LLVMFuzzerTestOneInput() 8 coap_pdu_parse(COAP_PROTO_UDP, data, size, pdu); in LLVMFuzzerTestOneInput() 9 coap_string_t *query = coap_get_query(pdu); in LLVMFuzzerTestOneInput() 10 coap_string_t *uri_path = coap_get_uri_path(pdu); in LLVMFuzzerTestOneInput() 11 coap_show_pdu(LOG_DEBUG, pdu); in LLVMFuzzerTestOneInput() 12 coap_pdu_encode_header(pdu, COAP_PROTO_UDP); in LLVMFuzzerTestOneInput() 16 coap_delete_pdu(pdu); in LLVMFuzzerTestOneInput()
|
/third_party/libcoap/examples/ |
D | tiny.c | 56 coap_pdu_t *pdu; in make_pdu() local 61 if (!(pdu = coap_pdu_init(COAP_MESSAGE_NON, COAP_REQUEST_CODE_POST, id++, in make_pdu() 68 coap_add_data( pdu, len, buf ); in make_pdu() 70 return pdu; in make_pdu() 139 coap_pdu_t *pdu; in main() local 172 if (! (pdu = make_pdu( rand() & 0xfff ) ) ) in main() 175 coap_send(session, pdu); in main()
|