package coap-core

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t
type kind =
  1. | Confirmable
  2. | Nonconfirmable
  3. | Acknowledgement
  4. | Reset
type code =
  1. | Empty
  2. | Request of [ `Get | `Post | `Put | `Delete ]
  3. | Response of [ `Created | `Deleted | `Valid | `Changed | `Content | `Bad_request | `Unauthorized | `Bad_option | `Forbidden | `Not_found | `Method_not_allowed | `Not_acceptable | `Precondition_failed | `Request_entity_too_large | `Unsupported_content_format | `Internal_server_error | `Not_implemented | `Bad_gateway | `Service_unavailable | `Gateway_timeout | `Proxying_not_supported ]
val pp_code : Format.formatter -> code -> unit
type content_format = [
  1. | `Text of [ `Plain ]
  2. | `Application of [ `Link_format | `Xml | `Octet_stream | `Exi | `Json | `Cbor ]
]
type option =
  1. | If_match of string
  2. | Uri_host of string
  3. | Etag of string
  4. | If_none_match
  5. | Uri_port of int
  6. | Location_path of string
  7. | Uri_path of string
  8. | Content_format of content_format
  9. | Max_age of int
  10. | Uri_query of string
  11. | Accept of int
  12. | Location_query of string
  13. | Proxy_uri of string
  14. | Proxy_scheme of string
  15. | Size1 of int
val make : ?version:int -> ?id:int -> ?token:string -> code:code -> ?kind:kind -> ?options:option list -> ?client_addr:string -> buffer -> t

Coap message constructor.

val version : t -> int
val id : t -> int
val kind : t -> kind
val code : t -> code
val token : t -> string

Message token used to match a response with a request.

Token values may be 0 to 8 bytes in length.

val options : t -> option list
val path : t -> string list

Extract request path from message options.

val client_addr : t -> string Option.t
val with_client_addr : string Option.t -> t -> t
val payload : t -> buffer
val payload_length : t -> int
val buffer_to_string : buffer -> string
val buffer_of_string : string -> buffer
val is_confirmable : t -> bool
val decode : buffer -> (t, error) result
val encode : t -> buffer
val pp : Format.formatter -> t -> unit
val max_size : int

Maximum safe message size.

https://tools.ietf.org/html/rfc7252#section-4.6

OCaml

Innovation. Community. Security.