Lines Matching refs:response

778   coap_pdu_t *response;
783 response = coap_pdu_init(COAP_MESSAGE_ACK, 0, request->mid, 0);
784 if (response)
785 result = coap_send_internal(session, response);
847 coap_pdu_t *response;
853 response = coap_new_error_response(request, code, opts);
854 if (response)
855 result = coap_send_internal(session, response);
863 coap_pdu_t *response;
867 response = coap_pdu_init(type, 0, request->mid, 0);
868 if (response)
869 result = coap_send_internal(session, response);
1005 * Need to wait for first request to get out and response back before
1023 coap_log_debug("** %s: timeout waiting for first response\n",
1061 * If this is not the first client request and are waiting for a response
1077 * When the pass / fail response for Extended Token is received, this PDU
1296 * (Q-)Block2 in the response. However, still need it for Observe, Oscore and
1335 /* Need to terminate and clean up previous response setup */
1484 * above and hence timeout / drop the response as appropriate
2370 coap_pdu_t *response;
2386 * Need space for IP for 5.08 response which is filled in in
2446 /* Now create the response and fill with options and payload data. */
2447 response = coap_pdu_init(type, code, request->mid, size);
2448 if (response) {
2450 if (!coap_add_token(response, request->actual_token.length,
2452 coap_log_debug("cannot add token to error response\n");
2453 coap_delete_pdu(response);
2460 coap_add_option_internal(response, opt_iter.number,
2468 coap_add_data(response, (size_t)strlen(phrase), (const uint8_t *)phrase);
2472 return response;
2506 coap_pdu_t *response) {
2532 if (!coap_insert_option(response, COAP_OPTION_CONTENT_FORMAT,
2537 if (response->used_size + len + 1 > response->max_size) {
2543 len, response->max_size - response->used_size - 1);
2544 len = response->max_size - response->used_size - 1;
2546 if (!coap_add_data(response, len, data_string->s)) {
2551 response, query,
2560 response->code = COAP_RESPONSE_CODE(205);
2566 if (response->code == 0) {
2567 /* set error code 5.03 and remove all options and data from response */
2568 response->code = COAP_RESPONSE_CODE(503);
2569 response->used_size = response->e_token_length;
2570 response->data = NULL;
2579 * required when receiving an RST message (usually in response to a
2616 * returns @c RESPONSE_DROP if @p response should be suppressed
2619 * If the response is a confirmable piggybacked response and RESPONSE_DROP,
2623 * Checks if the response code is 0.00 and if either the session is reliable or
2626 * Multicast response checking is also carried out.
2629 * a delayed separate response should be sent as the original requesting packet
2651 * @param response The response that is potentially suppressed.
2653 * @param session The session this request/response are associated with.
2656 * RESPONSE_DROP when the response must be discarded, or
2657 * RESPONSE_SEND when the response must be sent.
2660 no_response(coap_pdu_t *request, coap_pdu_t *response,
2667 assert(response);
2669 if (COAP_RESPONSE_CLASS(response->code) > 0) {
2675 /* The response should be dropped when the bit corresponding to
2676 * the response class is set (cf. table in function
2679 * this response. */
2680 if (((1 << (COAP_RESPONSE_CLASS(response->code) - 1)) & val) > 0) {
2681 /* Should be dropping the response */
2682 if (response->type == COAP_MESSAGE_ACK &&
2685 response->code = 0;
2687 response->actual_token.length = 0;
2688 response->e_token_length = 0;
2689 response->used_size = 0;
2690 response->data = NULL;
2704 COAP_RESPONSE_CLASS(response->code) == 2) {
2708 response->code == COAP_RESPONSE_CODE(205)) {
2709 if (response->data == NULL)
2713 COAP_RESPONSE_CLASS(response->code) == 4) {
2717 COAP_RESPONSE_CLASS(response->code) == 5) {
2721 } else if (COAP_PDU_IS_EMPTY(response) &&
2722 (response->type == COAP_MESSAGE_NON ||
2724 /* response is 0.00, and this is reliable or non-confirmable */
2735 response->type == COAP_MESSAGE_RST)
2739 COAP_RESPONSE_CLASS(response->code) > 2)
2743 /* Default behavior applies when we are not dealing with a response
2760 coap_pdu_t *response = NULL;
2763 /* The respond field indicates whether a response must be treated
2765 * or interest in a specific response class. DEFAULT indicates that
2803 coap_log_info("Retransmit async response\n");
2950 * else if well-known URI generate a default response
3050 response = coap_pdu_init(pdu->type == COAP_MESSAGE_CON ?
3053 if (!response) {
3054 coap_log_err("could not create response PDU\n");
3058 response->session = session;
3060 /* If handling a separate response, need CON, not ACK response */
3062 response->type = COAP_MESSAGE_CON;
3065 if (!coap_add_token(response, pdu->actual_token.length,
3090 if (coap_handle_request_put_block(context, session, pdu, response,
3098 if (coap_handle_request_send_block(session, pdu, response, resource,
3117 response->code = COAP_RESPONSE_CODE(400);
3124 response->code = COAP_RESPONSE_CODE(400);
3135 coap_add_option_internal(response, COAP_OPTION_OBSERVE,
3151 /* Make the proxy response separate and fix response later */
3179 h(resource, session, pdu, query, response);
3182 coap_check_code_lg_xmit(session, pdu, response, resource, query);
3185 /* Check to see if the server is doing a 4.01 + Echo response */
3186 if (response->code == COAP_RESPONSE_CODE(401) &&
3187 coap_check_option(response, COAP_OPTION_ECHO, &opt_iter)) {
3188 /* Need to keep lg_srcv around for client's response */
3194 if (added_block && COAP_RESPONSE_CLASS(response->code) == 2) {
3196 response->code = COAP_RESPONSE_CODE(231);
3201 response->type == COAP_MESSAGE_ACK) {
3203 response->type = COAP_MESSAGE_CON;
3205 if (response->code == 0) {
3209 respond = no_response(pdu, response, session, resource);
3214 if (COAP_RESPONSE_CLASS(response->code) != 2) {
3216 coap_remove_option(response, COAP_OPTION_OBSERVE);
3219 if (COAP_RESPONSE_CLASS(response->code) > 2) {
3223 coap_remove_option(response, COAP_OPTION_BLOCK1);
3227 * application handler made no changes to the response, then
3230 if ((response->type == COAP_MESSAGE_ACK)
3231 && (response->code == 0)) {
3233 response->actual_token.length = 0;
3234 response->e_token_length = 0;
3235 response->used_size = 0;
3236 response->data = NULL;
3243 /* No delays to response */
3246 !lg_xmit_ctrl && response->code == COAP_RESPONSE_CODE(205) &&
3247 coap_get_block_b(session, response, COAP_OPTION_Q_BLOCK2, &block) &&
3250 response,
3252 coap_log_debug("cannot send response for mid=0x%x\n", mid);
3253 response = NULL;
3259 if (coap_send_internal(session, response) == COAP_INVALID_MID) {
3260 coap_log_debug("cannot send response for mid=0x%04x\n", mid);
3263 /* Need to delay mcast response */
3272 if (!coap_pdu_encode_header(response, session->proto)) {
3277 node->id = response->mid;
3278 node->pdu = response;
3282 coap_log_debug(" %s: mid=0x%04x: mcast response delayed for %u.%03u secs\n",
3284 response->mid,
3293 coap_log_debug(" %s: mid=0x%04x: response dropped\n",
3295 response->mid);
3296 coap_show_pdu(COAP_LOG_DEBUG, response);
3298 coap_delete_pdu(response);
3325 coap_delete_pdu(response);
3326 response =
3329 if (response)
3340 /* In a lossy context, the ACK of a separate response may have
3351 /* Duplicate response */
3357 /* Duplicate response */
3420 /* Call application-specific response handler when available. */
3503 coap_pdu_t *response;
3506 response = coap_new_error_response(pdu, COAP_RESPONSE_CODE(400),
3508 if (!response) {
3509 coap_log_warn("coap_dispatch: cannot create error response\n");
3515 if (coap_send_internal(session, response) == COAP_INVALID_MID)
3516 coap_log_warn("coap_dispatch: error sending response\n");
3531 coap_pdu_t *response;
3554 response =
3557 if (!response) {
3558 coap_log_warn("coap_dispatch: cannot create error response\n");
3560 if (coap_send_internal(session, response) == COAP_INVALID_MID)
3561 coap_log_warn("coap_dispatch: error sending response\n");
3763 /* find transaction in sendqueue in case large response */
3783 response =
3786 if (!response) {
3787 coap_log_warn("coap_dispatch: cannot create error response\n");
3789 if (coap_send_internal(session, response) == COAP_INVALID_MID)
3790 coap_log_warn("coap_dispatch: error sending response\n");