'\" t .\" Title: coap_deprecated .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/31/2024 .\" Manual: libcoap Manual .\" Source: coap_deprecated 4.3.4 .\" Language: English .\" .TH "COAP_DEPRECATED" "3" "01/31/2024" "coap_deprecated 4\&.3\&.4" "libcoap Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" coap_deprecated, coap_clear_event_handler, coap_context_set_psk, coap_encode_var_bytes, coap_new_client_session_psk, coap_option_clrb, coap_option_getb, coap_option_setb, coap_read, coap_register_handler, coap_resource_set_dirty, coap_run_once, coap_set_event_handler, coap_write \- Work with CoAP deprecated functions .SH "SYNOPSIS" .sp \fB#include \fR .sp \fBvoid coap_clear_event_handler(coap_context_t *\fR\fB\fIcontext\fR\fR\fB);\fR .sp \fBint coap_context_set_psk(coap_context_t *\fR\fB\fIcontext\fR\fR\fB, const char *\fR\fB\fIhint\fR\fR\fB, const uint8_t *\fR\fB\fIkey\fR\fR\fB, size_t \fR\fB\fIkey_len\fR\fR\fB);\fR .sp \fBint coap_encode_var_bytes(uint8_t *\fR\fB\fIbuffer\fR\fR\fB, unsigned int \fR\fB\fIvalue\fR\fR\fB);\fR .sp \fBcoap_session_t *coap_new_client_session_psk(coap_context_t *\fR\fB\fIcontext\fR\fR\fB, const coap_address_t *\fR\fB\fIlocal_if\fR\fR\fB, const coap_address_t *\fR\fB\fIserver\fR\fR\fB, coap_proto_t \fR\fB\fIproto\fR\fR\fB, const char *\fR\fB\fIidentity\fR\fR\fB, const uint8_t *\fR\fB\fIkey\fR\fR\fB, unsigned \fR\fB\fIkey_len\fR\fR\fB);\fR .sp \fBint coap_option_clrb(coap_opt_filter_t *\fR\fB\fIfilter\fR\fR\fB, uint16_t \fR\fB\fItype\fR\fR\fB);\fR .sp \fBint coap_option_getb(coap_opt_filter_t *\fR\fB\fIfilter\fR\fR\fB, uint16_t \fR\fB\fItype\fR\fR\fB);\fR .sp \fBint coap_option_setb(coap_opt_filter_t *\fR\fB\fIfilter\fR\fR\fB, uint16_t \fR\fB\fItype\fR\fR\fB);\fR .sp \fBvoid coap_read(coap_context_t *\fR\fB\fIcontext\fR\fR\fB, coap_tick_t \fR\fB\fInow\fR\fR\fB);\fR .sp \fBvoid coap_register_handler(coap_resource_t *\fR\fB\fIresource\fR\fR\fB, coap_request_t \fR\fB\fImethod\fR\fR\fB, coap_method_handler_t \fR\fB\fIhandler\fR\fR\fB);\fR .sp \fBint coap_resource_set_dirty(coap_resource_t *\fR\fB\fIresource\fR\fR\fB, const coap_string_t *\fR\fB\fIquery\fR\fR\fB);\fR .sp \fBint coap_run_once(coap_context_t *\fR\fB\fIcontext\fR\fR\fB, uint32_t \fR\fB\fItimeout_ms\fR\fR\fB);\fR .sp \fBvoid coap_set_event_handler(coap_context_t *\fR\fB\fIcontext\fR\fR\fB, coap_event_handler_t \fR\fB\fIhandler\fR\fR\fB);\fR .sp \fBunsigned int coap_write(coap_context_t *\fR\fB\fIcontext\fR\fR\fB, coap_socket_t *\fR\fB\fIsockets\fR\fR\fB[], unsigned int \fR\fB\fImax_sockets\fR\fR\fB, unsigned int *\fR\fB\fInum_sockets\fR\fR\fB, coap_tick_t \fR\fB\fInow\fR\fR\fB);\fR .sp For specific (D)TLS library support, link with \fB\-lcoap\-3\-notls\fR, \fB\-lcoap\-3\-gnutls\fR, \fB\-lcoap\-3\-openssl\fR, \fB\-lcoap\-3\-mbedtls\fR or \fB\-lcoap\-3\-tinydtls\fR\&. Otherwise, link with \fB\-lcoap\-3\fR to get the default (D)TLS library support\&. .SH "DESCRIPTION" .sp Several of the existing CoAP API functions have been deprecated\&. These are listed here, along with the functions that should now be used instead\&. .SH "FUNCTIONS" .sp \fBFunction: coap_clear_event_handler()\fR .sp The \fBcoap_clear_event_handler\fR() function is replaced by \fBcoap_register_event_handler\fR(3), using NULL for \fIhandler\fR\&. .sp \fBFunction: coap_context_set_psk()\fR .sp The \fBcoap_context_set_psk\fR() function is replaced by \fBcoap_context_set_psk2\fR(3) which gives additional PSK configuration capability by the use of the coap_dtls_spsk_t structure\&. .sp \fBFunction: coap_encode_var_bytes()\fR .sp The \fBcoap_encode_var_bytes\fR() function is replaced by \fBcoap_encode_var_safe\fR(3)\&. .sp \fBFunction: coap_new_client_session_psk()\fR .sp The \fBcoap_new_client_session_psk\fR() function is replaced by \fBcoap_new_client_session_psk2\fR(3) which gives additional PSK configuration capability by the use of the coap_dtls_cpsk_t structure\&. .sp \fBFunction: coap_option_clrb()\fR .sp The \fBcoap_option_clrb\fR() function is replaced by \fBcoap_option_filter_unset\fR(3)\&. .sp \fBFunction: coap_option_getb()\fR .sp The \fBcoap_option_getb\fR() function is replaced by \fBcoap_option_filter_get\fR(3)\&. .sp \fBFunction: coap_option_setb()\fR .sp The \fBcoap_option_setb\fR() function is replaced by \fBcoap_option_filter_set\fR(3)\&. .sp \fBFunction: coap_read()\fR .sp The \fBcoap_read\fR() function is replaced by \fBcoap_io_do_io\fR(3)\&. .sp \fBFunction: coap_register_handler()\fR .sp The \fBcoap_register_handler\fR() function is replaced by \fBcoap_register_request_handler\fR(3)\&. .sp \fBFunction: coap_resource_set_dirty()\fR .sp The \fBcoap_resource_set_dirty\fR() function is replaced by \fBcoap_resource_notify_observers\fR(3)\&. .sp \fBFunction: coap_run_once()\fR .sp The \fBcoap_run_once\fR() function is replaced by \fBcoap_io_process\fR(3)\&. .sp \fBFunction: coap_set_event_handler()\fR .sp The \fBcoap_set_event_handler\fR() function is replaced by \fBcoap_register_event_handler\fR(3)\&. .sp \fBFunction: coap_clear_event_handler()\fR .sp The \fBcoap_write\fR() function is replaced by \fBcoap_io_prepare_io\fR(3)\&. .SH "RETURN VALUES" .sp \fBcoap_context_set_psk\fR() returns 1 if success, 0 on failure\&. .sp \fBcoap_encode_var_bytes\fR() returns either the length of bytes encoded (which can be 0 when encoding 0) or 0 on failure\&. .sp \fBcoap_new_client_session_psk\fR() returns a new session if success, NULL on failure\&. .sp \fBcoap_option_clrb\fR() returns 1 if bit was set, \-1 otherwise\&. .sp \fBcoap_option_getb\fR() returns 1 if bit was set, 0 if not\&. .sp \fBcoap_option_setb\fR() returns 1 if bit was set, \-1 otherwise\&. .sp \fBcoap_resource_set_dirty\fR() returns 1 if success, 0 on failure\&. .sp \fBcoap_run_once\fR() returns number of milliseconds spent in function or \-1 if there was an error\&. .sp \fBcoap_write\fR() returns the number of milli\-seconds that need to be waited before the function should next be called\&. .SH "SEE ALSO" .sp \fBcoap_endpoint_client\fR(3), \fBcoap_endpoint_server\fR(3), \fBcoap_handler\fR(3), \fBcoap_io\fR(3), \fBcoap_observe\fR(3), \fBcoap_pdu_access\fR(3) and \fBcoap_pdu_setup\fR(3)\&. .SH "FURTHER INFORMATION" .sp See .sp "RFC7252: The Constrained Application Protocol (CoAP)" .sp for further information\&. .SH "BUGS" .sp Please report bugs on the mailing list for libcoap: libcoap\-developers@lists\&.sourceforge\&.net or raise an issue on GitHub at https://github\&.com/obgm/libcoap/issues .SH "AUTHORS" .sp The libcoap project