Lines Matching refs:pdu
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()
588 coap_pdu_t *pdu) { in coap_send_impl() argument
593 if ( !context || !dst || !pdu ) in coap_send_impl()
598 data_backup = pdu->data; in coap_send_impl()
604 pbuf_realloc(pdu->pbuf, pdu->length); in coap_send_impl()
606 coap_transaction_id(dst, pdu, &id); in coap_send_impl()
608 udp_sendto(context->endpoint->pcb, pdu->pbuf, in coap_send_impl()
619 coap_pdu_t *pdu) { in coap_send() argument
620 return coap_send_impl(context, local_interface, dst, pdu); in coap_send()
705 coap_pdu_t *pdu) { in coap_send_confirmed() argument
716 node->id = coap_send_impl(context, local_interface, dst, pdu); in coap_send_confirmed()
730 node->pdu = pdu; in coap_send_confirmed()
789 node->retransmit_cnt, ntohs(node->pdu->hdr->id)); in coap_retransmit()
792 &node->remote, node->pdu); in coap_retransmit()
805 if (node->pdu->hdr->code >= 64) { in coap_retransmit()
808 token.length = node->pdu->hdr->token_length; in coap_retransmit()
809 token.s = node->pdu->hdr->token; in coap_retransmit()
883 node->pdu = coap_pdu_from_pbuf(coap_packet_extract_pbuf(packet)); in coap_handle_message()
885 node->pdu = coap_pdu_init(0, 0, 0, msg_len); in coap_handle_message()
887 if (!node->pdu) { in coap_handle_message()
891 if (!coap_pdu_parse(msg, msg_len, node->pdu)) { in coap_handle_message()
902 coap_transaction_id(&node->remote, node->pdu, &node->id); in coap_handle_message()
917 coap_show_pdu(node->pdu); in coap_handle_message()
993 context->sendqueue->pdu->hdr->token, in coap_cancel_all_messages()
994 context->sendqueue->pdu->hdr->token_length)) { in coap_cancel_all_messages()
997 debug("**** removed transaction %d\n", ntohs(q->pdu->hdr->id)); in coap_cancel_all_messages()
1011 q->pdu->hdr->token, q->pdu->hdr->token_length)) { in coap_cancel_all_messages()
1013 debug("**** removed transaction %d\n", ntohs(q->pdu->hdr->id)); in coap_cancel_all_messages()
1290 COAP_SET_STR(&token, sent->pdu->hdr->token_length, sent->pdu->hdr->token); in coap_cancel()
1365 coap_hash_request_uri(node->pdu, key); in handle_request()
1373 switch(node->pdu->hdr->code) { in handle_request()
1378 response = coap_wellknown_response(context, node->pdu); in handle_request()
1385 coap_new_error_response(node->pdu, COAP_RESPONSE_CODE(404), in handle_request()
1395 response = coap_new_error_response(node->pdu, COAP_RESPONSE_CODE(405), in handle_request()
1399 if (response && !no_response(node->pdu, response) && coap_send(context, &node->local_if, in handle_request()
1409 if ((size_t)node->pdu->hdr->code - 1 < in handle_request()
1411 h = resource->handler[node->pdu->hdr->code - 1]; in handle_request()
1416 response = coap_pdu_init(node->pdu->hdr->type == COAP_MESSAGE_CON in handle_request()
1419 0, node->pdu->hdr->id, COAP_MAX_PDU_SIZE); in handle_request()
1423 if (coap_add_token(response, node->pdu->hdr->token_length, in handle_request()
1424 node->pdu->hdr->token)) { in handle_request()
1425 str token = { node->pdu->hdr->token_length, node->pdu->hdr->token }; in handle_request()
1432 observe = coap_check_option(node->pdu, COAP_OPTION_OBSERVE, &opt_iter); in handle_request()
1452 node->pdu, &token, response); in handle_request()
1454 if (!no_response(node->pdu, response)) { in handle_request()
1478 debug("cannot send response for message %d\n", node->pdu->hdr->id); in handle_request()
1487 if (WANT_WKC(node->pdu, key)) { in handle_request()
1489 response = coap_wellknown_response(context, node->pdu); in handle_request()
1492 response = coap_new_error_response(node->pdu, COAP_RESPONSE_CODE(405), in handle_request()
1507 coap_send_ack(context, &rcvd->local_if, &rcvd->remote, rcvd->pdu); in handle_response()
1514 rcvd->pdu->hdr->token, in handle_response()
1515 rcvd->pdu->hdr->token_length); in handle_response()
1520 &rcvd->remote, sent ? sent->pdu : NULL, in handle_response()
1521 rcvd->pdu, rcvd->id); in handle_response()
1554 switch (rcvd->pdu->hdr->type) {
1559 if (rcvd->pdu->hdr->code == 0)
1565 if (sent && COAP_RESPONSE_CLASS(sent->pdu->hdr->code) == 2) {
1567 { sent->pdu->hdr->token_length, sent->pdu->hdr->token };
1578 coap_log(LOG_ALERT, "got RST for message %u\n", ntohs(rcvd->pdu->hdr->id));
1580 coap_log(LOG_ALERT, "got RST for message %u\n", uip_ntohs(rcvd->pdu->hdr->id));
1591 if (coap_option_check_critical(context, rcvd->pdu, opt_filter) == 0)
1596 if (coap_option_check_critical(context, rcvd->pdu, opt_filter) == 0) {
1601 coap_new_error_response(rcvd->pdu, COAP_RESPONSE_CODE(402), opt_filter);
1621 if (COAP_MESSAGE_IS_REQUEST(rcvd->pdu->hdr))
1623 else if (COAP_MESSAGE_IS_RESPONSE(rcvd->pdu->hdr))
1627 COAP_RESPONSE_CLASS(rcvd->pdu->hdr->code),
1628 rcvd->pdu->hdr->code & 0x1f);
1632 rcvd->pdu, COAP_MESSAGE_RST);