/net-tools-3.5.0/libcoap/tests/ |
D | test_pdu.c | 19 coap_pdu_t *pdu; /* Holds the parsed PDU for most tests */ variable 30 result = coap_pdu_parse((unsigned char *)teststr, sizeof(teststr), pdu); in t_parse_pdu1() 33 CU_ASSERT(pdu->length == sizeof(teststr)); in t_parse_pdu1() 34 CU_ASSERT(pdu->hdr->version == 1); in t_parse_pdu1() 35 CU_ASSERT(pdu->hdr->type == COAP_MESSAGE_CON); in t_parse_pdu1() 36 CU_ASSERT(pdu->hdr->token_length == 0); in t_parse_pdu1() 37 CU_ASSERT(pdu->hdr->code == COAP_REQUEST_GET); in t_parse_pdu1() 38 CU_ASSERT(memcmp(&pdu->hdr->id, teststr + 2, 2) == 0); in t_parse_pdu1() 39 CU_ASSERT_PTR_NULL(pdu->data); in t_parse_pdu1() 47 result = coap_pdu_parse((unsigned char *)teststr, sizeof(teststr), pdu); in t_parse_pdu2() [all …]
|
D | test_error_response.c | 19 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->hdr->type = COAP_MESSAGE_CON; in t_error_response1() 38 pdu->hdr->id = htons(0x1234); in t_error_response1() 42 response = coap_new_error_response(pdu, COAP_RESPONSE_CODE(400), opts); in t_error_response1() 51 CU_ASSERT(pdu->hdr->id == htons(0x1234)); in t_error_response1() 65 coap_pdu_clear(pdu, pdu->max_size); in t_error_response2() 66 pdu->hdr->type = COAP_MESSAGE_NON; in t_error_response2() 67 pdu->hdr->id = htons(0x1234); in t_error_response2() 68 coap_add_token(pdu, 5, (unsigned char *)"token"); in t_error_response2() [all …]
|
D | test_wellknown.c | 24 coap_pdu_t *pdu; /* Holds the parsed PDU for most tests */ variable 165 response = coap_wellknown_response(ctx, pdu); in t_wellknown4() 189 if (!coap_add_option(pdu, COAP_OPTION_BLOCK2, in t_wellknown5() 197 response = coap_wellknown_response(ctx, pdu); in t_wellknown5() 219 coap_pdu_clear(pdu, pdu->max_size); /* clear PDU */ in t_wellknown6() 221 pdu->hdr->type = COAP_MESSAGE_NON; in t_wellknown6() 222 pdu->hdr->code = COAP_REQUEST_GET; in t_wellknown6() 223 pdu->hdr->id = htons(0x1234); in t_wellknown6() 225 CU_ASSERT_PTR_NOT_NULL(pdu); in t_wellknown6() 227 if (!pdu || !coap_add_option(pdu, COAP_OPTION_BLOCK2, in t_wellknown6() [all …]
|
D | test_options.c | 433 coap_pdu_t pdu = { in t_iterate_option1() local 441 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option1() 458 coap_pdu_t pdu = { in t_iterate_option2() local 466 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option2() 484 coap_pdu_t pdu = { in t_iterate_option3() local 492 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option3() 526 coap_pdu_t pdu = { in t_iterate_option4() local 534 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option4() 567 coap_pdu_t pdu = { in t_iterate_option5() local 575 result = coap_option_iterator_init(&pdu, &oi, COAP_OPT_ALL); in t_iterate_option5() [all …]
|
D | test_uri.c | 328 coap_pdu_t pdu = { in t_parse_uri13() local 336 coap_hash_request_uri(&pdu, key); in t_parse_uri13()
|
/net-tools-3.5.0/libcoap/src/ |
D | pdu.c | 29 coap_pdu_clear(coap_pdu_t *pdu, size_t size) { in coap_pdu_clear() argument 30 assert(pdu); in coap_pdu_clear() 35 pdu->hdr = pdu->pbuf->payload; in coap_pdu_clear() 37 pdu->max_delta = 0; in coap_pdu_clear() 38 pdu->data = NULL; in coap_pdu_clear() 40 memset(pdu->hdr, 0, size); in coap_pdu_clear() 41 pdu->max_size = size; in coap_pdu_clear() 42 pdu->hdr->version = COAP_DEFAULT_VERSION; in coap_pdu_clear() 45 pdu->length = sizeof(coap_hdr_t); in coap_pdu_clear() 77 coap_pdu_t *pdu; in coap_pdu_init() local [all …]
|
D | net.c | 258 coap_delete_pdu(node->pdu); in coap_delete_node() 445 coap_pdu_t *pdu, in coap_option_check_critical() argument 451 coap_option_iterator_init(pdu, &opt_iter, COAP_OPT_ALL); in coap_option_check_critical() 496 coap_transaction_id(const coap_address_t *peer, const coap_pdu_t *pdu, in coap_transaction_id() argument 528 coap_hash((const unsigned char *)&pdu->hdr->id, sizeof(unsigned short), h); in coap_transaction_id() 557 coap_pdu_t *pdu) { in coap_send_impl() argument 561 if ( !context || !dst || !pdu ) in coap_send_impl() 567 COAP_RESPONSE_CLASS(pdu->hdr->code) > 2) { in coap_send_impl() 572 (unsigned char *)pdu->hdr, pdu->length); in coap_send_impl() 575 coap_transaction_id(dst, pdu, &id); in coap_send_impl() [all …]
|
D | block.c | 45 coap_get_block(coap_pdu_t *pdu, unsigned short type, coap_block_t *block) { in coap_get_block() argument 52 if (pdu && (option = coap_check_option(pdu, type, &opt_iter))) { in coap_get_block() 65 coap_pdu_t *pdu, size_t data_length) { in coap_write_block_opt() argument 69 assert(pdu); in coap_write_block_opt() 77 avail = pdu->max_size - pdu->length - 4; in coap_write_block_opt() 110 coap_add_option(pdu, type, coap_encode_var_bytes(buf, ((block->num << 4) | in coap_write_block_opt() 119 coap_add_block(coap_pdu_t *pdu, unsigned int len, const unsigned char *data, in coap_add_block() argument 127 return coap_add_data(pdu, in coap_add_block()
|
D | option.c | 25 options_start(coap_pdu_t *pdu) { in options_start() argument 27 if (pdu && pdu->hdr && in options_start() 28 (pdu->hdr->token + pdu->hdr->token_length in options_start() 29 < (unsigned char *)pdu->hdr + pdu->length)) { in options_start() 31 coap_opt_t *opt = pdu->hdr->token + pdu->hdr->token_length; in options_start() 120 coap_option_iterator_init(coap_pdu_t *pdu, coap_opt_iterator_t *oi, in coap_option_iterator_init() argument 122 assert(pdu); in coap_option_iterator_init() 123 assert(pdu->hdr); in coap_option_iterator_init() 128 oi->next_option = (unsigned char *)pdu->hdr + sizeof(coap_hdr_t) in coap_option_iterator_init() 129 + pdu->hdr->token_length; in coap_option_iterator_init() [all …]
|
D | debug.c | 375 coap_show_pdu(const coap_pdu_t *pdu) { in coap_show_pdu() argument 386 pdu->hdr->version, msg_type_string(pdu->hdr->type), in coap_show_pdu() 387 msg_code_string(pdu->hdr->code), ntohs(pdu->hdr->id)); in coap_show_pdu() 389 for (i = 0; i < pdu->hdr->token_length; i++) { in coap_show_pdu() 390 fprintf(COAP_DEBUG_FD, "%02x", pdu->hdr->token[i]); in coap_show_pdu() 395 coap_option_iterator_init((coap_pdu_t *)pdu, &opt_iter, COAP_OPT_ALL); in coap_show_pdu() 458 if (coap_get_data((coap_pdu_t *)pdu, &data_len, &data)) { in coap_show_pdu()
|
/net-tools-3.5.0/libcoap/examples/ |
D | tiny.c | 27 coap_pdu_t *pdu; in make_pdu() local 32 if ( ! ( pdu = coap_new_pdu() ) ) in make_pdu() 35 pdu->hdr->type = COAP_MESSAGE_NON; in make_pdu() 36 pdu->hdr->code = COAP_REQUEST_POST; in make_pdu() 37 pdu->hdr->id = htons(id++); in make_pdu() 40 coap_add_data( pdu, 1, &enc); in make_pdu() 44 coap_add_data( pdu, len, buf ); in make_pdu() 47 return pdu; in make_pdu() 103 coap_pdu_t *pdu; in main() local 134 if (! (pdu = make_pdu( rand() & 0xfff ) ) ) in main() [all …]
|
D | client.c | 137 coap_pdu_t *pdu; in coap_new_request() local 140 if ( ! ( pdu = coap_new_pdu() ) ) in coap_new_request() 143 pdu->hdr->type = msgtype; in coap_new_request() 144 pdu->hdr->id = coap_new_message_id(ctx); in coap_new_request() 145 pdu->hdr->code = m; in coap_new_request() 147 pdu->hdr->token_length = the_token.length; in coap_new_request() 148 if ( !coap_add_token(pdu, the_token.length, the_token.s)) { in coap_new_request() 152 coap_show_pdu(pdu); in coap_new_request() 160 coap_add_option(pdu, in coap_new_request() 169 coap_add_data(pdu, length, data); in coap_new_request() [all …]
|
D | coap-rd.c | 355 make_rd(coap_address_t *peer UNUSED_PARAM, coap_pdu_t *pdu) { in make_rd() argument 368 if (coap_get_data(pdu, &rd->data.length, &data)) { in make_rd() 378 etag = coap_check_option(pdu, COAP_OPTION_ETAG, &opt_iter); in make_rd()
|
/net-tools-3.5.0/ |
D | coap-client.c | 746 coap_pdu_t *pdu; in create_pdu() local 768 pdu = coap_new_request(user_data->coap_ctx, in create_pdu() 773 if (pdu) { in create_pdu() 775 data[user_data->index].expected_mid = ntohs(pdu->hdr->id); in create_pdu() 779 return pdu; in create_pdu() 785 coap_pdu_t *pdu; in send_packets() local 794 pdu = create_pdu(user_data); in send_packets() 795 if (!pdu) { in send_packets() 807 coap_show_pdu(pdu); in send_packets() 810 if (pdu->hdr->type == COAP_MESSAGE_CON) in send_packets() [all …]
|
/net-tools-3.5.0/libcoap/include/coap/ |
D | pdu.h | 299 void coap_pdu_clear(coap_pdu_t *pdu, size_t size); 342 int coap_add_token(coap_pdu_t *pdu, 354 size_t coap_add_option(coap_pdu_t *pdu, 366 unsigned char *coap_add_option_later(coap_pdu_t *pdu, 375 int coap_add_data(coap_pdu_t *pdu, 384 int coap_get_data(coap_pdu_t *pdu,
|
D | block.h | 91 int coap_get_block(coap_pdu_t *pdu, unsigned short type, coap_block_t *block); 115 coap_pdu_t *pdu, 130 int coap_add_block(coap_pdu_t *pdu,
|
D | net.h | 40 coap_pdu_t *pdu; /**< the CoAP PDU to send */ member 224 coap_pdu_t *pdu); 264 coap_pdu_t *pdu); 391 const coap_pdu_t *pdu, 505 coap_pdu_t *pdu,
|
D | option.h | 71 coap_opt_t *options_start(coap_pdu_t *pdu); 278 coap_opt_iterator_t *coap_option_iterator_init(coap_pdu_t *pdu, 313 coap_opt_t *coap_check_option(coap_pdu_t *pdu,
|
D | coap.h.in | 46 #include "pdu.h"
|
/net-tools-3.5.0/libcoap/ |
D | Makefile.libcoap | 1 libcoap_src = pdu.c net.c debug.c encode.c uri.c subscribe.c resource.c hashkey.c str.c option.c as…
|
D | Makefile.am | 62 src/pdu.c \ 88 include/coap/pdu.h \
|
D | ChangeLog | 112 * pdu.c: option codes for Accept and Size1 according to coap-18 133 * pdu.c (coap_pdu_parse): new PDU parser for Klaus-encoding 146 * pdu.h: new option codes from draft-ietf-core-coap-12 183 * pdu.c (coap_add_option): allow more than 15 options.
|
D | TODO | 32 -> Adding additional config options (like --with-pdu-size)
|
D | CONTRIBUTE | 135 coap_add_block(coap_pdu_t *pdu,
|
/net-tools-3.5.0/libcoap/examples/contiki/ |
D | Makefile.common | 11 COAPOBJS = net.o debug.o option.o resource.o hashkey.o pdu.o encode.o subscribe.o coap_io.o block.o…
|