interop

package
v3.12.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// LoRaAllianceJoinEUIDomain is the LoRa Alliance domain used for JoinEUI resolution.
	LoRaAllianceJoinEUIDomain = "joineuis." + loRaAllianceDomain

	// LoRaAllianceNetIDDomain is the LoRa Alliance domain used for NetID resolution.
	LoRaAllianceNetIDDomain = "netids." + loRaAllianceDomain
)
View Source
const InteropClientConfigurationName = "config.yml"

InteropClientConfigurationName represents the filename of interop client configuration.

View Source
const SenderClientCAsConfigurationName = "config.yml"

SenderClientCAsConfigurationName represents the filename of sender client CAs configuration.

Variables

View Source
var (
	ErrNoAction           = defineError("no_action", ResultNoAction, "no action")
	ErrMIC                = defineError("mic", ResultMICFailed, "MIC failed")
	ErrFrameReplayed      = defineError("frame_replayed", ResultFrameReplayed, "frame replayed")
	ErrJoinReq            = defineError("join_req", ResultJoinReqFailed, "join-request failed")
	ErrNoRoamingAgreement = defineError("no_roaming_agreement", ResultNoRoamingAgreement, "no roaming agreement")
	ErrDeviceRoaming      = defineError("device_roaming", ResultDevRoamingDisallowed, "device roaming disallowed")
	ErrRoamingActivation  = defineError("roaming_activation", ResultRoamingActDisallowed, "roaming activation disallowed")
	ErrActivation         = defineError("activation", ResultActivationDisallowed, "activation disallowed")
	ErrUnknownDevEUI      = defineError("unknown_dev_eui", ResultUnknownDevEUI, "unknown DevEUI")
	ErrUnknownDevAddr     = defineError("unknown_dev_addr", ResultUnknownDevAddr, "unknown DevAddr")
	ErrUnknownSender      = defineError("unknown_sender", ResultUnknownSender, "unknown sender")
	ErrUnknownReceiver    = defineError("unknown_receiver", ResultUnknownReceiver, "unknown receiver")
	ErrDeferred           = defineError("deferred", ResultDeferred, "deferred")
	ErrTransmitFailed     = defineError("transmit_failed", ResultXmitFailed, "transmit failed")
	ErrFPort              = defineError("f_port", ResultInvalidFPort, "invalid FPort")
	ErrProtocolVersion    = defineError("protocol_version", ResultInvalidProtocolVersion, "invalid protocol version")
	ErrStaleDeviceProfile = defineError("stale_device_profile", ResultStaleDeviceProfile, "stale device profile")
	ErrMalformedMessage   = defineError("malformed_message", ResultMalformedMessage, "malformed message")
	ErrFrameSize          = defineError("frame_size", ResultFrameSizeError, "frame size error")
)

Functions

func ErrorHandler

func ErrorHandler(err error, c echo.Context)

ErrorHandler is an echo.HTTPErrorHandler.

func GeneratedSessionKeyID

func GeneratedSessionKeyID(id []byte) bool

GeneratedSessionKeyID returns whether the session key ID is generated locally and not by the Join Server.

func JoinServerFQDN

func JoinServerFQDN(eui types.EUI64, domain string) string

JoinServerFQDN constructs Join Server FQDN using specified EUI under domain according to LoRaWAN Backend Interfaces specification. If domain is empty, LoRaAllianceJoinEUIDomain is used.

Types

type AppSKeyAns

type AppSKeyAns struct {
	JsAsMessageHeader
	Result       Result
	DevEUI       EUI64
	AppSKey      KeyEnvelope
	SessionKeyID Buffer
}

AppSKeyAns is an answer to an AppSKeyReq message.

type AppSKeyReq

type AppSKeyReq struct {
	AsJsMessageHeader
	DevEUI       EUI64
	SessionKeyID Buffer
}

AppSKeyReq is a AppSKey request message.

type ApplicationServer

type ApplicationServer interface {
}

ApplicationServer represents an Application Server.

type AsJsMessageHeader

type AsJsMessageHeader struct {
	MessageHeader
	SenderID string
	// ReceiverID is a JoinEUI.
	ReceiverID EUI64
}

AsJsMessageHeader contains the message header for AS to JS messages.

func (AsJsMessageHeader) AnswerHeader

func (h AsJsMessageHeader) AnswerHeader() (JsAsMessageHeader, error)

