Documentation
¶
Overview ¶
Package datatypes defines the structures, decoders and encoder for built-in data types described in Part 6 Section 5 Data encoding.
Index ¶
- Constants
- type AnonymousIdentityToken
- func (a *AnonymousIdentityToken) DecodeFromBytes(b []byte) error
- func (a *AnonymousIdentityToken) ID() string
- func (a *AnonymousIdentityToken) Len() int
- func (a *AnonymousIdentityToken) Serialize() ([]byte, error)
- func (a *AnonymousIdentityToken) SerializeTo(b []byte) error
- func (a *AnonymousIdentityToken) Type() int
- type Boolean
- type ByteString
- type Data
- type DataValue
- func (d *DataValue) DecodeFromBytes(b []byte) error
- func (d *DataValue) HasServerPicoSeconds() bool
- func (d *DataValue) HasServerTimestamp() bool
- func (d *DataValue) HasSourcePicoSeconds() bool
- func (d *DataValue) HasSourceTimestamp() bool
- func (d *DataValue) HasStatus() bool
- func (d *DataValue) HasValue() bool
- func (d *DataValue) Len() int
- func (d *DataValue) Serialize() ([]byte, error)
- func (d *DataValue) SerializeTo(b []byte) error
- func (d *DataValue) SetServerPicoSecondsFlag()
- func (d *DataValue) SetServerTimestampFlag()
- func (d *DataValue) SetSourcePicoSecondsFlag()
- func (d *DataValue) SetSourceTimestampFlag()
- func (d *DataValue) SetStatusFlag()
- func (d *DataValue) SetValueFlag()
- type DataValueArray
- type ExpandedNodeID
- type ExtensionObject
- type ExtensionObjectValue
- type Float
- type GUID
- type IntegerID
- type IssuedIdentityToken
- func (i *IssuedIdentityToken) DecodeFromBytes(b []byte) error
- func (i *IssuedIdentityToken) ID() string
- func (i *IssuedIdentityToken) Len() int
- func (i *IssuedIdentityToken) Serialize() ([]byte, error)
- func (i *IssuedIdentityToken) SerializeTo(b []byte) error
- func (i *IssuedIdentityToken) Type() int
- type LocalizedText
- func (l *LocalizedText) DataType() uint16
- func (l *LocalizedText) DecodeFromBytes(b []byte) error
- func (l *LocalizedText) HasLocale() bool
- func (l *LocalizedText) HasText() bool
- func (l *LocalizedText) Len() int
- func (l *LocalizedText) Serialize() ([]byte, error)
- func (l *LocalizedText) SerializeTo(b []byte) error
- func (l *LocalizedText) SetLocaleMask()
- func (l *LocalizedText) SetTextMask()
- func (l *LocalizedText) String() string
- type NodeID
- func DecodeNodeID(b []byte) (*NodeID, error)
- func NewFourByteNodeID(ns uint8, id uint16) *NodeID
- func NewGUIDNodeID(ns uint16, id string) *NodeID
- func NewNodeID(s string) (*NodeID, error)
- func NewNumericNodeID(ns uint16, id uint32) *NodeID
- func NewOpaqueNodeID(ns uint16, id []byte) *NodeID
- func NewStringNodeID(ns uint16, id string) *NodeID
- func NewTwoByteNodeID(id uint8) *NodeID
- func (n *NodeID) DecodeFromBytes(b []byte) error
- func (n *NodeID) EncodingMask() uint8
- func (n *NodeID) IndexFlag() bool
- func (n *NodeID) IntID() int
- func (n *NodeID) Len() int
- func (n *NodeID) Namespace() int
- func (n *NodeID) Serialize() ([]byte, error)
- func (n *NodeID) SerializeTo(b []byte) error
- func (n *NodeID) SetIndexFlag()
- func (n *NodeID) SetIntID(v int) error
- func (n *NodeID) SetNamespace(v int) error
- func (n *NodeID) SetStringID(v string) error
- func (n *NodeID) SetURIFlag()
- func (n *NodeID) String() string
- func (n *NodeID) StringID() string
- func (n *NodeID) Type() uint8
- func (n *NodeID) URIFlag() bool
- type QualifiedName
- type ReadValueID
- type ReadValueIDArray
- type ServersOnNetwork
- type ServersOnNetworkArray
- type String
- type StringArray
- type Uint32Array
- type UserIdentityToken
- type UserNameIdentityToken
- func (u *UserNameIdentityToken) DecodeFromBytes(b []byte) error
- func (u *UserNameIdentityToken) ID() string
- func (u *UserNameIdentityToken) Len() int
- func (u *UserNameIdentityToken) Serialize() ([]byte, error)
- func (u *UserNameIdentityToken) SerializeTo(b []byte) error
- func (u *UserNameIdentityToken) Type() int
- type Variant
- type WriteValue
- type WriteValueArray
- type X509IdentityToken
Constants ¶
const ( TypeTwoByte = iota TypeFourByte TypeNumeric TypeString TypeGUID TypeOpaque )
NodeID type definitions.
Specification: Part 6, 5.2.2.9
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnonymousIdentityToken ¶
type AnonymousIdentityToken struct {
PolicyID *String
}
AnonymousIdentityToken is used to indicate that the Client has no user credentials.
Specification: Part4, 7.36.5
func DecodeAnonymousIdentityToken ¶
func DecodeAnonymousIdentityToken(b []byte) (*AnonymousIdentityToken, error)
DecodeAnonymousIdentityToken decodes given bytes as AnonymousIdentityToken.
func NewAnonymousIdentityToken ¶
func NewAnonymousIdentityToken(policyID string) *AnonymousIdentityToken
NewAnonymousIdentityToken creates a new AnonymousIdentityToken.
func (*AnonymousIdentityToken) DecodeFromBytes ¶
func (a *AnonymousIdentityToken) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes as AnonymousIdentityToken.
func (*AnonymousIdentityToken) ID ¶
func (a *AnonymousIdentityToken) ID() string
ID returns PolicyID in string.
func (*AnonymousIdentityToken) Len ¶
func (a *AnonymousIdentityToken) Len() int
Len returns the actual Length of AnonymousIdentityToken in int.
func (*AnonymousIdentityToken) Serialize ¶
func (a *AnonymousIdentityToken) Serialize() ([]byte, error)
Serialize serializes AnonymousIdentityToken into bytes.
func (*AnonymousIdentityToken) SerializeTo ¶
func (a *AnonymousIdentityToken) SerializeTo(b []byte) error
SerializeTo serializes AnonymousIdentityToken into bytes.
func (*AnonymousIdentityToken) Type ¶
func (a *AnonymousIdentityToken) Type() int
Type returns type of token defined in NodeIds.csv in int.
type Boolean ¶
type Boolean struct {
Value uint8
}
Boolean represents the datatype Boolean.
Specification: Part 3, 8.8
func DecodeBoolean ¶
DecodeBoolean decodes given bytes into Boolean.
func NewBoolean ¶
NewBoolean creates a new Boolean datatype. If given true, this returns the Boolean(=uint8) value 0x01. Otherwise the value is 0x00,
func (*Boolean) DecodeFromBytes ¶
DecodeFromBytes decodes given bytes into Boolean.
func (*Boolean) SerializeTo ¶
SerializeTo serializes Boolean into bytes.
type ByteString ¶
ByteString is encoded as sequence of bytes preceded by its length in bytes. The length is encoded as a 32-bit signed integer. If the length of the byte string is −1 then the byte string is ‘null’.
Specification: Part 6, 5.2.2.7
func DecodeByteString ¶
func DecodeByteString(b []byte) (*ByteString, error)
DecodeByteString decodes given bytes into ByteString.
func NewByteString ¶
func NewByteString(b []byte) *ByteString
NewByteString creates a new ByteString.
func (*ByteString) DecodeFromBytes ¶
func (s *ByteString) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into OPC UA ByteString.
func (*ByteString) Get ¶
func (s *ByteString) Get() []byte
Get returns the value in Golang's built-in type string.
func (*ByteString) Len ¶
func (s *ByteString) Len() int
Len returns the actual length of ByteString in int.
func (*ByteString) Serialize ¶
func (s *ByteString) Serialize() ([]byte, error)
Serialize serializes ByteString into bytes.
func (*ByteString) SerializeTo ¶
func (s *ByteString) SerializeTo(b []byte) error
SerializeTo serializes ByteString into bytes.
func (*ByteString) Set ¶
func (s *ByteString) Set(b []byte)
Set sets the string value in ByteString and calcurate length.
type Data ¶
type Data interface { DecodeFromBytes([]byte) error Serialize() ([]byte, error) SerializeTo([]byte) error Len() int DataType() uint16 }
Data is an interface to handle any kind of OPC UA data types.
type DataValue ¶
type DataValue struct { EncodingMask byte Value *Variant Status uint32 SourceTimestamp time.Time SourcePicoSeconds uint16 ServerTimestamp time.Time ServerPicoSeconds uint16 }
DataValue is always preceded by a mask that indicates which fields are present in the stream.
Specification: Part 6, 5.2.2.17
func DecodeDataValue ¶
DecodeDataValue decodes given bytes into DataValue.
func NewDataValue ¶
func NewDataValue(hasValue, hasStatus, hasSrcTs, hasSrcPs, hasSvrTs, hasSvrPs bool, v *Variant, status uint32, srcTs time.Time, srcPs uint16, svrTs time.Time, svrPs uint16) *DataValue
NewDataValue creates a new DataValue.
func (*DataValue) DecodeFromBytes ¶
DecodeFromBytes decodes given bytes into DataValue.
func (*DataValue) HasServerPicoSeconds ¶
HasServerPicoSeconds checks if DataValue has ServerPicoSeconds or not.
func (*DataValue) HasServerTimestamp ¶
HasServerTimestamp checks if DataValue has ServerTimestamp or not.
func (*DataValue) HasSourcePicoSeconds ¶
HasSourcePicoSeconds checks if DataValue has SourcePicoSeconds or not.
func (*DataValue) HasSourceTimestamp ¶
HasSourceTimestamp checks if DataValue has SourceTimestamp or not.
func (*DataValue) SerializeTo ¶
SerializeTo serializes DataValue into bytes.
func (*DataValue) SetServerPicoSecondsFlag ¶
func (d *DataValue) SetServerPicoSecondsFlag()
SetServerPicoSecondsFlag sets server picoseconds flag in EncodingMask in DataValue.
func (*DataValue) SetServerTimestampFlag ¶
func (d *DataValue) SetServerTimestampFlag()
SetServerTimestampFlag sets server timestamp flag in EncodingMask in DataValue.
func (*DataValue) SetSourcePicoSecondsFlag ¶
func (d *DataValue) SetSourcePicoSecondsFlag()
SetSourcePicoSecondsFlag sets source picoseconds flag in EncodingMask in DataValue.
func (*DataValue) SetSourceTimestampFlag ¶
func (d *DataValue) SetSourceTimestampFlag()
SetSourceTimestampFlag sets source timestamp flag in EncodingMask in DataValue.
func (*DataValue) SetStatusFlag ¶
func (d *DataValue) SetStatusFlag()
SetStatusFlag sets status flag in EncodingMask in DataValue.
func (*DataValue) SetValueFlag ¶
func (d *DataValue) SetValueFlag()
SetValueFlag sets value flag in EncodingMask in DataValue.
type DataValueArray ¶
DataValueArray represents the DataValueArray.
func DecodeDataValueArray ¶
func DecodeDataValueArray(b []byte) (*DataValueArray, error)
DecodeDataValueArray decodes given bytes into DataValueArray.
func NewDataValueArray ¶
func NewDataValueArray(values []*DataValue) *DataValueArray
NewDataValueArray creates a new DataValueArray from multiple data values.
func (*DataValueArray) DecodeFromBytes ¶
func (d *DataValueArray) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into DataValueArray.
func (*DataValueArray) Len ¶
func (d *DataValueArray) Len() int
Len returns the actual length in int.
func (*DataValueArray) Serialize ¶
func (d *DataValueArray) Serialize() ([]byte, error)
Serialize serializes DataValueArray into bytes.
func (*DataValueArray) SerializeTo ¶
func (d *DataValueArray) SerializeTo(b []byte) error
SerializeTo serializes DataValueArray into bytes.
type ExpandedNodeID ¶
ExpandedNodeID extends the NodeID structure by allowing the NamespaceURI to be explicitly specified instead of using the NamespaceIndex. The NamespaceURI is optional. If it is specified, then the NamespaceIndex inside the NodeID shall be ignored.
Specification: Part 6, 5.2.2.10
func DecodeExpandedNodeID ¶
func DecodeExpandedNodeID(b []byte) (*ExpandedNodeID, error)
DecodeExpandedNodeID decodes given bytes into ExpandedNodeID.
func NewExpandedNodeID ¶
func NewExpandedNodeID(hasURI, hasIndex bool, nodeID *NodeID, uri string, idx uint32) *ExpandedNodeID
NewExpandedNodeID creates a new ExpandedNodeID.
func NewFourByteExpandedNodeID ¶
func NewFourByteExpandedNodeID(ns uint8, id uint16) *ExpandedNodeID
NewFourByteExpandedNodeID creates a four byte numeric expanded node id.
func NewTwoByteExpandedNodeID ¶
func NewTwoByteExpandedNodeID(id uint8) *ExpandedNodeID
NewTwoByteExpandedNodeID creates a two byte numeric expanded node id.
func (*ExpandedNodeID) DecodeFromBytes ¶
func (e *ExpandedNodeID) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into ExpandedNodeID.
func (*ExpandedNodeID) HasNamespaceURI ¶
func (e *ExpandedNodeID) HasNamespaceURI() bool
HasNamespaceURI checks if an ExpandedNodeID has NamespaceURI Flag.
func (*ExpandedNodeID) HasServerIndex ¶
func (e *ExpandedNodeID) HasServerIndex() bool
HasServerIndex checks if an ExpandedNodeID has ServerIndex Flag.
func (*ExpandedNodeID) Len ¶
func (e *ExpandedNodeID) Len() int
Len returns the actual length of ExpandedNodeID in int.
func (*ExpandedNodeID) Serialize ¶
func (e *ExpandedNodeID) Serialize() ([]byte, error)
Serialize serializes ExpandedNodeID into bytes.
func (*ExpandedNodeID) SerializeTo ¶
func (e *ExpandedNodeID) SerializeTo(b []byte) error
SerializeTo serializes ExpandedNodeID into bytes.
type ExtensionObject ¶
type ExtensionObject struct { TypeID *ExpandedNodeID EncodingMask byte Length int32 Value ExtensionObjectValue }
ExtensionObject is encoded as sequence of bytes prefixed by the NodeId of its DataTypeEncoding and the number of bytes encoded.
Specification: Part 6, 5.2.2.15
func DecodeExtensionObject ¶
func DecodeExtensionObject(b []byte) (*ExtensionObject, error)
DecodeExtensionObject decodes given bytes into ExtensionObject.
func NewExtensionObject ¶
func NewExtensionObject(mask uint8, extParam ExtensionObjectValue) *ExtensionObject
NewExtensionObject creates a new ExtensionObject from the ExtensionObjectValue given.
func (*ExtensionObject) DecodeFromBytes ¶
func (e *ExtensionObject) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into ExtensionObject.
func (*ExtensionObject) Len ¶
func (e *ExtensionObject) Len() int
Len returns the actual length of ExtensionObject in int.
func (*ExtensionObject) Serialize ¶
func (e *ExtensionObject) Serialize() ([]byte, error)
Serialize serializes ExtensionObject into bytes.
func (*ExtensionObject) SerializeTo ¶
func (e *ExtensionObject) SerializeTo(b []byte) error
SerializeTo serializes ExtensionObject into bytes.
func (*ExtensionObject) SetLength ¶
func (e *ExtensionObject) SetLength()
SetLength sets the length of Value in Length field.
type ExtensionObjectValue ¶
type ExtensionObjectValue interface { DecodeFromBytes([]byte) error SerializeTo(b []byte) error Len() int Type() int }
ExtensionObjectValue represents the value in ExtensionObject.
func DecodeExtensionObjectValue ¶
func DecodeExtensionObjectValue(b []byte, typ int) (ExtensionObjectValue, error)
DecodeExtensionObjectValue decodes given bytes as an ExtensionObjectValue depending on the specified type.
The type should be one defined in the DiscoveryConfiguration, UserIdentityToken, NodeAttributes, HistoryReadDetails, HistoryData, HistoryUpdateDetails, MonitoringFilterResult, FilterOperand.
type Float ¶
type Float struct {
Value float32
}
Float values shall be encoded with the appropriate IEEE-754 binary representation which has three basic components: the sign, the exponent, and the fraction.
Specification: Part 6, 5.2.2.3
func DecodeFloat ¶
DecodeFloat decodes given bytes into Float.
func (*Float) DecodeFromBytes ¶
DecodeFromBytes decodes given bytes into OPC UA Float.
func (*Float) SerializeTo ¶
SerializeTo serializes Float into bytes.
type GUID ¶
GUID represents GUID in binary stream. It is a 16-byte globally unique identifier.
Specification: Part 6, 5.1.3
func DecodeGUID ¶
DecodeGUID decodes given bytes into GUID.
func NewGUID ¶
NewGUID creates a new GUID. Input should be GUID string of 16 hexadecimal characters like 1111AAAA-22BB-33CC-44DD-55EE77FF9900. Dash can be omitted, and alphabets are not case-sensitive.
func (*GUID) DecodeFromBytes ¶
DecodeFromBytes decodes given bytes into GUID.
func (*GUID) SerializeTo ¶
SerializeTo serializes GUID into given bytes.
type IntegerID ¶
type IntegerID uint32
IntegerID is a UInt32 that is used as an identifier, such as a handle. All values, except for 0, are valid.
Specification: Part 4, 7.14
const ( IntegerIDNodeID IntegerID = iota + 1 IntegerIDNodeClass IntegerIDBrowseName IntegerIDDisplayName IntegerIDDescription IntegerIDWriteMask IntegerIDUserWriteMask IntegerIDIsAbstract IntegerIDSymmetric IntegerIDInverseName IntegerIDContainsNoLoops IntegerIDEventNotifier IntegerIDValue IntegerIDDataType IntegerIDValueRank IntegerIDArrayDimensions IntegerIDAccessLevel IntegerIDUserAccessLevel IntegerIDMinimumSamplingInterval IntegerIDHistorizing IntegerIDExecutable IntegerIDUserExecutable IntegerIDDataTypeDefinition IntegerIDRolePermissions IntegerIDUserRolePermissions IntegerIDAccessRestrictions IntegerIDAccessLevelEx )
Identifiers assigned to Attributes.
Specification: Part 6, A.1
type IssuedIdentityToken ¶
type IssuedIdentityToken struct { PolicyID *String TokenData *ByteString EncryptionAlgorithm *String }
IssuedIdentityToken is used to pass SecurityTokens issued by an external Authorization Service to the Server. These tokens may be text or binary. OAuth2 defines a standard for Authorization Services that produce JSON Web Tokens (JWT). These JWTs are passed as an Issued Token to an OPC UA Server which uses the signature contained in the JWT to validate the token. Part 6 describes OAuth2 and JWTs in more detail. If the token is encrypted, it shall use the EncryptedSecret format defined in 7.36.2.3. This token shall be encrypted by the Client if required by the SecurityPolicy of the UserTokenPolicy. The Server should specify a SecurityPolicy for the UserTokenPolicy if the SecureChannel has a SecurityPolicy of None and no transport layer encryption is available. The SecurityPolicy of the SecureChannel is used If no SecurityPolicy is specified in the UserTokenPolicy. If the SecurityPolicy is not None, the tokenData shall be encoded in UTF-8 (if it is not already binary), signed and encrypted according the rules specified for the tokenType of the associated UserTokenPolicy (see 7.37). If the SecurityPolicy is None then the tokenData only contains the UTF-8 encoded tokenData. This configuration should not be used unless the network is encrypted in some other manner such as a VPN. The use of this configuration without network encryption would result in a serious security fault, in that it would cause the appearance of a secure user access, but it would make the token visible in clear text.
Specification: Part4, 7.36.6
func DecodeIssuedIdentityToken ¶
func DecodeIssuedIdentityToken(b []byte) (*IssuedIdentityToken, error)
DecodeIssuedIdentityToken decodes given bytes as IssuedIdentityToken.
func NewIssuedIdentityToken ¶
func NewIssuedIdentityToken(policyID string, tokenData []byte, alg string) *IssuedIdentityToken
NewIssuedIdentityToken creates a new IssuedIdentityToken.
func (*IssuedIdentityToken) DecodeFromBytes ¶
func (i *IssuedIdentityToken) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes as IssuedIdentityToken.
func (*IssuedIdentityToken) ID ¶
func (i *IssuedIdentityToken) ID() string
ID returns PolicyID in string.
func (*IssuedIdentityToken) Len ¶
func (i *IssuedIdentityToken) Len() int
Len returns the actual Length of IssuedIdentityToken in int.
func (*IssuedIdentityToken) Serialize ¶
func (i *IssuedIdentityToken) Serialize() ([]byte, error)
Serialize serializes IssuedIdentityToken into bytes.
func (*IssuedIdentityToken) SerializeTo ¶
func (i *IssuedIdentityToken) SerializeTo(b []byte) error
SerializeTo serializes IssuedIdentityToken into bytes.
func (*IssuedIdentityToken) Type ¶
func (i *IssuedIdentityToken) Type() int
Type returns type of token defined in NodeIds.csv in int.
type LocalizedText ¶
LocalizedText represents a LocalizedText. A LocalizedText structure contains two fields that could be missing. For that reason, the encoding uses a bit mask to indicate which fields are actually present in the encoded form.
Specification: Part 6, 5.2.2.14
func DecodeLocalizedText ¶
func DecodeLocalizedText(b []byte) (*LocalizedText, error)
DecodeLocalizedText decodes given bytes into LocalizedText.
func NewLocalizedText ¶
func NewLocalizedText(locale, text string) *LocalizedText
NewLocalizedText creates a new NewLocalizedText.
func (*LocalizedText) DataType ¶
func (l *LocalizedText) DataType() uint16
DataType returns type of Data.
func (*LocalizedText) DecodeFromBytes ¶
func (l *LocalizedText) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into LocalizedText.
func (*LocalizedText) HasLocale ¶
func (l *LocalizedText) HasLocale() bool
HasLocale checks if the LocalizedText has HasLocale mask in EncodingMask.
func (*LocalizedText) HasText ¶
func (l *LocalizedText) HasText() bool
HasText checks if the LocalizedText has HasText mask in EncodingMask.
func (*LocalizedText) Len ¶
func (l *LocalizedText) Len() int
Len returns the actual length of LocalizedText in int.
func (*LocalizedText) Serialize ¶
func (l *LocalizedText) Serialize() ([]byte, error)
Serialize serializes LocalizedText into bytes.
func (*LocalizedText) SerializeTo ¶
func (l *LocalizedText) SerializeTo(b []byte) error
SerializeTo serializes LocalizedText into bytes.
func (*LocalizedText) SetLocaleMask ¶
func (l *LocalizedText) SetLocaleMask()
SetLocaleMask sets the HasLocale mask in EncodingMask.
func (*LocalizedText) SetTextMask ¶
func (l *LocalizedText) SetTextMask()
SetTextMask sets the HasText mask in EncodingMask.
func (*LocalizedText) String ¶
func (l *LocalizedText) String() string
String returns LocalizedText in string.
type NodeID ¶
type NodeID struct {
// contains filtered or unexported fields
}
NodeID is an identifier for a node in the address space of an OPC UA Server. The NodeID object encodes all different node id types.
func DecodeNodeID ¶
DecodeNodeID decodes a node id from bytes.
func NewFourByteNodeID ¶
NewFourByteNodeID returns a new four byte node id.
func NewGUIDNodeID ¶
NewGUIDNodeID returns a new GUID node id.
func NewNodeID ¶
NewNodeID returns a node id from a string definition of the format 'ns=<namespace>;{s,i,b,g}=<identifier>'.
For string node ids the 's=' prefix can be omitted.
For numeric ids the smallest possible type which can store the namespace and id value is returned.
Namespace URLs 'nsu=' are not supported since they require a lookup.
func NewNumericNodeID ¶
NewNumericNodeID returns a new numeric node id.
func NewOpaqueNodeID ¶
NewOpaqueNodeID returns a new opaque node id.
func NewStringNodeID ¶
NewStringNodeID returns a new string node id.
func NewTwoByteNodeID ¶
NewTwoByteNodeID returns a new two byte node id.
func (*NodeID) DecodeFromBytes ¶
DecodeFromBytes decodes a NodeID from bytes.
func (*NodeID) EncodingMask ¶
EncodingMask returns the encoding mask field including the type information and additional flags.
func (*NodeID) IntID ¶
IntID returns the identifier value if the type is TwoByte, FourByte or Numeric. For all other types IntID returns 0.
func (*NodeID) Namespace ¶
Namespace returns the namespace id. For two byte node ids this will always be zero.
func (*NodeID) SerializeTo ¶
SerializeTo serializes NodeID into bytes.
func (*NodeID) SetIndexFlag ¶
func (n *NodeID) SetIndexFlag()
SetIndexFlag sets NamespaceURI flag in EncodingMask.
func (*NodeID) SetIntID ¶
SetIntID sets the identifier value for two byte, four byte and numeric node ids. It returns an error for other types.
func (*NodeID) SetNamespace ¶
SetNamespace sets the namespace id. It returns an error if the id is not within the range of the node id type.
func (*NodeID) SetStringID ¶
SetStringID sets the identifier value for string, guid and opaque node ids. It returns an error for other types.
func (*NodeID) SetURIFlag ¶
func (n *NodeID) SetURIFlag()
SetURIFlag sets NamespaceURI flag in EncodingMask.
func (*NodeID) String ¶
String returns the string representation of the NodeID in the format described by NewNodeID.
type QualifiedName ¶
QualifiedName contains a qualified name. It is, for example, used as BrowseName. The name part of the QualifiedName is restricted to 512 characters.
Specification: Part 3, 8.3
func DecodeQualifiedName ¶
func DecodeQualifiedName(b []byte) (*QualifiedName, error)
DecodeQualifiedName decodes given bytes into QualifiedName.
func NewQualifiedName ¶
func NewQualifiedName(index uint16, name string) *QualifiedName
NewQualifiedName creates a new QualifiedName.
func (*QualifiedName) DecodeFromBytes ¶
func (q *QualifiedName) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into OPC UA QualifiedName.
func (*QualifiedName) Len ¶
func (q *QualifiedName) Len() int
Len returns the actual length of QualifiedName in int.
func (*QualifiedName) Serialize ¶
func (q *QualifiedName) Serialize() ([]byte, error)
Serialize serializes QualifiedName into bytes.
func (*QualifiedName) SerializeTo ¶
func (q *QualifiedName) SerializeTo(b []byte) error
SerializeTo serializes QualifiedName into bytes.
type ReadValueID ¶
type ReadValueID struct { NodeID *NodeID AttributeID IntegerID IndexRange *String DataEncoding *QualifiedName }
ReadValueID is an identifier for an item to read or to monitor.
Specification: Part 4, 7.24
func DecodeReadValueID ¶
func DecodeReadValueID(b []byte) (*ReadValueID, error)
DecodeReadValueID decodes given bytes into ReadValueID.
func NewReadValueID ¶
func NewReadValueID(nodeID *NodeID, attrID IntegerID, idxRange string, qIdx uint16, qName string) *ReadValueID
NewReadValueID creates a new ReadValueID.
func (*ReadValueID) DecodeFromBytes ¶
func (r *ReadValueID) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into OPC UA ReadValueID.
func (*ReadValueID) Len ¶
func (r *ReadValueID) Len() int
Len returns the actual length of ReadValueID in int.
func (*ReadValueID) Serialize ¶
func (r *ReadValueID) Serialize() ([]byte, error)
Serialize serializes ReadValueID into bytes.
func (*ReadValueID) SerializeTo ¶
func (r *ReadValueID) SerializeTo(b []byte) error
SerializeTo serializes ReadValueID into bytes.
type ReadValueIDArray ¶
type ReadValueIDArray struct { ArraySize int32 ReadValueIDs []*ReadValueID }
ReadValueIDArray represents an array of ReadValueIDs. It does not correspond to a certain type from the specification but makes encoding and decoding easier.
func DecodeReadValueIDArray ¶
func DecodeReadValueIDArray(b []byte) (*ReadValueIDArray, error)
DecodeReadValueIDArray decodes given bytes into ReadValueIDArray.
func NewReadValueIDArray ¶
func NewReadValueIDArray(ids []*ReadValueID) *ReadValueIDArray
NewReadValueIDArray creates a new ReadValueIDArray from multiple ReadValueIDs.
func (*ReadValueIDArray) DecodeFromBytes ¶
func (r *ReadValueIDArray) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into ReadValueIDArray.
func (*ReadValueIDArray) Len ¶
func (r *ReadValueIDArray) Len() int
Len returns the actual length in int.
func (*ReadValueIDArray) Serialize ¶
func (r *ReadValueIDArray) Serialize() ([]byte, error)
Serialize serializes ReadValueIDArray into bytes.
func (*ReadValueIDArray) SerializeTo ¶
func (r *ReadValueIDArray) SerializeTo(b []byte) error
SerializeTo serializes ReadValueIDArray into bytes.
type ServersOnNetwork ¶
type ServersOnNetwork struct { RecordID uint32 ServerName *String DiscoveryURI *String ServerCapabilities *StringArray }
ServersOnNetwork is a DNS service record that meet criteria specified in the request. This list is empty if no Servers meet the criteria.
Specification: Part4, 5.4.3.2
func DecodeServersOnNetwork ¶
func DecodeServersOnNetwork(b []byte) (*ServersOnNetwork, error)
DecodeServersOnNetwork decodes given bytes into ServersOnNetwork.
func NewServersOnNetwork ¶
func NewServersOnNetwork(record uint32, serverName, discoveryURI string, serverCap []string) *ServersOnNetwork
NewServersOnNetwork creates a new NewServersOnNetwork.
func (*ServersOnNetwork) DecodeFromBytes ¶
func (s *ServersOnNetwork) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into OPC UA ServersOnNetwork.
func (*ServersOnNetwork) Len ¶
func (s *ServersOnNetwork) Len() int
Len returns the actual length of ServersOnNetwork in int.
func (*ServersOnNetwork) Serialize ¶
func (s *ServersOnNetwork) Serialize() ([]byte, error)
Serialize serializes ServersOnNetwork into bytes.
func (*ServersOnNetwork) SerializeTo ¶
func (s *ServersOnNetwork) SerializeTo(b []byte) error
SerializeTo serializes ServersOnNetwork into bytes.
type ServersOnNetworkArray ¶
type ServersOnNetworkArray struct { ArraySize int32 ServersOnNetworks []*ServersOnNetwork }
ServersOnNetworkArray represents an array of ServersOnNetworks. It does not correspond to a certain type from the specification but makes encoding and decoding easier.
func DecodeServersOnNetworkArray ¶
func DecodeServersOnNetworkArray(b []byte) (*ServersOnNetworkArray, error)
DecodeServersOnNetworkArray decodes given bytes into ServersOnNetworkArray.
func NewServersOnNetworkArray ¶
func NewServersOnNetworkArray(ids []*ServersOnNetwork) *ServersOnNetworkArray
NewServersOnNetworkArray creates a new ServersOnNetworkArray from multiple ServersOnNetworks.
func (*ServersOnNetworkArray) DecodeFromBytes ¶
func (s *ServersOnNetworkArray) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into ServersOnNetworkArray.
func (*ServersOnNetworkArray) Len ¶
func (s *ServersOnNetworkArray) Len() int
Len returns the actual length in int.
func (*ServersOnNetworkArray) Serialize ¶
func (s *ServersOnNetworkArray) Serialize() ([]byte, error)
Serialize serializes ServersOnNetworkArray into bytes.
func (*ServersOnNetworkArray) SerializeTo ¶
func (s *ServersOnNetworkArray) SerializeTo(b []byte) error
SerializeTo serializes ServersOnNetworkArray into bytes.
type String ¶
String represents the String type in OPC UA Specifications. This consists of the four-byte length field and variable length of contents.
func DecodeString ¶
DecodeString decodes given bytes into String.
func (*String) DecodeFromBytes ¶
DecodeFromBytes decodes given bytes into OPC UA String.
func (*String) SerializeTo ¶
SerializeTo serializes String into bytes.
type StringArray ¶
StringArray represents the StringArray.
func DecodeStringArray ¶
func DecodeStringArray(b []byte) (*StringArray, error)
DecodeStringArray decodes given bytes into StringArray.
func NewStringArray ¶
func NewStringArray(strs []string) *StringArray
NewStringArray creates a new StringArray from multiple strings.
func (*StringArray) DecodeFromBytes ¶
func (s *StringArray) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into StringArray. TODO: add validation to avoid crash.
func (*StringArray) Serialize ¶
func (s *StringArray) Serialize() ([]byte, error)
Serialize serializes StringArray into bytes.
func (*StringArray) SerializeTo ¶
func (s *StringArray) SerializeTo(b []byte) error
SerializeTo serializes StringArray into bytes.
type Uint32Array ¶
Uint32Array represents the array of Uint32 type of data.
func DecodeUint32Array ¶
func DecodeUint32Array(b []byte) (*Uint32Array, error)
DecodeUint32Array decodes given bytes into Uint32Array.
func NewUint32Array ¶
func NewUint32Array(vals []uint32) *Uint32Array
NewUint32Array creates a new NewUint32Array from multiple uint32 values.
func (*Uint32Array) DecodeFromBytes ¶
func (u *Uint32Array) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into Uint32Array. TODO: add validation to avoid crash.
func (*Uint32Array) Serialize ¶
func (u *Uint32Array) Serialize() ([]byte, error)
Serialize serializes Uint32Array into bytes.
func (*Uint32Array) SerializeTo ¶
func (u *Uint32Array) SerializeTo(b []byte) error
SerializeTo serializes Uint32Array into bytes.
type UserIdentityToken ¶
type UserIdentityToken interface { ExtensionObjectValue }
UserIdentityToken is an interface to handle all types of UserIdentityToken types as one type.
type UserNameIdentityToken ¶
type UserNameIdentityToken struct { PolicyID *String UserName *String Password *ByteString EncryptionAlgorithm *String }
UserNameIdentityToken is used to pass simple username/password credentials to the Server.
This token shall be encrypted by the Client if required by the SecurityPolicy of the UserTokenPolicy. The Server should specify a SecurityPolicy for the UserTokenPolicy if the SecureChannel has a SecurityPolicy of None and no transport layer encryption is available. If None is specified for the UserTokenPolicy and SecurityPolicy is None then the password only contains the UTF-8 encoded password. The SecurityPolicy of the SecureChannel is used if no SecurityPolicy is specified in the UserTokenPolicy.
If the token is to be encrypted the password shall be converted to a UTF-8 ByteString, encrypted and then serialized as shown in Table 181. The Server shall decrypt the password and verify the ServerNonce.
If the SecurityPolicy is None then the password only contains the UTF-8 encoded password. This configuration should not be used unless the network is encrypted in some other manner such as a VPN. The use of this configuration without network encryption would result in a serious security fault, in that it would cause the appearance of a secure user access, but it would make the password visible in clear text.
Specification: Part4, 7.36.4
func DecodeUserNameIdentityToken ¶
func DecodeUserNameIdentityToken(b []byte) (*UserNameIdentityToken, error)
DecodeUserNameIdentityToken decodes given bytes as UserNameIdentityToken.
func NewUserNameIdentityToken ¶
func NewUserNameIdentityToken(policyID, username string, password []byte, alg string) *UserNameIdentityToken
NewUserNameIdentityToken creates a new UserNameIdentityToken.
func (*UserNameIdentityToken) DecodeFromBytes ¶
func (u *UserNameIdentityToken) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes as UserNameIdentityToken.
func (*UserNameIdentityToken) ID ¶
func (u *UserNameIdentityToken) ID() string
ID returns PolicyID in string.
func (*UserNameIdentityToken) Len ¶
func (u *UserNameIdentityToken) Len() int
Len returns the actual Length of UserNameIdentityToken in int.
func (*UserNameIdentityToken) Serialize ¶
func (u *UserNameIdentityToken) Serialize() ([]byte, error)
Serialize serializes UserNameIdentityToken into bytes.
func (*UserNameIdentityToken) SerializeTo ¶
func (u *UserNameIdentityToken) SerializeTo(b []byte) error
SerializeTo serializes UserNameIdentityToken into bytes.
func (*UserNameIdentityToken) Type ¶
func (u *UserNameIdentityToken) Type() int
Type returns type of token defined in NodeIds.csv in int.
type Variant ¶
type Variant struct { EncodingMask uint8 ArrayLength *int32 Value Data ArrayDimensionsLength *int32 ArrayDimensions []*int32 }
Variant is a union of the built-in types.
Specification: Part 6, 5.2.2.16
func DecodeVariant ¶
DecodeVariant decodes given bytes into Variant.
func (*Variant) DecodeFromBytes ¶
DecodeFromBytes decodes given bytes into Variant.
func (*Variant) SerializeTo ¶
SerializeTo serializes Variant into bytes.
type WriteValue ¶
WriteValue is a set of Node and Attribute to write.
Specification: Part4, 5.10.4.2
func DecodeWriteValue ¶
func DecodeWriteValue(b []byte) (*WriteValue, error)
DecodeWriteValue decodes given bytes into WriteValue.
func NewWriteValue ¶
func NewWriteValue(node *NodeID, attr IntegerID, idxRange string, value *DataValue) *WriteValue
NewWriteValue creates a new NewWriteValue.
func (*WriteValue) DecodeFromBytes ¶
func (w *WriteValue) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into OPC UA WriteValue.
func (*WriteValue) Len ¶
func (w *WriteValue) Len() int
Len returns the actual length of WriteValue in int.
func (*WriteValue) Serialize ¶
func (w *WriteValue) Serialize() ([]byte, error)
Serialize serializes WriteValue into bytes.
func (*WriteValue) SerializeTo ¶
func (w *WriteValue) SerializeTo(b []byte) error
SerializeTo serializes WriteValue into bytes.
type WriteValueArray ¶
type WriteValueArray struct { ArraySize int32 WriteValues []*WriteValue }
WriteValueArray represents an array of WriteValues. It does not correspond to a certain type from the specification but makes encoding and decoding easier.
func DecodeWriteValueArray ¶
func DecodeWriteValueArray(b []byte) (*WriteValueArray, error)
DecodeWriteValueArray decodes given bytes into WriteValueArray.
func NewWriteValueArray ¶
func NewWriteValueArray(ids []*WriteValue) *WriteValueArray
NewWriteValueArray creates a new WriteValueArray from multiple WriteValues.
func (*WriteValueArray) DecodeFromBytes ¶
func (w *WriteValueArray) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes into WriteValueArray.
func (*WriteValueArray) Len ¶
func (w *WriteValueArray) Len() int
Len returns the actual length in int.
func (*WriteValueArray) Serialize ¶
func (w *WriteValueArray) Serialize() ([]byte, error)
Serialize serializes WriteValueArray into bytes.
func (*WriteValueArray) SerializeTo ¶
func (w *WriteValueArray) SerializeTo(b []byte) error
SerializeTo serializes WriteValueArray into bytes.
type X509IdentityToken ¶
X509IdentityToken is used to pass an X.509 v3 Certificate which is issued by the user. This token shall always be accompanied by a Signature in the userTokenSignature parameter of ActivateSession if required by the SecurityPolicy. The Server should specify a SecurityPolicy for the UserTokenPolicy if the SecureChannel has a SecurityPolicy of None.
Specification: Part4, 7.36.5
func DecodeX509IdentityToken ¶
func DecodeX509IdentityToken(b []byte) (*X509IdentityToken, error)
DecodeX509IdentityToken decodes given bytes as X509IdentityToken.
func NewX509IdentityToken ¶
func NewX509IdentityToken(policyID, cert string) *X509IdentityToken
NewX509IdentityToken creates a new X509IdentityToken.
func (*X509IdentityToken) DecodeFromBytes ¶
func (x *X509IdentityToken) DecodeFromBytes(b []byte) error
DecodeFromBytes decodes given bytes as X509IdentityToken.
func (*X509IdentityToken) ID ¶
func (x *X509IdentityToken) ID() string
ID returns PolicyID in string.
func (*X509IdentityToken) Len ¶
func (x *X509IdentityToken) Len() int
Len returns the actual Length of X509IdentityToken in int.
func (*X509IdentityToken) Serialize ¶
func (x *X509IdentityToken) Serialize() ([]byte, error)
Serialize serializes X509IdentityToken into bytes.
func (*X509IdentityToken) SerializeTo ¶
func (x *X509IdentityToken) SerializeTo(b []byte) error
SerializeTo serializes X509IdentityToken into bytes.
func (*X509IdentityToken) Type ¶
func (x *X509IdentityToken) Type() int
Type returns type of token defined in NodeIds.csv in int.