opcua

package
v0.0.0-...-13edf00 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION                       = uint32(0)
	DEFAULT_MAX_CHUNK_COUNT       = 64
	DEFAULT_MAX_MESSAGE_SIZE      = uint32(2097152)
	DEFAULT_RECEIVE_BUFFER_SIZE   = uint32(65535)
	DEFAULT_SEND_BUFFER_SIZE      = uint32(65535)
	REQUEST_TIMEOUT               = 10 * time.Second
	REQUEST_TIMEOUT_LONG          = 10000
	PASSWORD_ENCRYPTION_ALGORITHM = "http://www.w3.org/2001/04/xmlenc#rsa-oaep"
	EPOCH_OFFSET                  = 116444736000000000 //Offset between OPC UA epoch time and linux epoch time.
)

Variables

View Source
var (
	SECURITY_POLICY_NONE = readWriteModel.NewPascalString(utils.ToPtr("http://opcfoundation.org/UA/SecurityPolicy#None"))
	NULL_STRING          = readWriteModel.NewPascalString(nil)
	NULL_BYTE_STRING     = readWriteModel.NewPascalByteString(-1, nil)
	NULL_EXPANDED_NODEID = readWriteModel.NewExpandedNodeId(false,
		false,
		readWriteModel.NewNodeIdTwoByte(0),
		nil,
		nil,
	)
	BINARY_ENCODING_MASK  = readWriteModel.NewExtensionObjectEncodingMask(false, false, true)
	NULL_EXTENSION_OBJECT = readWriteModel.NewNullExtensionObjectWithMask(NULL_EXPANDED_NODEID,
		readWriteModel.NewExtensionObjectEncodingMask(false, false, false),
		0,
		false) // Body

	INET_ADDRESS_PATTERN = regexp.MustCompile(`(.(?P<transportCode>tcp))?://(?P<transportHost>[\w.-]+)(:(?P<transportPort>\d*))?`)

	URI_PATTERN                 = regexp.MustCompile(`^(?P<protocolCode>opc)` + INET_ADDRESS_PATTERN.String() + `(?P<transportEndpoint>[\w/=]*)[?]?`)
	APPLICATION_URI             = readWriteModel.NewPascalString(utils.ToPtr("urn:apache:plc4x:client"))
	PRODUCT_URI                 = readWriteModel.NewPascalString(utils.ToPtr("urn:apache:plc4x:client"))
	APPLICATION_TEXT            = readWriteModel.NewPascalString(utils.ToPtr("OPCUA client for the Apache PLC4X:PLC4J project"))
	DEFAULT_CONNECTION_LIFETIME = uint32(36000000)
)

Functions

func NewDriver

func NewDriver(_options ...options.WithOption) plc4go.PlcDriver

Types

type CertificateKeyPair

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

func NewCertificateKeyPair

func NewCertificateKeyPair(keyPair *rsa.PrivateKey, certificate *x509.Certificate) *CertificateKeyPair

type CommandAndArgumentsCount

type CommandAndArgumentsCount interface {
	fmt.Stringer
	PLC4XEnumName() string
	NumberOfArguments() uint8
}

type Configuration

type Configuration struct {
	Code              string
	Host              string
	Port              string
	Endpoint          string
	TransportEndpoint string
	Params            string
	IsEncrypted       bool
	Thumbprint        readWriteModel.PascalByteString
	SenderCertificate []byte
	Discovery         bool
	Username          string
	Password          string
	SecurityPolicy    string
	KeyStoreFile      string
	CertDirectory     string
	KeyStorePassword  string
	Ckp               *CertificateKeyPair
	// contains filtered or unexported fields
}

func ParseFromOptions

func ParseFromOptions(log zerolog.Logger, options map[string][]string) (Configuration, error)

func (*Configuration) Serialize

func (d *Configuration) Serialize() ([]byte, error)

func (*Configuration) SerializeWithWriteBuffer

