Crate libcoap_sys

Source
Expand description

Auto-generated unsafe bindings to libcoap, generated using bindgen.

This crate allows direct (but unsafe) usage of the libcoap C library from Rust. The declarations made in this library are generated automatically using bindgen, for further documentation on how to use them, refer to the libcoap documentation.

In most cases you probably want to use the safe wrapper provided by the libcoap crate (or another coap library written in pure rust such as coap-rs) instead.

§Cargo Features

We currently define a number of features that affect the functionality provided by this wrapper and required by the linked libcoap library.

Features affecting functionality:

  • dtls: Enable usage of DTLS for transport security. Supports a number of different backends.

    Note that while not specified here due to limitations in Cargo’s syntax, the DTLS feature depends on one of the DTLS backends being enabled, and failing to enable a DTLS backend will result in a build failure.

    If you are developing a library based on libcoap-sys and do not care about the DTLS backend, enable the dtls feature and let the user decide on the backend to use, either by re-exporting these features (see the Cargo Book) or by assuming that the user will use libcoap-sys as a dependency and enable the corresponding backend feature themselves, relying on Cargo’s feature unification to enable it for your crate as well.

    Also note that the backends are mutually exclusive due to the C library having these backends as mutually exclusive features. If multiple backends are enabled (e.g. because multiple dependencies use libcoap-sys and use different backends), we select one based on the auto-detection order specified in the libcoap configure script (gnutls > openssl > mbedtls > tinydtls).

    • dtls_backend_(openssl|gnutls|mbedtls|tinydtls): Enable the corresponding DTLS backend.

      Note that enabling the OpenSSL, GnuTLS, TinyDTLS or MbedTLS backend will also require the appropriate library to be available (hence the dependency on the corresponding sys-crate). The TinyDTLS backend is built using a vendored (and statically linked) version of TinyDTLS by default, see the tinydtls-sys crate for more info. Choosing a DTLS backend also means that the license terms of these libraries may apply to you. See the relevant parts of the libcoap license file for more information.

  • tcp (default): Enable CoAP over TCP support

  • async (default): Enable async functionality.

    Note that this async functionality is not translated to Rust’s async language functionality, but instead adds functionality to the underlying C library to allow for making asynchronous requests (i.e. function calls that return before the response has arrived).

    Integrating libcoap into Rusts async language features is out of scope for this crate, but might be implemented later on in the libcoap (safe abstraction) crate.

  • server (default): Enable code related to server functionality

  • client (default): Enable code related to client functionality

  • epoll (default): Allow the underlying C library to perform IO operations using epoll.

Other features:

  • vendored (default): Use a vendored version of libcoap instead of the system-provided one. Note that vendored implies static.
  • static (default): Perform static linking to the libcoap C library.

§Note on features affecting functionality

The features that add or remove functionality do not change the generated bindings as libcoap’s headers (unlike the source files themselves) are not affected by the corresponding #defines.

For library users that link to a shared version of libcoap, this means that the feature flags do not have any effect and the supported features will correspond directly to the features enabled during the build of the shared libcoap instance (using the configure-script).

For users of the vendored version of libcoap (see the vendored feature), the supported features of the vendored libcoap will be set to match the cargo features during build.

Structs§

__BindgenBitfieldUnit
__BindgenUnionField
coap_addr_hash_t
coap_addr_tuple_t
coap_address_t
coap_address_t__bindgen_ty_1
coap_async_t
coap_attr_t
coap_bin_const_t
coap_binary_t
coap_block_b_t
coap_block_t
coap_cache_entry_t
coap_cache_key_t
coap_context_t
coap_dtls_cpsk_info_t
coap_dtls_cpsk_t
coap_dtls_key_t
coap_dtls_pki_t
coap_dtls_spsk_info_t
coap_dtls_spsk_t
coap_endpoint_t
coap_fixed_point_t
coap_lg_crcv_t
coap_lg_srcv_t
coap_lg_xmit_t
coap_opt_filter_t
coap_opt_iterator_t
coap_option
coap_option_t
coap_optlist_t
coap_packet_t
coap_pdu_t
coap_pki_key_asn1_t
coap_pki_key_pem_buf_t
coap_pki_key_pem_t
coap_pki_key_pkcs11_t
coap_queue_t
coap_resource_t
coap_session_t
coap_socket_t
coap_str_const_t
coap_string_t
coap_subscription_t
coap_tls_version_t
coap_uri_t

Enums§

coap_asn1_privatekey_type_t
coap_cache_record_pdu_t
coap_cache_session_based_t
coap_dtls_role_t
coap_event_t
coap_memory_tag_t
coap_nack_reason_t
coap_pdu_code_t
coap_pdu_signaling_proto_t
coap_pdu_type_t
coap_pki_key_t
coap_proto_t
coap_request_t
coap_response_t
coap_session_state_t
coap_session_type_t
coap_tls_library_t
coap_uri_scheme_t

