CoapUri

class CoapUri(val scheme: CoapScheme, val host: String, val port: Int = scheme.defaultPort, pathSegments: List<String> = emptyList(), querySegments: List<String> = emptyList())(source)

A CoAP URI (RFC 7252 §6, RFC 8323 §8) and its mapping to request options.

parse follows the decomposition algorithm of RFC 7252 §6.4 and toString the composition of §6.5, so CoapUri.parse(s).toString() normalizes s. parse is for URIs the application supplies and throws on a malformed one; a URI a peer supplied goes through parseOrNull, which never throws.

Constructors

Link copied to clipboard
constructor(scheme: CoapScheme, host: String, port: Int = scheme.defaultPort, pathSegments: List<String> = emptyList(), querySegments: List<String> = emptyList())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

the host without brackets; IPv6 literals are bracketed again by toString.

Link copied to clipboard

True for IPv4 and IPv6 literals, which RFC 7252 §6.4 step 5 sends without a Uri-Host option.

Link copied to clipboard

"/a/b", or "/" for the root.

Link copied to clipboard

Decoded Uri-Path values; an empty list is the root path. A copy of the list given.

Link copied to clipboard
val port: Int
Link copied to clipboard

Decoded Uri-Query values. A copy of the list given.

Link copied to clipboard

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun toOptions(destinationPort: Int = port): OptionSet

The request options this URI turns into (RFC 7252 §6.4 steps 5–8). Uri-Port is included only when destinationPort differs from port, which happens when sending to a proxy.

Link copied to clipboard
open override fun toString(): String