schema

package
v0.0.0-...-f6a1651 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JustWorks               = OwnerTransferMethod(0)
	SharedPin               = OwnerTransferMethod(1)
	ManufacturerCertificate = OwnerTransferMethod(2)
	Self                    = OwnerTransferMethod(4)
)
View Source
const (
	// OperationalState_RESET - Device reset state.
	OperationalState_RESET = OperationalState(0)
	// OperationalState_RFOTM - Ready for Device owner transfer method state.
	OperationalState_RFOTM = OperationalState(1)
	// OperationalState_RFPRO - Ready for Device provisioning state.
	OperationalState_RFPRO = OperationalState(2)
	// OperationalState_RFNOP - Ready for Device normal operation state.
	OperationalState_RFNOP = OperationalState(3)
	// OperationalState_SRESET - The Device is in a soft reset state."
	OperationalState_SRESET = OperationalState(4)
)
View Source
const DeviceResourceType = "oic.wk.d"
View Source
const DoxmHref = "/oic/sec/doxm"

Variables

This section is empty.

Functions

This section is empty.

Types

type BitMask

type BitMask uint8

BitMask is defined with Policy on the line 1822 of the Core specification.

const (
	Discoverable BitMask = 1 << iota
	Observable
)

BitMask is defined with Policy on the line 1822 of the Core specification.

func (BitMask) Has

func (b BitMask) Has(flag BitMask) bool

Has returns true if the flag is set.

type CertificateEncoding

type CertificateEncoding string
const (
	CertificateEncoding_PEM CertificateEncoding = "oic.sec.encoding.pem"
	CertificateEncoding_DER CertificateEncoding = "oic.sec.encoding.der" // iotivity-lite doesn't support it
)

type CertificateSigningRequestResponse

type CertificateSigningRequestResponse struct {
	Interfaces                []string            `json:"if"`
	ResourceTypes             []string            `json:"rt"`
	Name                      string              `json:"n"`
	InstanceId                string              `json:"id"`
	Encoding                  CertificateEncoding `json:"encoding"`
	CertificateSigningRequest interface{}         `json:"csr"`
}

func (CertificateSigningRequestResponse) CSR

type Credential

type Credential struct {
	ID                      int                       `json:"credid,omitempty"`
	Type                    CredentialType            `json:"credtype"`
	Subject                 string                    `json:"subjectuuid"`
	Usage                   CredentialUsage           `json:"credusage,omitempty"`
	SupportedRefreshMethods []CredentialRefreshMethod `json:"crms,omitempty"`
	OptionalData            *CredentialOptionalData   `json:"optionaldata,omitempty"`
	Period                  string                    `json:"period,omitempty"`
	PrivateData             *CredentialPrivateData    `json:"privatedata,omitempty"`
	PublicData              *CredentialPublicData     `json:"publicdata,omitempty"`
	RoleID                  *CredentialRoleID         `json:"roleid,omitempty"`
}

type CredentialOptionalData

type CredentialOptionalData struct {
	DataInternal interface{}                    `json:"data"`
	Encoding     CredentialOptionalDataEncoding `json:"encoding"`
	IsRevoked    bool                           `json:"revstat"`
}

func (CredentialOptionalData) Data

func (c CredentialOptionalData) Data() []byte

type CredentialOptionalDataEncoding

type CredentialOptionalDataEncoding string
const (
	CredentialOptionalDataEncoding_JWT    CredentialOptionalDataEncoding = "oic.sec.encoding.jwt"
	CredentialOptionalDataEncoding_CWT    CredentialOptionalDataEncoding = "oic.sec.encoding.cwt"
	CredentialOptionalDataEncoding_BASE64 CredentialOptionalDataEncoding = "oic.sec.encoding.base64"
	CredentialOptionalDataEncoding_PEM    CredentialOptionalDataEncoding = CredentialOptionalDataEncoding(CertificateEncoding_PEM)
	CredentialOptionalDataEncoding_DER    CredentialOptionalDataEncoding = CredentialOptionalDataEncoding(CertificateEncoding_DER) // iotivity-lite doesn't support it
	CredentialOptionalDataEncoding_RAW    CredentialOptionalDataEncoding = "oic.sec.encoding.raw"
)

