Documentation ¶
Overview ¶
Package fragmentation implements the Fragmented Data Block Transport v1.0.0 over LoRaWAN.
Index ¶
- Constants
- Variables
- func Encode(data []byte, fragmentSize, redundancy int) ([][]byte, error)
- type CID
- type Command
- type CommandPayload
- type Commands
- type DataFragmentPayload
- type DataFragmentPayloadIndexAndN
- type FragSessionDeleteAnsPayload
- type FragSessionDeleteAnsPayloadStatus
- type FragSessionDeleteReqPayload
- type FragSessionDeleteReqPayloadParam
- type FragSessionSetupAnsPayload
- type FragSessionSetupAnsPayloadStatusBitMask
- type FragSessionSetupReqPayload
- type FragSessionSetupReqPayloadControl
- type FragSessionSetupReqPayloadFragSession
- type FragSessionStatusAnsPayload
- type FragSessionStatusAnsPayloadReceivedAndIndex
- type FragSessionStatusAnsPayloadStatus
- type FragSessionStatusReqPayload
- type FragSessionStatusReqPayloadFragStatusReqParam
- type PackageVersionAnsPayload
Constants ¶
const DefaultFPort uint8 = 201
DefaultFPort defines the default fPort value for Fragmented Data Block Transport.
Variables ¶
var (
ErrNoPayloadForCID = errors.New("lorawan/applayer/fragmentation: no payload for given CID")
)
Errors
Functions ¶
Types ¶
type CID ¶
type CID byte
CID defines the command identifier.
const ( PackageVersionReq CID = 0x00 PackageVersionAns CID = 0x00 FragSessionStatusReq CID = 0x01 FragSessionStatusAns CID = 0x01 FragSessionSetupReq CID = 0x02 FragSessionSetupAns CID = 0x02 FragSessionDeleteReq CID = 0x03 FragSessionDeleteAns CID = 0x03 DataFragment CID = 0x08 )
Available command identifier.
type Command ¶
type Command struct { CID CID Payload CommandPayload }
Command defines the Command structure.
func (Command) MarshalBinary ¶
MarshalBinary encodes the command to a slice of bytes.
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 ¶
MarshalBinary encodes the commands to a slice of bytes.
type DataFragmentPayload ¶
type DataFragmentPayload struct { IndexAndN DataFragmentPayloadIndexAndN Payload []byte }
DataFragmentPayload implements the DataFragment payload.
func (DataFragmentPayload) MarshalBinary ¶
func (p DataFragmentPayload) MarshalBinary() ([]byte, error)
MarshalBinary encodes the given payload to a slice of bytes.
func (DataFragmentPayload) Size ¶
func (p DataFragmentPayload) Size() int
Size returns the payload size in bytes.
func (*DataFragmentPayload) UnmarshalBinary ¶
func (p *DataFragmentPayload) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes the payload from a slice of bytes.
type DataFragmentPayloadIndexAndN ¶
DataFragmentPayloadIndexAndN implements the DataFragment payload IndexAndN field.
type FragSessionDeleteAnsPayload ¶
type FragSessionDeleteAnsPayload struct {
Status FragSessionDeleteAnsPayloadStatus
}
FragSessionDeleteAnsPayload implements the FragSessionDeleteAns payload.
func (FragSessionDeleteAnsPayload) MarshalBinary ¶
func (p FragSessionDeleteAnsPayload) MarshalBinary() ([]byte, error)
MarshalBinary encodes the payload to a slice of bytes.
func (FragSessionDeleteAnsPayload) Size ¶
func (p FragSessionDeleteAnsPayload) Size() int
Size returns the size of the payload in bytes.
func (*FragSessionDeleteAnsPayload) UnmarshalBinary ¶
func (p *FragSessionDeleteAnsPayload) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes the payload from a slice of bytes.
type FragSessionDeleteAnsPayloadStatus ¶
FragSessionDeleteAnsPayloadStatus implements the FragSessionDeleteAns payload Status field.
type FragSessionDeleteReqPayload ¶
type FragSessionDeleteReqPayload struct {
Param FragSessionDeleteReqPayloadParam
}
FragSessionDeleteReqPayload implements the FragSessionDeleteReq paylaod.
func (FragSessionDeleteReqPayload) MarshalBinary ¶
func (p FragSessionDeleteReqPayload) MarshalBinary() ([]byte, error)
MarshalBinary encodes the payload to a slice of bytes.
func (FragSessionDeleteReqPayload) Size ¶
func (p FragSessionDeleteReqPayload) Size() int
Size returns the payload size in bytes.
func (*FragSessionDeleteReqPayload) UnmarshalBinary ¶
func (p *FragSessionDeleteReqPayload) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes the payload from a slice of bytes.
type FragSessionDeleteReqPayloadParam ¶
type FragSessionDeleteReqPayloadParam struct {
FragIndex uint8
}
FragSessionDeleteReqPayloadParam implements the FragSessionDeleteReq payload Param field.
type FragSessionSetupAnsPayload ¶
type FragSessionSetupAnsPayload struct {
StatusBitMask FragSessionSetupAnsPayloadStatusBitMask
}
FragSessionSetupAnsPayload implements the FragSessionSetupAns payload.
func (FragSessionSetupAnsPayload) MarshalBinary ¶
func (p FragSessionSetupAnsPayload) MarshalBinary() ([]byte, error)
MarshalBinary encodes the payload to a slice of bytes.
func (FragSessionSetupAnsPayload) Size ¶
func (p FragSessionSetupAnsPayload) Size() int
Size returns the paylaod size in bytes.
func (*FragSessionSetupAnsPayload) UnmarshalBinary ¶
func (p *FragSessionSetupAnsPayload) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes the payload from a slice of bytes.
type FragSessionSetupAnsPayloadStatusBitMask ¶
type FragSessionSetupAnsPayloadStatusBitMask struct { FragIndex uint8 WrongDescriptor bool FragSessionIndexNotSupported bool NotEnoughMemory bool EncodingUnsupported bool }
FragSessionSetupAnsPayloadStatusBitMask implements the FragSessionSetupAns payload StatusBitMask field.
type FragSessionSetupReqPayload ¶
type FragSessionSetupReqPayload struct { FragSession FragSessionSetupReqPayloadFragSession NbFrag uint16 FragSize uint8 Control FragSessionSetupReqPayloadControl Padding uint8 Descriptor [4]byte }
FragSessionSetupReqPayload implements the FragSessionSetupReq payload.
func (FragSessionSetupReqPayload) MarshalBinary ¶
func (p FragSessionSetupReqPayload) MarshalBinary() ([]byte, error)
MarshalBinary encodes the payload to a slice of bytes.
func (FragSessionSetupReqPayload) Size ¶
func (p FragSessionSetupReqPayload) Size() int
Size returns the payload size in number of bytes.
func (*FragSessionSetupReqPayload) UnmarshalBinary ¶
func (p *FragSessionSetupReqPayload) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes the payload from a slice of bytes.
type FragSessionSetupReqPayloadControl ¶
FragSessionSetupReqPayloadControl implements the FragSessionSetupReq payload Control field.
type FragSessionSetupReqPayloadFragSession ¶
FragSessionSetupReqPayloadFragSession implements the FragSessionSetupReq payload FragSession field.
type FragSessionStatusAnsPayload ¶
type FragSessionStatusAnsPayload struct { ReceivedAndIndex FragSessionStatusAnsPayloadReceivedAndIndex MissingFrag uint8 Status FragSessionStatusAnsPayloadStatus }
FragSessionStatusAnsPayload implements the FragSessionStatusAns payload.
func (FragSessionStatusAnsPayload) MarshalBinary ¶
func (p FragSessionStatusAnsPayload) MarshalBinary() ([]byte, error)
MarshalBinary encodes the payload to a slice of bytes.
func (FragSessionStatusAnsPayload) Size ¶
func (p FragSessionStatusAnsPayload) Size() int
Size returns the payload size in number of bytes.
func (*FragSessionStatusAnsPayload) UnmarshalBinary ¶
func (p *FragSessionStatusAnsPayload) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes the payload from a slice of bytes.
type FragSessionStatusAnsPayloadReceivedAndIndex ¶
FragSessionStatusAnsPayloadReceivedAndIndex implements the FragSessionStatusAns payload ReceivedAndIndex field.
type FragSessionStatusAnsPayloadStatus ¶
type FragSessionStatusAnsPayloadStatus struct {
NotEnoughMatrixMemory bool
}
FragSessionStatusAnsPayloadStatus implements the FragSessionStatusAns payload Status field.
type FragSessionStatusReqPayload ¶
type FragSessionStatusReqPayload struct {
FragStatusReqParam FragSessionStatusReqPayloadFragStatusReqParam
}
FragSessionStatusReqPayload implements the FragSessionStatusReq payload.
func (FragSessionStatusReqPayload) MarshalBinary ¶
func (p FragSessionStatusReqPayload) MarshalBinary() ([]byte, error)
MarshalBinary encodes the payload to a slice of bytes.
func (FragSessionStatusReqPayload) Size ¶
func (p FragSessionStatusReqPayload) Size() int
Size returns the payload size in number of bytes.
func (*FragSessionStatusReqPayload) UnmarshalBinary ¶
func (p *FragSessionStatusReqPayload) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes the payload from a slice of bytes.
type FragSessionStatusReqPayloadFragStatusReqParam ¶
FragSessionStatusReqPayloadFragStatusReqParam implements the FragSessionStatusReq payload FragStatusReqParam field.
type PackageVersionAnsPayload ¶
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.