func (d *Configuration) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Configuration) String

func (d *Configuration) String() string

type Connection

type Connection struct {
	_default.DefaultConnection
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(messageCodec *MessageCodec, configuration Configuration, driverContext DriverContext, tagHandler spi.PlcTagHandler, connectionOptions map[string][]string, _options ...options.WithOption) *Connection

func (*Connection) Close

func (c *Connection) Close() <-chan plc4go.PlcConnectionCloseResult

func (*Connection) ConnectWithContext

func (c *Connection) ConnectWithContext(ctx context.Context) <-chan plc4go.PlcConnectionConnectResult

func (*Connection) GetConnection

func (c *Connection) GetConnection() plc4go.PlcConnection

func (*Connection) GetConnectionId

func (c *Connection) GetConnectionId() string

func (*Connection) GetMessageCodec

func (c *Connection) GetMessageCodec() spi.MessageCodec

func (*Connection) GetMetadata

func (c *Connection) GetMetadata() apiModel.PlcConnectionMetadata

func (*Connection) GetTracer

func (c *Connection) GetTracer() tracer.Tracer

func (*Connection) IsTraceEnabled

func (c *Connection) IsTraceEnabled() bool

func (*Connection) ReadRequestBuilder

func (c *Connection) ReadRequestBuilder() apiModel.PlcReadRequestBuilder

func (*Connection) Serialize

func (d *Connection) Serialize() ([]byte, error)

func (*Connection) SerializeWithWriteBuffer

func (d *Connection) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Connection) String

func (d *Connection) String() string

func (*Connection) SubscriptionRequestBuilder

func (c *Connection) SubscriptionRequestBuilder() apiModel.PlcSubscriptionRequestBuilder

func (*Connection) UnsubscriptionRequestBuilder

func (c *Connection) UnsubscriptionRequestBuilder() apiModel.PlcUnsubscriptionRequestBuilder

func (*Connection) WriteRequestBuilder

func (c *Connection) WriteRequestBuilder() apiModel.PlcWriteRequestBuilder

type Driver

type Driver struct {
	_default.DefaultDriver
	// contains filtered or unexported fields
}

func (*Driver) GetConnectionWithContext

func (d *Driver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, driverOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult

func (*Driver) SetAwaitDisconnectComplete

func (d *Driver) SetAwaitDisconnectComplete(awaitComplete bool)

func (*Driver) SetAwaitSetupComplete

func (d *Driver) SetAwaitSetupComplete(awaitComplete bool)

type DriverContext

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

func NewDriverContext

func NewDriverContext(configuration Configuration) DriverContext

func (*DriverContext) Serialize

func (d *DriverContext) Serialize() ([]byte, error)

func (*DriverContext) SerializeWithWriteBuffer

func (d *DriverContext) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*DriverContext) String

func (d *DriverContext) String() string

type EncryptionHandler

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

func NewEncryptionHandler

func NewEncryptionHandler(log zerolog.Logger, ckp *CertificateKeyPair, senderCertificate []byte, securityPolicy string) *EncryptionHandler

func (*EncryptionHandler) String

func (h *EncryptionHandler) String() string

type MessageCodec

type MessageCodec struct {
	_default.DefaultCodec
	// contains filtered or unexported fields
}

func NewMessageCodec

func NewMessageCodec(transportInstance transports.TransportInstance, _options ...options.WithOption) *MessageCodec

func (*MessageCodec) Connect

func (m *MessageCodec) Connect() error

func (*MessageCodec) GetCodec

func (m *MessageCodec) GetCodec() spi.MessageCodec

func (*MessageCodec) Receive

func (m *MessageCodec) Receive() (spi.Message, error)

func (*MessageCodec) Send

func (m *MessageCodec) Send(message spi.Message) error

func (*MessageCodec) Serialize

func (d *MessageCodec) Serialize() ([]byte, error)

