libcoap

package
v0.0.0-...-dd13c3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCK_COMPONENT_NUMBER = 3
	SZX_BIT_NUMBER         = 3
	M_BIT_NUMBER           = 1
	ADDITIONAL_SZX         = 4
	MORE_BLOCK             = 1
	LAST_BLOCK             = 0
	LARGEST_BLOCK_SIZE     = 6
)

Variables

This section is empty.

Functions

func AddNewConnectingSession

func AddNewConnectingSession(session *Session)

* Add new connecting sessions in dots server * parameter: * session the session want to add

func Cleanup

func Cleanup()

func ConnectingSessions

func ConnectingSessions() map[*C.coap_session_t]*Session

* Get all connecting sessions to dots server * return: list of connecting sessions

func CreateNewCache

func CreateNewCache(expiration int, cleanupInterval int)

* Create new cache with with a default expiration time of 'expiration', and which purges expired items every 'cleanupInterval'

func DeleteUriFilterByKey

func DeleteUriFilterByKey(key string)

Delete uri filter by key

func DeleteUriFilterByValue

func DeleteUriFilterByValue(value string)

Delete uri filter by value

func GetAllResource

func GetAllResource() map[*C.coap_resource_t]*Resource

func GetDomainNameListFromCertificateFile

func GetDomainNameListFromCertificateFile(certFileName *string) (*C.coap_strlist_t, error)

* Get domain name list from the certificate file

func GetUriFilterByKey

func GetUriFilterByKey(key string) (values []string)

Get uri filter by key

func HandleCache

func HandleCache(resp *Pdu, response Pdu, resource *Resource, context *Context, keyItem string) error

* Handle delete item if block is last block * Handle add item if item does not exist in cache

func IsExistedUriQuery

func IsExistedUriQuery(queryParams []string) bool

Checking uri-query is exist

func OptionsToString

func OptionsToString(options []Option) (value string)

Convert the option to text format

func PinnedCertificate

func PinnedCertificate(pinCert *config.PinnedCertificate, cnArg *C.coap_strlist_t)

* Pinned certificate into the cache

func RemoveConnectingSession

func RemoveConnectingSession(session *Session)

* Remove the connecting sessions in dots server * parameter: * session the session want to remove

func SetBlockOptionFirstRequest

func SetBlockOptionFirstRequest(request *Pdu)

* Set block option with Num = 0 for first request

func SetUriFilter

func SetUriFilter(key string, value string)

Set uri filter

func SplitIdentifier

func SplitIdentifier(identifier string) (dns string, serviceType string)

* Splitting the identifier into the DNS domain name portion and the application service type portion * * The CN-ID/ DNS-ID includes the DNS domain name portion, but doesn't include the application service type portion * The SRV-ID includes both the DNS domain name portion and the application service type portion

func Startup

func Startup()

Types

type Address

type Address struct {
	// contains filtered or unexported fields
}

func AddressOf

func AddressOf(ip net.IP, port uint16) (_ Address, err error)

type Attr

type Attr struct {
	// contains filtered or unexported fields
}

type Block

type Block struct {
	NUM int
	M   int
	SZX int
}

func IntToBlock

func IntToBlock(val int) *Block

* Convert value type Int to type Block

func StringToBlock

func StringToBlock(val string) *Block

* Convert value type String to type Block

func (*Block) ToInt

func (block *Block) ToInt() int

* Convert value type Block to type Int

func (*Block) ToString

func (block *Block) ToString() string

* Convert value type Block to type String

type CoapCode

type CoapCode string
const (
	CoapCreated CoapCode = "2.01 Created"
	CoapDeleted CoapCode = "2.02 Deleted"
	CoapValid   CoapCode = "2.03 Valid"
	CoapChanged CoapCode = "2.04 Changed"
	CoapContent CoapCode = "2.05 Content"

	CoapBadRequest         CoapCode = "4.00 Bad Request"
	CoapUnauthorized       CoapCode = "4.01 Unauthorized"
	CoapBadOption          CoapCode = "4.02 Bad Option"
	CoapForbidden          CoapCode = "4.03 Forbidden"
	CoapNotFound           CoapCode = "4.04 Not Found"
	CoapMethodNotAllowed   CoapCode = "4.05 Method Not Allowed"
	CoapNotAcceptable      CoapCode = "4.06 Not Acceptable"
	CoapConflict           CoapCode = "4.09 Conflict"
	CoapPreconditionFailed CoapCode = "4.12 Precondition Failed"

	CoapRequestEntityTooLarge CoapCode = "4.13 Request Entity Too Large"
	CoapUnsupportedMediaType  CoapCode = "4.15 Unsupported Media Type"
	CoapUnprocessableEntity   CoapCode = "4.22 Unprocessable Entity"

	CoapInternalServerError CoapCode = "5.00 Internal Server Error"
	CoapNotImplemented      CoapCode = "5.01 Not Implemented"
	CoapServiceUnavailable  CoapCode = "5.03 Service Unavailable"

	CoapBadGateway           CoapCode = "5.02 Bad Gateway"
	CoapGatewayTimeout       CoapCode = "5.04 Gateway Timeout"
	CoapProxyingNotSupported CoapCode = "5.05 Proxying Not Supported"
)