type CredentialPrivateData

type CredentialPrivateData struct {
	DataInternal interface{}                   `json:"data"`
	Encoding     CredentialPrivateDataEncoding `json:"encoding"`
	Handle       int                           `json:"handle,omitempty"`
}

func (CredentialPrivateData) Data

func (c CredentialPrivateData) Data() []byte

type CredentialPrivateDataEncoding

type CredentialPrivateDataEncoding string
const (
	CredentialPrivateDataEncoding_JWT    CredentialPrivateDataEncoding = "oic.sec.encoding.jwt"
	CredentialPrivateDataEncoding_CWT    CredentialPrivateDataEncoding = "oic.sec.encoding.cwt"
	CredentialPrivateDataEncoding_BASE64 CredentialPrivateDataEncoding = "oic.sec.encoding.base64"
	CredentialPrivateDataEncoding_URI    CredentialPrivateDataEncoding = "oic.sec.encoding.uri"
	CredentialPrivateDataEncoding_HANDLE CredentialPrivateDataEncoding = "oic.sec.encoding.handle"
	CredentialPrivateDataEncoding_RAW    CredentialPrivateDataEncoding = "oic.sec.encoding.raw"
)

type CredentialPublicData

type CredentialPublicData struct {
	DataInternal interface{}                  `json:"data"`
	Encoding     CredentialPublicDataEncoding `json:"encoding"`
}

func (CredentialPublicData) Data

func (c CredentialPublicData) Data() []byte

type CredentialPublicDataEncoding

type CredentialPublicDataEncoding string
const (
	CredentialPublicDataEncoding_JWT    CredentialPublicDataEncoding = "oic.sec.encoding.jwt"
	CredentialPublicDataEncoding_CWT    CredentialPublicDataEncoding = "oic.sec.encoding.cwt"
	CredentialPublicDataEncoding_BASE64 CredentialPublicDataEncoding = "oic.sec.encoding.base64"
	CredentialPublicDataEncoding_URI    CredentialPublicDataEncoding = "oic.sec.encoding.uri"
	CredentialPublicDataEncoding_PEM    CredentialPublicDataEncoding = CredentialPublicDataEncoding(CertificateEncoding_PEM)
	CredentialPublicDataEncoding_DER    CredentialPublicDataEncoding = CredentialPublicDataEncoding(CertificateEncoding_DER) // iotivity-lite doesn't support it
	CredentialPublicDataEncoding_RAW    CredentialPublicDataEncoding = "oic.sec.encoding.raw"
)

type CredentialRefreshMethod

type CredentialRefreshMethod string
const (
	CredentialRefreshMethod_PROVISION_SERVICE                     CredentialRefreshMethod = "oic.sec.crm.pro"
	CredentialRefreshMethod_KEY_AGREEMENT_PROTOCOL_AND_RANDOM_PIN CredentialRefreshMethod = "oic.sec.crm.psk"
	CredentialRefreshMethod_KEY_AGREEMENT_PROTOCOL                CredentialRefreshMethod = "oic.sec.crm.rdp"
	CredentialRefreshMethod_KEY_DISTRIBUTION_SERVICE              CredentialRefreshMethod = "oic.sec.crm.skdc"
	CredentialRefreshMethod_PKCS10_REQUEST_TO_CA                  CredentialRefreshMethod = "oic.sec.crm.pk10"
)

type CredentialResponse

type CredentialResponse struct {
	ResourceOwner string       `json:"rowneruuid"`
	Interfaces    []string     `json:"if"`
	ResourceTypes []string     `json:"rt"`
	Name          string       `json:"n"`
	Credentials   []Credential `json:"creds"`
}

type CredentialRoleID

type CredentialRoleID struct {
	Authority string `json:"authority,omitempty"`
	Role      string `json:"role,omitempty"`
}

type CredentialType