func (*MessageCodec) SerializeWithWriteBuffer

func (d *MessageCodec) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*MessageCodec) String

func (d *MessageCodec) String() string

type Reader

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

func NewReader

func NewReader(connection *Connection, _options ...options.WithOption) *Reader

func (*Reader) Read

func (m *Reader) Read(ctx context.Context, readRequest apiModel.PlcReadRequest) <-chan apiModel.PlcReadRequestResult

type SecureChannel

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

func NewSecureChannel

func NewSecureChannel(log zerolog.Logger, ctx DriverContext, configuration Configuration) *SecureChannel

func (*SecureChannel) Serialize

func (d *SecureChannel) Serialize() ([]byte, error)

func (*SecureChannel) SerializeWithWriteBuffer

func (d *SecureChannel) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*SecureChannel) String

func (d *SecureChannel) String() string

type SecureChannelTransactionManager

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

func NewSecureChannelTransactionManager

func NewSecureChannelTransactionManager(log zerolog.Logger) *SecureChannelTransactionManager

func (*SecureChannelTransactionManager) Serialize

func (d *SecureChannelTransactionManager) Serialize() ([]byte, error)

func (*SecureChannelTransactionManager) SerializeWithWriteBuffer

func (d *SecureChannelTransactionManager) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*SecureChannelTransactionManager) String

type SecureChannelTransactionManagerTransaction

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

type Subscriber

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

func NewSubscriber

func NewSubscriber(addSubscriber func(subscriber *Subscriber), connection *Connection, _options ...options.WithOption) *Subscriber

func (*Subscriber) Serialize

func (d *Subscriber) Serialize() ([]byte, error)

func (*Subscriber) SerializeWithWriteBuffer

func (d *Subscriber) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Subscriber) String

func (d *Subscriber) String() string

func (*Subscriber) Subscribe

func (*Subscriber) Unregister

func (s *Subscriber) Unregister(registration apiModel.PlcConsumerRegistration)

func (*Subscriber) Unsubscribe

func (s *Subscriber) Unsubscribe(ctx context.Context, unsubscriptionRequest apiModel.PlcUnsubscriptionRequest) <-chan apiModel.PlcUnsubscriptionRequestResult

type SubscriptionHandle

type SubscriptionHandle struct {
	*spiModel.DefaultPlcSubscriptionHandle
	// contains filtered or unexported fields
}

func NewSubscriptionHandle

func NewSubscriptionHandle(log zerolog.Logger, subscriber *Subscriber, connection *Connection, subscriptionRequest apiModel.PlcSubscriptionRequest, subscriptionId uint32, cycleTime time.Duration) *SubscriptionHandle

type Tag

type Tag interface {
	apiModel.PlcTag
	GetIdentifierType() readWriteModel.OpcuaIdentifierType
	GetIdentifier() string
	GetNamespace() int
}

func NewTag

func NewTag(namespace int, identifier string, identifierType readWriteModel.OpcuaIdentifierType, dataType readWriteModel.OpcuaDataType) Tag

type TagHandler

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

func NewTagHandler

func NewTagHandler() TagHandler

func (TagHandler) ParseQuery

func (m TagHandler) ParseQuery(_ string) (apiModel.PlcQuery, error)

func (TagHandler) ParseTag

func (m TagHandler) ParseTag(tagAddress string) (apiModel.PlcTag, error)

type Writer

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

func NewWriter

func NewWriter(connection *Connection, _options ...options.WithOption) *Writer

func (*Writer) Write

func (m *Writer) Write(ctx context.Context, writeRequest apiModel.PlcWriteRequest) <-chan apiModel.PlcWriteRequestResult

func (*Writer) WriteSync

func (m *Writer) WriteSync(ctx context.Context, writeRequest apiModel.PlcWriteRequest, result chan apiModel.PlcWriteRequestResult)

Jump to

Keyboard shortcuts

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