Lines Matching refs:node
126 coap_free_node(coap_queue_t *node) { in coap_free_node() argument
127 coap_free_type(COAP_NODE, node); in coap_free_node()
143 coap_free_node(coap_queue_t *node) { in coap_free_node() argument
144 memp_free(MEMP_COAP_NODE, node); in coap_free_node()
174 coap_free_node(coap_queue_t *node) { in coap_free_node() argument
175 coap_free_type(COAP_NODE, node); in coap_free_node()
217 coap_insert_node(coap_queue_t **queue, coap_queue_t *node) { in coap_insert_node() argument
219 if ( !queue || !node ) in coap_insert_node()
224 *queue = node; in coap_insert_node()
230 if (node->t < q->t) { in coap_insert_node()
231 node->next = q; in coap_insert_node()
232 *queue = node; in coap_insert_node()
233 q->t -= node->t; /* make q->t relative to node->t */ in coap_insert_node()
239 node->t -= q->t; /* make node-> relative to q->t */ in coap_insert_node()
242 } while (q && q->t <= node->t); in coap_insert_node()
246 q->t -= node->t; /* make q->t relative to node->t */ in coap_insert_node()
248 node->next = q; in coap_insert_node()
249 p->next = node; in coap_insert_node()
254 coap_delete_node(coap_queue_t *node) { in coap_delete_node() argument
255 if ( !node ) in coap_delete_node()
258 coap_delete_pdu(node->pdu); in coap_delete_node()
259 coap_free_node(node); in coap_delete_node()
275 coap_queue_t *node; in coap_new_node() local
276 node = coap_malloc_node(); in coap_new_node()
278 if ( ! node ) { in coap_new_node()
285 memset(node, 0, sizeof(*node)); in coap_new_node()
286 return node; in coap_new_node()
706 coap_queue_t *node; in coap_send_confirmed() local
710 node = coap_new_node(); in coap_send_confirmed()
711 if (!node) { in coap_send_confirmed()
716 node->id = coap_send_impl(context, local_interface, dst, pdu); in coap_send_confirmed()
717 if (COAP_INVALID_TID == node->id) { in coap_send_confirmed()
719 coap_free_node(node); in coap_send_confirmed()
726 node->timeout = calc_timeout(r); in coap_send_confirmed()
728 node->local_if = *local_interface; in coap_send_confirmed()
729 memcpy(&node->remote, dst, sizeof(coap_address_t)); in coap_send_confirmed()
730 node->pdu = pdu; in coap_send_confirmed()
742 node->t = node->timeout; in coap_send_confirmed()
746 node->t = (now - context->sendqueue_basetime) + node->timeout; in coap_send_confirmed()
749 coap_insert_node(&context->sendqueue, node); in coap_send_confirmed()
752 …if (node == context->sendqueue) /* don't bother with timer stuff if there are earlier retransmits … in coap_send_confirmed()
770 return node->id; in coap_send_confirmed()
774 coap_retransmit(coap_context_t *context, coap_queue_t *node) { in coap_retransmit() argument
775 if (!context || !node) in coap_retransmit()
779 if (node->retransmit_cnt < COAP_DEFAULT_MAX_RETRANSMIT) { in coap_retransmit()
780 node->retransmit_cnt++; in coap_retransmit()
781 node->t = node->timeout << node->retransmit_cnt; in coap_retransmit()
782 coap_insert_node(&context->sendqueue, node); in coap_retransmit()
784 …if (node == context->sendqueue) /* don't bother with timer stuff if there are earlier retransmits … in coap_retransmit()
789 node->retransmit_cnt, ntohs(node->pdu->hdr->id)); in coap_retransmit()
791 node->id = coap_send_impl(context, &node->local_if, in coap_retransmit()
792 &node->remote, node->pdu); in coap_retransmit()
793 return node->id; in coap_retransmit()
799 debug("** removed transaction %d\n", ntohs(node->id)); 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()
811 coap_handle_failed_notify(context, &node->remote, &token); in coap_retransmit()
816 coap_delete_node( node ); in coap_retransmit()
855 coap_queue_t *node; in coap_handle_message() local
874 node = coap_new_node(); in coap_handle_message()
875 if (!node) { in coap_handle_message()
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()
896 coap_ticks(&node->t); in coap_handle_message()
898 coap_packet_populate_endpoint(packet, &node->local_if); in coap_handle_message()
899 coap_packet_copy_source(packet, &node->remote); 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()
921 coap_dispatch(ctx, node); in coap_handle_message()
926 coap_delete_node(node); in coap_handle_message()
934 coap_remove_from_queue(coap_queue_t **queue, coap_tid_t id, coap_queue_t **node) { in coap_remove_from_queue() argument
943 *node = *queue; in coap_remove_from_queue()
946 (*queue)->t += (*node)->t; in coap_remove_from_queue()
948 (*node)->next = NULL; in coap_remove_from_queue()
967 *node = q; in coap_remove_from_queue()
1355 handle_request(coap_context_t *context, coap_queue_t *node) { in handle_request() argument
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()
1400 &node->remote, response) == COAP_INVALID_TID) { in handle_request()
1401 warn("cannot send response for transaction %u\n", node->id); 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()
1442 subscription = coap_add_observer(resource, &node->local_if, in handle_request()
1443 &node->remote, &token); in handle_request()
1445 coap_touch_observer(context, &node->remote, &token); in handle_request()
1451 h(context, resource, &node->local_if, &node->remote, in handle_request()
1452 node->pdu, &token, response); in handle_request()
1454 if (!no_response(node->pdu, response)) { in handle_request()
1458 coap_delete_observer(resource, &node->remote, &token); in handle_request()
1474 && !coap_mcast_interface(&node->local_if))) { in handle_request()
1476 if (coap_send(context, &node->local_if, in handle_request()
1477 &node->remote, response) == COAP_INVALID_TID) { 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()
1495 if (!response || (coap_send(context, &node->local_if, &node->remote, in handle_request()
1497 debug("cannot send response for transaction %u\n", node->id); in handle_request()
1528 coap_queue_t *node __attribute__ ((unused))) { argument
1530 handle_locally(coap_context_t *context, coap_queue_t *node) {