type Code

type Code uint8
const (
	RequestGet    Code = 1
	RequestPost   Code = 2
	RequestPut    Code = 3
	RequestDelete Code = 4

	ResponseCreated Code = 65
	ResponseDeleted Code = 66
	ResponseValid   Code = 67
	ResponseChanged Code = 68
	ResponseContent Code = 69

	ResponseLimit2xxCode Code = 100

	ResponseBadRequest         Code = 128
	ResponseUnauthorized       Code = 129
	ResponseBadOption          Code = 130
	ResponseForbidden          Code = 131
	ResponseNotFound           Code = 132
	ResponseMethodNotAllowed   Code = 133
	ResponseNotAcceptable      Code = 134
	ResponseConflict           Code = 137
	ResponsePreconditionFailed Code = 140

	RequestEntityTooLarge        Code = 141
	ResponseUnsupportedMediaType Code = 143

	ResponseUnprocessableEntity Code = 150

	ResponseInternalServerError Code = 160
	ResponseNotImplemented      Code = 161
	ResponseServiceUnavailable  Code = 163

	ResponseBadGateway           Code = 162
	ResponseGatewayTimeout       Code = 164
	ResponseProxyingNotSupported Code = 165
)

func (Code) HttpCode

func (code Code) HttpCode() int

*

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext(addr *Address) *Context

func NewContextDtls

func NewContextDtls(addr *Address, dtls *DtlsParam, ctxPeer int, sessionTimeout *int) *Context

func (*Context) AddResource

func (context *Context) AddResource(resource *Resource)

func (*Context) CanExit

func (context *Context) CanExit() bool

func (*Context) CheckResourceDirty

func (context *Context) CheckResourceDirty(resource *Resource) bool

Check dirty of resource

func (*Context) ContextSetPSK

func (context *Context) ContextSetPSK(identity string, key []byte)

func (*Context) DeleteResource

func (context *Context) DeleteResource(resource *Resource)

func (*Context) DeleteResourceByQuery

func (context *Context) DeleteResourceByQuery(query *string)

func (*Context) EnableResourceDirty

func (context *Context) EnableResourceDirty(resource *Resource) int

* Enable resource dirty and return the resource

func (*Context) FreeContext

func (context *Context) FreeContext()

func (*Context) GetResourceByQuery

func (context *Context) GetResourceByQuery(query *string) (res *Resource)

func (*Context) NewClientSession

func (ctx *Context) NewClientSession(dst Address, proto Proto) *Session

func (*Context) NewClientSessionDTLS

func (ctx *Context) NewClientSessionDTLS(dst Address, proto Proto) *Session

func (*Context) NewClientSessionPSK

func (ctx *Context) NewClientSessionPSK(dst Address, proto Proto, identity string, key []byte) *Session

func (*Context) NewEndpoint

func (context *Context) NewEndpoint(address Address, proto Proto) *EndPoint

func (*Context) RegisterEventHandler

func (context *Context) RegisterEventHandler(handler EventHandler)

Register event handler to libcoap

func (*Context) RegisterNackHandler

func (context *Context) RegisterNackHandler(handler NackHandler)

func (*Context) RegisterResponseHandler

func (context *Context) RegisterResponseHandler(handler ResponseHandler)

func (*Context) RunOnce

func (context *Context) RunOnce(timeout time.Duration) time.Duration

type ContextPeer

type ContextPeer int
const (
	CLIENT_PEER ContextPeer = iota
	SERVER_PEER
)

type DtlsParam

type DtlsParam struct {
	CaFilename          *string
	CaPath              *string
	CertificateFilename *string
	PrivateKeyFilename  *string
	PinnedCertificate   *config.PinnedCertificate
}

type EndPoint

type EndPoint struct {
	// contains filtered or unexported fields
}