Constants§

COAP_ATTR_FLAGS_RELEASE_NAME
COAP_ATTR_FLAGS_RELEASE_VALUE
COAP_BERT_BASE
COAP_BLOCK_SINGLE_BODY
COAP_BLOCK_USE_LIBCOAP
COAP_DEFAULT_HOP_LIMIT
COAP_DEFAULT_MAX_AGE
COAP_DEFAULT_MAX_LATENCY
COAP_DEFAULT_MAX_RETRANSMIT
COAP_DEFAULT_MTU
COAP_DEFAULT_NSTART
COAP_DEFAULT_PORT
COAP_DEFAULT_PROBING_RATE
COAP_DEFAULT_SCHEME
COAP_DEFAULT_URI_WELLKNOWN
COAP_DTLS_CPSK_SETUP_VERSION
COAP_DTLS_HINT_LENGTH
COAP_DTLS_MAX_PSK
COAP_DTLS_MAX_PSK_IDENTITY
COAP_DTLS_PKI_SETUP_VERSION
COAP_DTLS_RPK_CERT_CN
COAP_DTLS_SPSK_SETUP_VERSION
COAP_ERROR_PHRASE_LENGTH
COAP_INVALID_MID
COAP_INVALID_SOCKET
COAP_INVALID_TID
COAP_IO_WAIT
COAP_LOG_CIPHERS
COAP_MAX_BLOCK_SZX
COAP_MAX_EPOLL_EVENTS
COAP_MAX_OPT
COAP_MAX_STR_CONST_FUNC
COAP_MEDIATYPE_ANY
COAP_MEDIATYPE_APPLICATION_ACE_CBOR
COAP_MEDIATYPE_APPLICATION_CBOR
COAP_MEDIATYPE_APPLICATION_COAP_GROUP_JSON
COAP_MEDIATYPE_APPLICATION_COSE_ENCRYPT
COAP_MEDIATYPE_APPLICATION_COSE_ENCRYPT0
COAP_MEDIATYPE_APPLICATION_COSE_KEY
COAP_MEDIATYPE_APPLICATION_COSE_KEY_SET
COAP_MEDIATYPE_APPLICATION_COSE_MAC
COAP_MEDIATYPE_APPLICATION_COSE_MAC0
COAP_MEDIATYPE_APPLICATION_COSE_SIGN
COAP_MEDIATYPE_APPLICATION_COSE_SIGN1
COAP_MEDIATYPE_APPLICATION_CWT
COAP_MEDIATYPE_APPLICATION_DOTS_CBOR
COAP_MEDIATYPE_APPLICATION_EXI
COAP_MEDIATYPE_APPLICATION_JSON
COAP_MEDIATYPE_APPLICATION_LINK_FORMAT
COAP_MEDIATYPE_APPLICATION_OCTET_STREAM
COAP_MEDIATYPE_APPLICATION_RDF_XML
COAP_MEDIATYPE_APPLICATION_SENML_CBOR
COAP_MEDIATYPE_APPLICATION_SENML_EXI
COAP_MEDIATYPE_APPLICATION_SENML_JSON
COAP_MEDIATYPE_APPLICATION_SENML_XML
COAP_MEDIATYPE_APPLICATION_SENSML_CBOR
COAP_MEDIATYPE_APPLICATION_SENSML_EXI
COAP_MEDIATYPE_APPLICATION_SENSML_JSON
COAP_MEDIATYPE_APPLICATION_SENSML_XML
COAP_MEDIATYPE_APPLICATION_XML
COAP_MEDIATYPE_TEXT_PLAIN
COAP_OBSERVE_CANCEL
COAP_OBSERVE_ESTABLISH
COAP_OPTION_ACCEPT
COAP_OPTION_BLOCK1
COAP_OPTION_BLOCK2
COAP_OPTION_CONTENT_FORMAT
COAP_OPTION_CONTENT_TYPE
COAP_OPTION_ECHO
COAP_OPTION_ETAG
COAP_OPTION_HOP_LIMIT
COAP_OPTION_IF_MATCH
COAP_OPTION_IF_NONE_MATCH
COAP_OPTION_LOCATION_PATH
COAP_OPTION_LOCATION_QUERY
COAP_OPTION_MAXAGE
COAP_OPTION_NORESPONSE
COAP_OPTION_OBSERVE
COAP_OPTION_OSCORE
COAP_OPTION_PROXY_SCHEME
COAP_OPTION_PROXY_URI
COAP_OPTION_RTAG
COAP_OPTION_SIZE1
COAP_OPTION_SIZE2
COAP_OPTION_URI_HOST
COAP_OPTION_URI_PATH
COAP_OPTION_URI_PORT
COAP_OPTION_URI_QUERY
COAP_OPT_FILTER_LONG
COAP_OPT_FILTER_SHORT
COAP_PRINT_STATUS_ERROR
COAP_PRINT_STATUS_MASK
COAP_PRINT_STATUS_TRUNC
COAP_RESOURCE_CHECK_TIME
COAP_RESOURCE_FLAGS_HAS_MCAST_SUPPORT
COAP_RESOURCE_FLAGS_LIB_DIS_MCAST_DELAYS
COAP_RESOURCE_FLAGS_LIB_DIS_MCAST_SUPPRESS_4_XX
COAP_RESOURCE_FLAGS_LIB_DIS_MCAST_SUPPRESS_5_XX
COAP_RESOURCE_FLAGS_LIB_ENA_MCAST_SUPPRESS_2_05
COAP_RESOURCE_FLAGS_LIB_ENA_MCAST_SUPPRESS_2_XX
COAP_RESOURCE_FLAGS_MCAST_LIST
COAP_RESOURCE_FLAGS_NOTIFY_CON
COAP_RESOURCE_FLAGS_NOTIFY_NON
COAP_RESOURCE_FLAGS_NOTIFY_NON_ALWAYS
COAP_RESOURCE_FLAGS_RELEASE_URI
COAP_RXBUFFER_SIZE
COAP_SIGNALING_OPTION_ALTERNATIVE_ADDRESS
COAP_SIGNALING_OPTION_BAD_CSM_OPTION
COAP_SIGNALING_OPTION_BLOCK_WISE_TRANSFER
COAP_SIGNALING_OPTION_CUSTODY
COAP_SIGNALING_OPTION_HOLD_OFF
COAP_SIGNALING_OPTION_MAX_MESSAGE_SIZE
COAP_SOCKET_ERROR
COAP_URI_SCHEME_SECURE_MASK

