1c87c5fbaSopenharmony_ci// -*- mode:doc; -*- 2c87c5fbaSopenharmony_ci// vim: set syntax=asciidoc tw=0 3c87c5fbaSopenharmony_ci 4c87c5fbaSopenharmony_cicoap_deprecated(3) 5c87c5fbaSopenharmony_ci================== 6c87c5fbaSopenharmony_ci:doctype: manpage 7c87c5fbaSopenharmony_ci:man source: coap_deprecated 8c87c5fbaSopenharmony_ci:man version: @PACKAGE_VERSION@ 9c87c5fbaSopenharmony_ci:man manual: libcoap Manual 10c87c5fbaSopenharmony_ci 11c87c5fbaSopenharmony_ciNAME 12c87c5fbaSopenharmony_ci---- 13c87c5fbaSopenharmony_cicoap_deprecated, 14c87c5fbaSopenharmony_cicoap_clear_event_handler, 15c87c5fbaSopenharmony_cicoap_context_set_psk, 16c87c5fbaSopenharmony_cicoap_encode_var_bytes, 17c87c5fbaSopenharmony_cicoap_new_client_session_psk, 18c87c5fbaSopenharmony_cicoap_option_clrb, 19c87c5fbaSopenharmony_cicoap_option_getb, 20c87c5fbaSopenharmony_cicoap_option_setb, 21c87c5fbaSopenharmony_cicoap_read, 22c87c5fbaSopenharmony_cicoap_register_handler, 23c87c5fbaSopenharmony_cicoap_resource_set_dirty, 24c87c5fbaSopenharmony_cicoap_run_once, 25c87c5fbaSopenharmony_cicoap_set_event_handler, 26c87c5fbaSopenharmony_cicoap_write 27c87c5fbaSopenharmony_ci- Work with CoAP deprecated functions 28c87c5fbaSopenharmony_ci 29c87c5fbaSopenharmony_ciSYNOPSIS 30c87c5fbaSopenharmony_ci-------- 31c87c5fbaSopenharmony_ci*#include <coap@LIBCOAP_API_VERSION@/coap.h>* 32c87c5fbaSopenharmony_ci 33c87c5fbaSopenharmony_ci*void coap_clear_event_handler(coap_context_t *_context_);* 34c87c5fbaSopenharmony_ci 35c87c5fbaSopenharmony_ci*int coap_context_set_psk(coap_context_t *_context_, const char *_hint_, 36c87c5fbaSopenharmony_ciconst uint8_t *_key_, size_t _key_len_);* 37c87c5fbaSopenharmony_ci 38c87c5fbaSopenharmony_ci*int coap_encode_var_bytes(uint8_t *_buffer_, unsigned int _value_);* 39c87c5fbaSopenharmony_ci 40c87c5fbaSopenharmony_ci*coap_session_t *coap_new_client_session_psk(coap_context_t *_context_, 41c87c5fbaSopenharmony_ciconst coap_address_t *_local_if_, const coap_address_t *_server_, 42c87c5fbaSopenharmony_cicoap_proto_t _proto_, const char *_identity_, const uint8_t *_key_, 43c87c5fbaSopenharmony_ciunsigned _key_len_);* 44c87c5fbaSopenharmony_ci 45c87c5fbaSopenharmony_ci*int coap_option_clrb(coap_opt_filter_t *_filter_, uint16_t _type_);* 46c87c5fbaSopenharmony_ci 47c87c5fbaSopenharmony_ci*int coap_option_getb(coap_opt_filter_t *_filter_, uint16_t _type_);* 48c87c5fbaSopenharmony_ci 49c87c5fbaSopenharmony_ci*int coap_option_setb(coap_opt_filter_t *_filter_, uint16_t _type_);* 50c87c5fbaSopenharmony_ci 51c87c5fbaSopenharmony_ci*void coap_read(coap_context_t *_context_, coap_tick_t _now_);* 52c87c5fbaSopenharmony_ci 53c87c5fbaSopenharmony_ci*void coap_register_handler(coap_resource_t *_resource_, 54c87c5fbaSopenharmony_cicoap_request_t _method_, coap_method_handler_t _handler_);* 55c87c5fbaSopenharmony_ci 56c87c5fbaSopenharmony_ci*int coap_resource_set_dirty(coap_resource_t *_resource_, 57c87c5fbaSopenharmony_ciconst coap_string_t *_query_);* 58c87c5fbaSopenharmony_ci 59c87c5fbaSopenharmony_ci*int coap_run_once(coap_context_t *_context_, uint32_t _timeout_ms_);* 60c87c5fbaSopenharmony_ci 61c87c5fbaSopenharmony_ci*void coap_set_event_handler(coap_context_t *_context_, 62c87c5fbaSopenharmony_cicoap_event_handler_t _handler_);* 63c87c5fbaSopenharmony_ci 64c87c5fbaSopenharmony_ci*unsigned int coap_write(coap_context_t *_context_, coap_socket_t *_sockets_[], 65c87c5fbaSopenharmony_ciunsigned int _max_sockets_, unsigned int *_num_sockets_, coap_tick_t _now_);* 66c87c5fbaSopenharmony_ci 67c87c5fbaSopenharmony_ciFor specific (D)TLS library support, link with 68c87c5fbaSopenharmony_ci*-lcoap-@LIBCOAP_API_VERSION@-notls*, *-lcoap-@LIBCOAP_API_VERSION@-gnutls*, 69c87c5fbaSopenharmony_ci*-lcoap-@LIBCOAP_API_VERSION@-openssl*, *-lcoap-@LIBCOAP_API_VERSION@-mbedtls* 70c87c5fbaSopenharmony_cior *-lcoap-@LIBCOAP_API_VERSION@-tinydtls*. Otherwise, link with 71c87c5fbaSopenharmony_ci*-lcoap-@LIBCOAP_API_VERSION@* to get the default (D)TLS library support. 72c87c5fbaSopenharmony_ci 73c87c5fbaSopenharmony_ciDESCRIPTION 74c87c5fbaSopenharmony_ci----------- 75c87c5fbaSopenharmony_ci 76c87c5fbaSopenharmony_ciSeveral of the existing CoAP API functions have been deprecated. These are 77c87c5fbaSopenharmony_cilisted here, along with the functions that should now be used instead. 78c87c5fbaSopenharmony_ci 79c87c5fbaSopenharmony_ciFUNCTIONS 80c87c5fbaSopenharmony_ci--------- 81c87c5fbaSopenharmony_ci 82c87c5fbaSopenharmony_ci*Function: coap_clear_event_handler()* 83c87c5fbaSopenharmony_ci 84c87c5fbaSopenharmony_ciThe *coap_clear_event_handler*() function is replaced by 85c87c5fbaSopenharmony_ci*coap_register_event_handler*(3), using NULL for _handler_. 86c87c5fbaSopenharmony_ci 87c87c5fbaSopenharmony_ci*Function: coap_context_set_psk()* 88c87c5fbaSopenharmony_ci 89c87c5fbaSopenharmony_ciThe *coap_context_set_psk*() function is replaced by 90c87c5fbaSopenharmony_ci*coap_context_set_psk2*(3) which gives additional PSK configuration capability 91c87c5fbaSopenharmony_ciby the use of the coap_dtls_spsk_t structure. 92c87c5fbaSopenharmony_ci 93c87c5fbaSopenharmony_ci*Function: coap_encode_var_bytes()* 94c87c5fbaSopenharmony_ci 95c87c5fbaSopenharmony_ciThe *coap_encode_var_bytes*() function is replaced by 96c87c5fbaSopenharmony_ci*coap_encode_var_safe*(3). 97c87c5fbaSopenharmony_ci 98c87c5fbaSopenharmony_ci*Function: coap_new_client_session_psk()* 99c87c5fbaSopenharmony_ci 100c87c5fbaSopenharmony_ciThe *coap_new_client_session_psk*() function is replaced by 101c87c5fbaSopenharmony_ci*coap_new_client_session_psk2*(3) which gives additional PSK configuration capability 102c87c5fbaSopenharmony_ciby the use of the coap_dtls_cpsk_t structure. 103c87c5fbaSopenharmony_ci 104c87c5fbaSopenharmony_ci*Function: coap_option_clrb()* 105c87c5fbaSopenharmony_ci 106c87c5fbaSopenharmony_ciThe *coap_option_clrb*() function is replaced by 107c87c5fbaSopenharmony_ci*coap_option_filter_unset*(3). 108c87c5fbaSopenharmony_ci 109c87c5fbaSopenharmony_ci*Function: coap_option_getb()* 110c87c5fbaSopenharmony_ci 111c87c5fbaSopenharmony_ciThe *coap_option_getb*() function is replaced by 112c87c5fbaSopenharmony_ci*coap_option_filter_get*(3). 113c87c5fbaSopenharmony_ci 114c87c5fbaSopenharmony_ci*Function: coap_option_setb()* 115c87c5fbaSopenharmony_ci 116c87c5fbaSopenharmony_ciThe *coap_option_setb*() function is replaced by 117c87c5fbaSopenharmony_ci*coap_option_filter_set*(3). 118c87c5fbaSopenharmony_ci 119c87c5fbaSopenharmony_ci*Function: coap_read()* 120c87c5fbaSopenharmony_ci 121c87c5fbaSopenharmony_ciThe *coap_read*() function is replaced by 122c87c5fbaSopenharmony_ci*coap_io_do_io*(3). 123c87c5fbaSopenharmony_ci 124c87c5fbaSopenharmony_ci*Function: coap_register_handler()* 125c87c5fbaSopenharmony_ci 126c87c5fbaSopenharmony_ciThe *coap_register_handler*() function is replaced by 127c87c5fbaSopenharmony_ci*coap_register_request_handler*(3). 128c87c5fbaSopenharmony_ci 129c87c5fbaSopenharmony_ci*Function: coap_resource_set_dirty()* 130c87c5fbaSopenharmony_ci 131c87c5fbaSopenharmony_ciThe *coap_resource_set_dirty*() function is replaced by 132c87c5fbaSopenharmony_ci*coap_resource_notify_observers*(3). 133c87c5fbaSopenharmony_ci 134c87c5fbaSopenharmony_ci*Function: coap_run_once()* 135c87c5fbaSopenharmony_ci 136c87c5fbaSopenharmony_ciThe *coap_run_once*() function is replaced by 137c87c5fbaSopenharmony_ci*coap_io_process*(3). 138c87c5fbaSopenharmony_ci 139c87c5fbaSopenharmony_ci*Function: coap_set_event_handler()* 140c87c5fbaSopenharmony_ci 141c87c5fbaSopenharmony_ciThe *coap_set_event_handler*() function is replaced by 142c87c5fbaSopenharmony_ci*coap_register_event_handler*(3). 143c87c5fbaSopenharmony_ci 144c87c5fbaSopenharmony_ci*Function: coap_clear_event_handler()* 145c87c5fbaSopenharmony_ci 146c87c5fbaSopenharmony_ciThe *coap_write*() function is replaced by 147c87c5fbaSopenharmony_ci*coap_io_prepare_io*(3). 148c87c5fbaSopenharmony_ci 149c87c5fbaSopenharmony_ciRETURN VALUES 150c87c5fbaSopenharmony_ci------------- 151c87c5fbaSopenharmony_ci*coap_context_set_psk*() returns 1 if success, 0 on failure. 152c87c5fbaSopenharmony_ci 153c87c5fbaSopenharmony_ci*coap_encode_var_bytes*() returns either the length of bytes encoded (which can 154c87c5fbaSopenharmony_cibe 0 when encoding 0) or 0 on failure. 155c87c5fbaSopenharmony_ci 156c87c5fbaSopenharmony_ci*coap_new_client_session_psk*() returns a new session if success, NULL on 157c87c5fbaSopenharmony_cifailure. 158c87c5fbaSopenharmony_ci 159c87c5fbaSopenharmony_ci*coap_option_clrb*() returns 1 if bit was set, -1 otherwise. 160c87c5fbaSopenharmony_ci 161c87c5fbaSopenharmony_ci*coap_option_getb*() returns 1 if bit was set, 0 if not. 162c87c5fbaSopenharmony_ci 163c87c5fbaSopenharmony_ci*coap_option_setb*() returns 1 if bit was set, -1 otherwise. 164c87c5fbaSopenharmony_ci 165c87c5fbaSopenharmony_ci*coap_resource_set_dirty*() returns 1 if success, 0 on failure. 166c87c5fbaSopenharmony_ci 167c87c5fbaSopenharmony_ci*coap_run_once*() returns number of milliseconds spent in function or -1 168c87c5fbaSopenharmony_ciif there was an error. 169c87c5fbaSopenharmony_ci 170c87c5fbaSopenharmony_ci*coap_write*() returns the number of milli-seconds that need to be waited 171c87c5fbaSopenharmony_cibefore the function should next be called. 172c87c5fbaSopenharmony_ci 173c87c5fbaSopenharmony_ciSEE ALSO 174c87c5fbaSopenharmony_ci-------- 175c87c5fbaSopenharmony_ci*coap_endpoint_client*(3), *coap_endpoint_server*(3), *coap_handler*(3), 176c87c5fbaSopenharmony_ci*coap_io*(3), *coap_observe*(3), *coap_pdu_access*(3) and *coap_pdu_setup*(3). 177c87c5fbaSopenharmony_ci 178c87c5fbaSopenharmony_ciFURTHER INFORMATION 179c87c5fbaSopenharmony_ci------------------- 180c87c5fbaSopenharmony_ciSee 181c87c5fbaSopenharmony_ci 182c87c5fbaSopenharmony_ci"https://rfc-editor.org/rfc/rfc7252[RFC7252: The Constrained Application Protocol (CoAP)]" 183c87c5fbaSopenharmony_ci 184c87c5fbaSopenharmony_cifor further information. 185c87c5fbaSopenharmony_ci 186c87c5fbaSopenharmony_ciBUGS 187c87c5fbaSopenharmony_ci---- 188c87c5fbaSopenharmony_ciPlease report bugs on the mailing list for libcoap: 189c87c5fbaSopenharmony_cilibcoap-developers@lists.sourceforge.net or raise an issue on GitHub at 190c87c5fbaSopenharmony_cihttps://github.com/obgm/libcoap/issues 191c87c5fbaSopenharmony_ci 192c87c5fbaSopenharmony_ciAUTHORS 193c87c5fbaSopenharmony_ci------- 194c87c5fbaSopenharmony_ciThe libcoap project <libcoap-developers@lists.sourceforge.net> 195