Package-level declarations

Types

Link copied to clipboard

A byte stream: TCP or TLS (RFC 8323 coap+tcp, coaps+tcp). The reliable messaging layer does the Len/TKL framing on top. One messaging-layer instance per connection, so tokens are scoped to it.

Link copied to clipboard

The CoAP URI schemes and what each needs from the transport layer.

Link copied to clipboard
sealed interface Connection

A connection for CoAP over a reliable transport (RFC 8323): a ByteStreamConnection (TCP, TLS) or a MessageConnection (WebSocket). The CoAP endpoint runs one reliable messaging layer per connection, so tokens and signaling state (CSM, Ping, Release, Abort) are scoped to it (RFC 8323 §3.3, §4.3).

Link copied to clipboard

Accepts connections for CoAP over reliable transports: a TCP server socket, or a WebSocket endpoint at /.well-known/coap that requires the subprotocol coap (RFC 8323 §4.1).

Link copied to clipboard
interface Connector

Opens connections for CoAP over reliable transports (RFC 8323 §8): coap+tcp and coaps+tcp to an Endpoint.Tcp, coap+ws and coaps+ws to an Endpoint.WebSocket. A CoAP endpoint calls it when a request needs a connection to a peer it has none to, and closes it when the endpoint closes.

Link copied to clipboard
sealed interface DatagramEvent

What a DatagramTransport hands to the messaging layer.

Link copied to clipboard

Adds DTLS to a datagram transport, which is what coaps needs (RFC 7252 §9.1). kcoap-dtls will implement it; until then no implementation exists, coaps is unavailable, and the interface is ExperimentalKcoapApi because its shape may change with that first implementation.

Link copied to clipboard

Datagrams in, datagrams out: UDP, multicast, non-IP links, and DTLS through DatagramSecurity. Used by the RFC 7252 messaging layer (CON/NON/ACK/RST, deduplication, retransmission).

Link copied to clipboard
sealed interface Endpoint

The other side of a message.

Link copied to clipboard
object IpLiteral

The one textual form of an IP address, which Endpoint.Udp and Endpoint.Tcp keep their host in, so that one address is one endpoint: dotted decimal for IPv4, RFC 5952 canonical text for IPv6 (lower case, no leading zeros, the longest run of two or more zero groups compressed to ::). IPv4-mapped IPv6 addresses are written as IPv4, as a dual-stack socket reports such peers.

Link copied to clipboard

A message stream: WebSocket (RFC 8323 coap+ws, coaps+ws), one CoAP message per binary frame. TLS for coaps+ws is always the WebSocket client's own (wss://), also in browsers.

Link copied to clipboard
sealed interface PeerIdentity

Who the peer is according to channel security (DTLS or TLS), already authenticated by that layer. OSCORE and EDHOC identities are separate; the application can authorize on either or both.

Link copied to clipboard

Channel-security modes of RFC 7252 §9. RFC 8323 §9.1 uses the same three secured modes for TLS.

Link copied to clipboard

Thrown by DatagramTransport.send when the target Endpoint.Secure has ended.

Link copied to clipboard
Link copied to clipboard
data class SessionId(val value: Long)

A handle the local DTLS layer assigns to a session, unique within one transport for its lifetime. Not the DTLS session_id, which may be empty and is shared by resumed connections.

Link copied to clipboard