class CoAP::Message

Overview

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

Defined in:

coap/message.cr

Constant Summary

ENDIAN = ["big"]

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

KLASS_NAME = [CoAP::Message]

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

PARTS = [{type: "bitfield", name: 2, cls: CoAP::Message, onlyif: nil, verify: nil}, {type: "basic", name: message_id, cls: UInt16, onlyif: nil, verify: nil, value: nil}, {type: "bytes", name: token, cls: Bytes, onlyif: nil, verify: nil, length: -> do token_length end, value: nil}, {type: "variable_array", name: raw_options, cls: Option, onlyif: nil, verify: nil, length: -> do if opt = raw_options[-1]? !opt.end_of_options? else if remaining = io.peek remaining.size > 0 else false end end end, value: nil}, {type: "bytes", name: payload_data, cls: Bytes, onlyif: nil, verify: nil, length: -> do io.peek.try(&.size) || 0 end, value: nil}] of Nil

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

REMAINING = [] of Nil

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

Class Method Summary

Instance Method Summary

Macro Summary

Instance methods inherited from class CoAP::Header

__format__ : IO::ByteFormat __format__, token_length : UInt8 token_length, token_length=(token_length : UInt8) token_length=, type : Type type, type=(type : UInt8)
type=(value : Type)
type=
, version : UInt8 version, version=(version : UInt8) version=

Class methods inherited from class CoAP::Header

bit_fields bit_fields

Class Method Detail

def self.bit_fields #

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


[View source]

Instance Method Detail

def __format__ : IO::ByteFormat #

[View source]
def code_class : CodeClass #

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


[View source]
def code_class=(code_class : UInt8) #

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


def code_class=(value : CodeClass) #

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


[View source]
def code_detail : UInt8 #

When code_class above == Method then this indicates if it's a GET POST etc


def code_detail=(code_detail : UInt8) #

When code_class above == Method then this indicates if it's a GET POST etc


def message_id : UInt16 #

def message_id=(message_id : UInt16) #

def method #

[View source]
def options : Array(Option) #

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


[View source]
def options=(values : Enumerable(Option)) #

allow for reasonablly flexible header parsing


[View source]
def payload_data : Bytes #

def payload_data=(payload_data : Bytes) #

def raw_options : Array(Option) #

def raw_options=(raw_options : Array(Option)) #

def status #

These do actually differ slightly from the HTTP originals https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#response-codes


[View source]
def status=(value : Int | HTTP::Status) #

[View source]
def status_code #

[View source]
def status_code=(value : Int | HTTP::Status) #

[View source]
def success? #

[View source]
def token : Bytes #

def token=(token : Bytes) #

Macro Detail

macro co_ap_header(name, onlyif = nil, verify = nil, value = nil) #

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


[View source]
macro co_ap_message(name, onlyif = nil, verify = nil, value = nil) #

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


[View source]
macro co_ap_option(name, onlyif = nil, verify = nil, value = nil) #

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


[View source]