type Event

type Event int
const (
	EventSessionDisconnected Event = C.COAP_EVENT_DTLS_CLOSED
	EventSessionConnected    Event = C.COAP_EVENT_DTLS_CONNECTED
	EventSessionRenegotiate  Event = C.COAP_EVENT_DTLS_RENEGOTIATE
	EventSessionError        Event = C.COAP_EVENT_DTLS_ERROR
	EventPartialBlock        Event = C.COAP_EVENT_PARTIAL_BLOCK //(Q-)BLOCK receive errors
	EventSessionNew          Event = C.COAP_EVENT_SERVER_SESSION_NEW
	EventSessionDelete       Event = C.COAP_EVENT_SERVER_SESSION_DEL
	EventXmitBlockFail       Event = C.COAP_EVENT_XMIT_BLOCK_FAIL
)

type EventHandler

type EventHandler func(*Session, Event)

type HexCBOR

type HexCBOR string
const (
	IETF_MITIGATION_SCOPE_HEX      HexCBOR = "a1 01"       // "ietf-dots-signal-channel:mitigation-scope"
	IETF_SESSION_CONFIGURATION_HEX HexCBOR = "a1 18 1e"    // "ietf-dots-signal-channel:signal-config"
	IETF_TELEMETRY_PRE_MITIGATION  HexCBOR = "a1 18 d0 a1" // "ietf-dots-telemetry:telemetry"
	IETF_TELEMETRY_SETUP_HEX       HexCBOR = "a1 18 cb a1" // "ietf-dots-telemetry:telemetry-setup"
)

type MediaType

type MediaType uint16

MediaType specifies the content type of a message.

const (
	TextPlain     MediaType = 0   // text/plain;charset=utf-8
	AppLinkFormat MediaType = 40  // application/link-format
	AppXML        MediaType = 41  // application/xml
	AppOctets     MediaType = 42  // application/octet-stream
	AppExi        MediaType = 47  // application/exi
	AppJSON       MediaType = 50  // application/json
	AppDotsCbor   MediaType = 271 // application/dots+cbor
)

Content types.

type MethodHandler

type MethodHandler func(*Context, *Resource, *Session, *Pdu, *[]byte, *string, *Pdu)

across invocations, sessions are not 'eq'

type NackHandler

type NackHandler func(*Session, *Pdu, NackReason)

type NackReason

type NackReason C.coap_nack_reason_t
const (
	NackTooManyRetries NackReason = C.COAP_NACK_TOO_MANY_RETRIES
	NackNotDeliverable NackReason = C.COAP_NACK_NOT_DELIVERABLE
	NackRst            NackReason = C.COAP_NACK_RST
	NackTlsFailed      NackReason = C.COAP_NACK_TLS_FAILED
)

type Option

type Option struct {
	Key   OptionKey
	Value []byte
}

func (Option) String

func (opt Option) String() string

func (Option) Uint

func (opt Option) Uint() (res uint32, err error)

type OptionKey

type OptionKey uint16
const (
	OptionIfMatch       OptionKey = C.COAP_OPTION_IF_MATCH
	OptionUriHost       OptionKey = C.COAP_OPTION_URI_HOST
	OptionEtag          OptionKey = C.COAP_OPTION_ETAG
	OptionIfNoneMatch   OptionKey = C.COAP_OPTION_IF_NONE_MATCH
	OptionObserve       OptionKey = C.COAP_OPTION_OBSERVE
	OptionUriPort       OptionKey = C.COAP_OPTION_URI_PORT
	OptionLocationPath  OptionKey = C.COAP_OPTION_LOCATION_PATH
	OptionUriPath       OptionKey = C.COAP_OPTION_URI_PATH
	OptionContentFormat OptionKey = C.COAP_OPTION_CONTENT_FORMAT
	OptionContentType   OptionKey = C.COAP_OPTION_CONTENT_TYPE
	OptionMaxage        OptionKey = C.COAP_OPTION_MAXAGE
	OptionUriQuery      OptionKey = C.COAP_OPTION_URI_QUERY
	OptionAccept        OptionKey = C.COAP_OPTION_ACCEPT
	OptionLocationQuery OptionKey = C.COAP_OPTION_LOCATION_QUERY
	OptionProxyUri      OptionKey = C.COAP_OPTION_PROXY_URI
	OptionProxyScheme   OptionKey = C.COAP_OPTION_PROXY_SCHEME
	OptionSize1         OptionKey = C.COAP_OPTION_SIZE1
	OptionBlock2        OptionKey = C.COAP_OPTION_BLOCK2
	OptionSize2         OptionKey = C.COAP_OPTION_SIZE2
	OptionQBlock2       OptionKey = C.COAP_OPTION_Q_BLOCK2
)

