Bounded, deterministic unicast CoAP protocol core for MoonBit
Dependencies
pub(all) enum Action {
SendDatagram(String, Bytes)
RequestReceived(IncomingRequest)
ResponseReceived(Int, Message)
Failed(Int, Failure)
Cancelled(Int)
} derive(Eq, Debug)pub struct Allocator {
// private fields
}pub(all) struct Config {
limits : Limits
ack_timeout_ms : Int64
ack_random_factor_permille : Int
max_retransmit : Int
exchange_lifetime_ms : Int64
non_lifetime_ms : Int64
response_timeout_ms : Int64
max_peers : Int
max_exchanges : Int
max_dedup : Int
max_mid_leases : Int
max_queue : Int
max_actions : Int
nstart : Int
initial_mid : Int
token_seed : Int64
} derive(Eq, Debug)pub struct Discovery {
// private fields
}pub struct Endpoint {
// private fields
}fn Endpoint::serve(self : Endpoint, router : Router, incoming : IncomingRequest, now : Int64) -> Result[Unit, Failure]pub(all) struct ExchangeView {
id : Int
peer : String
mid : Int
token : Bytes
phase : ExchangePhase
created_at : Int64
last_sent_at : Int64
deadline : Int64
transmit_deadline : Int64
next_retry : Int64?
interval : Int64
retransmissions : Int
} derive(Eq, Debug)pub(all) struct Message {
msg_type : MessageType
code : Code
mid : Int
token : Bytes
options : Array[CoapOption]
payload : Bytes
} derive(Eq, Debug)pub(all) struct OptionSpec {
number : Int
name : String
kind : OptionKind
min_length : Int
max_length : Int
repeatable : Bool
request_only : Bool
response_only : Bool
} derive(Eq, Debug)pub(all) struct Request {
verb : Method
options : Array[CoapOption]
payload : Bytes
confirmable : Bool
} derive(Eq, Debug)pub struct ResourceStore {
// private fields
}fn ResourceStore::new(capacity : Int, max_bytes : Int, formats : Array[Int], allow_create : Bool, limits : Limits) -> Result[ResourceStore, Failure]fn ResourceStore::put(self : ResourceStore, path : String, payload : Bytes, format : Int, max_age : Int64, writable : Bool) -> Result[Representation, Failure]pub(all) struct Response {
code : Code
options : Array[CoapOption]
payload : Bytes
} derive(Eq, Debug)pub struct ResponseCache {
// private fields
}fn ResponseCache::invalidate(self : ResponseCache, peer : String, path : String) -> Result[Int, Failure]fn ResponseCache::lookup(self : ResponseCache, peer : String, request : Request, now : Int64) -> Result[CacheLookup, Failure]fn ResponseCache::new(capacity : Int, max_bytes : Int, limits : Limits) -> Result[ResponseCache, Failure]fn ResponseCache::store(self : ResponseCache, peer : String, request : Request, response : Response, now : Int64) -> Result[Unit, Failure]fn ResponseCache::validate(self : ResponseCache, peer : String, request : Request, response : Response, now : Int64) -> Result[Unit, Failure]pub struct Router {
// private fields
}pub(all) struct ServerView {
id : Int
peer : String
request_mid : Int
token : Bytes
expires_at : Int64
acknowledged : Bool
answered : Bool
response_mid : Int?
response_phase : ExchangePhase?
response_deadline : Int64?
last_sent_at : Int64?
retransmissions : Int
} derive(Eq, Debug)fn received_options(message : Message, supported : Array[Int]) -> Result[Array[CoapOption], Failure]Install
Download zipBounded, deterministic unicast CoAP protocol core for MoonBit
Dependencies