AnswerHeader returns the header of the answer message.

type Buffer

type Buffer []byte

Buffer contains binary data.

func (Buffer) MarshalJSON

func (b Buffer) MarshalJSON() ([]byte, error)

MarshalJSON marshals the binary data to a hexadecimal string.

func (*Buffer) UnmarshalJSON

func (b *Buffer) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a hexadecimal string to binary data.

type Client

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

func NewClient

func NewClient(ctx context.Context, conf config.InteropClient) (*Client, error)

NewClient return new interop client. fallbackTLS is optional.

func (Client) GetAppSKey

func (cl Client) GetAppSKey(ctx context.Context, asID string, req *ttnpb.SessionKeyRequest) (*ttnpb.AppSKeyResponse, error)

GetAppSKey performs AppSKey request to Join Server associated with req.JoinEUI.

func (Client) HandleJoinRequest

func (cl Client) HandleJoinRequest(ctx context.Context, netID types.NetID, req *ttnpb.JoinRequest) (*ttnpb.JoinResponse, error)

HandleJoinRequest performs Join request to Join Server associated with req.JoinEUI.

type Component added in v3.12.0

type Component interface {
	Context() context.Context
	RateLimiter() ratelimit.Interface
}

Components represents the Component to the Interop Server.

type DevAddr

type DevAddr types.DevAddr

DevAddr is a LoRaWAN DevAddr.

func (DevAddr) MarshalJSON

func (n DevAddr) MarshalJSON() ([]byte, error)

MarshalJSON marshals the DevAddr to JSON.

func (*DevAddr) UnmarshalJSON

func (n *DevAddr) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the DevAddr from JSON.

type EUI64

type EUI64 types.EUI64

EUI64 is an 64-bit EUI, e.g. a DevEUI or JoinEUI.

func (EUI64) MarshalJSON

func (n EUI64) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EUI64 to JSON.

func (*EUI64) UnmarshalJSON

func (n *EUI64) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the EUI64 from JSON.

type ErrorMessage

type ErrorMessage struct {
	RawMessageHeader
	Result Result
}

ErrorMessage is a message with raw header and a result field.

type ForwardingNetworkServer

type ForwardingNetworkServer interface {
}

ForwardingNetworkServer represents a Forwarding Network Server.

type HomeNSAns

type HomeNSAns struct {
	JsNsMessageHeader
	Result Result
	HNSID  NetID
	HNetID NetID
}

HomeNSAns is an answer to a HomeNSReq message.

type HomeNSReq

type HomeNSReq struct {
	NsJsMessageHeader
	DevEUI EUI64
}

HomeNSReq is a NetID request message.

type HomeNetworkServer

type HomeNetworkServer interface {
}

HomeNetworkServer represents a Home Network Server.

type JoinAns

type JoinAns struct {
	JsNsMessageHeader
	PHYPayload   Buffer
	Result       Result
	Lifetime     uint32
	SNwkSIntKey  *KeyEnvelope `json:",omitempty"`
	FNwkSIntKey  *KeyEnvelope `json:",omitempty"`
	NwkSEncKey   *KeyEnvelope `json:",omitempty"`
	NwkSKey      *KeyEnvelope `json:",omitempty"`
	AppSKey      *KeyEnvelope `json:",omitempty"`
	SessionKeyID Buffer       `json:",omitempty"`
}

JoinAns is an answer to a JoinReq message.

type JoinReq

type JoinReq struct {
	NsJsMessageHeader
	MACVersion MACVersion
	PHYPayload Buffer
	DevEUI     EUI64
	DevAddr    DevAddr
	DLSettings Buffer
	RxDelay    ttnpb.RxDelay
	CFList     Buffer
}

JoinReq is a join-request message.

type JoinServer

type JoinServer interface {
	JoinRequest(context.Context, *JoinReq) (*JoinAns, error)
	AppSKeyRequest(context.Context, *AppSKeyReq) (*AppSKeyAns, error)
	HomeNSRequest(context.Context, *HomeNSReq) (*HomeNSAns, error)
}

JoinServer represents a Join Server.

type JoinServerProtocol

type JoinServerProtocol uint8

JoinServerProtocol represents the protocol used for connection to Join Server by interop client.

const (
	// LoRaWANJoinServerProtocol1_0 represents Join Server protocol defined by LoRaWAN Backend Interfaces 1.0 specification.
	LoRaWANJoinServerProtocol1_0 JoinServerProtocol = iota
	// LoRaWANJoinServerProtocol1_1 represents Join Server protocol defined by LoRaWAN Backend Interfaces 1.1 specification.
	LoRaWANJoinServerProtocol1_1
)

func (JoinServerProtocol) BackendInterfacesVersion

func (p JoinServerProtocol) BackendInterfacesVersion() string

BackendInterfacesVersion returns the version of LoRaWAN Backend Interfaces specification version the protocol p is compliant with. BackendInterfacesVersion panics if p is not compliant with LoRaWAN Backend Interfaces specification.

func (*JoinServerProtocol) UnmarshalYAML

func (p *JoinServerProtocol) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type JsAsMessageHeader

type JsAsMessageHeader struct {
	MessageHeader
	// SenderID is a JoinEUI.
	SenderID   EUI64
	ReceiverID string
}

JsAsMessageHeader contains the message header for JS to AS messages.

type JsNsMessageHeader

type JsNsMessageHeader struct {
	MessageHeader
	// SenderID is a JoinEUI.
	SenderID     EUI64
	ReceiverID   NetID
	ReceiverNSID NetID
}

JsNsMessageHeader contains the message header for JS to NS messages.

type KeyEnvelope

type KeyEnvelope ttnpb.KeyEnvelope

KeyEnvelope contains a (encrypted) key.

func (KeyEnvelope) MarshalJSON

func (k KeyEnvelope) MarshalJSON() ([]byte, error)

MarshalJSON marshals the key envelope to JSON.

func (*KeyEnvelope) UnmarshalJSON

func (k *KeyEnvelope) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the key envelope from JSON.

type MACVersion

type MACVersion ttnpb.MACVersion

MACVersion is the MAC version.

func (MACVersion) MarshalJSON

func (v MACVersion) MarshalJSON() ([]byte, error)

MarshalJSON marshals the version to text format.

func (*MACVersion) UnmarshalJSON

func (v *MACVersion) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a version in text format.

type MessageHeader

type MessageHeader struct {
	ProtocolVersion string
	TransactionID   uint32
	MessageType     MessageType
	SenderToken     Buffer `json:",omitempty"`
	ReceiverToken   Buffer `json:",omitempty"`
}

MessageHeader contains the message header.

func (MessageHeader) AnswerHeader

func (h MessageHeader) AnswerHeader() (MessageHeader, error)

AnswerHeader returns the header of the answer message.

type MessageType

type MessageType string

MessageType is the message type.

const (
	MessageTypeJoinReq      MessageType = "JoinReq"
	MessageTypeJoinAns      MessageType = "JoinAns"
	MessageTypeRejoinReq    MessageType = "RejoinReq"
	MessageTypeRejoinAns    MessageType = "RejoinAns"
	MessageTypeAppSKeyReq   MessageType = "AppSKeyReq"
	MessageTypeAppSKeyAns   MessageType = "AppSKeyAns"
	MessageTypePRStartReq   MessageType = "PRStartReq"
	MessageTypePRStartAns   MessageType = "PRStartAns"
	MessageTypePRStartNotif MessageType = "PRStartNotif"
	MessageTypePRStopReq    MessageType = "PRStopReq"
	MessageTypePRStopAns    MessageType = "PRStopAns"
	MessageTypeHRStartReq   MessageType = "HRStartReq"
	MessageTypeHRStartAns   MessageType = "HRStartAns"
	MessageTypeHRStopReq    MessageType = "HRStopReq"
	MessageTypeHRStopAns    MessageType = "HRStopAns"
	MessageTypeHomeNSReq    MessageType = "HomeNSReq"
	MessageTypeHomeNSAns    MessageType = "HomeNSAns"
	MessageTypeProfileReq   MessageType = "ProfileReq"
	MessageTypeProfileAns   MessageType = "ProfileAns"
	MessageTypeXmitDataReq  MessageType = "XmitDataReq"
	MessageTypeXmitDataAns  MessageType = "XmitDataAns"
	MessageTypeXmitLocReq   MessageType = "XmitLocReq"
	MessageTypeXmitLocAns   MessageType = "XmitLocAns"
	MessageTypeErrorNotif   MessageType = "ErrorNotif"
)

type NetID

type NetID types.NetID

NetID is a LoRaWAN NetID.

func (NetID) MarshalJSON

func (n NetID) MarshalJSON() ([]byte, error)

MarshalJSON marshals the NetID to JSON.

func (*NetID) UnmarshalJSON

func (n *NetID) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the NetID from JSON.

type NsJsMessageHeader

type NsJsMessageHeader struct {
	MessageHeader
	SenderID NetID
	// ReceiverID is a JoinEUI.
	ReceiverID EUI64
	SenderNSID NetID
}

NsJsMessageHeader contains the message header for NS to JS messages.

func (NsJsMessageHeader) AnswerHeader

func (h NsJsMessageHeader) AnswerHeader() (JsNsMessageHeader, error)

AnswerHeader returns the header of the answer message.

type RawMessageHeader

type RawMessageHeader struct {
	MessageHeader
	SenderID,
	ReceiverID string
}

RawMessageHeader contains a message header with generic sender and receiver IDs.

func (RawMessageHeader) AnswerHeader

func (h RawMessageHeader) AnswerHeader() (RawMessageHeader, error)

AnswerHeader returns the header of the answer message.

type Registerer

type Registerer interface {
	RegisterInterop(s *Server)
}

Registerer allows components to register their interop services to the web server.

type Result

type Result struct {
	ResultCode  ResultCode
	Description string `json:",omitempty"`
}

Result contains the result of an operation.

type ResultCode

type ResultCode string

ResultCode is the result of an answer message.

const (
	ResultSuccess                ResultCode = "Success"
	ResultNoAction               ResultCode = "NoAction"
	ResultMICFailed              ResultCode = "MICFailed"
	ResultFrameReplayed          ResultCode = "FrameReplayed"
	ResultJoinReqFailed          ResultCode = "JoinReqFailed"
	ResultNoRoamingAgreement     ResultCode = "NoRoamingAgreement"
	ResultDevRoamingDisallowed   ResultCode = "DevRoamingDisallowed"
	ResultRoamingActDisallowed   ResultCode = "RoamingActDisallowed"
	ResultActivationDisallowed   ResultCode = "ActivationDisallowed"
	ResultUnknownDevEUI          ResultCode = "UnknownDevEUI"
	ResultUnknownDevAddr         ResultCode = "UnknownDevAddr"
	ResultUnknownSender          ResultCode = "UnknownSender"
	ResultUnknownReceiver        ResultCode = "UnknownReceiver"
	ResultDeferred               ResultCode = "Deferred"
	ResultXmitFailed             ResultCode = "XmitFailed"
	ResultInvalidFPort           ResultCode = "InvalidFPort"
	ResultInvalidProtocolVersion ResultCode = "InvalidProtocolVersion"
	ResultStaleDeviceProfile     ResultCode = "StaleDeviceProfile"
	ResultMalformedMessage       ResultCode = "MalformedMessage"
	ResultFrameSizeError         ResultCode = "FrameSizeError"
	ResultOther                  ResultCode = "Other"
)

type Server

type Server struct {
	SenderClientCAs map[string][]*x509.Certificate
	// contains filtered or unexported fields
}

Server is the server.

func NewServer

func NewServer(c Component, contextFiller fillcontext.Filler, conf config.InteropServer) (*Server, error)

NewServer builds a new server.

func (*Server) RegisterAS

func (s *Server) RegisterAS(as ApplicationServer)

RegisterAS registers the Application Server for JS-AS messages.

func (*Server) RegisterFNS

func (s *Server) RegisterFNS(fNS ForwardingNetworkServer)

RegisterFNS registers the Forwarding Network Server for sNS-fNS and JS-vNS messages.

func (*Server) RegisterHNS

func (s *Server) RegisterHNS(hNS HomeNetworkServer)

RegisterHNS registers the Home Network Server for AS-hNS, JS-hNS and sNS-hNS messages.

func (*Server) RegisterJS

func (s *Server) RegisterJS(js JoinServer)

RegisterJS registers the Join Server for AS-JS, hNS-JS and vNS-JS messages.

func (*Server) RegisterSNS

func (s *Server) RegisterSNS(sNS ServingNetworkServer)

RegisterSNS registers the Serving Network Server for hNS-sNS, fNS-sNS and JS-vNS messages.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

type ServingNetworkServer

type ServingNetworkServer interface {
}

ServingNetworkServer represents a Serving Network Server.

Jump to

Keyboard shortcuts

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