func (OptionKey) Opaque

func (key OptionKey) Opaque(value string) (Option, error)

Add option with type is opaque

func (OptionKey) String

func (key OptionKey) String(value string) Option

func (OptionKey) ToString

func (key OptionKey) ToString() (value string)

Convert option key to string

func (OptionKey) Uint

func (key OptionKey) Uint(value interface{}) (Option, error)

type Pdu

type Pdu struct {
	Type      Type
	Code      Code
	MessageID uint16
	Token     []byte
	Options   []Option
	Data      []byte
}

func (*Pdu) AddOption

func (pdu *Pdu) AddOption(key OptionKey, val interface{})

AddOption adds an option.

func (*Pdu) AsMapKey

func (pdu *Pdu) AsMapKey() string

* Get key of Pdu: 3 options * 1. Pdu Message ID * 2. Pdu Token * 3. Pdu Message ID + Token

func (*Pdu) CoapCode

func (pdu *Pdu) CoapCode() CoapCode

* Get full coap code to print debug log when receive response * parameter: * code response code * return CoapCode: * CoapCode: full coap code that user can easy to read and understand (Ex: 2.01 Created)

func (*Pdu) GetOptionIntegerValue

func (pdu *Pdu) GetOptionIntegerValue(key OptionKey) (int, error)

func (*Pdu) GetOptionOpaqueValue

func (pdu *Pdu) GetOptionOpaqueValue(key OptionKey) (opaqueValue string)

Get value of option with type is opaque

func (*Pdu) GetOptionStringValue

func (pdu *Pdu) GetOptionStringValue(key OptionKey) (value string)

func (*Pdu) IsMessageResponse

func (pdu *Pdu) IsMessageResponse() bool

* The response data is an message (not an object data) in case the response code is different: * 1. Created * 2. Changed * 3. Content * 4. Conflict * 5. ServiceUnavailable

func (*Pdu) OptionValues

func (pdu *Pdu) OptionValues(o OptionKey) []interface{}

Options gets all the values for the given option.

func (*Pdu) Path

func (pdu *Pdu) Path() []string

func (*Pdu) PathString

func (pdu *Pdu) PathString() string

func (*Pdu) Queries

func (pdu *Pdu) Queries() []string

func (*Pdu) QueryParams

func (pdu *Pdu) QueryParams() []string

func (*Pdu) RemoveOption

func (pdu *Pdu) RemoveOption(key OptionKey)

RemoveOption removes all references to an option

func (*Pdu) SetOption

func (pdu *Pdu) SetOption(key OptionKey, val interface{})

SetOption sets an option, discarding any previous value

func (*Pdu) SetPath

func (pdu *Pdu) SetPath(path []string)

func (*Pdu) SetPathString

func (pdu *Pdu) SetPathString(path string)

func (*Pdu) ToString

func (pdu *Pdu) ToString() string

Convert the pdu to text format

type Proto

type Proto C.coap_proto_t
const (
	ProtoUdp  Proto = C.COAP_PROTO_UDP
	ProtoTcp  Proto = C.COAP_PROTO_TCP
	ProtoDtls Proto = C.COAP_PROTO_DTLS
	ProtoTls  Proto = C.COAP_PROTO_TLS
)

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

func ResourceInit

func ResourceInit(uri *string, flags ResourceFlags) *Resource

func ResourceUnknownInit

func ResourceUnknownInit() *Resource

func (*Resource) AddAttr

func (resource *Resource) AddAttr(name string, value *string) *Attr

func (*Resource) CheckDeleted

func (resource *Resource) CheckDeleted() bool

Get check deleted

func (*Resource) GetBlockSize

func (resource *Resource) GetBlockSize() *int

Get block size

func (*Resource) GetCustomerId

func (resource *Resource) GetCustomerId() *int

* Get customerId

func (*Resource) GetIsBlockwiseInProgress

func (resource *Resource) GetIsBlockwiseInProgress() bool

func (*Resource) GetObserveNumber

func (resource *Resource) GetObserveNumber() int

Get observe number

func (*Resource) GetRemovableResource

func (resource *Resource) GetRemovableResource() bool

func (*Resource) GetSizeBlock2FromSubscribers

func (resource *Resource) GetSizeBlock2FromSubscribers() int

