Documentation ¶
Index ¶
- func CompareMsgCriteria(mc1 MsgCriteria, mc2 MsgCriteria) int
- func CreateMsg(isTcp bool, mp MsgParams) (coap.Message, error)
- func Encode(m coap.Message) ([]byte, error)
- func MatchMsgCriteria(listenc MsgCriteria, msgc MsgCriteria) bool
- func NextMessageId() uint16
- func ParseOp(op string) (coap.COAPCode, error)
- func SortListeners(listeners []*Listener)
- type Dispatcher
- func (d *Dispatcher) AddListener(mc MsgCriteria) (*Listener, error)
- func (d *Dispatcher) Dispatch(data []byte) bool
- func (d *Dispatcher) ErrorAll(err error)
- func (d *Dispatcher) ErrorOne(mc MsgCriteria, err error) error
- func (d *Dispatcher) ProcessCoapReq(data []byte) (coap.Message, error)
- func (d *Dispatcher) RemoveListener(mc MsgCriteria) *Listener
- type Listener
- type MsgCriteria
- type MsgParams
- type ObserveCode
- type Reassembler
- type Receiver
- type RxFilterFunc
- type RxMsgFilter
- type TxMsgFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareMsgCriteria ¶
func CompareMsgCriteria(mc1 MsgCriteria, mc2 MsgCriteria) int
func MatchMsgCriteria ¶
func MatchMsgCriteria(listenc MsgCriteria, msgc MsgCriteria) bool
Determines if a listener matches an incoming message.
func NextMessageId ¶
func NextMessageId() uint16
func SortListeners ¶
func SortListeners(listeners []*Listener)
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
The dispatcher is the owner of the listeners it points to. Only the dispatcher writes to these listeners.
func NewDispatcher ¶
func NewDispatcher(isTcp bool, logDepth int) *Dispatcher
func (*Dispatcher) AddListener ¶
func (d *Dispatcher) AddListener(mc MsgCriteria) (*Listener, error)
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(data []byte) bool
Returns true if the response was dispatched.
func (*Dispatcher) ErrorAll ¶
func (d *Dispatcher) ErrorAll(err error)
func (*Dispatcher) ErrorOne ¶
func (d *Dispatcher) ErrorOne(mc MsgCriteria, err error) error
func (*Dispatcher) ProcessCoapReq ¶
func (d *Dispatcher) ProcessCoapReq(data []byte) (coap.Message, error)
func (*Dispatcher) RemoveListener ¶
func (d *Dispatcher) RemoveListener(mc MsgCriteria) *Listener
type Listener ¶
type Listener struct { Criteria MsgCriteria RspChan chan coap.Message ErrChan chan error // contains filtered or unexported fields }
func NewListener ¶
func NewListener(mc MsgCriteria) *Listener
func (*Listener) AfterTimeout ¶
type MsgCriteria ¶
func CriteriaFromMsg ¶
func CriteriaFromMsg(msg coap.Message) MsgCriteria
func (*MsgCriteria) String ¶
func (mc *MsgCriteria) String() string
type MsgParams ¶
type MsgParams struct { Code coap.COAPCode Uri string Observe ObserveCode Token []byte Payload []byte }
type ObserveCode ¶
type ObserveCode int
const ( OBSERVE_NONE ObserveCode = iota OBSERVE_START OBSERVE_STOP )
These observe codes differ from those specified in the CoAP spec. It is done this way so that the default value (0) implies no observe action.
func (ObserveCode) Spec ¶
func (o ObserveCode) Spec() int
type Reassembler ¶
type Reassembler struct {
// contains filtered or unexported fields
}
func NewReassembler ¶
func NewReassembler() *Reassembler
func (*Reassembler) RxFrag ¶
func (r *Reassembler) RxFrag(frag []byte) *coap.TcpMessage
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
func NewReceiver ¶
type RxFilterFunc ¶
type RxFilterFunc func(msg coap.Message) (coap.Message, error)
func (RxFilterFunc) Filter ¶
func (f RxFilterFunc) Filter(msg coap.Message) (coap.Message, error)
type RxMsgFilter ¶
type RxMsgFilter interface {
Filter(msg coap.Message) (coap.Message, error)
}
type TxMsgFilter ¶
type TxMsgFilter interface { // Filter applies the filter to an outgoing CoAP message. Filter(msg coap.Message) (coap.Message, error) // Freeze makes the filter use the same parameters for all transmits until // unfrozen. The parameters will be different from the previous message, // but they will not change while the session is frozen. Freeze() // Unfreeze makes the filter use new parameters for all subsequent // messages. Unfreeze() }
Click to show internal directories.
Click to hide internal directories.