Lines Matching +full:- +full:r

4  * SPDX-License-Identifier: Apache-2.0
45 if (poll(fds, nfds, -1) < 0) { in wait()
72 return -errno; in start_coap_client()
78 return -errno; in start_coap_client()
97 return -ENOMEM; in process_simple_coap_reply()
102 ret = -EIO; in process_simple_coap_reply()
110 ret = -errno; in process_simple_coap_reply()
135 int r; in send_simple_coap_request() local
139 return -ENOMEM; in send_simple_coap_request()
142 r = coap_packet_init(&request, data, MAX_COAP_MSG_LEN, in send_simple_coap_request()
146 if (r < 0) { in send_simple_coap_request()
152 r = coap_packet_append_option(&request, COAP_OPTION_URI_PATH, in send_simple_coap_request()
154 if (r < 0) { in send_simple_coap_request()
167 r = coap_packet_append_payload_marker(&request); in send_simple_coap_request()
168 if (r < 0) { in send_simple_coap_request()
173 r = coap_packet_append_payload(&request, (uint8_t *)payload, in send_simple_coap_request()
174 sizeof(payload) - 1); in send_simple_coap_request()
175 if (r < 0) { in send_simple_coap_request()
182 r = -EINVAL; in send_simple_coap_request()
188 r = send(sock, request.data, request.offset, 0); in send_simple_coap_request()
193 return r; in send_simple_coap_request()
199 int r; in send_simple_coap_msgs_and_wait_for_reply() local
206 r = send_simple_coap_request(COAP_METHOD_GET); in send_simple_coap_msgs_and_wait_for_reply()
207 if (r < 0) { in send_simple_coap_msgs_and_wait_for_reply()
208 return r; in send_simple_coap_msgs_and_wait_for_reply()
215 r = send_simple_coap_request(COAP_METHOD_PUT); in send_simple_coap_msgs_and_wait_for_reply()
216 if (r < 0) { in send_simple_coap_msgs_and_wait_for_reply()
217 return r; in send_simple_coap_msgs_and_wait_for_reply()
224 r = send_simple_coap_request(COAP_METHOD_POST); in send_simple_coap_msgs_and_wait_for_reply()
225 if (r < 0) { in send_simple_coap_msgs_and_wait_for_reply()
226 return r; in send_simple_coap_msgs_and_wait_for_reply()
233 r = send_simple_coap_request(COAP_METHOD_DELETE); in send_simple_coap_msgs_and_wait_for_reply()
234 if (r < 0) { in send_simple_coap_msgs_and_wait_for_reply()
235 return r; in send_simple_coap_msgs_and_wait_for_reply()
243 r = process_simple_coap_reply(); in send_simple_coap_msgs_and_wait_for_reply()
244 if (r < 0) { in send_simple_coap_msgs_and_wait_for_reply()
245 return r; in send_simple_coap_msgs_and_wait_for_reply()
266 return -ENOMEM; in process_large_coap_reply()
271 ret = -EIO; in process_large_coap_reply()
279 ret = -errno; in process_large_coap_reply()
317 int r; in send_large_coap_request() local
326 return -ENOMEM; in send_large_coap_request()
329 r = coap_packet_init(&request, data, MAX_COAP_MSG_LEN, in send_large_coap_request()
333 if (r < 0) { in send_large_coap_request()
339 r = coap_packet_append_option(&request, COAP_OPTION_URI_PATH, in send_large_coap_request()
341 if (r < 0) { in send_large_coap_request()
347 r = coap_append_block2_option(&request, &blk_ctx); in send_large_coap_request()
348 if (r < 0) { in send_large_coap_request()
355 r = send(sock, request.data, request.offset, 0); in send_large_coap_request()
360 return r; in send_large_coap_request()
365 int r; in get_large_coap_msgs() local
371 r = send_large_coap_request(); in get_large_coap_msgs()
372 if (r < 0) { in get_large_coap_msgs()
373 return r; in get_large_coap_msgs()
376 r = process_large_coap_reply(); in get_large_coap_msgs()
377 if (r < 0) { in get_large_coap_msgs()
378 return r; in get_large_coap_msgs()
382 if (r == 1) { in get_large_coap_msgs()
395 int r; in send_obs_reply_ack() local
402 r = coap_packet_init(&request, data, MAX_COAP_MSG_LEN, in send_obs_reply_ack()
404 if (r < 0) { in send_obs_reply_ack()
411 r = send(sock, request.data, request.offset, 0); in send_obs_reply_ack()
412 if (r < 0) { in send_obs_reply_ack()
426 uint8_t *counter = (uint8_t *)reply->user_data; in obs_notification_cb()
452 return -ENOMEM; in process_obs_coap_reply()
457 ret = -EIO; in process_obs_coap_reply()
465 ret = -errno; in process_obs_coap_reply()
494 int r; in send_obs_coap_request() local
498 return -ENOMEM; in send_obs_coap_request()
501 r = coap_packet_init(&request, data, MAX_COAP_MSG_LEN, in send_obs_coap_request()
505 if (r < 0) { in send_obs_coap_request()
510 r = coap_append_option_int(&request, COAP_OPTION_OBSERVE, 0); in send_obs_coap_request()
511 if (r < 0) { in send_obs_coap_request()
517 r = coap_packet_append_option(&request, COAP_OPTION_URI_PATH, in send_obs_coap_request()
519 if (r < 0) { in send_obs_coap_request()
528 reply->reply = obs_notification_cb; in send_obs_coap_request()
529 reply->user_data = user_data; in send_obs_coap_request()
531 r = send(sock, request.data, request.offset, 0); in send_obs_coap_request()
536 return r; in send_obs_coap_request()
544 int r; in send_obs_reset_coap_request() local
548 return -ENOMEM; in send_obs_reset_coap_request()
551 r = coap_packet_init(&request, data, MAX_COAP_MSG_LEN, in send_obs_reset_coap_request()
553 reply->tkl, reply->token, in send_obs_reset_coap_request()
555 if (r < 0) { in send_obs_reset_coap_request()
560 r = coap_append_option_int(&request, COAP_OPTION_OBSERVE, 1); in send_obs_reset_coap_request()
561 if (r < 0) { in send_obs_reset_coap_request()
567 r = coap_packet_append_option(&request, COAP_OPTION_URI_PATH, in send_obs_reset_coap_request()
569 if (r < 0) { in send_obs_reset_coap_request()
577 r = send(sock, request.data, request.offset, 0); in send_obs_reset_coap_request()
582 return r; in send_obs_reset_coap_request()
589 int r; in register_observer() local
592 r = send_obs_coap_request(&reply, &counter); in register_observer()
593 if (r < 0) { in register_observer()
594 return r; in register_observer()
598 r = process_obs_coap_reply(&reply); in register_observer()
599 if (r < 0) { in register_observer()
600 return r; in register_observer()
609 r = send_obs_reset_coap_request(&reply); in register_observer()
610 if (r < 0) { in register_observer()
611 return r; in register_observer()
615 r = process_obs_coap_reply(&reply); in register_observer()
616 if (r < 0) { in register_observer()
617 return r; in register_observer()
629 int r; in main() local
631 LOG_DBG("Start CoAP-client sample"); in main()
632 r = start_coap_client(); in main()
633 if (r < 0) { in main()
638 r = send_simple_coap_msgs_and_wait_for_reply(); in main()
639 if (r < 0) { in main()
643 /* Block-wise transfer */ in main()
644 r = get_large_coap_msgs(); in main()
645 if (r < 0) { in main()
650 r = register_observer(); in main()
651 if (r < 0) { in main()