* Get size block2 from subscribers

func (*Resource) GetTokenFromSubscribers

func (resource *Resource) GetTokenFromSubscribers() []byte

* Get token from subscribers

func (*Resource) IncreaseObserveNumber

func (resource *Resource) IncreaseObserveNumber()

Increase observe number

func (*Resource) IsNotification

func (resource *Resource) IsNotification() bool

Get is notification

func (*Resource) IsObserved

func (resource *Resource) IsObserved() bool

func (*Resource) IsQBlock2

func (resource *Resource) IsQBlock2() bool

Get is q-block 2

func (*Resource) RegisterHandler

func (resource *Resource) RegisterHandler(method Code, handler MethodHandler)

func (*Resource) RegisterServerHandler

func (resource *Resource) RegisterServerHandler(method Code, handler MethodHandler)

func (*Resource) SetBlockSize

func (resource *Resource) SetBlockSize(blockSize *int)

Set block size

func (*Resource) SetCheckDeleted

func (resource *Resource) SetCheckDeleted(checkDeleted bool)

Set check deleted

func (*Resource) SetCustomerId

func (resource *Resource) SetCustomerId(id *int)

* Set customerId

func (*Resource) SetIsBlockwiseInProgress

func (resource *Resource) SetIsBlockwiseInProgress(isInProgress bool)

func (*Resource) SetIsNotification

func (resource *Resource) SetIsNotification(isNotification bool)

Set is notification

func (*Resource) SetIsObserved

func (resource *Resource) SetIsObserved(isObserved bool)

Set resource is observed

func (*Resource) SetQBlock2

func (resource *Resource) SetQBlock2(isQBlock2 bool)

Set is q-block 2

func (*Resource) SetSession

func (resource *Resource) SetSession(session *Session)

Set session for resource

func (*Resource) ToRemovableResource

func (resource *Resource) ToRemovableResource()

func (*Resource) TurnOnResourceObservable

func (resource *Resource) TurnOnResourceObservable()

func (*Resource) UriPath

func (resource *Resource) UriPath() string

type ResponseHandler

type ResponseHandler func(*Context, *Session, *Pdu, *Pdu)

type Session

type Session struct {
	// contains filtered or unexported fields
}

func GetSessionFromResource

func GetSessionFromResource(resource *Resource) *Session

Get session from resource

func (*Session) DtlsGetPeerCommonName

func (session *Session) DtlsGetPeerCommonName() (_ string, err error)

func (*Session) GetCurrentMissingHb

func (session *Session) GetCurrentMissingHb() int

* Get current session missing-hb-allowed * return: current missing-hb-allowed value

func (*Session) GetIsHeartBeatTask

func (session *Session) GetIsHeartBeatTask() bool

* Get session is-hb-task * return: is-hb-task value

func (*Session) GetIsNotification

func (session *Session) GetIsNotification() bool

* Get session is notification * return: isNotification

func (*Session) GetIsReceiveHeartBeat

func (session *Session) GetIsReceiveHeartBeat() bool

* Get session is receive heartbeat * return: isReceiveHeartBeat

func (*Session) GetIsReceiveResponseContent

func (session *Session) GetIsReceiveResponseContent() bool

* Get session is Receive Response Content heartbeat * return: isReceiveResponseContent

func (*Session) GetIsReceivedPreMitigation

func (session *Session) GetIsReceivedPreMitigation() bool

* Get session is received pre-mitigation * return: isReceivedPreMitigation

func (*Session) GetIsSentHeartBeat

func (session *Session) GetIsSentHeartBeat() bool

* Get session is-sent-hb * return: is-sent-hb value

func (*Session) GetMissingHbAllowed

func (session *Session) GetMissingHbAllowed() int

* Get session missing-hb-allowed * return: missing-hb-allowed value

func (*Session) GetSessionPtr

func (session *Session) GetSessionPtr() *C.coap_session_t

* Get session ptr * return: C.coap_session_t

func (*Session) HandleForgetNotification

func (session *Session) HandleForgetNotification(pdu *Pdu)

* Handle forget notification * Send RST message to the dots_server to remove the observe out of resource

func (*Session) IsHeartbeatAllowed

func (session *Session) IsHeartbeatAllowed() bool

* Check if the missing heartbeat is allowed * return: bool * true: allow * false: not allow

func (*Session) IsWaitNotification

func (session *Session) IsWaitNotification() bool

* Get session is wait notitication * return: isWaitNotification

func (*Session) NewMessageID

