Man page - coap_session_get_type(3)
Packages contains this manual
- coap_context_get_max_handshake_sessions(3)
- coap_dtls_cpsk_t(3)
- coap_observe(3)
- coap_get_data_large(3)
- coap_context_set_max_token_size(3)
- coap_is_af_unix(3)
- coap_context_set_block_mode(3)
- coap_session_get_max_retransmit(3)
- coap_option_filter_set(3)
- coap_delete_str_const(3)
- coap_can_exit(3)
- coap_resource_unknown_init2(3)
- coap_context_set_psk2(3)
- coap_session_get_default_leisure(3)
- coap_dtls_log(3)
- coap_write(3)
- coap_session_get_addr_local(3)
- coap_clear_event_handler(3)
- coap_endpoint_client(3)
- coap_address_equals(3)
- coap_set_log_handler(3)
- coap_session_set_ack_timeout(3)
- coap_io_do_epoll(3)
- coap_register_request_handler(3)
- coap_send(3)
- coap_register_ping_handler(3)
- coap_new_cache_entry(3)
- coap_add_data(3)
- coap_session_get_state(3)
- coap_cache(3)
- coap_free_async(3)
- coap_new_client_session(3)
- coap_host_is_unix_domain(3)
- coap_resource_proxy_uri_init(3)
- coap_pdu_get_type(3)
- coap_dtls_pki_t(3)
- coap_resource_init(3)
- coap_context_set_csm_timeout(3)
- coap_io_process(3)
- coap_session_set_nstart(3)
- coap_log_emerg(3)
- coap_session_set_probing_rate(3)
- coap_split_uri(3)
- coap_new_client_session_psk(3)
- coap_persist_track_funcs(3)
- coap_add_resource(3)
- coap_sockaddr_un(3)
- coap_session_set_app_data(3)
- coap_encode_var_bytes(3)
- coap_insert_optlist(3)
- coap_option_filter_get(3)
- coap_persist_set_observe_num(3)
- coap_address_t(3)
- coap_dtls_set_log_level(3)
- coap_log(3)
- coap_resource(3)
- coap_register_event_handler(3)
- coap_print_ip_addr(3)
- coap_tls_is_supported(3)
- coap_option_filter_clear(3)
- coap_opt_length(3)
- coap_new_message_id(3)
- coap_tls_library(3)
- coap_delete_binary(3)
- coap_new_bin_const(3)
- coap_block_build_body(3)
- coap_pdu_set_mid(3)
- coap_add_data_blocked_response(3)
- coap_session_get_non_timeout(3)
- coap_session_set_ack_random_factor(3)
- coap_session_set_non_max_retransmit(3)
- coap_string_tls_support(3)
- coap_decode_var_bytes8(3)
- coap_log_notice(3)
- coap_context_set_session_timeout(3)
- coap_set_event_handler(3)
- coap_split_query(3)
- coap_pdu_access(3)
- coap_keepalive(3)
- coap_pdu_get_code(3)
- coap_encode_var_safe(3)
- coap_cache_derive_key(3)
- coap_resource_set_mode(3)
- coap_pdu_setup(3)
- coap_cache_set_app_data(3)
- coap_make_str_const(3)
- coap_string_equal(3)
- coap_resource_set_dirty(3)
- coap_lwip(3)
- coap_is_bcast(3)
- coap_split_proxy_uri(3)
- coap_delete_oscore_conf(3)
- coap_deprecated(3)
- coap_option_getb(3)
- coap_register_handler(3)
- coap_resource_unknown_init(3)
- coap_session_set_non_timeout(3)
- coap_run_once(3)
- coap_session_set_mtu(3)
- coap_is_mcast(3)
- coap_io_pending(3)
- coap_debug_set_packet_loss(3)
- coap_resource_notify_observers(3)
- coap_string_tls_version(3)
- coap_session_get_ack_random_factor(3)
- coap_session_get_addr_remote(3)
- coap_string(3)
- coap_session_set_type_client(3)
- coap_uri_into_options(3)
- coap_new_client_session_pki(3)
- coap_log_err(3)
- coap_session_get_addr_mcast(3)
- coap_context_get_session_timeout(3)
- coap_clone_uri(3)
- coap_new_oscore_recipient(3)
- coap_dtls_rpk_is_supported(3)
- coap_add_option(3)
- coap_add_token(3)
- coap_dtls_pkcs11_is_supported(3)
- coap_session_init_token(3)
- coap_join_mcast_group_intf(3)
- coap_async_get_app_data(3)
- coap_set_show_pdu_output(3)
- coap_delete_uri(3)
- coap_session_get_tls(3)
- coap_new_string(3)
- coap_show_tls_version(3)
- coap_endpoint_set_default_mtu(3)
- coap_get_data(3)
- coap_delete_string(3)
- coap_log_warn(3)
- coap_cache_derive_key_w_ignore(3)
- coap_session_get_type(3)
- coap_dtls_spsk_t(3)
- coap_persist_observe_add(3)
- coap_print_addr(3)
- coap_dtls_psk_is_supported(3)
- coap_persist(3)
- coap_endpoint_str(3)
- coap_dtls_get_log_level(3)
- coap_register_pong_handler(3)
- coap_io_process_with_fds(3)
- coap_new_client_session_oscore_psk(3)
- coap_new_oscore_conf(3)
- coap_resource_get_uri_path(3)
- coap_session_reference(3)
- coap_new_str_const(3)
- coap_session_get_psk_hint(3)
- coap_pdu_set_type(3)
- coap_option_clrb(3)
- coap_async_trigger(3)
- coap_new_endpoint(3)
- coap_session_get_ack_timeout(3)
- coap_context_get_max_idle_sessions(3)
- coap_dtls_is_supported(3)
- coap_ws_set_host_request(3)
- coap_new_optlist(3)
- coap_resource_get_userdata(3)
- coap_option_iterator_init(3)
- coap_log_info(3)
- coap_get_tls_library_version(3)
- coap_context_get_csm_timeout(3)
- coap_io_prepare_epoll(3)
- coap_free_endpoint(3)
- coap_address_init(3)
- coap_resource_proxy_uri_init2(3)
- coap_package_version(3)
- coap_attr_get_value(3)
- coap_session_new_token(3)
- coap_check_option(3)
- coap_context_oscore_server(3)
- coap_log_alert(3)
- coap_session_get_non_max_retransmit(3)
- coap_new_context(3)
- coap_context_set_keepalive(3)
- coap_address_set_unix_domain(3)
- coap_get_available_scheme_hint_bits(3)
- coap_resource_release_userdata_handler(3)
- coap_session_get_probing_rate(3)
- coap_pdu_get_mid(3)
- coap_init(3)
- coap_read(3)
- coap_add_data_large_response(3)
- coap_find_async(3)
- coap_log_oscore(3)
- coap_delete_cache_entry(3)
- coap_tcp_is_supported(3)
- coap_pdu_get_token(3)
- coap_logging(3)
- coap_io_do_io(3)
- coap_context_set_pki(3)
- coap_io(3)
- coap_new_binary(3)
- coap_websockets(3)
- coap_add_optlist_pdu(3)
- coap_new_uri(3)
- coap_session_get_nstart(3)
- coap_resize_binary(3)
- coap(7)
- coap_async_set_delay(3)
- coap_encryption(3)
- coap_attribute(3)
- coap_add_attr(3)
- coap_cache_get_by_pdu(3)
- coap_delete_cache_key(3)
- coap_binary_equal(3)
- coap_address(3)
- coap_async_set_app_data(3)
- coap_cache_ignore_options(3)
- coap_cache_get_app_data(3)
- coap_show_pdu(3)
- coap_new_pdu(3)
- coap_option_setb(3)
- coap_session_get_psk_key(3)
- coap_option_filter_unset(3)
- coap_block(3)
- coap_get_uri_path(3)
- coap_register_nack_handler(3)
- coap_session_set_non_receive_timeout(3)
- coap_new_client_session_oscore(3)
- coap_session_release(3)
- coap_session_get_max_payloads(3)
- coap_register_async(3)
- coap_persist_stop(3)
- coap_log_debug(3)
- coap_resource_set_userdata(3)
- coap_pdu_init(3)
- coap_set_log_level(3)
- coap_lwip_set_input_wait_handler(3)
- coap_wss_is_supported(3)
- coap_resource_set_get_observable(3)
- coap_uri(3)
- coap_delete_bin_const(3)
- coap_context_set_max_idle_sessions(3)
- coap_recovery(3)
- coap_context_set_psk(3)
- coap_session(3)
- coap_session_max_pdu_size(3)
- coap_context_get_coap_fd(3)
- coap_encode_var_safe8(3)
- coap_session_get_proto(3)
- coap_context(3)
- coap_session_disconnected(3)
- coap_context_set_max_handshake_sessions(3)
- coap_address_copy(3)
- coap_async_is_supported(3)
- coap_delete_oscore_recipient(3)
- coap_session_get_non_receive_timeout(3)
- coap_register_response_handler(3)
- coap_session_set_max_payloads(3)
- coap_handler(3)
- coap_persist_startup(3)
- coap_cancel_observe(3)
- coap_cache_get_by_key(3)
- coap_io_prepare_io(3)
- coap_package_build(3)
- coap_option_next(3)
- coap_free_address_info(3)
- coap_get_log_level(3)
- coap_address_get_port(3)
- coap_lwip_dump_memory_pools(3)
- coap_startup(3)
- coap_split_path(3)
- coap_q_block_is_supported(3)
- coap_session_set_max_retransmit(3)
- coap_pdu_set_code(3)
- coap_oscore_is_supported(3)
- coap_free_context(3)
- coap_session_str(3)
- coap_delete_optlist(3)
- coap_session_set_no_observe_cancel(3)
- coap_resolve_address_info(3)
- coap_cache_get_pdu(3)
- coap_context_set_pki_root_cas(3)
- coap_mcast_per_resource(3)
- coap_endpoint_server(3)
- coap_add_data_large_request(3)
- coap_log_crit(3)
- coap_opt_value(3)
- coap_async(3)
- coap_delete_resource(3)
- coap_new_client_session_psk2(3)
- coap_find_attr(3)
- coap_dtls_pki_is_supported(3)
- coap_session_get_app_data(3)
- coap_package_name(3)
- coap_ws_is_supported(3)
- coap_cleanup(3)
- coap_session_get_context(3)
- coap_session_set_default_leisure(3)
- coap_new_client_session_oscore_pki(3)
- coap_decode_var_bytes(3)
- coap_oscore(3)
- coap_address_set_port(3)
- coap_session_get_ifindex(3)
apt-get install libcoap3t64
Manual
COAP_SESSION
NAMESYNOPSIS
DESCRIPTION
FUNCTIONS
RETURN VALUES
SEE ALSO
FURTHER INFORMATION
BUGS
AUTHORS
NAME
coap_session, coap_session_reference, coap_session_release, coap_session_disconnected, coap_session_set_type_client, coap_session_set_app_data, coap_session_get_app_data, coap_session_get_addr_local, coap_session_get_addr_mcast, coap_session_get_addr_remote, coap_session_get_context, coap_session_get_ifindex, coap_session_get_proto, coap_session_get_state, coap_session_get_tls, coap_session_get_type, coap_session_get_psk_hint, coap_session_get_psk_key - Work with CoAP sessions
SYNOPSIS
#include <coap3/coap.h>
coap_session_t *coap_session_reference(coap_session_t * session );
void coap_session_release(coap_session_t * session );
void coap_session_disconnected(coap_session_t * session , coap_nack_reason_t reason );
int coap_session_set_type_client(coap_session_t * session );
void coap_session_set_app_data(coap_session_t * session , void * data );
void *coap_session_get_app_data(const coap_session_t * session );
const coap_address_t *coap_session_get_addr_local( const coap_session_t * session );
const coap_address_t *coap_session_get_addr_mcast( const coap_session_t * session );
const coap_address_t *coap_session_get_addr_remote( const coap_session_t * session );
coap_context_t *coap_session_get_context(const coap_session_t * session );
int coap_session_get_ifindex(const coap_session_t * session );
coap_proto_t coap_session_get_proto(const coap_session_t * session );
coap_session_state_t coap_session_get_state(const coap_session_t * session );
void *coap_session_get_tls(const coap_session_t * session , coap_tls_library_t *tls_lib);
coap_session_type_t coap_session_get_type(const coap_session_t * session );
const coap_bin_const_t *coap_session_get_psk_hint( const coap_session_t * session );
const coap_bin_const_t *coap_session_get_psk_key( const coap_session_t * session );
For specific (D)TLS library support, link with -lcoap-3-notls , -lcoap-3-gnutls , -lcoap-3-openssl , -lcoap-3-mbedtls or -lcoap-3-tinydtls . Otherwise, link with -lcoap-3 to get the default (D)TLS library support.
DESCRIPTION
This man page focuses on the CoAP Session and how to update or get information from the opaque coap_session_t structure.
A CoAP Session maintains the state of an ongoing connection between a Client and Server which is stored in a coap_session_t Session object. A CoAP session is tracked by local port, CoAP protocol, remote IP address and remote port.
The Session network traffic can be encrypted or un-encrypted if there is an underlying TLS library.
FUNCTIONS
Function: coap_session_reference()
The coap_session_reference () function is used to increment the reference count of the session . Incrementing the reference count by an application means that the library will not inadvertently remove the session when it has finished processing the session.
Function: coap_session_release()
The coap_session_release () function is be used to decrement the session reference count, which when it gets to 0, will:-
If type Client, free off the session which then clears all entries from the receive queue and send queue. NOTE: All client sessions start off with a reference count of 1.
If type Server, then the session is added to an idle pool ready for subsequent re-use. If the Server session is not used for 5 minutes, then it will get completely freed off. NOTE: Unless the application increments the reference count, this is the case for all type server sessions as they start with a reference count of 0.
Function: coap_session_disconnected()
The coap_session_disconnected () function is used to force the closure of a session for the reason reason . It will cause any outstanding traffic to get dropped.
Function: coap_session_set_type_client()
The coap_session_set_type_client () function is used to convert the session frrm a session endpoint type of Server to Client. This typically is used in a Call-Home type environment where the roles have to change following the establishment of a session. The reference count is incremented by 1.
Function: coap_session_set_app_data()
The coap_session_set_app_data () function is used to define a data pointer for the session which can then be retrieved at a later date.
Function: coap_session_get_app_data()
The coap_session_get_app_data () function is used to retrieve the data pointer previously defined by coap_session_set_app_data ().
Function: coap_session_get_addr_local()
The coap_session_get_addr_local () function is used to get the local IP address and port information from the session .
Function: coap_session_get_addr_mcast()
The coap_session_get_addr_mcast () function is used to get the remote (peer) multicast IP address and port information from the session if the session was originally set up to send requests to a multicast IP.
Function: coap_session_get_addr_remote()
The coap_session_get_addr_remote () function is used to get the remote (peer) IP address and port information from the session . If the session was originally set up to send requests to a multicast IP, then the returned IP will be that of the unicast response from a peer. The returned IP will get set back to the multicast IP when the next coap_send (3) is called.
Function: coap_session_get_context()
The coap_session_get_context () function is used to get the CoAP context associated with the session .
Function: coap_session_get_ifindex()
The coap_session_get_ifindex () function is used to get the network interface index that the traffic came in over from the session .
COAP_PROTO_UDP
COAP_PROTO_DTLS
COAP_PROTO_TCP
COAP_PROTO_TLS
COAP_PROTO_WS
COAP_PROTO_WSS
The coap_session_get_proto () function is used to get the CoAP protocol from the session .
COAP_SESSION_STATE_NONE
COAP_SESSION_STATE_CONNECTING
COAP_SESSION_STATE_HANDSHAKE
COAP_SESSION_STATE_CSM
COAP_SESSION_STATE_ESTABLISHED
The coap_session_get_state () function is used to get the current state of the session .
OpenSSL: SSL*
GnuTLS: gnutls_session_t (implicit *)
Mbed TLS: mbedtls_ssl_context*
TinyDTLS: struct dtls_context*
The coap_session_get_tls () function is used to get the pointer to the TLS information from the session . This is TLS library specific. tls_lib is updated with the underlying (D)TLS library type.
COAP_SESSION_TYPE_CLIENT
COAP_SESSION_TYPE_SERVER
COAP_SESSION_TYPE_HELLO /* Negotiating a (D)TLS session
*/
The coap_session_get_type () function is used to get the session type from the session .
The coap_session_get_psk_hint () function is used to get the current server session 's pre-shared-key identity hint.
The coap_session_get_psk_key () function is used to get the current session 's pre-shared-key key information.
RETURN VALUES
coap_session_reference () returns a pointer to the session.
coap_session_set_type_client () returns 1 on success, otherwise 0.
coap_session_get_app_data () returns a previously defined pointer.
coap_session_get_addr_local () and coap_session_get_addr_remote () return a pointer to the IP address / port or NULL on error.
coap_session_get_addr_mcast () returns a pointer to the remote multicast IP address / port or NULL on error or this is not a multicast session.
coap_session_get_context () returns a pointer to the current CoAP Context or NULL on error.
coap_session_get_ifindex () returns the network interface the traffic last came in over, or -1 on error.
coap_session_get_proto () returns the current sessionās protocol or 0 on error.
coap_session_get_state () returns the current sessionās state or 0 on error.
coap_session_get_tls () returns a pointer to the current sessionās TLS information (TLS library dependent) or NULL if there is none or there is an error.
coap_session_get_type () returns the current sessionās type or 0 on error.
coap_session_get_psk_hint () returns the current server sessionās pre-shared-key identity hint, or NULL if not defined.
coap_session_get_psk_key () returns the current sessionās pre-shared-key key information, or NULL if not defined.
SEE ALSO
coap_context (3), coap_endpoint_client (3) and coap_endpoint_server (3)
FURTHER INFORMATION
See
"RFC7252: The Constrained Application Protocol (CoAP)"
for further information.
BUGS
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
AUTHORS
The libcoap project <libcoap-developers@lists.sourceforge.net>