type CredentialType uint8
const (
	CredentialType_EMPTY                               CredentialType = 0
	CredentialType_SYMMETRIC_PAIR_WISE                 CredentialType = 1 //OC_CREDTYPE_PSK
	CredentialType_SYMMETRIC_GROUP                     CredentialType = 2
	CredentialType_ASYMMETRIC_SIGNING                  CredentialType = 4
	CredentialType_ASYMMETRIC_SIGNING_WITH_CERTIFICATE CredentialType = 8
	CredentialType_PIN_OR_PASSWORD                     CredentialType = 16
	CredentialType_ASYMMETRIC_ENCRYPTION_KEY           CredentialType = 32
)

func (CredentialType) Has

func (b CredentialType) Has(flag CredentialType) bool

Has returns true if the flag is set.

func (CredentialType) String

func (s CredentialType) String() string

type CredentialUpdateRequest

type CredentialUpdateRequest struct {
	ResourceOwner string       `json:"rowneruuid,omitempty"`
	Credentials   []Credential `json:"creds"`
}

type CredentialUsage

type CredentialUsage string
const (
	CredentialUsage_TRUST_CA     CredentialUsage = "oic.sec.cred.trustca"
	CredentialUsage_CERT         CredentialUsage = "oic.sec.cred.cert"
	CredentialUsage_ROLE_CERT    CredentialUsage = "oic.sec.cred.rolecert"
	CredentialUsage_MFG_TRUST_CA CredentialUsage = "oic.sec.cred.mfgtrustca"
	CredentialUsage_MFG_CERT     CredentialUsage = "oic.sec.cred.mfgcert"
)

type Device

type Device struct {
	ID                    string            `json:"di"`
	ResourceTypes         []string          `json:"rt"`
	Interfaces            []string          `json:"if"`
	Name                  string            `json:"n"`
	ManufacturerName      []LocalizedString `json:"dmn"`
	ModelNumber           string            `json:"dmno"`
	ProtocolIndependentID string            `json:"piid"`
}

Device info. https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.d.swagger.json

func (Device) GetManufacturerName

func (d Device) GetManufacturerName() string

GetManufacturerName finds the manufacturer name in English. https://tools.ietf.org/html/rfc5646#section-2.2.1

type DeviceOnboardingState

type DeviceOnboardingState struct {
	Pending                          bool             `json:"p,omitempty"`
	CurrentOrPendingOperationalState OperationalState `json:"s"`
}

type Doxm

type Doxm struct {
	ResourceOwner                 string                `json:"rowneruuid"`
	SupportedOwnerTransferMethods []OwnerTransferMethod `json:"oxms"`
	OwnerID                       string                `json:"devowneruuid"`
	DeviceID                      string                `json:"deviceuuid"`
	Owned                         bool                  `json:"owned"`
	Name                          string                `json:"n"`
	InstanceID                    string                `json:"id"`
	SupportedCredentialTypes      CredentialType        `json:"sct"`
	SelectedOwnerTransferMethod   OwnerTransferMethod   `json:"oxmsel"`
	Interfaces                    []string              `json:"if"`
	ResourceTypes                 []string              `json:"rt"`
}

type DoxmUpdate

type DoxmUpdate struct {
	ResourceOwner             *string              `json:"rowneruuid,omitempty"`
	OwnerID                   *string              `json:"devowneruuid,omitempty"`
	DeviceID                  *string              `json:"deviceuuid,omitempty"`
	Owned                     *bool                `json:"owned,omitempty"`
	SelectOwnerTransferMethod *OwnerTransferMethod `json:"oxmsel,omitempty"`
}

type Endpoint

type Endpoint struct {
	URI      string `json:"ep"`
	Priority uint64 `json:"pri"`
}

Endpoint is defined on the line 2439 and 1892, Priority on 2434 of the Core specification: - https://openconnectivity.org/specs/OCF_Core_Specification_v2.0.0.pdf - https://github.com/openconnectivityfoundation/core/blob/OCF-v2.0.0/schemas/oic.oic-link-schema.json When there are multiple endpoints, Priority indicates the priority among them. The lower the value, the higher the priority.

func (Endpoint) GetAddr

func (ep Endpoint) GetAddr() (kitNet.Addr, error)

GetAddr parses a endpoint URI to addr.

type Endpoints

type Endpoints []Endpoint

func (Endpoints) FilterSecureEndpoints

func (r Endpoints) FilterSecureEndpoints() Endpoints

FilterSecureEndpoints returns secure endpoints in order of priority.

func (Endpoints) FilterUnsecureEndpoints

func (r Endpoints) FilterUnsecureEndpoints() Endpoints

FilterUnsecureEndpoints returns unsecure endpoints in order of priority.

func (Endpoints) GetAddr

func (r Endpoints) GetAddr(scheme Scheme) (kitNet.Addr, error)

func (Endpoints) Sort

func (r Endpoints) Sort() Endpoints

Sort sorts in order priority

type LocalizedString

type LocalizedString struct {
	Language string `json:"language"`
	Value    string `json:"value"`
}

LocalizedString struct.

type OperationalMode

type OperationalMode uint8
const (
	OperationalMode_SERVER_DIRECTED_UTILIZING_MULTIPE_SERVICES OperationalMode = 1 << iota
	OperationalMode_SERVER_DIRECTED_UTILIZING_SINGLE_SERVICE
	OperationalMode_CLIENT_DIRECTED
)

func (OperationalMode) Has

func (b OperationalMode) Has(flag OperationalMode) bool

Has returns true if the flag is set.

func (OperationalMode) String

func (s OperationalMode) String() string

type OperationalState

type OperationalState int

func (OperationalState) String

func (s OperationalState) String() string

type OwnerTransferMethod

type OwnerTransferMethod int

func (OwnerTransferMethod) String

func (o OwnerTransferMethod) String() string

type Platform

type Platform struct {
	Interfaces                      []string `json:"if,omitempty"`
	ResourceTypes                   []string `json:"rt,omitempty"`
	PlatformIdentifier              string   `json:"pi"`
	ManufacturerName                string   `json:"mnmn"`
	SerialNumber                    string   `json:"mnsel,omitempty"`
	ManufacturersURL                string   `json:"mnml,omitempty"`
	ManufacturersSupport            string   `json:"mnsl,omitempty"`
	ModelNumber                     string   `json:"mnmo,omitempty"`
	ManufacturersDefinedInformation string   `json:"vid,omitempty"`
	PlatformVersion                 string   `json:"mnpv,omitempty"`
}

Platform info https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.p.swagger.json

type Policy

type Policy struct {
	BitMask    BitMask `json:"bm"`
	UDPPort    uint16  `json:"port"`
	TCPPort    uint16  `json:"x.org.iotivity.tcp"`
	TCPTLSPort uint16  `json:"x.org.iotivity.tls"`

	// Secured is true if the resource is only available via an encrypted connection.
	Secured bool `json:"sec"`
}

Policy is defined on the line 1822 of the Core specification: https://openconnectivity.org/specs/OCF_Core_Specification_v2.0.0.pdf

type ProvisionStatusResponse

type ProvisionStatusResponse struct {
	ResourceOwner             string                `json:"rowneruuid"`
	Interfaces                []string              `json:"if"`
	ResourceTypes             []string              `json:"rt"`
	CurrentOperationalMode    OperationalMode       `json:"om"`
	CurrentProvisioningMode   ProvisioningMode      `json:"cm"`
	Name                      string                `json:"n"`
	InstanceId                string                `json:"id"`
	DeviceIsOperational       bool                  `json:"isop"`
	TargetProvisioningMode    ProvisioningMode      `json:"tm"`
	SupportedOperationalModes OperationalMode       `json:"sm"`
	DeviceOnboardingState     DeviceOnboardingState `json:"dos"`
}

type ProvisionStatusUpdateRequest

type ProvisionStatusUpdateRequest struct {
	ResourceOwner          string                 `json:"rowneruuid,omitempty"`
	CurrentOperationalMode OperationalMode        `json:"om,omitempty"`
	TargetProvisioningMode ProvisioningMode       `json:"tm,omitempty"`
	DeviceOnboardingState  *DeviceOnboardingState `json:"dos,omitempty"`
}

type ProvisioningMode

type ProvisioningMode uint16
const (
	// ProvisioningMode_INIT_SOFT_VER_VALIDATION - Software version validation requested/pending(1), completed(0)
	ProvisioningMode_INIT_SOFT_VER_VALIDATION ProvisioningMode = 1 << 6
	// ProvisioningMode_INIT_SEC_SOFT_UPDATE - Secure software update requested/pending(1), completed(0)
	ProvisioningMode_INIT_SEC_SOFT_UPDATE ProvisioningMode = 1 << 7
)

func (ProvisioningMode) Has

Has returns true if the flag is set.

func (ProvisioningMode) String

func (s ProvisioningMode) String() string
type ResourceLink struct {
	ID                    string    `json:"id,omitempty"`
	Href                  string    `json:"href"`
	ResourceTypes         []string  `json:"rt"`
	Interfaces            []string  `json:"if"`
	Policy                *Policy   `json:"p,omitempty"`
	Endpoints             Endpoints `json:"eps,omitempty"`
	Anchor                string    `json:"anchor,omitempty"`
	DeviceID              string    `json:"di,omitempty"`
	InstanceID            int64     `json:"ins,omitempty"`
	Title                 string    `json:"title,omitempty"`
	SupportedContentTypes []string  `json:"type,omitempty"`
}

ResourceLink provides a link for retrieving details for its resource types: https://github.com/openconnectivityfoundation/core/blob/OCF-v2.0.0/schemas/oic.oic-link-schema.json

func (ResourceLink) GetDeviceID

func (r ResourceLink) GetDeviceID() string

GetDeviceID returns device id.

func (ResourceLink) GetEndpoints

func (d ResourceLink) GetEndpoints() Endpoints

GetEndpoints returns endpoints in order of priority.

func (ResourceLink) GetSecureEndpoints

func (d ResourceLink) GetSecureEndpoints() Endpoints

func (ResourceLink) GetTCPAddr

func (r ResourceLink) GetTCPAddr() (_ kitNet.Addr, err error)

GetTCPAddr parses and finds a TCP endpoint address.

func (ResourceLink) GetTCPSecureAddr

func (r ResourceLink) GetTCPSecureAddr() (_ kitNet.Addr, err error)

GetTCPSecureAddr parses and finds a TCP secure endpoint address.

func (ResourceLink) GetUDPAddr

func (r ResourceLink) GetUDPAddr() (_ kitNet.Addr, err error)

GetUDPAddr parses and finds a UDP endpoint address.

func (ResourceLink) GetUDPSecureAddr

func (r ResourceLink) GetUDPSecureAddr() (_ kitNet.Addr, err error)

GetUDPSecureAddr parses and finds a UDP endpoint address.

func (ResourceLink) GetUnsecureEndpoints

func (d ResourceLink) GetUnsecureEndpoints() Endpoints

func (ResourceLink) HasType

func (r ResourceLink) HasType(resourceType string) bool

HasType checks the resource type.

func (ResourceLink) PatchEndpoint

func (r ResourceLink) PatchEndpoint(addr kitNet.Addr, deviceEndpoints Endpoints) ResourceLink

PatchEndpoint adds Endpoint information where missing.

type ResourceLinks []ResourceLink

func (ResourceLinks) GetResourceHrefs

func (d ResourceLinks) GetResourceHrefs(resourceTypes ...string) []string

GetResourceHrefs resolves URIs for a resource type.

func (d ResourceLinks) GetResourceLink(href string) (_ ResourceLink, ok bool)

GetResourceLink finds a resource link with the same href.

func (d ResourceLinks) GetResourceLinks(resourceTypes ...string) ResourceLinks

GetResourceLinks resolves URIs for a resource type.

func (ResourceLinks) PatchEndpoint

func (d ResourceLinks) PatchEndpoint(addr kitNet.Addr, deviceEndpoints Endpoints) ResourceLinks

PatchEndpoint adds Endpoint information where missing.

type Scheme

type Scheme string
const (
	TCPSecureScheme Scheme = "coaps+tcp"
	TCPScheme       Scheme = "coap+tcp"
	UDPScheme       Scheme = "coap"
	UDPSecureScheme Scheme = "coaps"
)

Directories

Path Synopsis
Access Control List https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.acl2.swagger.json
Access Control List https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.acl2.swagger.json

Jump to

Keyboard shortcuts

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