func (session *Session) NewMessageID() uint16

func (*Session) Send

func (session *Session) Send(pdu *Pdu) (err error)

func (*Session) SessionRelease

func (session *Session) SessionRelease()

func (*Session) SetAckRandomFactor

func (session *Session) SetAckRandomFactor(value decimal.Decimal)

func (*Session) SetAckTimeout

func (session *Session) SetAckTimeout(value decimal.Decimal)

func (*Session) SetCurrentMissingHb

func (session *Session) SetCurrentMissingHb(new_hb_allowed int)

* Set current session missing-hb-allowed * parameter: * new_hb_allowed new current missing-hb-allowed

func (*Session) SetIsHeartBeatTask

func (session *Session) SetIsHeartBeatTask(isHeartBeat bool)

* Set session is-hb-task * parameter: * isHeartBeat new session is-hb-task

func (*Session) SetIsNotification

func (session *Session) SetIsNotification(isNotification bool)

* Set session is notification * parameter: * isNotification

func (*Session) SetIsReceiveHeartBeat

func (session *Session) SetIsReceiveHeartBeat(isReceiveHeartBeat bool)

* Set session is receive heartbeat * parameter: * isReceiveHeartBeat

func (*Session) SetIsReceiveResponseContent

func (session *Session) SetIsReceiveResponseContent(isReceiveResponseContent bool)

* Set session is receive response heartbeat * parameter: * isReceiveResponseContent

func (*Session) SetIsReceivedPreMitigation

func (session *Session) SetIsReceivedPreMitigation(isReceivedPreMitigation bool)

* Set session is received pre-mitigation * parameter: * isReceivedPreMitigation

func (*Session) SetIsSentHeartBeat

func (session *Session) SetIsSentHeartBeat(isSentHeartBeat bool)

* Set session is-sent-hb * parameter: * isHeartBeat new session is-sent-hb

func (*Session) SetIsWaitNotification

func (session *Session) SetIsWaitNotification(isWaitNotification bool)

* Set session is wait notification * parameter: * isWaitNotification

func (*Session) SetMaxPayLoads

func (session *Session) SetMaxPayLoads(value int)

func (*Session) SetMaxRetransmit

func (session *Session) SetMaxRetransmit(value int)

func (*Session) SetNonMaxRetransmit

func (session *Session) SetNonMaxRetransmit(value int)

func (*Session) SetNonReceiveTimeout

func (session *Session) SetNonReceiveTimeout(value decimal.Decimal)

func (*Session) SetNonTimeout

func (session *Session) SetNonTimeout(value decimal.Decimal)

func (*Session) SetSessionConfig

func (session *Session) SetSessionConfig(missingHbAllowed int, maxRetransmit int, ackTimeout float64, ackRandomFactor float64)

* Update new session configuration for the session * parameter: * missingHbAllowed the new missingHbAllowed * maxRetransmit the new maxRetransmit * ackTimeout the new ackTimeout * ackRandomFactor the new ackRandomFactor

func (*Session) SetSessionDefaultConfigIdle

func (session *Session) SetSessionDefaultConfigIdle()

* Set default session configuration for the session * parameter: * missingHbAllowed the default missingHbAllowed * maxRetransmit the default maxRetransmit * ackTimeout the default ackTimeout * ackRandomFactor the default ackRandomFactor

func (*Session) String

func (session *Session) String() string

* Parse session to string * return: session string

func (*Session) TerminateConnectingSession

func (session *Session) TerminateConnectingSession(context *Context)

* Terminate the connecting session * parameter:

type SessionConfig

type SessionConfig struct {
	// contains filtered or unexported fields
}

type Type

type Type uint8
const (
	TypeCon Type = C.COAP_MESSAGE_CON
	TypeNon Type = C.COAP_MESSAGE_NON
	TypeAck Type = C.COAP_MESSAGE_ACK
	TypeRst Type = C.COAP_MESSAGE_RST
)

type UriQuery

type UriQuery string
const (
	TargetPrefix   UriQuery = "target-prefix"
	TargetPort     UriQuery = "target-port"
	TargetProtocol UriQuery = "target-protocol"
	TargetFqdn     UriQuery = "target-fqdn"
	TargetUri      UriQuery = "target-uri"
	AliasName      UriQuery = "alias-name"
	SourcePrefix   UriQuery = "source-prefix"
	SourcePort     UriQuery = "source-port"
	SourceIcmpType UriQuery = "source-icmp-type"
	Content        UriQuery = "c="
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL