multicastsetup

package
v0.0.0-...-78d1355 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package multicastsetup implements the Remote Multicast Setup v1.0.0 over LoRaWAN.

Index

Constants

View Source
const DefaultFPort uint8 = 200

DefaultFPort defines the default fPort value for Remote Multicast Setup.

Variables

View Source
var (
	ErrNoPayloadForCID = errors.New("lorawan/applayer/multicastsetup: no payload for given CID")
)

Errors

Functions

func GetMcAppSKey

func GetMcAppSKey(mcKey lorawan.AES128Key, mcAddr lorawan.DevAddr) (lorawan.AES128Key, error)

GetMcAppSKey returns the McAppSKey given the McKey and McAddr.

func GetMcKEKey

func GetMcKEKey(mcRootKey lorawan.AES128Key) (lorawan.AES128Key, error)

GetMcKEKey returns the McKEKey given the McRootKey.

func GetMcNetSKey

func GetMcNetSKey(mcKey lorawan.AES128Key, mcAddr lorawan.DevAddr) (lorawan.AES128Key, error)

GetMcNetSKey returns the McNetSKey given the McKey and McAddr.

func GetMcRootKeyForAppKey

func GetMcRootKeyForAppKey(appKey lorawan.AES128Key) (lorawan.AES128Key, error)

GetMcRootKeyForAppKey returns the McRootKey given an AppKey. Note: The AppKey is only used for LoRaWAN 1.1.x devices.

func GetMcRootKeyForGenAppKey

func GetMcRootKeyForGenAppKey(genAppKey lorawan.AES128Key) (lorawan.AES128Key, error)

GetMcRootKeyForGenAppKey returns the McRootKey given a GenAppKey. Note: The GenAppKey is only used for LoRaWAN 1.0.x devices.

Types

type CID

type CID byte

CID defines the command identifier.

const (
	PackageVersionReq  CID = 0x00
	PackageVersionAns  CID = 0x00
	McGroupStatusReq   CID = 0x01
	McGroupStatusAns   CID = 0x01
	McGroupSetupReq    CID = 0x02
	McGroupSetupAns    CID = 0x02
	McGroupDeleteReq   CID = 0x03
	McGroupDeleteAns   CID = 0x03
	McClassCSessionReq CID = 0x04
	McClassCSessionAns CID = 0x04
	McClassBSessionReq CID = 0x05
	McClassBSessionAns CID = 0x05
)

Available command identifiers.

func (CID) String

func (i CID) String() string

type Command

type Command struct {
	CID     CID
	Payload CommandPayload
}

Command defines the Command structure.

func (Command) MarshalBinary

func (c Command) MarshalBinary() ([]byte, error)

MarshalBinary encodes the command to a slice of bytes.

func (Command) Size

func (c Command) Size() int

Size returns the size of the command in bytes.

func (*Command) UnmarshalBinary

func (c *Command) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes a slice of bytes into a command.

type CommandPayload

type CommandPayload interface {
	MarshalBinary() (data []byte, err error)
	UnmarshalBinary(data []byte) error
	Size() int
}

CommandPayload defines the interface that a command payload must implement.

func GetCommandPayload

func GetCommandPayload(uplink bool, c CID) (CommandPayload, error)

GetCommandPayload returns a new CommandPayload for the given CID.

type Commands

type Commands []Command

Commands defines a slice of commands.

func (Commands) MarshalBinary

func (c Commands) MarshalBinary() ([]byte, error)

MarshalBinary encodes the commands to a slice of bytes.

func (*Commands) UnmarshalBinary

func (c *Commands) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes a slice of bytes into a slice of commands.

type McClassBSessionAnsPayload

type McClassBSessionAnsPayload struct {
	StatusAndMcGroupID McClassBSessionAnsPayloadStatusAndMcGroupID
	TimeToStart        *uint32
}

McClassBSessionAnsPayload implements the McClassBSessionAns payload.

func (McClassBSessionAnsPayload) MarshalBinary

func (p McClassBSessionAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McClassBSessionAnsPayload) Size

func (p McClassBSessionAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*McClassBSessionAnsPayload) UnmarshalBinary

