Lines Matching refs:context
290 coap_peek_next( coap_context_t *context ) { in coap_peek_next() argument
291 if ( !context || !context->sendqueue ) in coap_peek_next()
294 return context->sendqueue; in coap_peek_next()
298 coap_pop_next( coap_context_t *context ) { in coap_pop_next() argument
301 if ( !context || !context->sendqueue ) in coap_pop_next()
304 next = context->sendqueue; in coap_pop_next()
305 context->sendqueue = context->sendqueue->next; in coap_pop_next()
306 if (context->sendqueue) { in coap_pop_next()
307 context->sendqueue->t += next->t; in coap_pop_next()
384 c->endpoint->context = c; in coap_new_context()
419 coap_free_context(coap_context_t *context) { in coap_free_context() argument
421 if (!context) in coap_free_context()
424 coap_delete_all(context->sendqueue); in coap_free_context()
427 context->sendqueue = NULL; in coap_free_context()
428 coap_retransmittimer_restart(context); in coap_free_context()
431 coap_delete_all_resources(context); in coap_free_context()
433 coap_free_endpoint(context->endpoint); in coap_free_context()
435 coap_free_type(COAP_CONTEXT, context); in coap_free_context()
534 coap_send_ack(coap_context_t *context, in coap_send_ack() argument
545 result = coap_send(context, local_interface, dst, response); in coap_send_ack()
554 coap_send_impl(coap_context_t *context, in coap_send_impl() argument
561 if ( !context || !dst || !pdu ) in coap_send_impl()
571 bytes_written = context->network_send(context, local_interface, dst, in coap_send_impl()
585 coap_send_impl(coap_context_t *context, in coap_send_impl() argument
593 if ( !context || !dst || !pdu ) in coap_send_impl()
608 udp_sendto(context->endpoint->pcb, pdu->pbuf, in coap_send_impl()
616 coap_send(coap_context_t *context, in coap_send() argument
620 return coap_send_impl(context, local_interface, dst, pdu); in coap_send()
624 coap_send_error(coap_context_t *context, in coap_send_error() argument
638 result = coap_send(context, local_interface, dst, response); in coap_send_error()
646 coap_send_message_type(coap_context_t *context, in coap_send_message_type() argument
657 result = coap_send(context, local_interface, dst, response); in coap_send_message_type()
702 coap_send_confirmed(coap_context_t *context, in coap_send_confirmed() argument
716 node->id = coap_send_impl(context, local_interface, dst, pdu); in coap_send_confirmed()
741 if (context->sendqueue == NULL) { in coap_send_confirmed()
743 context->sendqueue_basetime = now; 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()
753 coap_retransmittimer_restart(context); in coap_send_confirmed()
760 nextpdu = coap_peek_next(context); in coap_send_confirmed()
765 etimer_set(&context->retransmit_timer, nextpdu->t); 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()
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()
785 coap_retransmittimer_restart(context); in coap_retransmit()
791 node->id = coap_send_impl(context, &node->local_if, in coap_retransmit()
811 coap_handle_failed_notify(context, &node->remote, &token); in coap_retransmit()
820 void coap_dispatch(coap_context_t *context, coap_queue_t *rcvd);
984 coap_cancel_all_messages(coap_context_t *context, const coap_address_t *dst, in coap_cancel_all_messages() argument
990 while (context->sendqueue && in coap_cancel_all_messages()
991 coap_address_equals(dst, &context->sendqueue->remote) && in coap_cancel_all_messages()
993 context->sendqueue->pdu->hdr->token, in coap_cancel_all_messages()
994 context->sendqueue->pdu->hdr->token_length)) { in coap_cancel_all_messages()
995 q = context->sendqueue; in coap_cancel_all_messages()
996 context->sendqueue = q->next; in coap_cancel_all_messages()
1001 if (!context->sendqueue) in coap_cancel_all_messages()
1004 p = context->sendqueue; in coap_cancel_all_messages()
1129 get_wkc_len(coap_context_t *context, coap_opt_t *query_filter) { in get_wkc_len() argument
1133 if (coap_print_wellknown(context, buf, &len, UINT_MAX, query_filter) in get_wkc_len()
1147 coap_wellknown_response(coap_context_t *context, coap_pdu_t *request) { in coap_wellknown_response() argument
1174 wkc_len = get_wkc_len(context, query_filter); in coap_wellknown_response()
1254 result = coap_print_wellknown(context, resp->data, &len, offset, query_filter); in coap_wellknown_response()
1281 coap_cancel(coap_context_t *context, const coap_queue_t *sent) { in coap_cancel() argument
1292 RESOURCES_ITER(context->resources, r) { in coap_cancel()
1294 coap_cancel_all_messages(context, &sent->remote, token.s, token.length); in coap_cancel()
1355 handle_request(coap_context_t *context, coap_queue_t *node) { in handle_request() argument
1366 resource = coap_get_resource_from_key(context, key); in handle_request()
1378 response = coap_wellknown_response(context, node->pdu); in handle_request()
1399 if (response && !no_response(node->pdu, response) && coap_send(context, &node->local_if, 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()
1476 if (coap_send(context, &node->local_if, in handle_request()
1489 response = coap_wellknown_response(context, node->pdu); in handle_request()
1495 if (!response || (coap_send(context, &node->local_if, &node->remote, in handle_request()
1504 handle_response(coap_context_t *context, in handle_response() argument
1507 coap_send_ack(context, &rcvd->local_if, &rcvd->remote, rcvd->pdu); in handle_response()
1513 coap_cancel_all_messages(context, &rcvd->remote, in handle_response()
1518 if (context->response_handler) { in handle_response()
1519 context->response_handler(context, &rcvd->local_if, in handle_response()
1527 handle_locally(coap_context_t *context __attribute__ ((unused)), argument
1530 handle_locally(coap_context_t *context, coap_queue_t *node) {
1537 coap_dispatch(coap_context_t *context, coap_queue_t *rcvd) { argument
1542 if (!context)
1557 coap_remove_from_queue(&context->sendqueue, rcvd->id, &sent);
1568 coap_touch_observer(context, &sent->remote, &token);
1584 coap_remove_from_queue(&context->sendqueue, rcvd->id, &sent);
1587 coap_cancel(context, sent);
1591 if (coap_option_check_critical(context, rcvd->pdu, opt_filter) == 0)
1596 if (coap_option_check_critical(context, rcvd->pdu, opt_filter) == 0) {
1606 if (coap_send(context, &rcvd->local_if, &rcvd->remote, response)
1620 if (handle_locally(context, rcvd)) {
1622 handle_request(context, rcvd);
1624 handle_response(context, sent, rcvd);
1631 coap_send_message_type(context, &rcvd->local_if, &rcvd->remote,
1644 coap_can_exit( coap_context_t *context ) { argument
1645 return !context || (context->sendqueue == NULL);