Functions§

coap_add_attr
coap_add_block
coap_add_block_b_data
coap_add_data
coap_add_data_after
coap_add_data_blocked_response
coap_add_data_large_request
coap_add_data_large_response
coap_add_option
coap_add_optlist_pdu
coap_add_resource
coap_add_token
coap_address_equals
coap_address_get_port
coap_address_init
coap_address_set_port
coap_async_get_app_data
coap_async_is_supported
coap_async_set_app_data
coap_async_set_delay
coap_async_trigger
coap_attr_get_value
coap_block_build_body
coap_cache_derive_key
coap_cache_derive_key_w_ignore
coap_cache_get_app_data
coap_cache_get_by_key
coap_cache_get_by_pdu
coap_cache_get_pdu
coap_cache_ignore_options
coap_cache_set_app_data
coap_can_exit
coap_cancel_observe
coap_check_option
coap_cleanup
coap_clear_event_handler
coap_clock_init
coap_clone_uri
coap_context_get_coap_fd
coap_context_get_csm_max_message_size
coap_context_get_csm_timeout
coap_context_get_max_handshake_sessions
coap_context_get_max_idle_sessions
coap_context_get_session_timeout
coap_context_set_block_mode
coap_context_set_csm_max_message_size
coap_context_set_csm_timeout
coap_context_set_keepalive
coap_context_set_max_handshake_sessions
coap_context_set_max_idle_sessions
coap_context_set_pki
coap_context_set_pki_root_cas
coap_context_set_psk
coap_context_set_psk2
coap_context_set_session_timeout
coap_debug_send_packet
coap_debug_set_packet_loss
coap_decode_var_bytes
coap_decode_var_bytes8
coap_delete_bin_const
coap_delete_binary
coap_delete_cache_entry
coap_delete_cache_key
coap_delete_optlist
coap_delete_pdu
coap_delete_resource
coap_delete_str_const
coap_delete_string
coap_dtls_get_log_level
coap_dtls_is_supported
coap_dtls_set_log_level
coap_encode_var_safe
coap_encode_var_safe8
coap_endpoint_set_default_mtu
coap_endpoint_str
coap_find_async
coap_find_attr
coap_fls
coap_flsll
coap_free_async
coap_free_context
coap_free_endpoint
coap_free_type
coap_get_app_data
coap_get_block
coap_get_block_b
coap_get_data
coap_get_data_large
coap_get_log_level
coap_get_query
coap_get_resource_from_uri_path
coap_get_tls_library_version
coap_get_uri_path
coap_handle_event
coap_insert_optlist
coap_io_do_epoll
coap_io_do_io
coap_io_prepare_epoll
coap_io_prepare_io
coap_io_process
coap_io_process_with_fds
coap_is_mcast
coap_join_mcast_group_intf
coap_log_impl
coap_make_str_const
coap_malloc_type
coap_mcast_per_resource
coap_mcast_set_hops
coap_memory_init
coap_new_bin_const
coap_new_binary
coap_new_cache_entry
coap_new_client_session
coap_new_client_session_pki
coap_new_client_session_psk
coap_new_client_session_psk2
coap_new_context
coap_new_endpoint
coap_new_error_response
coap_new_message_id
coap_new_optlist
coap_new_pdu
coap_new_str_const
coap_new_string
coap_new_uri
coap_opt_block_num
coap_opt_encode
coap_opt_encode_size
coap_opt_length
coap_opt_parse
coap_opt_setheader
coap_opt_size
coap_opt_value
coap_option_filter_clear
coap_option_filter_get
coap_option_filter_set
coap_option_filter_unset
coap_option_iterator_init
coap_option_next
coap_package_build
coap_package_name
coap_package_version
coap_pdu_duplicate
coap_pdu_get_code
coap_pdu_get_mid
coap_pdu_get_token
coap_pdu_get_type
coap_pdu_init
coap_pdu_parse
coap_pdu_set_code
coap_pdu_set_mid
coap_pdu_set_type
coap_print_addr
coap_print_link
coap_prng
coap_prng_init
coap_realloc_type
coap_register_async
coap_register_event_handler
coap_register_handler
coap_register_nack_handler
coap_register_option
coap_register_ping_handler
coap_register_pong_handler
coap_register_request_handler
coap_register_response_handler
coap_resize_binary
coap_resource_get_uri_path
coap_resource_get_userdata
coap_resource_init
coap_resource_notify_observers
coap_resource_proxy_uri_init
coap_resource_proxy_uri_init2
coap_resource_release_userdata_handler
coap_resource_set_dirty
coap_resource_set_get_observable
coap_resource_set_mode
coap_resource_set_userdata
coap_resource_unknown_init
coap_resource_unknown_init2
coap_response_phrase
coap_send
coap_send_ack
coap_send_error
coap_send_message_type
coap_send_rst
coap_session_disconnected
coap_session_get_ack_random_factor
coap_session_get_ack_timeout
coap_session_get_addr_local
coap_session_get_addr_remote
coap_session_get_app_data
coap_session_get_by_peer
coap_session_get_context
coap_session_get_default_leisure
coap_session_get_ifindex
coap_session_get_max_retransmit
coap_session_get_nstart
coap_session_get_probing_rate
coap_session_get_proto
coap_session_get_psk_hint
coap_session_get_psk_identity
coap_session_get_psk_key
coap_session_get_state
coap_session_get_tls
coap_session_get_type
coap_session_init_token
coap_session_max_pdu_size
coap_session_new_token
coap_session_reference
coap_session_release
coap_session_send_ping
coap_session_set_ack_random_factor
coap_session_set_ack_timeout
coap_session_set_app_data
coap_session_set_default_leisure
coap_session_set_max_retransmit
coap_session_set_mtu
coap_session_set_no_observe_cancel
coap_session_set_nstart
coap_session_set_probing_rate
coap_session_set_type_client
coap_session_str
coap_set_app_data
coap_set_event_handler
coap_set_log_handler
coap_set_log_level
coap_set_prng
coap_set_show_pdu_output
coap_show_pdu
coap_show_tls_version
coap_socket_strerror
coap_split_path
coap_split_proxy_uri
coap_split_query
coap_split_uri
coap_startup
coap_string_tls_support
coap_string_tls_version
coap_tcp_is_supported
coap_ticks
coap_ticks_from_rt_us
coap_ticks_to_rt
coap_ticks_to_rt_us
coap_tls_is_supported
coap_write_block_b_opt
coap_write_block_opt

Type Aliases§

coap_cache_app_data_free_callback_t
coap_dtls_cn_callback_t
coap_dtls_id_callback_t
coap_dtls_ih_callback_t
coap_dtls_pki_sni_callback_t
coap_dtls_psk_sni_callback_t
coap_dtls_security_setup_t
coap_event_handler_t
coap_fd_t
coap_log_handler_t
coap_log_t
coap_method_handler_t
coap_mid_t
coap_nack_handler_t
coap_opt_t
coap_option_num_t
coap_ping_handler_t
coap_pong_handler_t
coap_print_status_t
coap_rand_func_t
coap_release_large_data_t
coap_resource_release_userdata_handler_t
coap_response_handler_t
coap_socket_flags_t
coap_tick_diff_t
coap_tick_t
coap_time_t

Unions§

coap_dtls_key_t__bindgen_ty_1