func (p *McClassBSessionAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McClassBSessionAnsPayloadStatusAndMcGroupID

type McClassBSessionAnsPayloadStatusAndMcGroupID struct {
	McGroupUndefined bool
	FreqError        bool
	DRError          bool
	McGroupID        uint8
}

McClassBSessionAnsPayloadStatusAndMcGroupID implements the McClassBSessionAns payload StatusAndMcGroupID field.

type McClassBSessionReqPayload

type McClassBSessionReqPayload struct {
	McGroupIDHeader    McClassBSessionReqPayloadMcGroupIDHeader
	SessionTime        uint32
	TimeOutPeriodicity McClassBSessionReqPayloadTimeOutPeriodicity
	DLFrequency        uint32
	DR                 uint8
}

McClassBSessionReqPayload implements the McClassBSessionReq payload.

func (McClassBSessionReqPayload) MarshalBinary

func (p McClassBSessionReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McClassBSessionReqPayload) Size

func (p McClassBSessionReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*McClassBSessionReqPayload) UnmarshalBinary

func (p *McClassBSessionReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McClassBSessionReqPayloadMcGroupIDHeader

type McClassBSessionReqPayloadMcGroupIDHeader struct {
	McGroupID uint8
}

McClassBSessionReqPayloadMcGroupIDHeader implements the McClassBSessionReq payload McGroupIDHeader field.

type McClassBSessionReqPayloadTimeOutPeriodicity

type McClassBSessionReqPayloadTimeOutPeriodicity struct {
	Periodicity uint8
	TimeOut     uint8
}

McClassBSessionReqPayloadTimeOutPeriodicity implements the McClassBSessionReq payload TimeOutPeriodicity field.

type McClassCSessionAnsPayload

type McClassCSessionAnsPayload struct {
	StatusAndMcGroupID McClassCSessionAnsPayloadStatusAndMcGroupID
	TimeToStart        *uint32
}

McClassCSessionAnsPayload implements the McClassCSessionAns payload.

func (McClassCSessionAnsPayload) MarshalBinary

func (p McClassCSessionAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McClassCSessionAnsPayload) Size

func (p McClassCSessionAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*McClassCSessionAnsPayload) UnmarshalBinary

func (p *McClassCSessionAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McClassCSessionAnsPayloadStatusAndMcGroupID

type McClassCSessionAnsPayloadStatusAndMcGroupID struct {
	McGroupUndefined bool
	FreqError        bool
	DRError          bool
	McGroupID        uint8
}

McClassCSessionAnsPayloadStatusAndMcGroupID implements the McClassCSessionAns payload StatusAndMcGroupID field.

type McClassCSessionReqPayload

type McClassCSessionReqPayload struct {
	McGroupIDHeader McClassCSessionReqPayloadMcGroupIDHeader
	SessionTime     uint32
	SessionTimeOut  McClassCSessionReqPayloadSessionTimeOut
	DLFrequency     uint32 // the frequency in Hz!
	DR              uint8
}

McClassCSessionReqPayload implements the McClassCSessionReq payload.

func (McClassCSessionReqPayload) MarshalBinary

func (p McClassCSessionReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (*McClassCSessionReqPayload) Size

func (p *McClassCSessionReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*McClassCSessionReqPayload) UnmarshalBinary

func (p *McClassCSessionReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McClassCSessionReqPayloadMcGroupIDHeader

type McClassCSessionReqPayloadMcGroupIDHeader struct {
	McGroupID uint8
}

McClassCSessionReqPayloadMcGroupIDHeader implements the McClassCSessionReq payload McGroupIDHeader field.

type McClassCSessionReqPayloadSessionTimeOut

type McClassCSessionReqPayloadSessionTimeOut struct {
	TimeOut uint8 // the actual value in seconds is 2^TimeOut
}

McClassCSessionReqPayloadSessionTimeOut implements the McClassCSessionReq payload SessionTimeOut field.

type McGroupDeleteAnsPayload

type McGroupDeleteAnsPayload struct {
	McGroupIDHeader McGroupDeleteAnsPayloadMcGroupIDHeader
}

McGroupDeleteAnsPayload implements the McGroupDeleteAns payload.

func (McGroupDeleteAnsPayload) MarshalBinary

func (p McGroupDeleteAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McGroupDeleteAnsPayload) Size

func (p McGroupDeleteAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*McGroupDeleteAnsPayload) UnmarshalBinary

func (p *McGroupDeleteAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McGroupDeleteAnsPayloadMcGroupIDHeader

type McGroupDeleteAnsPayloadMcGroupIDHeader struct {
	McGroupUndefined bool
	McGroupID        uint8
}

McGroupDeleteAnsPayloadMcGroupIDHeader implements the McGroupDeleteAns payload McGroupIDHeader field.

type McGroupDeleteReqPayload

type McGroupDeleteReqPayload struct {
	McGroupIDHeader McGroupDeleteReqPayloadMcGroupIDHeader
}

McGroupDeleteReqPayload implements the McGroupDeleteReq payload.

func (McGroupDeleteReqPayload) MarshalBinary

func (p McGroupDeleteReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McGroupDeleteReqPayload) Size

func (p McGroupDeleteReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*McGroupDeleteReqPayload) UnmarshalBinary

func (p *McGroupDeleteReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McGroupDeleteReqPayloadMcGroupIDHeader

type McGroupDeleteReqPayloadMcGroupIDHeader struct {
	McGroupID uint8
}

McGroupDeleteReqPayloadMcGroupIDHeader implements the McGroupDeleteReq payload McGroupIDHeader field.

type McGroupSetupAnsPayload

type McGroupSetupAnsPayload struct {
	McGroupIDHeader McGroupSetupAnsPayloadMcGroupIDHeader
}

McGroupSetupAnsPayload implements the McGroupSetupAns payload.

func (McGroupSetupAnsPayload) MarshalBinary

func (p McGroupSetupAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McGroupSetupAnsPayload) Size

func (p McGroupSetupAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*McGroupSetupAnsPayload) UnmarshalBinary

func (p *McGroupSetupAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McGroupSetupAnsPayloadMcGroupIDHeader

type McGroupSetupAnsPayloadMcGroupIDHeader struct {
	IDError   bool
	McGroupID uint8
}

McGroupSetupAnsPayloadMcGroupIDHeader implements the McGroupSetupAns payload GroupIDHeader field.

type McGroupSetupReqPayload

type McGroupSetupReqPayload struct {
	McGroupIDHeader McGroupSetupReqPayloadMcGroupIDHeader
	McAddr          lorawan.DevAddr
	McKeyEncrypted  [16]byte
	MinMcFCnt       uint32
	MaxMcFCnt       uint32
}

McGroupSetupReqPayload implements the McGroupSetupReq payload.

func (McGroupSetupReqPayload) MarshalBinary

func (p McGroupSetupReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McGroupSetupReqPayload) Size

func (p McGroupSetupReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*McGroupSetupReqPayload) UnmarshalBinary

func (p *McGroupSetupReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McGroupSetupReqPayloadMcGroupIDHeader

type McGroupSetupReqPayloadMcGroupIDHeader struct {
	McGroupID uint8
}

McGroupSetupReqPayloadMcGroupIDHeader implements the McGroupSetupReq payload McGroupIDHeader field.

type McGroupStatusAnsPayload

type McGroupStatusAnsPayload struct {
	Status McGroupStatusAnsPayloadStatus
	Items  []McGroupStatusAnsPayloadItem
}

McGroupStatusAnsPayload implements the McGroupStatusAns payload.

func (McGroupStatusAnsPayload) MarshalBinary

func (p McGroupStatusAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McGroupStatusAnsPayload) Size

func (p McGroupStatusAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*McGroupStatusAnsPayload) UnmarshalBinary

func (p *McGroupStatusAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McGroupStatusAnsPayloadItem

type McGroupStatusAnsPayloadItem struct {
	McGroupID uint8
	McAddr    lorawan.DevAddr
}

McGroupStatusAnsPayloadItem implements an McGroupID + MacAddr item.

type McGroupStatusAnsPayloadStatus

type McGroupStatusAnsPayloadStatus struct {
	NbTotalGroups uint8
	AnsGroupMask  [4]bool
}

McGroupStatusAnsPayloadStatus implements the McGroupStatusAns payload Status field.

type McGroupStatusReqPayload

type McGroupStatusReqPayload struct {
	CmdMask McGroupStatusReqPayloadCmdMask
}

McGroupStatusReqPayload implements the McGroupStatusReq payload.

func (McGroupStatusReqPayload) MarshalBinary

func (p McGroupStatusReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (McGroupStatusReqPayload) Size

func (p McGroupStatusReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*McGroupStatusReqPayload) UnmarshalBinary

func (p *McGroupStatusReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type McGroupStatusReqPayloadCmdMask

type McGroupStatusReqPayloadCmdMask struct {
	RegGroupMask [4]bool
}

McGroupStatusReqPayloadCmdMask implements the McGroupStatusReq payload CmdMask field.

type PackageVersionAnsPayload

type PackageVersionAnsPayload struct {
	PackageIdentifier uint8
	PackageVersion    uint8
}

PackageVersionAnsPayload implements the PackageVersionAns payload.

func (PackageVersionAnsPayload) MarshalBinary

func (p PackageVersionAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (PackageVersionAnsPayload) Size

func (p PackageVersionAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*PackageVersionAnsPayload) UnmarshalBinary

func (p *PackageVersionAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

Jump to

Keyboard shortcuts

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