iec61850

package module
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

README

iec61850

License PkgGoDev Go Version Go Report Card

English | 中文

cgo version of IEC 61850 library, reference libiec61850

Version Requirements

This project requires libiec61850 v1.6.1 with the following features enabled:

  • ✅ R-GOOSE (Routable GOOSE over UDP/IP)
  • ✅ R-SMV (Routable Sampled Values over UDP/IP)
  • ✅ SNTP Client (Network time synchronization)

See COMPATIBILITY.md for feature coverage and build instructions.

Overview

iec61850 is an open source (GPL-3.0 license) implementation of the IEC 61850 client and server library that implements the MMS, GOOSE and SV protocols. It can be used to implement IEC 61850 compliant clients and PCs on embedded systems and PCs running Linux, Windows Server application. This project relies on and refers to libiec61850.

Features

The library support the following IEC 61850 protocol features:

  • MMS client/server, GOOSE (IEC 61850-8-1)
  • Sampled Values (SV - IEC 61850-9-2)
  • Support for buffered and unbuffered reports
  • Online report control block configuration
  • GOOSE control block client operations (read/write GoCB configuration)
  • Data access service (get data, set data)
  • Online data model discovery and browsing
  • All data set services (get values, set values, browse)
  • Dynamic data set services (create and delete)
  • Log service
  • MMS file services (browse, get file, set file, delete/rename file)
  • Setting group handling
  • Support for service tracking
  • GOOSE and SV control block handling
  • TLS support

How to use

go get -u github.com/boeboe/iec61850

Building libiec61850 v1.6.1

Before using this library, you must build libiec61850 v1.6.1 with advanced features enabled:

Prerequisites
  • mbedtls (required for R-GOOSE and R-SMV):
    # macOS
    brew install mbedtls
    
    # Ubuntu/Debian
    sudo apt-get install libmbedtls-dev
    
Build Libraries
# Automated build script
./scripts/rebuild_libraries.sh
Verify Installation
go test -v -run TestLibraryVersion
# Expected: Using libiec61850 version: 1.6.1 (with R-GOOSE, R-SMV, SNTP enabled)

License

iec61850 is based on the GPL-3.0 license agreement, and iec61850 relies on some third-party components whose open source agreement is GPL-3.0 and MIT.

Contact

Documentation

Index

Constants

View Source
const (
	GoCBElementGoEna      = 1   // GOCB_ELEMENT_GO_ENA
	GoCBElementGoID       = 2   // GOCB_ELEMENT_GO_ID
	GoCBElementDatSet     = 4   // GOCB_ELEMENT_DATSET
	GoCBElementConfRev    = 8   // GOCB_ELEMENT_CONF_REV
	GoCBElementNdsComm    = 16  // GOCB_ELEMENT_NDS_COMM
	GoCBElementDstAddress = 32  // GOCB_ELEMENT_DST_ADDRESS
	GoCBElementMinTime    = 64  // GOCB_ELEMENT_MIN_TIME
	GoCBElementMaxTime    = 128 // GOCB_ELEMENT_MAX_TIME
	GoCBElementFixedOffs  = 256 // GOCB_ELEMENT_FIXED_OFFS
	GoCBElementAll        = 511 // GOCB_ELEMENT_ALL
)

GOOSE Control Block element masks

View Source
const (
	ActDA  = "%s/%s.SGCB.ActSG"
	EditDA = "%s/%s.SGCB.EditSG"
	CnfDA  = "%s/%s.SGCB.CnfEdit"
)
View Source
const (
	Edition1  uint8 = 0 // IEC 61850 Edition 1
	Edition2  uint8 = 1 // IEC 61850 Edition 2
	Edition21 uint8 = 2 // IEC 61850 Edition 2.1
)

ServerConfig Configuration object to configure IEC 61850 stack features IEC 61850 Edition constants

View Source
const (
	MmsVariableReadOnly  MmsVariableAccessAttribute = 0
	MmsVariableWriteOnly MmsVariableAccessAttribute = 1
	MmsVariableReadWrite MmsVariableAccessAttribute = 2
	// Aliases with MMS_ prefix for compatibility.
	MMS_VARIABLE_READ_ONLY  = MmsVariableReadOnly
	MMS_VARIABLE_WRITE_ONLY = MmsVariableWriteOnly
	MMS_VARIABLE_READ_WRITE = MmsVariableReadWrite
	MMS_ACCESS_READ_WRITE   = MmsVariableReadWrite
	MMS_ACCESS_READ_ONLY    = MmsVariableReadOnly
	MMS_ACCESS_WRITE_ONLY   = MmsVariableWriteOnly
)
View Source
const (
	MmsFileAccessNone MmsFileAccessAttribute = 0
	MmsFileRead       MmsFileAccessAttribute = 1
	MmsFileWrite      MmsFileAccessAttribute = 2
	MmsFileDelete     MmsFileAccessAttribute = 4
	// Aliases with MMS_ prefix for compatibility.
	MMS_FILE_ACCESS_NONE = MmsFileAccessNone
	MMS_FILE_READ        = MmsFileRead
	MMS_FILE_WRITE       = MmsFileWrite
	MMS_FILE_DELETE      = MmsFileDelete
)
View Source
const (
	MmsJournalVariableTag     MmsJournalVariable = 0
	MmsJournalVariableEntryID MmsJournalVariable = 1
	// Aliases with MMS_ prefix for compatibility.
	MMS_JOURNAL_VARIABLE_TAG      = MmsJournalVariableTag
	MMS_JOURNAL_VARIABLE_ENTRY_ID = MmsJournalVariableEntryID
)
View Source
const (
	MmsDeletableNone           MmsDeletableType = 0
	MmsDeletableAASpecific     MmsDeletableType = 1
	MmsDeletableDomainSpecific MmsDeletableType = 2
	MmsDeletableVMDSpecific    MmsDeletableType = 3
	// Aliases with MMS_ prefix for compatibility.
	MMS_DELETABLE_NONE            = MmsDeletableNone
	MMS_DELETABLE_AA_SPECIFIC     = MmsDeletableAASpecific
	MMS_DELETABLE_DOMAIN_SPECIFIC = MmsDeletableDomainSpecific
	MMS_DELETABLE_VMD_SPECIFIC    = MmsDeletableVMDSpecific
)
View Source
const (
	MMS_DELETABLE_NOT    = MmsDeletableNone
	MMS_DELETABLE_AA     = MmsDeletableAASpecific
	MMS_DELETABLE_DOMAIN = MmsDeletableDomainSpecific
	MMS_DELETABLE_VMD    = MmsDeletableVMDSpecific
)
View Source
const (
	NamedVariableListTypeVMDSpecific              MmsNamedVariableListType = 0
	NamedVariableListTypeDomainSpecific           MmsNamedVariableListType = 1
	NamedVariableListTypeAssociationSpecific      MmsNamedVariableListType = 2
	NAMED_VARIABLE_LIST_TYPE_VMD_SPECIFIC                                  = NamedVariableListTypeVMDSpecific
	NAMED_VARIABLE_LIST_TYPE_DOMAIN_SPECIFIC                               = NamedVariableListTypeDomainSpecific
	NAMED_VARIABLE_LIST_TYPE_ASSOCIATION_SPECIFIC                          = NamedVariableListTypeAssociationSpecific
)
View Source
const (
	MmsServerStateIdle       MmsServerState = 0
	MmsServerStateLoading    MmsServerState = 1
	MmsServerStateRunning    MmsServerState = 2
	MMS_SERVER_STATE_IDLE                   = MmsServerStateIdle
	MMS_SERVER_STATE_LOADING                = MmsServerStateLoading
	MMS_SERVER_STATE_RUNNING                = MmsServerStateRunning
)
View Source
const (
	MmsServerConnectionStateIdle        MmsServerConnectionState = 0
	MmsServerConnectionStateAssociation MmsServerConnectionState = 1
	MmsServerConnectionStateConcluded   MmsServerConnectionState = 2
	MMS_CON_STATE_IDLE                                           = MmsServerConnectionStateIdle
	MMS_CON_STATE_ASSOCIATION                                    = MmsServerConnectionStateAssociation
	MMS_CON_STATE_CONCLUDED                                      = MmsServerConnectionStateConcluded
)
View Source
const (
	MmsServiceStatus                               MmsServiceSupportedBitmap = 0x0001
	MmsServiceGetNameList                          MmsServiceSupportedBitmap = 0x0002
	MmsServiceIdentify                             MmsServiceSupportedBitmap = 0x0004
	MmsServiceRead                                 MmsServiceSupportedBitmap = 0x0008
	MmsServiceWrite                                MmsServiceSupportedBitmap = 0x0010
	MmsServiceGetVariableAccess                    MmsServiceSupportedBitmap = 0x0020
	MmsServiceDefineNamedVariableList              MmsServiceSupportedBitmap = 0x0040
	MmsServiceGetNamedVariableListAttrs            MmsServiceSupportedBitmap = 0x0080
	MmsServiceDeleteNamedVariableList              MmsServiceSupportedBitmap = 0x0100
	MmsServiceFileOpen                             MmsServiceSupportedBitmap = 0x0200
	MmsServiceFileRead                             MmsServiceSupportedBitmap = 0x0400
	MmsServiceFileClose                            MmsServiceSupportedBitmap = 0x0800
	MmsServiceFileDelete                           MmsServiceSupportedBitmap = 0x1000
	MmsServiceFileDirectory                        MmsServiceSupportedBitmap = 0x2000
	MmsServiceJournalRead                          MmsServiceSupportedBitmap = 0x4000
	MMS_SERVICE_STATUS                                                       = MmsServiceStatus
	MMS_SERVICE_GET_NAME_LIST                                                = MmsServiceGetNameList
	MMS_SERVICE_IDENTIFY                                                     = MmsServiceIdentify
	MMS_SERVICE_READ                                                         = MmsServiceRead
	MMS_SERVICE_WRITE                                                        = MmsServiceWrite
	MMS_SERVICE_GET_VARIABLE_ACCESS                                          = MmsServiceGetVariableAccess
	MMS_SERVICE_DEFINE_NAMED_VARIABLE_LIST                                   = MmsServiceDefineNamedVariableList
	MMS_SERVICE_GET_NAMED_VARIABLE_LIST_ATTRIBUTES                           = MmsServiceGetNamedVariableListAttrs
	MMS_SERVICE_DELETE_NAMED_VARIABLE_LIST                                   = MmsServiceDeleteNamedVariableList
	MMS_SERVICE_FILE_OPEN                                                    = MmsServiceFileOpen
	MMS_SERVICE_FILE_READ                                                    = MmsServiceFileRead
	MMS_SERVICE_FILE_CLOSE                                                   = MmsServiceFileClose
	MMS_SERVICE_FILE_DELETE                                                  = MmsServiceFileDelete
	MMS_SERVICE_FILE_DIRECTORY                                               = MmsServiceFileDirectory
	MMS_SERVICE_JOURNAL_READ                                                 = MmsServiceJournalRead
)

Variables

View Source
var (
	NotConnected                      = errors.New("the service request can not be executed because the client is not yet connected")
	AlreadyConnected                  = errors.New("connect service not execute because the client is already connected")
	ConnectionLost                    = errors.New("the service request can not be executed caused by a loss of connection")
	ServiceNotSupported               = errors.New("the service or some given parameters are not supported by the client stack or by the server")
	ConnectionRejected                = errors.New("connection rejected by server")
	OutstandingCallLimitReached       = errors.New("cannot send request because outstanding call limit is reached")
	UserProvidedInvalidArgument       = errors.New("API function has been called with an invalid argument")
	EnableReportFailedDatasetMismatch = errors.New("API function has been called with an invalid argument")
	ObjectReferenceInvalid            = errors.New("the object provided object reference is invalid (there is a syntactical error)")
	UnexpectedValueReceived           = errors.New("received object is of unexpected type")
	Timeout                           = errors.New("the communication to the server failed with a timeout")
	AccessDenied                      = errors.New("the server rejected the access to the requested object/service due to access control")
	ObjectDoesNotExist                = errors.New("the server reported that the requested object does not exist (returned by server)")
	ObjectExists                      = errors.New("the server reported that the requested object already exists")
	ObjectAccessUnsupported           = errors.New("the server does not support the requested access method (returned by server)")
	TypeInconsistent                  = errors.New("the server expected an object of another type (returned by server)")
	TemporarilyUnavailable            = errors.New("the object or service is temporarily unavailable (returned by server)")
	ObjectUndefined                   = errors.New("the specified object is not defined in the server (returned by server)")
	InvalidAddress                    = errors.New("the specified address is invalid (returned by server)")
	HardwareFault                     = errors.New("service failed due to a hardware fault (returned by server)")
	TypeUnsupported                   = errors.New("the requested data type is not supported by the server (returned by server)")
	ObjectAttributeInconsistent       = errors.New("the provided attributes are inconsistent (returned by server)")
	ObjectValueInvalid                = errors.New("the provided object value is invalid (returned by server)")
	ObjectInvalidated                 = errors.New("the object is invalidated (returned by server)")
	MalformedMessage                  = errors.New("received an invalid response message from the server")
	ServiceNotImplemented             = errors.New("service not implemented")
	Unknown                           = errors.New("unknown error")
	StructureMustBeMmsValue           = errors.New("structure type must be MmsValue array")
	CreateControlObjectClientFail     = errors.New("control object not found in server")
	ControlObjectFail                 = errors.New("control object fail")
	ControlSelectFail                 = errors.New("select control fail")
	UnSupportedOperation              = errors.New("unsupported operation")
	ReadDataAccessError               = errors.New("data access error")
	NullPointer                       = errors.New("null pointer returned from C function")
)
View Source
var (
	ErrCreateGoosePublisher = errors.New("can not create goose publisher")
	ErrSendGooseValue       = errors.New("can not send goose value")
)

Functions

func C2GoBool

func C2GoBool(i C.int) bool

func C2GoStr

func C2GoStr(str *C.char) string

func GetIedClientError

func GetIedClientError(err C.IedClientError) error

func GetLibraryVersion added in v1.1.0

func GetLibraryVersion() string

GetLibraryVersion returns the version string of the underlying libiec61850 C library

func GetMmsError added in v1.1.1

func GetMmsError(err C.MmsError) error

GetMmsError maps a C MmsError to a Go error. Used by low-level MMS client APIs.

func Go2CBool

func Go2CBool(b bool) C.int

func Go2CStr

func Go2CStr(str string) *C.char

func IsBitSet

func IsBitSet(val int, pos int) bool

func MmsValueDelete added in v1.1.1

func MmsValueDelete(r *MmsValueRef)

MmsValueDelete frees a C MmsValue. It is used when the caller has received a raw value from the C API (e.g. from Read) and must release it.

Types

type ACSIClass added in v1.0.9

type ACSIClass int

ACSIClass represents the ACSI class type for filtering logical node elements

const (
	ACSIClassDataObject ACSIClass = 0
	ACSIClassDataSet    ACSIClass = 1
	ACSIClassBRCB       ACSIClass = 2 // Buffered Report Control Block
	ACSIClassURCB       ACSIClass = 3 // Unbuffered Report Control Block
	ACSIClassLCB        ACSIClass = 4 // Log Control Block
	ACSIClassLog        ACSIClass = 5
	ACSIClassSGCB       ACSIClass = 6  // Setting Group Control Block
	ACSIClassGoCB       ACSIClass = 7  // GOOSE Control Block
	ACSIClassGsCB       ACSIClass = 8  // GSSE Control Block
	ACSIClassMSVCB      ACSIClass = 9  // Multicast Sampled Value Control Block
	ACSIClassUSVCB      ACSIClass = 10 // Unicast Sampled Value Control Block
)

type AccessPolicy added in v1.1.1

type AccessPolicy int

AccessPolicy is the default write access policy for an FC (allow or deny).

const (
	AccessPolicyAllow AccessPolicy = 0
	AccessPolicyDeny  AccessPolicy = 1
)

type AcseAuthenticationMechanism

type AcseAuthenticationMechanism int
const (
	// ACSE_AUTH_NONE Neither ACSE nor TLS authentication used
	ACSE_AUTH_NONE AcseAuthenticationMechanism = iota

	// ACSE_AUTH_PASSWORD Use ACSE password for client authentication
	ACSE_AUTH_PASSWORD

	// ACSE_AUTH_CERTIFICATE Use ACSE certificate for client authentication
	ACSE_AUTH_CERTIFICATE

	// ACSE_AUTH_TLS Use TLS certificate for client authentication
	ACSE_AUTH_TLS
)

type AcseAuthenticationParameter

type AcseAuthenticationParameter struct {
	Mechanism   AcseAuthenticationMechanism
	Password    []byte // for mechanism = ACSE_AUTH_PASSWORD
	Certificate []byte // for mechanism = ACSE_AUTH_CERTIFICATE or ACSE_AUTH_TLS
}

type BRReport

type BRReport struct {
	Data string
}

type Client

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

func NewClient

func NewClient(settings Settings) (*Client, error)

NewClient 创建客户端实例

func NewClientWithDefaultSettings

func NewClientWithDefaultSettings() (*Client, error)

func NewClientWithTlsSupport

func NewClientWithTlsSupport(settings Settings, tlsConfig *TLSConfig) (*Client, error)

func NewClientWithoutConnect added in v1.1.1

func NewClientWithoutConnect(settings Settings) (*Client, error)

NewClientWithoutConnect creates a client and its underlying connection but does not connect. Use ConnectAsync or ConnectWithAuth to connect later. Close() must be called when done if never connected.

func NewClientWithoutConnectWithTls added in v1.1.1

func NewClientWithoutConnectWithTls(settings Settings, tlsConfig *TLSConfig) (*Client, error)

NewClientWithoutConnectWithTls is like NewClientWithoutConnect but with TLS configuration.

func (*Client) Close

func (c *Client) Close()

Close 关闭连接

func (*Client) ConnectAsync added in v1.1.1

func (c *Client) ConnectAsync(hostname string, port int, callback func(error))

ConnectAsync starts a non-blocking connection attempt. The callback is invoked when the connection is established (with nil) or when it fails or is closed (with an error). The client must have been created with NewClientWithoutConnect or NewClientWithoutConnectWithTls.

func (*Client) ConnectWithAuth added in v1.1.1

func (c *Client) ConnectWithAuth(hostname string, port int, username, password string) error

ConnectWithAuth connects to the server using ACSE password authentication. The client must have been created with NewClientWithoutConnect or NewClientWithoutConnectWithTls. Username is not used by the ACSE password mechanism; only password is sent.

func (*Client) ControlByControlModel

func (c *Client) ControlByControlModel(objectRef string, controlModel ControlModel, param *ControlObjectParam) error

func (*Client) ControlByControlModelAPC

func (c *Client) ControlByControlModelAPC(objectRef string, controlModel ControlModel, param *ControlObjectParamAPC) error

func (*Client) ControlByControlModelINC

func (c *Client) ControlByControlModelINC(objectRef string, controlModel ControlModel, param *ControlObjectParamINC) error

func (*Client) ControlForDirectWithEnhancedSecurity

func (c *Client) ControlForDirectWithEnhancedSecurity(objectRef string, value bool) error

ControlForDirectWithEnhancedSecurity 控制模式 3[direct-with-enhanced-security]

func (*Client) ControlForDirectWithNormalSecurity

func (c *Client) ControlForDirectWithNormalSecurity(objectRef string, ctlVal bool) error

ControlForDirectWithNormalSecurity 控制模式 1[direct-with-normal-security]

func (*Client) ControlForSboWithEnhancedSecurity

func (c *Client) ControlForSboWithEnhancedSecurity(objectRef string, value bool) error

ControlForSboWithEnhancedSecurity 控制模式 4[sbo-with-enhanced-security]

func (*Client) ControlForSboWithNormalSecurity

func (c *Client) ControlForSboWithNormalSecurity(objectRef string, value bool) error

ControlForSboWithNormalSecurity 控制模式 2[sbo-with-normal-security]

func (*Client) DefineNamedVariableList added in v1.1.1

func (c *Client) DefineNamedVariableList(domainID, listName string, variableSpecs []VariableAccessSpec) error

DefineNamedVariableList defines a new domain or VMD scoped named variable list. Pass domainID as "" for VMD scope.

func (*Client) DefineNamedVariableListAssociationSpecific added in v1.1.1

func (c *Client) DefineNamedVariableListAssociationSpecific(listName string, variableSpecs []VariableAccessSpec) error

DefineNamedVariableListAssociationSpecific defines a new association-specific named variable list.

func (*Client) DeleteAssociationSpecificNamedVariableList added in v1.1.1

func (c *Client) DeleteAssociationSpecificNamedVariableList(listName string) (bool, error)

DeleteAssociationSpecificNamedVariableList deletes an association-specific named variable list.

func (*Client) DeleteNamedVariableList added in v1.1.1

func (c *Client) DeleteNamedVariableList(domainID, listName string) (bool, error)

DeleteNamedVariableList deletes a domain or VMD scoped named variable list. Pass domainID as "" for VMD scope.

func (*Client) GetConnectionParameters added in v1.1.1

func (c *Client) GetConnectionParameters() (*MmsConnectionParameters, error)

GetConnectionParameters returns the MMS connection parameters (max outstanding calls, PDU size, etc.). The client must have an established connection (conn may be set; parameters are updated after connect).

func (*Client) GetDAs

func (c *Client) GetDAs(doRef string, das []DA)

func (*Client) GetDataDirectory

func (c *Client) GetDataDirectory(dataRef string) ([]string, error)

GetDataDirectory returns the directory of the given data object (DO) or data attribute. Returns list of all data attributes or sub data objects as simple name strings.

This function implements the GetDataDirectory ACSI service.

Example:

names, err := client.GetDataDirectory("myLD/myLN.myDO")
// Returns: ["mag", "q", "t", "subVal"]

func (*Client) GetDataDirectoryByFC

func (c *Client) GetDataDirectoryByFC(dataRef string, fc FC) ([]string, error)

GetDataDirectoryByFC returns the directory filtered by specific functional constraint. More precise than trying multiple FCs - only returns attributes/objects with the given FC.

Example:

names, err := client.GetDataDirectoryByFC("myLD/myLN.myDO", FC_MX)
// Returns only measurement attributes: ["mag", "q", "t"]

func (*Client) GetDataDirectoryWithFC

func (c *Client) GetDataDirectoryWithFC(dataRef string) ([]DirectoryEntry, error)

GetDataDirectoryWithFC returns the directory of the given data object with FC annotations. Returns list of data attributes or sub data objects with functional constraint appended in square brackets (e.g., "mag[MX]", "stVal[ST]", "q[MX]").

This solves the enumeration problem for determining which FC to use when reading values!

Example:

entries, err := client.GetDataDirectoryWithFC("myLD/myLN.myDO")
// Returns: ["mag[MX]", "q[MX]", "t[MX]", "stVal[ST]"]

func (*Client) GetDataSetDirectory added in v1.0.9

func (c *Client) GetDataSetDirectory(dataSetRef string) (*DataSetInfo, error)

GetDataSetDirectory returns the members of a dataset with deletable information. Returns the list of data object references (FCDs/FCDAs) that make up the dataset.

The returned member references use the format: LDName/LNodeName.item[FC]

Example:

info, err := client.GetDataSetDirectory("myLD/LLN0.Events")
// info.Members: ["myLD/GGIO1.Ind.stVal[ST]", "myLD/GGIO1.Ind.q[ST]", "myLD/GGIO1.Ind.t[ST]"]
// info.IsDeletable: false (pre-configured) or true (dynamic)

func (*Client) GetDomainNames added in v1.1.1

func (c *Client) GetDomainNames() ([]string, error)

GetDomainNames returns the list of MMS domain names on the server.

func (*Client) GetDomainVariableListNames added in v1.1.1

func (c *Client) GetDomainVariableListNames(domainID string) ([]string, error)

GetDomainVariableListNames returns the names of named variable lists in a domain, or VMD scope if domainID is "".

func (*Client) GetDomainVariableNames added in v1.1.1

func (c *Client) GetDomainVariableNames(domainID string) ([]string, error)

GetDomainVariableNames returns the names of variables in an MMS domain.

func (*Client) GetFile added in v1.0.10

func (c *Client) GetFile(fileName string) ([]byte, error)

GetFile retrieves a file from the server

func (*Client) GetFileDirectory

func (c *Client) GetFileDirectory() ([]string, error)

GetFileDirectory returns the list of available files on the server

func (*Client) GetFileDirectoryEx added in v1.0.10

func (c *Client) GetFileDirectoryEx(directoryName, continueAfter string) ([]FileDirectoryEntry, bool, error)

GetFileDirectoryEx retrieves detailed file directory information from the server

func (*Client) GetFileDirectoryExEntries added in v1.1.1

func (c *Client) GetFileDirectoryExEntries(directoryName, continueAfter string) ([]MmsFileDirectoryEntryEx, bool, error)

GetFileDirectoryExEntries returns the file directory as a slice of MmsFileDirectoryEntryEx (Filename, FileSize, LastModifiedTime, FileAttributes). FileAttributes may be 0 if the server does not provide them.

func (*Client) GetGoCBValues added in v1.1.0

func (c *Client) GetGoCBValues(goCBReference string) (*ClientGooseControlBlockValues, error)

GetGoCBValues reads the GOOSE control block values from the server

Parameters:

  • goCBReference: IEC 61850-7-2 ACSI object reference (e.g., "simpleIOGenericIO/LLN0.gcbEvents")

Returns:

  • ClientGooseControlBlockValues containing the current GoCB values
  • error if the operation fails

func (*Client) GetGoCBValuesAsync added in v1.1.3

func (c *Client) GetGoCBValuesAsync(goCBReference string, callback func(*ClientGooseControlBlockValues, error)) (uint32, error)

GetGoCBValuesAsync reads the GOOSE control block values from the server asynchronously. The callback is invoked with the values and nil error on success, or nil and error on failure. Returns the invoke ID (for cancellation/tracking) and an error if the request could not be started.

func (*Client) GetLastApplError added in v1.0.10

func (c *Client) GetLastApplError() LastApplError

GetLastApplError returns the last application error received

func (*Client) GetLogicalDeviceDataSets

func (c *Client) GetLogicalDeviceDataSets(ldName string) ([]string, error)

GetLogicalDeviceDataSets returns all data set names in a logical device. Returns MMS notation (e.g., "LLN0$dataset1").

func (*Client) GetLogicalDeviceDirectory added in v1.0.9

func (c *Client) GetLogicalDeviceDirectory(ldName string) ([]string, error)

GetLogicalDeviceDirectory returns the directory of logical nodes in a logical device. This directly calls IedConnection_getLogicalDeviceDirectory() to get the list of logical nodes without triggering verbose "Data set: xxx (not deletable)" output.

Example:

lnNames, err := client.GetLogicalDeviceDirectory("myLD")
// Returns: ["LLN0", "GGIO1", "MMXU1", ...]

func (*Client) GetLogicalDeviceList

func (c *Client) GetLogicalDeviceList() DataModel

func (*Client) GetLogicalDeviceNames

func (c *Client) GetLogicalDeviceNames() ([]string, error)

GetLogicalDeviceNames is a convenience wrapper around GetServerDirectory that returns logical device names. This is the recommended replacement for the deprecated GetLogicalDeviceList() function.

func (*Client) GetLogicalDeviceVariables

func (c *Client) GetLogicalDeviceVariables(ldName string) ([]string, error)

GetLogicalDeviceVariables returns all MMS variables in a logical device. Returns MMS notation (e.g., "GGIO1$ST$Ind1$stVal") and includes control blocks.

Useful for getting a complete picture of all variables in an LD.

func (*Client) GetLogicalNodeDirectory added in v1.0.9

func (c *Client) GetLogicalNodeDirectory(lnRef string, acsiClass ACSIClass) ([]string, error)

GetLogicalNodeDirectory returns elements of a logical node filtered by ACSI class. This allows retrieving specific types of elements (data objects, datasets, control blocks).

ACSI Classes:

  • ACSIClassDataObject: Data objects (DO)
  • ACSIClassDataSet: Data sets
  • ACSIClassBRCB: Buffered report control blocks
  • ACSIClassURCB: Unbuffered report control blocks
  • ACSIClassGoCB: GOOSE control blocks
  • ACSIClassSGCB: Setting group control blocks
  • etc.

Example:

dataObjects, err := client.GetLogicalNodeDirectory("myLD/GGIO1", ACSIClassDataObject)
// Returns: ["Ind", "SPCSO1", "Mod", "Beh", "Health"]

dataSets, err := client.GetLogicalNodeDirectory("myLD/LLN0", ACSIClassDataSet)
// Returns: ["Events", "Measurements"]

func (*Client) GetLogicalNodeVariables

func (c *Client) GetLogicalNodeVariables(lnRef string) ([]string, error)

GetLogicalNodeVariables returns all MMS variables that are children of the given logical node. Returns raw MMS notation (e.g., "GGIO1$ST$Ind1$stVal") including control block variables.

This is useful for complete enumeration but returns MMS paths, not IEC 61850 references.

func (*Client) GetRCBValues

func (c *Client) GetRCBValues(objectReference string) (*ClientReportControlBlock, error)

func (*Client) GetRequestTimeout added in v1.0.10

func (c *Client) GetRequestTimeout() uint32

GetRequestTimeout returns the current request timeout in milliseconds

func (*Client) GetSG

func (c *Client) GetSG(objectRef string) (*SettingGroup, error)

GetSG 获取SettingGroup

func (*Client) GetServerDirectory

func (c *Client) GetServerDirectory(getFileNames bool) ([]string, error)

GetServerDirectory returns list of Logical Devices or files from the server. This is the modern, recommended API that replaces GetLogicalDeviceList().

When getFileNames is false: Returns list of Logical Device names (clean, no verbose output) When getFileNames is true: Returns list of available files on the server

This function uses the GetServerDirectory ACSI service and does not trigger verbose "Data set: xxx (not deletable)" output like the deprecated IedConnection_getLogicalDeviceList does.

func (*Client) GetServerFileDirectory added in v1.0.10

func (c *Client) GetServerFileDirectory(directoryName string) ([]string, error)

GetServerFileDirectory retrieves the file directory from the server

func (*Client) GetServerStatus added in v1.1.1

func (c *Client) GetServerStatus(extendedDerivation bool) (*MmsServerStatus, error)

GetServerStatus returns the MMS server status (VMD logical and physical status). extendedDerivation instructs the server to run self-diagnosis to determine status.

func (*Client) GetState added in v1.0.10

func (c *Client) GetState() IedConnectionState

GetState returns the current connection state

func (*Client) GetVariableAccessAttributes added in v1.1.1

func (c *Client) GetVariableAccessAttributes(domainID, itemID string) (*MmsVariableSpecificationRef, error)

GetVariableAccessAttributes returns the MMS variable access attributes (type specification) for a named variable. The caller must call Free() on the returned ref when done.

func (*Client) GetVariableListNamesAssociationSpecific added in v1.1.1

func (c *Client) GetVariableListNamesAssociationSpecific() ([]string, error)

GetVariableListNamesAssociationSpecific returns the names of association-specific named variable lists.

func (*Client) GetVariableSpecType

func (c *Client) GetVariableSpecType(objectReference string, fc FC) (MmsType, error)

GetVariableSpecType 获取类型规格

func (*Client) GetVariableSpecification

func (c *Client) GetVariableSpecification(dataAttrRef string, fc FC) (*VariableSpec, error)

GetVariableSpecification returns detailed MMS variable specification for a data attribute. This allows you to determine the exact type (float32/float64/int32, etc.) BEFORE reading, eliminating guesswork in generic client implementations.

Example:

spec, err := client.GetVariableSpecification("myLD/myLN.myDO.mag.f", FC_MX)
if spec.Type == Float {
    // Now you know it's a float and can read it appropriately
}

func (*Client) Identify added in v1.1.1

func (c *Client) Identify() (*MmsServerIdentity, error)

Identify returns the server identity (vendor name, model name, revision) via the MMS identify service.

func (*Client) InstallReportHandler

func (c *Client) InstallReportHandler(objectReference string, function ReportCallbackFunction) error

func (*Client) ObtainFile added in v1.1.1

func (c *Client) ObtainFile(sourceFile, destinationFile string) error

ObtainFile sends an obtainFile request: the server will read the file from the client. sourceFile is the local (client) path, destinationFile is the remote (server) path. This is the same as uploading a file to the server (MMS obtainFile service).

func (*Client) Read

func (c *Client) Read(objectRef string, fc FC) (interface{}, error)

Read 读取属性数据

func (*Client) ReadBitString added in v1.0.10

func (c *Client) ReadBitString(objectRef string, fc FC) ([]byte, error)

ReadBitString reads a bit string value

func (*Client) ReadBool

func (c *Client) ReadBool(objectRef string, fc FC) (bool, error)

ReadBool 读取bool类型值

func (*Client) ReadDataSet

func (c *Client) ReadDataSet(objectRef string) ([]*MmsValue, error)

ReadDataSet 读取DataSet

func (*Client) ReadDataSetValues added in v1.1.3

func (c *Client) ReadDataSetValues(dataSetReference string) (*ClientDataSet, error)

ReadDataSetValues reads the data set values from the server. dataSetReference is the object reference (e.g. "LD/LN.dsName" or "@asName"). Pass nil for existing to create a new container; pass an existing *ClientDataSet to update it in place.

func (*Client) ReadFloat

func (c *Client) ReadFloat(objectRef string, fc FC) (float32, error)

ReadFloat 读取float类型值

func (*Client) ReadInt8 added in v1.0.10

func (c *Client) ReadInt8(objectRef string, fc FC) (int8, error)

ReadInt8 reads an int8 value

func (*Client) ReadInt16 added in v1.0.10

func (c *Client) ReadInt16(objectRef string, fc FC) (int16, error)

ReadInt16 reads an int16 value

func (*Client) ReadInt32

func (c *Client) ReadInt32(objectRef string, fc FC) (int32, error)

ReadInt32 读取int32类型值

func (*Client) ReadInt64

func (c *Client) ReadInt64(objectRef string, fc FC) (int64, error)

ReadInt64 读取int64类型值

func (*Client) ReadJournalStartAfter added in v1.1.1

func (c *Client) ReadJournalStartAfter(domainID, itemID string, timeSpecificationMs uint64, entrySpecification []byte) (entries []JournalEntry, moreFollows bool, err error)

ReadJournalStartAfter reads journal entries starting after the given time and entry specification. timeSpecification and entrySpecification are MMS binary time and octet string respectively; pass nil for entrySpecification to start from the time.

func (*Client) ReadJournalTimeRange added in v1.1.1

func (c *Client) ReadJournalTimeRange(domainID, itemID string, startTimeMs, endTimeMs uint64) (entries []JournalEntry, moreFollows bool, err error)

ReadJournalTimeRange reads journal entries in the given time range. startTimeMs and endTimeMs are milliseconds since Unix epoch (binary time). The caller does not own the returned entries.

func (*Client) ReadNamedVariableListDirectory added in v1.1.1

func (c *Client) ReadNamedVariableListDirectory(domainID, listName string) (entries []VariableListEntry, deletable bool, err error)

ReadNamedVariableListDirectory returns the directory (list of variable references) and whether the list is deletable.

func (*Client) ReadNamedVariableListDirectoryAssociationSpecific added in v1.1.1

func (c *Client) ReadNamedVariableListDirectoryAssociationSpecific(listName string) (entries []VariableListEntry, deletable bool, err error)

ReadNamedVariableListDirectoryAssociationSpecific returns the directory for an association-specific list.

func (*Client) ReadNamedVariableListValues added in v1.1.1

func (c *Client) ReadNamedVariableListValues(domainID, listName string, specWithResult bool) ([]*MmsValue, error)

ReadNamedVariableListValues reads all values from a domain or VMD scoped named variable list. Pass domainID as "" for VMD scope. specWithResult should be true for IEC 61850 compliant requests. The returned slice contains one MmsValue per list entry; the caller does not own the underlying C memory (it is freed by the library after the call returns), so values are converted to Go types.

func (*Client) ReadNamedVariableListValuesAssociationSpecific added in v1.1.1

func (c *Client) ReadNamedVariableListValuesAssociationSpecific(listName string, specWithResult bool) ([]*MmsValue, error)

ReadNamedVariableListValuesAssociationSpecific reads values from an association-specific named variable list.

func (*Client) ReadOctetString added in v1.0.10

func (c *Client) ReadOctetString(objectRef string, fc FC) ([]byte, error)

ReadOctetString reads an octet string (binary data) value

func (*Client) ReadQualityValue added in v1.0.10

func (c *Client) ReadQualityValue(objectRef string, fc FC) (Quality, error)

ReadQualityValue reads quality flags

func (*Client) ReadString

func (c *Client) ReadString(objectRef string, fc FC) (string, error)

ReadString 读取string类型值

func (*Client) ReadTimestampValue added in v1.0.10

func (c *Client) ReadTimestampValue(objectRef string, fc FC) (*Timestamp, error)

ReadTimestampValue reads a timestamp value with quality information

func (*Client) ReadUint8 added in v1.0.10

func (c *Client) ReadUint8(objectRef string, fc FC) (uint8, error)

ReadUint8 reads a uint8 value

func (*Client) ReadUint16 added in v1.0.10

func (c *Client) ReadUint16(objectRef string, fc FC) (uint16, error)

ReadUint16 reads a uint16 value

func (*Client) ReadUint32

func (c *Client) ReadUint32(objectRef string, fc FC) (uint32, error)

ReadUint32 读取uint32类型值

func (*Client) ReadVisibleString added in v1.0.10

func (c *Client) ReadVisibleString(objectRef string, fc FC) (string, error)

ReadVisibleString reads a visible string value (same as ReadString)

func (*Client) RenameFile added in v1.1.1

func (c *Client) RenameFile(currentName, newName string) error

RenameFile renames a file on the server (currentName -> newName).

func (*Client) SetGoCBValues added in v1.1.0

func (c *Client) SetGoCBValues(goCBReference string, values *ClientGooseControlBlockValues, parametersMask uint32, singleRequest bool) error

SetGoCBValues writes GOOSE control block values to the server

Parameters:

  • goCBReference: IEC 61850-7-2 ACSI object reference (e.g., "simpleIOGenericIO/LLN0.gcbEvents")
  • values: The GoCB values to write
  • parametersMask: Bitmask specifying which parameters to write (use GoCBElement* constants)
  • singleRequest: If true, use single MMS write request; if false, use multiple requests

Returns:

  • error if the operation fails

Note: Only GoEna, GoID, DatSet, and DstAddress are typically writable on most servers. Other attributes are usually read-only.

func (*Client) SetGoCBValuesAsync added in v1.1.3

func (c *Client) SetGoCBValuesAsync(goCBReference string, values *ClientGooseControlBlockValues, parametersMask uint32, singleRequest bool, callback func(error)) (uint32, error)

SetGoCBValuesAsync writes GOOSE control block values to the server asynchronously. The callback is invoked with nil on success or an error on failure. Returns the invoke ID and an error if the request could not be started.

func (*Client) SetNamedVariableListValues added in v1.1.1

func (c *Client) SetNamedVariableListValues(domainID, listName string, values []*MmsValueRef) ([]MmsDataAccessError, error)

SetNamedVariableListValues is an alias for WriteNamedVariableList: writes values to a domain or VMD scoped named variable list.

func (*Client) SetRCBValues

func (c *Client) SetRCBValues(objectReference string, settings ClientReportControlBlock) error

func (*Client) TriggerGIReport

func (c *Client) TriggerGIReport(objectReference string) error

func (*Client) UninstallReportHandler

func (c *Client) UninstallReportHandler(objectReference string)

func (*Client) Write

func (c *Client) Write(objectRef string, fc FC, value interface{}) error

Write 写单个属性值,不支持Structure

func (*Client) WriteMultipleVariables added in v1.1.1

func (c *Client) WriteMultipleVariables(domainID string, itemIDs []string, values []*MmsValueRef) ([]MmsDataAccessError, error)

WriteMultipleVariables writes multiple variables in one request. itemIDs and values must have the same length; each value is written to the variable named by the corresponding itemID in the given domain. Returns one MmsDataAccessError per variable.

func (*Client) WriteMultipleVariablesFromSpecs added in v1.1.1

func (c *Client) WriteMultipleVariablesFromSpecs(domainID string, items []VariableAccessSpec, values []*MmsValueRef) ([]MmsDataAccessError, error)

WriteMultipleVariablesFromSpecs writes multiple variables in one request using variable access specs. All items must be in the same domain (domainID). values must have the same length as items; each value is written to the variable specified by the corresponding VariableAccessSpec. Returns one MmsDataAccessError per variable.

func (*Client) WriteNamedVariableList added in v1.1.1

func (c *Client) WriteNamedVariableList(domainID, listName string, values []*MmsValueRef) ([]MmsDataAccessError, error)

WriteNamedVariableList writes values to a domain or VMD scoped named variable list. Pass domainID as "" for VMD scope. values must contain one MmsValueRef per list entry; refs are not consumed. Returns the data access error result for each variable write.

func (*Client) WriteSG

func (c *Client) WriteSG(ld, ln, objectRef string, fc FC, actSG int, value interface{}) error

WriteSG 写入SettingGroup

type ClientAuthenticator

type ClientAuthenticator func(securityToken *unsafe.Pointer, authParameter *AcseAuthenticationParameter, appReference *IsoApplicationReference) bool

type ClientConnection added in v1.1.1

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

ClientConnection represents a client connection to the server. Use from connection indication or access handlers.

func (*ClientConnection) Abort added in v1.1.1

func (c *ClientConnection) Abort() bool

Abort closes the client connection. The connection must not be used after calling Abort.

func (*ClientConnection) ClaimOwnership added in v1.1.1

func (c *ClientConnection) ClaimOwnership() *ClientConnection

ClaimOwnership claims the connection for use outside the callback; call Release when done.

func (*ClientConnection) LocalAddress added in v1.1.1

func (c *ClientConnection) LocalAddress() string

LocalAddress returns the local server address. Valid only while the connection exists.

func (*ClientConnection) PeerAddress added in v1.1.1

func (c *ClientConnection) PeerAddress() string

PeerAddress returns the client peer address. Valid only while the connection exists.

func (*ClientConnection) Release added in v1.1.1

func (c *ClientConnection) Release()

Release releases ownership claimed with ClaimOwnership.

func (*ClientConnection) SecurityToken added in v1.1.1

func (c *ClientConnection) SecurityToken() unsafe.Pointer

SecurityToken returns the security token set by the authenticator, or nil.

type ClientDataSet added in v1.1.3

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

ClientDataSet holds data set values read from the server. Create with ReadDataSetValues; call Destroy when done. The underlying MmsValue (MMS_ARRAY) can be passed to NewGooseSubscriberWithDataSet for GOOSE; keep the ClientDataSet alive for the lifetime of that subscriber.

func (*ClientDataSet) Destroy added in v1.1.3

func (d *ClientDataSet) Destroy()

Destroy frees the ClientDataSet. Do not use it or any GooseDataSetValues derived from it after Destroy.

func (*ClientDataSet) GooseDataSetValues added in v1.1.3

func (d *ClientDataSet) GooseDataSetValues() GooseDataSetValues

GooseDataSetValues returns a handle to the underlying MmsValue (MMS_ARRAY) for use with NewGooseSubscriberWithDataSet. The ClientDataSet must remain alive while the subscriber uses it.

type ClientGooseControlBlockValues added in v1.1.0

type ClientGooseControlBlockValues struct {
	GoEna      bool          // GOOSE enable
	GoID       string        // GOOSE identifier
	DatSet     string        // Dataset reference
	ConfRev    uint32        // Configuration revision
	NdsComm    bool          // Needs commissioning
	MinTime    uint32        // Minimum time between GOOSE messages (ms)
	MaxTime    uint32        // Maximum time between GOOSE messages (ms)
	FixedOffs  bool          // Fixed offsets flag
	DstAddress PhyComAddress // Destination physical communication address
}

ClientGooseControlBlockValues holds the values of a GOOSE control block

type ClientReport

type ClientReport struct {
	Report C.ClientReport
}

func (*ClientReport) GetBufOvfl

func (clientReport *ClientReport) GetBufOvfl() bool

func (*ClientReport) GetConfRev

func (clientReport *ClientReport) GetConfRev() int32

func (*ClientReport) GetDataReference

func (clientReport *ClientReport) GetDataReference(elementIndex int) string

func (*ClientReport) GetDataSetName

func (clientReport *ClientReport) GetDataSetName() string

func (*ClientReport) GetDataSetValues

func (clientReport *ClientReport) GetDataSetValues() (MmsValue, error)

func (*ClientReport) GetElement

func (clientReport *ClientReport) GetElement(elementIndex int) (MmsValue, error)

func (*ClientReport) GetMoreSeqmentsFollow

func (clientReport *ClientReport) GetMoreSeqmentsFollow() bool

func (*ClientReport) GetRcbReference

func (clientReport *ClientReport) GetRcbReference() string

func (*ClientReport) GetReasonForInclusion

func (clientReport *ClientReport) GetReasonForInclusion(elementIndex int) ReasonForInclusion

func (*ClientReport) GetRptId

func (clientReport *ClientReport) GetRptId() string

func (*ClientReport) GetSeqNum

func (clientReport *ClientReport) GetSeqNum() int16

func (*ClientReport) GetSubSeqNum

func (clientReport *ClientReport) GetSubSeqNum() int16

func (*ClientReport) GetTimestamp

func (clientReport *ClientReport) GetTimestamp() int64

func (*ClientReport) HasBufOvfl

func (clientReport *ClientReport) HasBufOvfl() bool

func (*ClientReport) HasConfRev

func (clientReport *ClientReport) HasConfRev() bool

func (*ClientReport) HasDataReference

func (clientReport *ClientReport) HasDataReference() bool

func (*ClientReport) HasDataSetName

func (clientReport *ClientReport) HasDataSetName() bool

func (*ClientReport) HasReasonForInclusion

func (clientReport *ClientReport) HasReasonForInclusion() bool

func (*ClientReport) HasSeqNum

func (clientReport *ClientReport) HasSeqNum() bool

func (*ClientReport) HasSubSeqNum

func (clientReport *ClientReport) HasSubSeqNum() bool

func (*ClientReport) HasTimestamp

func (clientReport *ClientReport) HasTimestamp() bool

type ClientReportControlBlock

type ClientReportControlBlock struct {
	Ena     bool    // 使能
	IntgPd  int     // 周期上送时间
	Resv    bool    // Reservation for URCB
	TrgOps  TrgOps  // 触发条件
	OptFlds OptFlds // 报告选项
}

type CommParameters added in v1.1.3

type CommParameters struct {
	VlanPriority uint8
	VlanID       uint16
	AppID        uint16
	DstAddr      [6]uint8
}

CommParameters is the Go equivalent of C's struct sCommParameters (goose_publisher.h). It holds VLAN, APPID, and destination MAC for GOOSE/SV. Embedded in GoosePublisherConf.

type ConnectionIndicationHandler added in v1.1.1

type ConnectionIndicationHandler func(connection *ClientConnection, connected bool)

ConnectionIndicationHandler is called when a client connects or disconnects.

type ControlAction

type ControlAction struct {
	ControlTime    uint64
	IsSelect       bool
	InterlockCheck bool
	SynchroCheck   bool
	CtlNum         int
	OrIdent        []byte
	OrCat          int
}

type ControlHandler

type ControlHandler func(node *ModelNode, action *ControlAction, mmsValue *MmsValue, test bool) ControlHandlerResult

type ControlHandlerResult

type ControlHandlerResult int
const (
	CONTROL_RESULT_FAILED ControlHandlerResult = iota
	CONTROL_RESULT_OK
	CONTROL_RESULT_WAITING
)

type ControlModel

type ControlModel int
const (
	// CONTROL_MODEL_STATUS_ONLY No support for control functions. Control object only support status information.
	CONTROL_MODEL_STATUS_ONLY ControlModel = iota
	// CONTROL_MODEL_DIRECT_NORMAL Direct control with normal security: Supports Operate, TimeActivatedOperate (optional), and Cancel (optional).
	CONTROL_MODEL_DIRECT_NORMAL
	// CONTROL_MODEL_SBO_NORMAL Select before operate (SBO) with normal security: Supports Select, Operate, TimeActivatedOperate (optional), and Cancel (optional).
	CONTROL_MODEL_SBO_NORMAL
	// CONTROL_MODEL_DIRECT_ENHANCED Direct control with enhanced security (enhanced security includes the CommandTermination service)
	CONTROL_MODEL_DIRECT_ENHANCED
	// CONTROL_MODEL_SBO_ENHANCED Select before operate (SBO) with enhanced security (enhanced security includes the CommandTermination service)
	CONTROL_MODEL_SBO_ENHANCED
)

type ControlObjectParam

type ControlObjectParam struct {
	CtlVal      bool
	OrIdent     string
	OrCat       int
	Test        bool
	Check       bool
	OperateTime uint64
}

func NewControlObjectParam

func NewControlObjectParam(ctlVal bool) *ControlObjectParam

type ControlObjectParamAPC

type ControlObjectParamAPC struct {
	CtlVal      float32
	OrIdent     string
	OrCat       int
	Test        bool
	Check       bool
	OperateTime uint64
}

func NewControlObjectParamAPC

func NewControlObjectParamAPC(ctlVal float32) *ControlObjectParamAPC

type ControlObjectParamINC

type ControlObjectParamINC struct {
	CtlVal      int
	OrIdent     string
	OrCat       int
	Test        bool
	Check       bool
	OperateTime uint64
}

func NewControlObjectParamINC

func NewControlObjectParamINC(ctlVal int) *ControlObjectParamINC

type DA

type DA struct {
	Data string
	DAs  []DA
}

type DO

type DO struct {
	Data string
	DAs  []DA
}

type DS

type DS struct {
	Data   string
	DSRefs []DSRef
}

type DSRef

type DSRef struct {
	Data string
}

type DataAttribute

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

type DataModel

type DataModel struct {
	LDs []LD
}

type DataObject

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

func (*DataObject) GetChild

func (do *DataObject) GetChild(name string) *DataAttribute

type DataSet

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

func (*DataSet) AddDataSetEntry

func (ds *DataSet) AddDataSetEntry(ref string)

AddDataSetEntry adds a new DataSetEntry to this DataSet.

type DataSetInfo added in v1.0.9

type DataSetInfo struct {
	Members     []string // Dataset member references (format: LDName/LNodeName.item[FC])
	IsDeletable bool     // Whether the dataset can be deleted by clients
}

DataSetInfo represents dataset directory information with deletable flag

type DirectoryEntry

type DirectoryEntry struct {
	Name string
	FC   *FC // Functional Constraint (nil if not applicable)
}

DirectoryEntry represents a single directory entry with optional FC annotation

type FC

type FC int
const (
	// ST Status information
	ST FC = iota
	// MX Measurands - analogue values
	MX
	// SP Setpoint
	SP
	// SV Substitution
	SV
	// CF Configuration
	CF
	// DC Description
	DC
	// SG Setting group
	SG
	// SE Setting group editable
	SE
	// SR service response / service tracking
	SR
	// OR Operate received
	OR
	// BL Blocking
	BL
	// EX Extended definition
	EX
	// CO Control, deprecated but kept here for backward compatibility
	CO
	// US Unicast SV
	US
	// MS Multicast SV
	MS
	// RP Unbuffered Reporting
	RP
	// BR Buffered Reporting
	BR
	// LG Log control blocks
	LG
	// GO Goose control blocks
	GO
	// ALL All FCs - wildcard value
	ALL  FC = 99
	NONE FC = -1
)

fc types

type FileAccessHandler added in v1.1.1

type FileAccessHandler func(service MmsFileServiceType, localFilename, otherFilename string) error

FileAccessHandler is called when a client requests an MMS file service. Return nil to allow, or an error (e.g. MMS_ERROR_FILE_FILE_ACCESS_DENIED) to deny.

type FileDirectoryEntry added in v1.0.10

type FileDirectoryEntry struct {
	FileName     string
	FileSize     uint32
	LastModified uint64
}

FileDirectoryEntry contains file metadata

type GetFileCompleteHandler added in v1.1.1

type GetFileCompleteHandler func(destinationFilename string)

GetFileCompleteHandler is called when a file upload (obtainFile) has completed.

type GetNameListHandler added in v1.1.1

type GetNameListHandler func(nameListType MmsGetNameListType, domainID string) bool

GetNameListHandler is called when a client requests a name list (domains, journals, data sets, or data). Return true to allow, false to deny.

type GooseCallbackHandlerID

type GooseCallbackHandlerID uintptr

type GooseDataSetValues added in v1.1.3

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

GooseDataSetValues is an opaque handle to the MmsValue array from a ClientDataSet, for use with NewGooseSubscriberWithDataSet. Obtain it from ClientDataSet.GooseDataSetValues(); keep the ClientDataSet alive for the lifetime of the subscriber.

type GooseParseError

type GooseParseError int
const (
	GooseParseErrorNoError GooseParseError = iota
	GooseParseErrorUnknownTag
	GooseParseErrorTagDecode
	GooseParseErrorSublevel
	GooseParseErrorOverflow
	GooseParseErrorUnderflow
	GooseParseErrorTypeMismatch
	GooseParseErrorLengthMismatch
	GooseParseErrorInvalidPadding
)

type GoosePublisher

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

func NewGoosePublisher

func NewGoosePublisher(conf GoosePublisherConf) (publisher *GoosePublisher, err error)

func NewGoosePublisherEx added in v1.1.3

func NewGoosePublisherEx(conf GoosePublisherConf, useVlanTag bool) (publisher *GoosePublisher, err error)

NewGoosePublisherEx creates a GOOSE publisher with optional VLAN tag. useVlanTag false disables VLAN tags in sent frames when not needed. Otherwise equivalent to NewGoosePublisher.

func (*GoosePublisher) Close

func (receiver *GoosePublisher) Close()

func (*GoosePublisher) IncreaseStNum

func (receiver *GoosePublisher) IncreaseStNum()

func (*GoosePublisher) Publish

func (receiver *GoosePublisher) Publish(dataSet *LinkedListValue) error

func (*GoosePublisher) PublishAndDump added in v1.1.3

func (receiver *GoosePublisher) PublishAndDump(dataSet *LinkedListValue, msgBuf []byte) (msgLen int, err error)

PublishAndDump publishes a GOOSE message and copies the raw encoded payload into msgBuf. Returns the number of bytes written into msgBuf (use msgBuf[:msgLen]) or an error if publish failed. msgBuf must be non-nil and have positive length; use a large enough buffer (e.g. 1500+ bytes for Ethernet).

func (*GoosePublisher) Reset

func (receiver *GoosePublisher) Reset()

func (*GoosePublisher) SetConfRev

func (receiver *GoosePublisher) SetConfRev(confRef uint32)

func (*GoosePublisher) SetDataSetRef

func (receiver *GoosePublisher) SetDataSetRef(dataSetRef string)

func (*GoosePublisher) SetGoCbRef

func (receiver *GoosePublisher) SetGoCbRef(goCbRef string)

func (*GoosePublisher) SetGoID added in v1.1.3

func (receiver *GoosePublisher) SetGoID(goID string)

SetGoID sets the GOOSE identifier string sent in GOOSE messages (e.g. when it differs from GoCbRef).

func (*GoosePublisher) SetNeedsCommission

func (receiver *GoosePublisher) SetNeedsCommission(ndsCom bool)

func (*GoosePublisher) SetSimulation

func (receiver *GoosePublisher) SetSimulation(simulation bool)

func (*GoosePublisher) SetSqNum

func (receiver *GoosePublisher) SetSqNum(sqNum uint32)

func (*GoosePublisher) SetStNum

func (receiver *GoosePublisher) SetStNum(stNum uint32)

func (*GoosePublisher) SetTimeAllowedToLive

func (receiver *GoosePublisher) SetTimeAllowedToLive(timeAllowedToLive uint32)

type GoosePublisherConf

type GoosePublisherConf struct {
	InterfaceID string
	CommParameters
}

GoosePublisherConf configures a GOOSE publisher. InterfaceID is the Ethernet interface (e.g. "eth0"); the remaining fields are the C CommParameters (embedded).

type GooseReceiver

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

func NewGooseReceiver

func NewGooseReceiver() *GooseReceiver

func NewGooseReceiverEx added in v1.1.3

func NewGooseReceiverEx(buffer []byte) *GooseReceiver

NewGooseReceiverEx creates a GOOSE receiver that uses the given buffer for message handling instead of allocating its own. Pass nil or an empty slice to use the default (library-allocated) buffer. When buffer is non-nil, the receiver keeps a reference to it for its lifetime; do not modify the buffer while the receiver is in use.

func (*GooseReceiver) AddSubscriber

func (receiver *GooseReceiver) AddSubscriber(subscriber *GooseSubscriber) *GooseReceiver

func (*GooseReceiver) Destroy

func (receiver *GooseReceiver) Destroy()

func (*GooseReceiver) GetInterfaceID

func (receiver *GooseReceiver) GetInterfaceID() string

func (*GooseReceiver) HandleMessage added in v1.1.3

func (receiver *GooseReceiver) HandleMessage(buffer []byte)

HandleMessage parses a GOOSE message from a raw Ethernet frame. Use this when driving reception yourself (e.g. with StartThreadless or custom socket reads). buffer must contain the complete Ethernet frame.

func (*GooseReceiver) IsRunning

func (receiver *GooseReceiver) IsRunning() bool

func (*GooseReceiver) RemoveSubscriber

func (receiver *GooseReceiver) RemoveSubscriber(subscriber *GooseSubscriber) *GooseReceiver

func (*GooseReceiver) SetInterfaceID

func (receiver *GooseReceiver) SetInterfaceID(interfaceID string) *GooseReceiver

func (*GooseReceiver) Start

func (receiver *GooseReceiver) Start() *GooseReceiver

func (*GooseReceiver) StartThreadless added in v1.1.3

func (receiver *GooseReceiver) StartThreadless() *GooseReceiverSocket

StartThreadless starts the GOOSE receiver in non-threaded mode. The returned socket handle can be used with external read loops; call HandleMessage with each received Ethernet frame. Call StopThreadless to stop.

func (*GooseReceiver) Stop

func (receiver *GooseReceiver) Stop() *GooseReceiver

func (*GooseReceiver) StopThreadless added in v1.1.3

func (receiver *GooseReceiver) StopThreadless()

StopThreadless stops the receiver when running in threadless mode (after StartThreadless).

func (*GooseReceiver) Tick

func (receiver *GooseReceiver) Tick() bool

type GooseReceiverSocket added in v1.1.3

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

GooseReceiverSocket is the opaque handle returned by StartThreadless. It represents the Ethernet socket used for receiving; the receiver parses frames when you call HandleMessage with a buffer.

type GooseReport

type GooseReport struct {
	*GooseSubscriber
	// contains filtered or unexported fields
}

type GooseReportCallback

type GooseReportCallback func(report *GooseReport)

type GooseSubscriber

type GooseSubscriber struct {
	Conf SubscriberConf // 网卡名称

	HandlerID GooseCallbackHandlerID
	// contains filtered or unexported fields
}

func NewGooseSubscriber

func NewGooseSubscriber(conf SubscriberConf) (subscriber *GooseSubscriber)

func NewGooseSubscriberWithDataSet added in v1.1.3

func NewGooseSubscriberWithDataSet(conf SubscriberConf, dataSetValues *GooseDataSetValues) (subscriber *GooseSubscriber)

NewGooseSubscriberWithDataSet creates a GOOSE subscriber that writes received data set values into the pre-allocated MmsValue from dataSetValues. Obtain dataSetValues from Client.ReadDataSetValues and ClientDataSet.GooseDataSetValues(); the ClientDataSet must remain alive for the lifetime of the subscriber. Pass nil for dataSetValues to use auto-allocated values (same as NewGooseSubscriber).

func (*GooseSubscriber) Destroy

func (receiver *GooseSubscriber) Destroy()

func (*GooseSubscriber) GetAppID

func (receiver *GooseSubscriber) GetAppID() int32

func (*GooseSubscriber) GetConfRev

func (receiver *GooseSubscriber) GetConfRev() uint32

func (*GooseSubscriber) GetDataSetName

func (receiver *GooseSubscriber) GetDataSetName() string

func (*GooseSubscriber) GetDataSetValues

func (receiver *GooseSubscriber) GetDataSetValues() (*MmsValue, error)

func (*GooseSubscriber) GetDstMac

func (receiver *GooseSubscriber) GetDstMac() [6]uint8

func (*GooseSubscriber) GetGoCbRef

func (receiver *GooseSubscriber) GetGoCbRef() string

func (*GooseSubscriber) GetGoID

func (receiver *GooseSubscriber) GetGoID() string

func (*GooseSubscriber) GetParseError

func (receiver *GooseSubscriber) GetParseError() GooseParseError

func (*GooseSubscriber) GetSqNum

func (receiver *GooseSubscriber) GetSqNum() uint32

func (*GooseSubscriber) GetSrcMac

func (receiver *GooseSubscriber) GetSrcMac() [6]uint8

func (*GooseSubscriber) GetStNum

func (receiver *GooseSubscriber) GetStNum() uint32

func (*GooseSubscriber) GetTimeAllowedToLive

func (receiver *GooseSubscriber) GetTimeAllowedToLive() uint32

func (*GooseSubscriber) GetTimestamp

func (receiver *GooseSubscriber) GetTimestamp() uint64

func (*GooseSubscriber) GetVlanID

func (receiver *GooseSubscriber) GetVlanID() uint16

func (*GooseSubscriber) GetVlanPriority

func (receiver *GooseSubscriber) GetVlanPriority() uint8

func (*GooseSubscriber) IsTest

func (receiver *GooseSubscriber) IsTest() bool

func (*GooseSubscriber) IsValid

func (receiver *GooseSubscriber) IsValid() bool

func (*GooseSubscriber) IsVlanSet

func (receiver *GooseSubscriber) IsVlanSet() bool

func (*GooseSubscriber) NeedsCommission

func (receiver *GooseSubscriber) NeedsCommission() bool

func (*GooseSubscriber) SetObserver added in v1.1.3

func (receiver *GooseSubscriber) SetObserver()

SetObserver configures the subscriber to listen to any received GOOSE message (observer mode). When set, the subscriber still has access to goCbRef, goId, and datSet of the received message.

type IedConnectionState added in v1.0.10

type IedConnectionState int

IedConnectionState represents the connection state

const (
	IedStateClosed     IedConnectionState = 0
	IedStateConnecting IedConnectionState = 1
	IedStateConnected  IedConnectionState = 2
	IedStateClosing    IedConnectionState = 3
)

type IedModel

type IedModel struct {
	Model *C.IedModel
}

func CreateModelFromConfigFileEx

func CreateModelFromConfigFileEx(filepath string) (*IedModel, error)

func NewIedModel

func NewIedModel(name string) *IedModel

func NewIedModelFromPointer

func NewIedModelFromPointer(model unsafe.Pointer) *IedModel

This is a little hacky but it works for calls from runtime_scl.

The pointer must be a pointer to the C version of the IedModel.

func (*IedModel) CreateLogicalDevice

func (m *IedModel) CreateLogicalDevice(name string) *LogicalDevice

func (*IedModel) Destroy

func (m *IedModel) Destroy()

func (*IedModel) GetModelNodeByObjectReference

func (m *IedModel) GetModelNodeByObjectReference(objectRef string) *ModelNode

type IedServer

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

func NewServer

func NewServer(iedModel *IedModel) *IedServer

NewServer creates a new instance of the IedServer using the provided _iedModel.

func NewServerWithConfig

func NewServerWithConfig(serverConfig ServerConfig, iedModel *IedModel) *IedServer

func NewServerWithTlsSupport

func NewServerWithTlsSupport(serverConfig ServerConfig, tlsConfig *TLSConfig, iedModel *IedModel) (*IedServer, error)

func (*IedServer) Destroy

func (is *IedServer) Destroy()

Destroy frees all resources associated with the IedServer.

func (*IedServer) DisableGoosePublishing added in v1.1.3

func (is *IedServer) DisableGoosePublishing()

DisableGoosePublishing disables GOOSE publishing on the server.

func (*IedServer) EnableDynamicNamedVariableLists added in v1.1.1

func (is *IedServer) EnableDynamicNamedVariableLists(enable bool)

EnableDynamicNamedVariableLists enables or disables dynamic named variable list (data set) service at runtime.

func (*IedServer) EnableGoosePublishing added in v1.1.3

func (is *IedServer) EnableGoosePublishing()

EnableGoosePublishing enables GOOSE publishing on the server (when using integrated GOOSE publisher).

func (*IedServer) EnableJournalService added in v1.1.1

func (is *IedServer) EnableJournalService(enable bool)

EnableJournalService enables or disables the MMS journal service at runtime. Requires CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME in the C library.

func (*IedServer) EnableMmsFileService added in v1.1.1

func (is *IedServer) EnableMmsFileService(enable bool)

EnableMmsFileService enables or disables the MMS file service at runtime.

func (*IedServer) GetAttributeValue

func (is *IedServer) GetAttributeValue(node *ModelNode) (*MmsValue, error)

GetAttributeValue reads the value of the attribute in the server

func (*IedServer) GetFilestoreBasepath added in v1.1.1

func (is *IedServer) GetFilestoreBasepath() string

GetFilestoreBasepath returns the filestore base path last set with SetFilestoreBasepath, or empty string. The C API does not provide a getter; this returns the value stored by the Go binding.

func (*IedServer) GetMaxMmsPduSize added in v1.1.1

func (is *IedServer) GetMaxMmsPduSize() int

GetMaxMmsPduSize returns the maximum MMS PDU size. Returns 0 as there is no server-wide value in the public API.

func (*IedServer) GetNumberOfOpenConnections

func (is *IedServer) GetNumberOfOpenConnections() int

GetNumberOfOpenConnections reads the amount of connections with the server

func (*IedServer) GetUTCTimeAttributeValue

func (is *IedServer) GetUTCTimeAttributeValue(node *ModelNode) int64

GetUTCTimeAttributeValue reads the value of a time attribute in the server

func (*IedServer) InstallGetFileCompleteHandler added in v1.1.1

func (is *IedServer) InstallGetFileCompleteHandler(handler GetFileCompleteHandler)

InstallGetFileCompleteHandler installs a callback invoked when a file upload (obtainFile) has completed.

func (*IedServer) InstallGetNameListHandler added in v1.1.1

func (is *IedServer) InstallGetNameListHandler(handler GetNameListHandler)

InstallGetNameListHandler installs a callback invoked when a client requests a name list (domains, journals, data sets, or data). Return true to allow, false to deny.

func (*IedServer) InstallObtainFileHandler added in v1.1.1

func (is *IedServer) InstallObtainFileHandler(handler ObtainFileHandler)

InstallObtainFileHandler installs a callback invoked when a client uploads a file (obtainFile). Return true to allow, false to deny.

func (*IedServer) InstallReadJournalHandler added in v1.1.1

func (is *IedServer) InstallReadJournalHandler(handler ReadJournalHandler)

InstallReadJournalHandler installs a callback invoked when a client accesses a journal. Return true to allow, false to deny.

func (*IedServer) InstallVariableListAccessHandler added in v1.1.1

func (is *IedServer) InstallVariableListAccessHandler(handler VariableListAccessHandler)

InstallVariableListAccessHandler installs a callback invoked when a client accesses a named variable list (create, delete, read, write, get directory). Return nil to allow the access, or an error (e.g. AccessDenied) to deny.

func (*IedServer) IsRunning

func (is *IedServer) IsRunning() bool

IsRunning checks if the IedServer is currently running.

func (*IedServer) LockDataModel

func (is *IedServer) LockDataModel()

LockDataModel locks the data _iedModel of the IedServer.

func (*IedServer) PerformPeriodicTasks added in v1.1.1

func (is *IedServer) PerformPeriodicTasks()

PerformPeriodicTasks runs periodic background tasks (e.g. report timeouts). Call when using StartThreadless.

func (*IedServer) ProcessIncomingData added in v1.1.1

func (is *IedServer) ProcessIncomingData()

ProcessIncomingData processes incoming TCP data. Call periodically when using StartThreadless.

func (*IedServer) SetAuthenticator

func (is *IedServer) SetAuthenticator(clientAuthenticator ClientAuthenticator)

func (*IedServer) SetConnectionIndicationHandler added in v1.1.1

func (is *IedServer) SetConnectionIndicationHandler(handler ConnectionIndicationHandler)

SetConnectionIndicationHandler sets a callback invoked when a client connects or disconnects.

func (*IedServer) SetControlHandler

func (is *IedServer) SetControlHandler(modelNode *ModelNode, handler ControlHandler)

func (*IedServer) SetFileAccessHandler added in v1.1.1

func (is *IedServer) SetFileAccessHandler(handler FileAccessHandler)

SetFileAccessHandler installs a callback that is invoked when a client requests an MMS file service. Use it to allow or deny file access.

func (*IedServer) SetFilestoreBasepath added in v1.1.1

func (is *IedServer) SetFilestoreBasepath(basepath string)

SetFilestoreBasepath sets the (virtual) filestore base path for MMS file services. Call before Start. GetFilestoreBasepath returns the last value set here (the C API does not expose a getter).

func (*IedServer) SetGooseInterfaceId added in v1.1.3

func (is *IedServer) SetGooseInterfaceId(interfaceId string)

SetGooseInterfaceId sets the Ethernet interface used for GOOSE (e.g. "eth0"). Call before or after Start.

func (*IedServer) SetHandleWriteAccess

func (is *IedServer) SetHandleWriteAccess(modelNode *ModelNode, handler WriteAccessHandler)

func (*IedServer) SetHandleWriteAccessForComplexAttribute added in v1.1.1

func (is *IedServer) SetHandleWriteAccessForComplexAttribute(modelNode *ModelNode, handler WriteAccessHandler)

SetHandleWriteAccessForComplexAttribute installs a write access handler for a data attribute and all its sub-attributes (for complex attributes).

func (*IedServer) SetHandleWriteAccessForDataObject added in v1.1.1

func (is *IedServer) SetHandleWriteAccessForDataObject(dataObject *DataObject, fc FC, handler WriteAccessHandlerForDataObject)

SetHandleWriteAccessForDataObject installs a write access handler for all data attributes of a data object with the given FC.

func (*IedServer) SetMaxAssociationSpecificDataSets added in v1.1.1

func (is *IedServer) SetMaxAssociationSpecificDataSets(maxDataSets int)

SetMaxAssociationSpecificDataSets sets the maximum number of association-specific (non-permanent) data sets per connection.

func (*IedServer) SetMaxConnections added in v1.1.1

func (is *IedServer) SetMaxConnections(maxConnections int)

SetMaxConnections is an alias for SetMaxMmsConnections.

func (*IedServer) SetMaxDataSetEntries added in v1.1.1

func (is *IedServer) SetMaxDataSetEntries(maxDataSetEntries int)

SetMaxDataSetEntries sets the maximum number of data set entries for dynamic data sets.

func (*IedServer) SetMaxDomainSpecificDataSets added in v1.1.1

func (is *IedServer) SetMaxDomainSpecificDataSets(maxDataSets int)

SetMaxDomainSpecificDataSets sets the maximum number of domain-specific (permanent) data sets.

func (*IedServer) SetMaxMmsConnections added in v1.1.1

func (is *IedServer) SetMaxMmsConnections(maxConnections int)

SetMaxMmsConnections sets the maximum number of MMS client connections at runtime.

func (*IedServer) SetMaxMmsPduSize added in v1.1.1

func (is *IedServer) SetMaxMmsPduSize(maxPduSize int)

SetMaxMmsPduSize sets the maximum MMS PDU size for the server (applies to new connections). Not all builds export this.

func (*IedServer) SetMmsClientAuthenticator added in v1.1.1

func (is *IedServer) SetMmsClientAuthenticator(handler func(connection *MmsServerConnection, tlsCert *x509.Certificate) bool)

SetMmsClientAuthenticator installs a callback to authenticate clients. Use IedServer.SetAuthenticator instead, which provides the same capability via the ACSE authenticator (password, certificate, or TLS).

func (*IedServer) SetMmsLocalIpAddress added in v1.1.1

func (is *IedServer) SetMmsLocalIpAddress(localIpAddress string) error

SetMmsLocalIpAddress sets the local IP address the MMS server will bind to. Call before Start.

func (*IedServer) SetMmsTcpPort added in v1.1.1

func (is *IedServer) SetMmsTcpPort(tcpPort int) error

SetMmsTcpPort is not supported by the library; the TCP port is set when calling Start(port).

func (*IedServer) SetServerIdentity

func (is *IedServer) SetServerIdentity(vendor string, model string, version string)

SetServerIdentity updates the server identity of the IedServer

func (*IedServer) SetWriteAccessPolicy added in v1.1.1

func (is *IedServer) SetWriteAccessPolicy(fc FC, policy AccessPolicy)

SetWriteAccessPolicy sets the default write access policy for the given functional constraint.

func (*IedServer) Start

func (is *IedServer) Start(port int)

Start initiates the IedServer on the provided port.

func (*IedServer) StartThreadless added in v1.1.1

func (is *IedServer) StartThreadless(port int)

StartThreadless starts the server in non-threaded mode; call ProcessIncomingData and optionally WaitReady periodically.

func (*IedServer) Stop

func (is *IedServer) Stop()

Stop terminates the IedServer.

func (*IedServer) StopThreadless added in v1.1.1

func (is *IedServer) StopThreadless()

StopThreadless stops the server when running in threadless mode.

func (*IedServer) UnlockDataModel

func (is *IedServer) UnlockDataModel()

UnlockDataModel unlocks the data _iedModel of the IedServer.

func (*IedServer) UpdateFloatAttributeValue

func (is *IedServer) UpdateFloatAttributeValue(node *ModelNode, value float32)

UpdateFloatAttributeValue updates a DataAttribute with a float value.

func (*IedServer) UpdateInt32AttributeValue

func (is *IedServer) UpdateInt32AttributeValue(node *ModelNode, value int32)

UpdateInt32AttributeValue updates a DataAttribute with an Int32 value.

func (*IedServer) UpdateQuality

func (is *IedServer) UpdateQuality(node *ModelNode, quality uint16)

UpdateQuality updates the quality attribute with an UInt16 value

func (*IedServer) UpdateTimestampAttributeValue added in v1.1.6

func (is *IedServer) UpdateTimestampAttributeValue(node *ModelNode, ts *Timestamp)

UpdateTimestampAttributeValue updates a UTC time (timestamp) DataAttribute with a full Timestamp (time + time quality). Use this when both value and quality must be set; otherwise UpdateUTCTimeAttributeValue(node, ms) only sets the time value.

func (*IedServer) UpdateUTCTimeAttributeValue

func (is *IedServer) UpdateUTCTimeAttributeValue(node *ModelNode, value int64)

UpdateUTCTimeAttributeValue updates a DataAttribute with a UTC time value.

func (*IedServer) UpdateVisibleStringAttributeValue

func (is *IedServer) UpdateVisibleStringAttributeValue(attr *DataAttribute, value string)

UpdateVisibleStringAttributeValue updates a DataAttribute with a visible string value.

func (*IedServer) WaitReady added in v1.1.1

func (is *IedServer) WaitReady(timeoutMs uint) int

WaitReady waits until a connection has data or the timeout expires. For use with StartThreadless. Returns non-zero if at least one connection is ready (then call ProcessIncomingData).

type IsoApplicationReference

type IsoApplicationReference struct {
	ApTitle     []uint16
	AeQualifier int
}

type IsoConnectionParameters added in v1.1.1

type IsoConnectionParameters struct {
	LocalApTitle      []byte
	LocalAeQualifier  int32
	RemoteApTitle     []byte
	RemoteAeQualifier int32
	LocalTSelector    []byte
	LocalSSelector    []byte
	LocalPSelector    []byte
	RemoteTSelector   []byte
	RemoteSSelector   []byte
	RemotePSelector   []byte
}

IsoConnectionParameters holds ISO layer connection parameters (AP title, selectors).

type JournalEntry added in v1.1.1

type JournalEntry struct {
	EntryID        *MmsValue // Octet string
	OccurrenceTime *MmsValue // Binary time
	Variables      []JournalVariable
}

JournalEntry is one entry from a journal read.

type JournalVariable added in v1.1.1

type JournalVariable struct {
	Tag   string
	Value *MmsValue
}

JournalVariable is one variable in a journal entry.

type LD

type LD struct {
	Data string
	LNs  []LN
}

type LN

type LN struct {
	Data      string
	DOs       []DO
	DSs       []DS
	URReports []URReport
	BRReports []BRReport
}

type LastApplError added in v1.0.10

type LastApplError struct {
	CtlNum   int
	Error    int
	AddCause int
}

LastApplError contains control application error information

type LinkedListValue

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

func NewLinkedListValue

func NewLinkedListValue() *LinkedListValue

func (*LinkedListValue) Add

func (receiver *LinkedListValue) Add(value *MmsValue) error

func (*LinkedListValue) Destroy

func (receiver *LinkedListValue) Destroy()

func (*LinkedListValue) Size

func (receiver *LinkedListValue) Size() int

type LogicalDevice

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

func (*LogicalDevice) CreateLogicalNode

func (d *LogicalDevice) CreateLogicalNode(name string) *LogicalNode

type LogicalNode

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

func (*LogicalNode) CreateDataObjectCDC_APC

func (n *LogicalNode) CreateDataObjectCDC_APC(name string, ctlModel int) *DataObject

func (*LogicalNode) CreateDataObjectCDC_ENS

func (n *LogicalNode) CreateDataObjectCDC_ENS(name string) *DataObject

func (*LogicalNode) CreateDataObjectCDC_SAV

func (n *LogicalNode) CreateDataObjectCDC_SAV(name string, isInteger bool) *DataObject

func (*LogicalNode) CreateDataObjectCDC_VSS

func (n *LogicalNode) CreateDataObjectCDC_VSS(name string) *DataObject

func (*LogicalNode) CreateDataSet

func (ln *LogicalNode) CreateDataSet(name string) *DataSet

CreateDataSet creates a new DataSet under this LogicalNode.

type MmsConnection added in v1.1.1

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

MmsConnection wraps a C MmsConnection for standalone MMS client use (without IedConnection). Call Destroy when done.

func NewMmsConnection added in v1.1.1

func NewMmsConnection() *MmsConnection

NewMmsConnection creates a new non-TLS MmsConnection. Call Destroy when done.

func NewMmsConnectionNonThreaded added in v1.1.1

func NewMmsConnectionNonThreaded(tlsConfig *TLSConfiguration) *MmsConnection

NewMmsConnectionNonThreaded creates an MmsConnection that does not use a background thread; call Tick() periodically. tlsConfig may be nil for non-TLS.

func NewMmsConnectionSecure added in v1.1.1

func NewMmsConnectionSecure(tlsConfig *TLSConfiguration) *MmsConnection

NewMmsConnectionSecure creates a new TLS-enabled MmsConnection using the given TLS configuration. Call Destroy when done.

func (*MmsConnection) AbortAsync added in v1.1.1

func (c *MmsConnection) AbortAsync() error

AbortAsync sends the MMS abort service asynchronously. The C API does not provide a completion callback; it returns immediately.

func (*MmsConnection) Conclude added in v1.1.1

func (c *MmsConnection) Conclude() error

Conclude sends the MMS conclude service to orderly close the association with the server. The connection is closed; use Connect again to reconnect.

func (*MmsConnection) ConcludeAsync added in v1.1.1

func (c *MmsConnection) ConcludeAsync(callback func(error)) error

ConcludeAsync sends the MMS conclude service asynchronously. The callback is invoked when the operation completes (may run from another goroutine).

func (*MmsConnection) ConnectAsync added in v1.1.1

func (c *MmsConnection) ConnectAsync(hostname string, port int, callback func(error)) error

ConnectAsync starts a non-blocking connection. The callback is invoked with nil when connected or with an error on failure/close.

func (*MmsConnection) DefineNamedVariableListAsync added in v1.1.1

func (c *MmsConnection) DefineNamedVariableListAsync(domainID, listName string, variableSpecs []VariableAccessSpec, callback func(error)) error

DefineNamedVariableListAsync defines a new domain or VMD scoped named variable list asynchronously. Pass domainID as "" for VMD scope. The callback is invoked on completion; it may run from another goroutine.

func (*MmsConnection) Destroy added in v1.1.1

func (c *MmsConnection) Destroy()

Destroy releases the C MmsConnection. Safe to call multiple times.

func (*MmsConnection) FileDirectoryAsync added in v1.1.1

func (c *MmsConnection) FileDirectoryAsync(fileSpecification, continueAfter string, callback func(entries []MmsFileDirectoryEntryEx, moreFollows bool, err error)) error

FileDirectoryAsync retrieves the file directory asynchronously. fileSpecification is the path/pattern; use "" for continueAfter to start from the beginning. The callback receives the list of entries, moreFollows (true if more data is available server-side), and any error.

func (*MmsConnection) GetConnectTimeout added in v1.1.1

func (c *MmsConnection) GetConnectTimeout() uint32

GetConnectTimeout returns the connect timeout in milliseconds. The C library does not expose a getter; returns 0.

func (*MmsConnection) GetDomainJournals added in v1.1.1

func (c *MmsConnection) GetDomainJournals(domainID string) ([]string, error)

GetDomainJournals returns the journal names in the given domain. Pass domainID as "" for VMD scope.

func (*MmsConnection) GetDomainJournalsAsync added in v1.1.1

func (c *MmsConnection) GetDomainJournalsAsync(domainID, continueAfter string, callback func(names []string, moreFollows bool, err error)) error

GetDomainJournalsAsync returns journal names in a domain asynchronously. continueAfter is "" to start.

func (*MmsConnection) GetDomainNamesAsync added in v1.1.1

func (c *MmsConnection) GetDomainNamesAsync(continueAfter string, callback func(names []string, moreFollows bool, err error)) error

GetDomainNamesAsync returns domain names asynchronously. continueAfter is "" to start.

func (*MmsConnection) GetDomainVariableListNames added in v1.1.1

func (c *MmsConnection) GetDomainVariableListNames(domainID string) ([]string, error)

GetDomainVariableListNames returns the names of named variable lists in the given domain. Pass domainID as "" for VMD scope.

func (*MmsConnection) GetDomainVariableListNamesAsync added in v1.1.1

func (c *MmsConnection) GetDomainVariableListNamesAsync(domainID, continueAfter string, callback func(names []string, moreFollows bool, err error)) error

GetDomainVariableListNamesAsync returns named variable list names in a domain asynchronously. continueAfter is "" to start.

func (*MmsConnection) GetDomainVariableNamesAsync added in v1.1.1

func (c *MmsConnection) GetDomainVariableNamesAsync(domainID, continueAfter string, callback func(names []string, moreFollows bool, err error)) error

GetDomainVariableNamesAsync returns variable names in a domain asynchronously. continueAfter is "" to start.

func (*MmsConnection) GetIsoConnectionParameters added in v1.1.1

func (c *MmsConnection) GetIsoConnectionParameters() *IsoConnectionParameters

GetIsoConnectionParameters returns a copy of the ISO connection parameters (selectors, AP titles). Returns nil if connection is invalid.

func (*MmsConnection) GetLocalDetail added in v1.1.1

func (c *MmsConnection) GetLocalDetail() int32

GetLocalDetail returns the maximum MMS PDU size (local detail) for this connection.

func (*MmsConnection) GetMmsConnectionParameters added in v1.1.1

func (c *MmsConnection) GetMmsConnectionParameters() *MmsConnectionParameters

GetMmsConnectionParameters returns the MMS connection parameters (max outstanding calls, PDU size, etc.). Returns nil if the connection is invalid.

func (*MmsConnection) GetNamedVariableListAttributes added in v1.1.1

func (c *MmsConnection) GetNamedVariableListAttributes(domainID, listName string) (*MmsNamedVariableListAttributes, error)

GetNamedVariableListAttributes returns the attributes of a named variable list (deletable, variable specs). Pass domainID as "" for VMD scope.

func (*MmsConnection) GetNamedVariableListAttributesAsync added in v1.1.1

func (c *MmsConnection) GetNamedVariableListAttributesAsync(domainID, listName string, callback func(*MmsNamedVariableListAttributes, error)) error

GetNamedVariableListAttributesAsync retrieves the attributes of a named variable list asynchronously. Pass domainID as "" for VMD scope. The callback may run from another goroutine.

func (*MmsConnection) GetRequestTimeout added in v1.1.1

func (c *MmsConnection) GetRequestTimeout() uint32

GetRequestTimeout returns the request timeout in milliseconds.

func (*MmsConnection) GetServerStatus added in v1.1.1

func (c *MmsConnection) GetServerStatus(extendedDerivation bool) (*MmsServerStatus, error)

GetServerStatus returns the MMS server status (VMD logical and physical status).

func (*MmsConnection) GetVMDVariableNames added in v1.1.1

func (c *MmsConnection) GetVMDVariableNames() ([]string, error)

GetVMDVariableNames returns the VMD-scope variable names. Pass "" for continueAfter in async version.

func (*MmsConnection) GetVMDVariableNamesAsync added in v1.1.1

func (c *MmsConnection) GetVMDVariableNamesAsync(continueAfter string, callback func(names []string, moreFollows bool, err error)) error

GetVMDVariableNamesAsync returns VMD variable names asynchronously. continueAfter is "" to start.

func (*MmsConnection) GetVariableAccessAttributesAsync added in v1.1.1

func (c *MmsConnection) GetVariableAccessAttributesAsync(domainID, itemID string, callback func(*MmsVariableSpecificationRef, error)) error

GetVariableAccessAttributesAsync retrieves the variable access attributes (type specification) asynchronously. On success the callback receives a non-nil MmsVariableSpecificationRef; the caller must call Free() on it when done. The callback may run from another goroutine.

func (*MmsConnection) GetVariableListNamesAssociationSpecificAsync added in v1.1.1

func (c *MmsConnection) GetVariableListNamesAssociationSpecificAsync(continueAfter string, callback func(names []string, moreFollows bool, err error)) error

GetVariableListNamesAssociationSpecificAsync returns association-specific variable list names asynchronously. continueAfter is "" to start.

func (*MmsConnection) IdentifyAsync added in v1.1.1

func (c *MmsConnection) IdentifyAsync(callback func(vendorName, modelName, revision string, err error)) error

IdentifyAsync retrieves the server identity (vendor, model, revision) asynchronously. The callback may run from another goroutine.

func (*MmsConnection) ObtainFile added in v1.1.1

func (c *MmsConnection) ObtainFile(sourceFile, destinationFile string) error

ObtainFile requests the server to read a file from the client (upload: sourceFile local, destinationFile remote).

func (*MmsConnection) ReadArrayElements added in v1.1.1

func (c *MmsConnection) ReadArrayElements(domainID, itemID string, startIndex, numberOfElements uint32) (*MmsValue, error)

ReadArrayElements reads one or more elements of an array variable. startIndex is the first element; numberOfElements is the count (0 = single element at startIndex). Returns the value (single element or array of elements) or nil on error. Caller does not free the result.

func (*MmsConnection) ReadJournal added in v1.1.1

func (c *MmsConnection) ReadJournal(domainID, journalName string, startingTime, endingTime *uint64) ([]*MmsJournalEntry, bool, error)

ReadJournal reads journal entries with optional time range. If startingTime and endingTime are nil, 0 and max are used.

func (*MmsConnection) ReadJournalStartAfter added in v1.1.1

func (c *MmsConnection) ReadJournalStartAfter(domainID, journalName string, entryID []byte, timeSpec *uint64) ([]*MmsJournalEntry, bool, error)

ReadJournalStartAfter reads journal entries starting after the given entry and optional time.

func (*MmsConnection) ReadJournalStartAfterAsync added in v1.1.1

func (c *MmsConnection) ReadJournalStartAfterAsync(domainID, journalName string, entryID []byte, timeSpec *uint64, callback func(entries []*MmsJournalEntry, moreFollows bool, err error)) error

ReadJournalStartAfterAsync reads journal entries starting after the given time and entry specification asynchronously. The callback may run from another goroutine.

func (*MmsConnection) ReadJournalTimeRange added in v1.1.1

func (c *MmsConnection) ReadJournalTimeRange(domainID, journalName string, startTime, endTime uint64) ([]*MmsJournalEntry, bool, error)

ReadJournalTimeRange reads journal entries in the given time range (milliseconds since Unix epoch).

func (*MmsConnection) ReadJournalTimeRangeAsync added in v1.1.1

func (c *MmsConnection) ReadJournalTimeRangeAsync(domainID, journalName string, startTime, endTime uint64, callback func(entries []*MmsJournalEntry, moreFollows bool, err error)) error

ReadJournalTimeRangeAsync reads journal entries in the given time range asynchronously (milliseconds since Unix epoch). The callback may run from another goroutine.

func (*MmsConnection) ReadNamedVariableListDirectoryAsync added in v1.1.1

func (c *MmsConnection) ReadNamedVariableListDirectoryAsync(domainID, listName string, callback func(specs []MmsVariableAccessSpec, deletable bool, err error)) error

ReadNamedVariableListDirectoryAsync reads the entry list of a named variable list asynchronously. Pass domainID as "" for VMD scope. The callback receives the variable specs and deletable flag; it may run from another goroutine.

func (*MmsConnection) ReadNamedVariableListValues added in v1.1.1

func (c *MmsConnection) ReadNamedVariableListValues(domainID, listName string, specification bool) (*MmsValue, error)

ReadNamedVariableListValues reads the values of a domain or VMD scoped named variable list. Pass domainID as "" for VMD scope. specification should be true for IEC 61850 compliant requests. Returns a single MmsValue of type Array (Value is []*MmsValue) or nil on empty/error. Caller does not free the result.

func (*MmsConnection) ReadNamedVariableListValuesAsync added in v1.1.1

func (c *MmsConnection) ReadNamedVariableListValuesAsync(domainID, listName string, specification bool, callback func(*MmsValue, error)) error

ReadNamedVariableListValuesAsync reads the values of a domain or VMD scoped named variable list asynchronously. Pass domainID as "" for VMD scope. specification should be true for IEC 61850 compliant requests. The callback receives a single MmsValue of type Array (Value is []*MmsValue) or nil on error. Caller does not own the value.

func (*MmsConnection) ReadVariableAsync added in v1.1.1

func (c *MmsConnection) ReadVariableAsync(domainID, itemID string, callback func(*MmsValue, error)) error

ReadVariableAsync reads a single variable asynchronously. The callback receives the value and any error. On success the value is non-nil (caller does not free it). The callback may be invoked from a different goroutine.

func (*MmsConnection) RenameFile added in v1.1.1

func (c *MmsConnection) RenameFile(currentName, newName string) error

RenameFile renames a file on the server.

func (*MmsConnection) SendRawData added in v1.1.1

func (c *MmsConnection) SendRawData(buffer []byte) error

SendRawData sends raw data on the connection (for test purposes). buffer is the payload to send.

func (*MmsConnection) SetConnectTimeout added in v1.1.1

func (c *MmsConnection) SetConnectTimeout(timeoutMs uint32)

SetConnectTimeout sets the connect timeout in milliseconds.

func (*MmsConnection) SetFilestoreBasepath added in v1.1.1

func (c *MmsConnection) SetFilestoreBasepath(basepath string)

SetFilestoreBasepath sets the virtual filestore basepath for MMS file services (client side). Requires CONFIG_SET_FILESTORE_BASEPATH_AT_RUNTIME in the C library.

func (*MmsConnection) SetInformationReportHandler added in v1.1.1

func (c *MmsConnection) SetInformationReportHandler(callback func(domainName, variableListName string, value *MmsValue, isVariableListName bool))

SetInformationReportHandler sets the handler for MMS information reports (unsolicited updates). Pass nil to clear.

func (*MmsConnection) SetIsoConnectionParameters added in v1.1.1

func (c *MmsConnection) SetIsoConnectionParameters(
	localTSelector, localSSelector, localPSelector []byte,
	remoteTSelector, remoteSSelector, remotePSelector []byte,
)

SetIsoConnectionParameters sets the ISO layer selectors (T, S, P) for local and remote. Pass nil or empty slice for a selector to leave it unchanged or empty. T selector max 4 bytes, S and P selectors max 16 bytes.

func (*MmsConnection) SetLocalDetail added in v1.1.1

func (c *MmsConnection) SetLocalDetail(localDetail int32)

SetLocalDetail sets the maximum MMS PDU size (local detail) for this connection.

func (*MmsConnection) SetMaxOutstandingCalls added in v1.1.1

func (c *MmsConnection) SetMaxOutstandingCalls(calling, called int)

SetMaxOutstandingCalls sets the maximum outstanding calls (calling and called) for this connection.

func (*MmsConnection) SetRawMessageHandler added in v1.1.1

func (c *MmsConnection) SetRawMessageHandler(callback func(message []byte, received bool))

SetRawMessageHandler sets a callback that receives every raw MMS message (sent or received). Pass nil to clear. The callback may be invoked from a different goroutine; received is true for incoming, false for outgoing.

func (*MmsConnection) SetRequestTimeout added in v1.1.1

func (c *MmsConnection) SetRequestTimeout(timeoutMs uint32)

SetRequestTimeout sets the request timeout in milliseconds.

func (*MmsConnection) Tick added in v1.1.1

func (c *MmsConnection) Tick() bool

Tick processes connection events for non-threaded mode. Call periodically. Returns true if more work is pending.

func (*MmsConnection) WriteArrayElements added in v1.1.1

func (c *MmsConnection) WriteArrayElements(domainID, itemID string, index, numberOfElements int, value *MmsValueRef) (MmsDataAccessError, error)

WriteArrayElements writes one or more array elements. index is the first element; numberOfElements is the count (0 = single element). value is the data to write (MmsValueRef, not consumed).

func (*MmsConnection) WriteMultipleVariables added in v1.1.1

func (c *MmsConnection) WriteMultipleVariables(domainID string, items []string, values []*MmsValueRef, accessResults *[]MmsDataAccessError) error

WriteMultipleVariables writes multiple variables in one request. items and values must have the same length; values are C-backed MmsValueRefs. If accessResults is non-nil it is filled with the per-variable data access error results.

func (*MmsConnection) WriteNamedVariableList added in v1.1.1

func (c *MmsConnection) WriteNamedVariableList(domainID, listName string, values []*MmsValueRef, accessResults *[]MmsDataAccessError) error

WriteNamedVariableList writes values to a domain or VMD scoped named variable list. Pass domainID as "" for VMD scope. values must contain one MmsValueRef per list entry (not consumed). If accessResults is non-nil it is filled with the per-variable data access error results.

func (*MmsConnection) WriteVariableAsync added in v1.1.1

func (c *MmsConnection) WriteVariableAsync(domainID, itemID string, value *MmsValueRef, callback func(error)) error

WriteVariableAsync writes a single variable asynchronously. value must be a valid MmsValueRef (C-backed). The callback is invoked with nil on success or an error. It may be invoked from a different goroutine.

type MmsConnectionParameters added in v1.1.1

type MmsConnectionParameters struct {
	MaxServOutstandingCalling int32
	MaxServOutstandingCalled  int32
	DataStructureNestingLevel int32
	MaxPduSize                int32
	ServicesSupported         [11]uint8
}

MmsConnectionParameters holds MMS layer connection parameters (max outstanding calls, PDU size, etc.). Returned by Client.GetConnectionParameters after connection is established.

type MmsDataAccessError

type MmsDataAccessError int
const (
	DATA_ACCESS_ERROR_SUCCESS_NO_UPDATE             MmsDataAccessError = -3
	DATA_ACCESS_ERROR_NO_RESPONSE                   MmsDataAccessError = -2
	DATA_ACCESS_ERROR_SUCCESS                       MmsDataAccessError = -1
	DATA_ACCESS_ERROR_OBJECT_INVALIDATED            MmsDataAccessError = 0
	DATA_ACCESS_ERROR_HARDWARE_FAULT                MmsDataAccessError = 1
	DATA_ACCESS_ERROR_TEMPORARILY_UNAVAILABLE       MmsDataAccessError = 2
	DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED          MmsDataAccessError = 3
	DATA_ACCESS_ERROR_OBJECT_UNDEFINED              MmsDataAccessError = 4
	DATA_ACCESS_ERROR_INVALID_ADDRESS               MmsDataAccessError = 5
	DATA_ACCESS_ERROR_TYPE_UNSUPPORTED              MmsDataAccessError = 6
	DATA_ACCESS_ERROR_TYPE_INCONSISTENT             MmsDataAccessError = 7
	DATA_ACCESS_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT MmsDataAccessError = 8
	DATA_ACCESS_ERROR_OBJECT_ACCESS_UNSUPPORTED     MmsDataAccessError = 9
	DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT          MmsDataAccessError = 10
	DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID          MmsDataAccessError = 11
	DATA_ACCESS_ERROR_UNKNOWN                       MmsDataAccessError = 12
	DATA_ACCESS_ERROR_TYPE_CONFLICT                 MmsDataAccessError = 13
)

type MmsDeletable added in v1.1.1

type MmsDeletable = MmsDeletableType

MmsDeletable is an alias for MmsDeletableType for compatibility.

type MmsDeletableType added in v1.1.1

type MmsDeletableType int32

MmsDeletableType indicates whether a named variable list (or similar) is deletable and by whom.

type MmsFileAccessAttribute added in v1.1.1

type MmsFileAccessAttribute int32

MmsFileAccessAttribute describes file access permissions (bitmask).

type MmsFileDirectoryEntryEx added in v1.1.1

type MmsFileDirectoryEntryEx struct {
	Filename         string
	FileSize         uint32
	LastModifiedTime uint64
	FileAttributes   uint32
}

MmsFileDirectoryEntryEx holds extended file directory entry (name, size, last modified, attributes).

type MmsFileServiceType added in v1.1.1

type MmsFileServiceType int

MmsFileServiceType indicates the type of MMS file service requested.

const (
	MmsFileAccessReadDirectory MmsFileServiceType = 0
	MmsFileAccessOpen          MmsFileServiceType = 1
	MmsFileAccessObtain        MmsFileServiceType = 2
	MmsFileAccessDelete        MmsFileServiceType = 3
	MmsFileAccessRename        MmsFileServiceType = 4
)

type MmsGetNameListType added in v1.1.1

type MmsGetNameListType int

MmsGetNameListType indicates the type of GetNameList request (domains, journals, data sets, or data).

const (
	MmsGetNameListDomains  MmsGetNameListType = 0
	MmsGetNameListJournals MmsGetNameListType = 1
	MmsGetNameListDataSets MmsGetNameListType = 2
	MmsGetNameListData     MmsGetNameListType = 3
)

type MmsJournalEntry added in v1.1.1

type MmsJournalEntry struct {
	EntryID      []byte
	OccurTime    uint64
	EntryContent *MmsValue
}

MmsJournalEntry holds a single journal entry (entry ID bytes, occurrence time, content).

type MmsJournalVariable added in v1.1.1

type MmsJournalVariable int32

MmsJournalVariable identifies a journal variable type (tag or entry ID).

type MmsJournalVariableSpec added in v1.1.1

type MmsJournalVariableSpec struct {
	Tag       string
	ValueSpec *MmsVariableSpecificationRef
}

MmsJournalVariableSpec specifies a journal variable (tag and optional value spec).

type MmsNamedVariableList added in v1.1.1

type MmsNamedVariableList C.MmsNamedVariableList

MmsNamedVariableList is the C named variable list pointer type (opaque; used on server side).

type MmsNamedVariableListAttributes added in v1.1.1

type MmsNamedVariableListAttributes struct {
	IsDeletable   bool
	DeletableType MmsDeletable
	ListType      MmsNamedVariableListType
	Variables     []MmsVariableAccessSpec
}

MmsNamedVariableListAttributes holds attributes of a named variable list (deletable, list type, variable specs).

type MmsNamedVariableListType added in v1.1.1

type MmsNamedVariableListType int32

MmsNamedVariableListType indicates the scope of a named variable list.

type MmsServerConnection added in v1.1.1

type MmsServerConnection struct {
	Connection    C.MmsServerConnection
	RemoteAddress string
	LocalAddress  string
}

MmsServerConnection represents an MMS server-side client connection. RemoteAddress and LocalAddress may be set when the library exports MmsServerConnection_getClientAddress/getLocalAddress.

type MmsServerConnectionState added in v1.1.1

type MmsServerConnectionState int32

MmsServerConnectionState represents the state of an MMS server connection.

type MmsServerIdentity added in v1.1.1

type MmsServerIdentity struct {
	VendorName string
	ModelName  string
	Revision   string
}

MmsServerIdentity holds the result of MMS Identify (VMD identity).

type MmsServerState added in v1.1.1

type MmsServerState int32

MmsServerState represents the MMS server state.

type MmsServerStatus added in v1.1.1

type MmsServerStatus struct {
	VmdLogicalStatus  int32
	VmdPhysicalStatus int32
	LocalDetail       int32
}

MmsServerStatus holds the result of GetServerStatus (VMD logical/physical status).

type MmsServiceSupportedBitmap added in v1.1.1

type MmsServiceSupportedBitmap uint32

MmsServiceSupportedBitmap is a bitmap of supported MMS services.

type MmsType

type MmsType int
const (
	Array MmsType = iota
	Structure
	Boolean
	BitString
	Integer
	Unsigned
	Float
	OctetString
	VisibleString
	GeneralizedTime
	BinaryTime
	Bcd
	ObjId
	String
	UTCTime
	DataAccessError
	Int8
	Int16
	Int32
	Int64
	Uint8
	Uint16
	Uint32
)

data types

type MmsTypeSpecification added in v1.1.1

type MmsTypeSpecification = MmsVariableSpecification

MmsTypeSpecification: in libiec61850 type information is represented by MmsVariableSpecification. This alias exists for API compatibility with the MMS type specification concept.

type MmsValue

type MmsValue struct {
	Type  MmsType
	Value interface{}
}

func CMmsValueToMmsValue added in v1.1.1

func CMmsValueToMmsValue(cVal *C.MmsValue) *MmsValue

CMmsValueToMmsValue converts a C MmsValue to the high-level Go MmsValue. The caller retains ownership of the C value (e.g. must call MmsValue_delete if the C layer transferred it).

func (*MmsValue) DeleteAllBitStringBits added in v1.1.1

func (v *MmsValue) DeleteAllBitStringBits() error

DeleteAllBitStringBits clears all bits. Requires a C-backed value; use MmsValueRef for in-place bit manipulation.

func (*MmsValue) GetBitStringAsInteger added in v1.1.1

func (v *MmsValue) GetBitStringAsInteger() (uint32, error)

GetBitStringAsInteger returns the bit string as an unsigned integer (little-endian). Only valid when v.Type == BitString and v.Value is uint32.

func (*MmsValue) GetBitStringAsIntegerBigEndian added in v1.1.1

func (v *MmsValue) GetBitStringAsIntegerBigEndian() (uint32, error)

GetBitStringAsIntegerBigEndian returns the bit string as an unsigned integer (big-endian). Only valid when v.Type == BitString and v.Value is uint32 (bits are reordered).

func (*MmsValue) GetDataAccessError added in v1.1.1

func (v *MmsValue) GetDataAccessError() (MmsDataAccessError, error)

GetDataAccessError returns the data access error code when the value type is DataAccessError. Only valid when v.Type == DataAccessError and Value holds an int or MmsDataAccessError.

func (*MmsValue) SetAllBitStringBits added in v1.1.1

func (v *MmsValue) SetAllBitStringBits() error

SetAllBitStringBits sets all bits. Requires a C-backed value; use MmsValueRef for in-place bit manipulation.

func (*MmsValue) SetBitStringFromInteger added in v1.1.1

func (v *MmsValue) SetBitStringFromInteger(value uint32) error

SetBitStringFromInteger sets the bit string from an unsigned integer (little-endian). Only valid when v.Type == BitString.

func (*MmsValue) SetBitStringFromIntegerBigEndian added in v1.1.1

func (v *MmsValue) SetBitStringFromIntegerBigEndian(value uint32) error

SetBitStringFromIntegerBigEndian sets the bit string from an unsigned integer (big-endian). Only valid when v.Type == BitString.

type MmsValueRef added in v1.1.1

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

MmsValueRef wraps a C MmsValue pointer for use with MMS value constructors and accessors. The caller is responsible for calling Free() when the value is no longer needed, unless the value is passed to Client.Write (which does not take ownership).

BitString integer conversions: use GetBitStringAsInteger, SetBitStringFromInteger, GetBitStringAsIntegerBigEndian, SetBitStringFromIntegerBigEndian on *MmsValueRef (the C-backed type). The high-level MmsValue type (Type + Value) does not hold a C pointer.

func DecodeMmsData added in v1.1.1

func DecodeMmsData(buffer []byte, startPos, length int) (value *MmsValueRef, endPos int)

DecodeMmsData decodes BER-encoded MMS data from buffer[startPos:startPos+length] and returns a new MmsValueRef. The caller must call Free() on the returned value when done. endPos is the buffer position after the decoded value.

func MmsValueCreateArray added in v1.1.1

func MmsValueCreateArray(elementType *MmsVariableSpecificationRef, size int) *MmsValueRef

MmsValueCreateArray creates an array with elements described by elementType and initializes with default values. Caller must call Free() when done.

func MmsValueCreateEmptyArray added in v1.1.1

func MmsValueCreateEmptyArray(size int) *MmsValueRef

MmsValueCreateEmptyArray creates an empty array of the given size. Caller must call Free() when done.

func MmsValueNewDefaultValue added in v1.1.1

func MmsValueNewDefaultValue(typeSpec *MmsVariableSpecificationRef) *MmsValueRef

MmsValueNewDefaultValue creates a new MmsValue with default value for the given type specification. Caller must call Free() when done.

func NewMmsValueBinaryTime added in v1.1.1

func NewMmsValueBinaryTime(timeOfDay bool) *MmsValueRef

NewMmsValueBinaryTime creates an MMS binary time value. If timeOfDay is true, only time-of-day (4 octets) is used. Caller must call Free() when done.

func NewMmsValueBitString added in v1.1.1

func NewMmsValueBitString(bitSize int) *MmsValueRef

NewMmsValueBitString creates a bit string of the given size in bits. Caller must call Free() when done.

func NewMmsValueDataAccessError added in v1.1.1

func NewMmsValueDataAccessError(accessError MmsDataAccessError) *MmsValueRef

NewMmsValueDataAccessError creates an MMS data access error value. Caller must call Free() when done.

func NewMmsValueMmsString added in v1.1.1

func NewMmsValueMmsString(s string) *MmsValueRef

NewMmsValueMmsString creates an MMS string value. Caller must call Free() when done.

func NewMmsValueMmsStringWithSize added in v1.1.1

func NewMmsValueMmsStringWithSize(size int) *MmsValueRef

NewMmsValueMmsStringWithSize creates an empty MMS string with the given maximum size. Caller must call Free() when done.

func NewMmsValueUtcTimeByMsTime added in v1.1.1

func NewMmsValueUtcTimeByMsTime(timevalMs uint64) *MmsValueRef

NewMmsValueUtcTimeByMsTime creates an MMS UTC time value from milliseconds since Unix epoch. Caller must call Free() when done.

func NewMmsValueVisibleString added in v1.1.1

func NewMmsValueVisibleString(s string) *MmsValueRef

NewMmsValueVisibleString creates an MMS visible string value. Caller must call Free() when done.

func NewMmsValueVisibleStringWithSize added in v1.1.1

func NewMmsValueVisibleStringWithSize(size int) *MmsValueRef

NewMmsValueVisibleStringWithSize creates an empty visible string with the given maximum size. Caller must call Free() when done.

func (*MmsValueRef) EncodeMmsData added in v1.1.1

func (r *MmsValueRef) EncodeMmsData(buffer []byte, startPos int, encode bool) int

EncodeMmsData encodes the value as BER-encoded MMS data into buffer starting at startPos. If encode is false, no bytes are written and the returned length is the encoded size only (buffer may be nil). Returns the encoded length in bytes.

func (*MmsValueRef) Free added in v1.1.1

func (r *MmsValueRef) Free()

Free releases the C memory associated with the MmsValue. It is safe to call multiple times.

func (*MmsValueRef) GetArraySize added in v1.1.1

func (r *MmsValueRef) GetArraySize() uint32

GetArraySize returns the number of elements in an array or structure. The value must be of type MMS_ARRAY or MMS_STRUCTURE.

func (*MmsValueRef) GetBinaryTimeAsUtcMs added in v1.1.1

func (r *MmsValueRef) GetBinaryTimeAsUtcMs() uint64

GetBinaryTimeAsUtcMs returns the value in milliseconds since Unix epoch.

func (*MmsValueRef) GetBitStringAsInteger added in v1.1.1

func (r *MmsValueRef) GetBitStringAsInteger() uint32

GetBitStringAsInteger returns the bit string as an unsigned integer (little-endian bit order).

func (*MmsValueRef) GetBitStringAsIntegerBigEndian added in v1.1.1

func (r *MmsValueRef) GetBitStringAsIntegerBigEndian() uint32

GetBitStringAsIntegerBigEndian returns the bit string as an unsigned integer (big-endian bit order).

func (*MmsValueRef) GetBitStringSize added in v1.1.1

func (r *MmsValueRef) GetBitStringSize() int

GetBitStringSize returns the size of the bit string in bits.

func (*MmsValueRef) GetDataAccessError added in v1.1.1

func (r *MmsValueRef) GetDataAccessError() MmsDataAccessError

GetDataAccessError returns the data access error code when the value type is MMS_DATA_ACCESS_ERROR.

func (*MmsValueRef) GetElement added in v1.1.1

func (r *MmsValueRef) GetElement(index int) *MmsValueRef

GetElement returns the element at the given index (array or structure). Caller does not own the returned value.

func (*MmsValueRef) GetNumberOfSetBits added in v1.1.1

func (r *MmsValueRef) GetNumberOfSetBits() int

GetNumberOfSetBits returns the number of bits set to 1 in a bit string. Returns 0 for non–bit-string values.

func (*MmsValueRef) GetSizeInMemory added in v1.1.1

func (r *MmsValueRef) GetSizeInMemory() int

GetSizeInMemory returns the approximate size in bytes of the value representation in memory.

func (*MmsValueRef) GetType added in v1.1.1

func (r *MmsValueRef) GetType() MmsType

GetType returns the MMS type of the value.

func (*MmsValueRef) SetBinaryTime added in v1.1.1

func (r *MmsValueRef) SetBinaryTime(timestampMs uint64)

SetBinaryTime sets the value in milliseconds since Unix epoch.

func (*MmsValueRef) SetBitStringFromInteger added in v1.1.1

func (r *MmsValueRef) SetBitStringFromInteger(val uint32)

SetBitStringFromInteger sets the bit string from an unsigned integer (little-endian bit order).

func (*MmsValueRef) SetBitStringFromIntegerBigEndian added in v1.1.1

func (r *MmsValueRef) SetBitStringFromIntegerBigEndian(val uint32)

SetBitStringFromIntegerBigEndian sets the bit string from an unsigned integer (big-endian bit order).

func (*MmsValueRef) SetElement added in v1.1.1

func (r *MmsValueRef) SetElement(index int, v *MmsValueRef)

SetElement sets the element at the given index. If an element already exists it is replaced; the caller is responsible for freeing the replaced value. v is not consumed (caller still owns it).

func (*MmsValueRef) SetMmsString added in v1.1.1

func (r *MmsValueRef) SetMmsString(s string)

SetMmsString sets the value of an MMS string. The ref must be of type MMS_STRING.

func (*MmsValueRef) SetVisibleString added in v1.1.1

func (r *MmsValueRef) SetVisibleString(s string)

SetVisibleString sets the value of a visible string. The ref must be of type MMS_VISIBLE_STRING.

func (*MmsValueRef) ToDouble added in v1.1.1

func (r *MmsValueRef) ToDouble() float64

ToDouble returns the value as float64. The underlying MmsValue must be of type MMS_FLOAT.

func (*MmsValueRef) ToInt64 added in v1.1.1

func (r *MmsValueRef) ToInt64() int64

ToInt64 returns the value as int64. The underlying MmsValue must be of type MMS_INTEGER or MMS_UNSIGNED.

func (*MmsValueRef) ToUint32 added in v1.1.1

func (r *MmsValueRef) ToUint32() uint32

ToUint32 returns the value as uint32. The underlying MmsValue must be of type MMS_INTEGER or MMS_UNSIGNED.

type MmsVariableAccessAttribute added in v1.1.1

type MmsVariableAccessAttribute int32

MmsVariableAccessAttribute describes variable access (read/write) for MMS variable attributes.

type MmsVariableAccessSpec added in v1.1.1

type MmsVariableAccessSpec struct {
	DomainID string
	ItemID   string
}

MmsVariableAccessSpec describes a variable reference in a named variable list (domain + item).

type MmsVariableListAccessType added in v1.1.1

type MmsVariableListAccessType int

MmsVariableListAccessType indicates the kind of named variable list access (create, delete, read, write, get directory).

const (
	MmsVarlistCreate       MmsVariableListAccessType = 0
	MmsVarlistDelete       MmsVariableListAccessType = 1
	MmsVarlistRead         MmsVariableListAccessType = 2
	MmsVarlistWrite        MmsVariableListAccessType = 3
	MmsVarlistGetDirectory MmsVariableListAccessType = 4
)

type MmsVariableListAttributes added in v1.1.1

type MmsVariableListAttributes struct {
	IsDeletable   bool
	DeletableType MmsDeletableType
	NumberOfItems int32
	VariableNames []string
}

MmsVariableListAttributes holds attributes of a named variable list (deletable, variable names).

type MmsVariableListType added in v1.1.1

type MmsVariableListType int

MmsVariableListType indicates the scope of the named variable list (domain, association, or VMD specific).

const (
	MmsVarlistTypeDomainSpecific      MmsVariableListType = 0
	MmsVarlistTypeAssociationSpecific MmsVariableListType = 1
	MmsVarlistTypeVmdSpecific         MmsVariableListType = 2
)

type MmsVariableSpecification added in v1.1.1

type MmsVariableSpecification C.MmsVariableSpecification

MmsVariableSpecification is the C MmsVariableSpecification struct type (for type mapping). Use MmsVariableSpecificationRef for API calls that return or take variable specifications.

type MmsVariableSpecificationRef added in v1.1.1

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

MmsVariableSpecificationRef wraps a C MmsVariableSpecification pointer, typically obtained from Client.GetVariableAccessAttributes, MmsConnection.GetVariableAccessAttributes(Async), or from NewMmsVariableSpecification / CreateStructure / CreateArray. Caller must call Free() on the root ref when done. Do not call Free() on refs returned by GetChildSpecificationByIndex, GetChildSpecificationByName, or GetArrayElementSpecification.

func CreateArray added in v1.1.1

func CreateArray(name string, elementType *MmsVariableSpecificationRef, elementCount int) *MmsVariableSpecificationRef

CreateArray creates an array type specification with the given element type and length. The elementType ref is incorporated; do not call Free() on it after. Caller must call Free() on the returned ref when done.

func CreateStructure added in v1.1.1

func CreateStructure(name string, elements []*MmsVariableSpecificationRef) *MmsVariableSpecificationRef

CreateStructure creates a structure type specification containing the given element specs. The element refs are incorporated into the structure; do not call Free() on them after. Caller must call Free() on the returned ref when done.

func NewMmsVariableSpecification added in v1.1.1

func NewMmsVariableSpecification(typ MmsType, name string, size int) *MmsVariableSpecificationRef

NewMmsVariableSpecification creates a simple type specification. Caller must call Free() when done. Size meaning: bit width for MMS_INTEGER, MMS_UNSIGNED, MMS_BIT_STRING; max bytes for MMS_OCTET_STRING, MMS_VISIBLE_STRING, MMS_STRING; exponent width for MMS_FLOAT (e.g. 11 for double); 4 or 6 for MMS_BINARY_TIME. Name may be empty. For MMS_BOOLEAN and other types with no size, pass 0.

func (*MmsVariableSpecificationRef) Free added in v1.1.1

func (r *MmsVariableSpecificationRef) Free()

Free releases the C memory for a root ref. It is a no-op for child refs and safe to call multiple times.

func (*MmsVariableSpecificationRef) GetArrayElementSpecification added in v1.1.1

func (r *MmsVariableSpecificationRef) GetArrayElementSpecification() *MmsVariableSpecificationRef

GetArrayElementSpecification returns the element type specification for an array. Do not call Free() on the returned ref.

func (*MmsVariableSpecificationRef) GetChildSpecificationByIndex added in v1.1.1

func (r *MmsVariableSpecificationRef) GetChildSpecificationByIndex(index int) *MmsVariableSpecificationRef

GetChildSpecificationByIndex returns the child variable specification at the given index (for structure or array). Do not call Free() on the returned ref.

func (*MmsVariableSpecificationRef) GetChildSpecificationByName added in v1.1.1

func (r *MmsVariableSpecificationRef) GetChildSpecificationByName(name string) *MmsVariableSpecificationRef

GetChildSpecificationByName returns the child variable specification with the given name. Do not call Free() on the returned ref.

func (*MmsVariableSpecificationRef) GetChildValue added in v1.1.1

func (r *MmsVariableSpecificationRef) GetChildValue(value *MmsValueRef, childId string) *MmsValueRef

GetChildValue returns the child of value corresponding to the relative MMS path childId (use "$" as separator). The ref must be for a structure; value must be the corresponding MmsValue. Caller does not own the returned value.

func (*MmsVariableSpecificationRef) GetExponentWidth added in v1.1.1

func (r *MmsVariableSpecificationRef) GetExponentWidth() int

GetExponentWidth returns the exponent width for floating-point types; returns a meaningful value only for MMS_FLOAT/MMS_VISIBLE_STRING etc. as defined by the library.

func (*MmsVariableSpecificationRef) GetName added in v1.1.1

func (r *MmsVariableSpecificationRef) GetName() string

GetName returns the variable name. The returned string is only valid while the specification exists.

func (*MmsVariableSpecificationRef) GetNamedVariableRecursive added in v1.1.1

func (r *MmsVariableSpecificationRef) GetNamedVariableRecursive(nameId string) *MmsVariableSpecificationRef

GetNamedVariableRecursive returns the variable specification of the child specified by the relative MMS name nameId (use "$" as separator). Do not call Free() on the returned ref.

func (*MmsVariableSpecificationRef) GetSize added in v1.1.1

func (r *MmsVariableSpecificationRef) GetSize() int

GetSize returns the number of elements for structures/arrays, or bit/byte size for other types. Returns -1 if not applicable.

func (*MmsVariableSpecificationRef) GetStructureElements added in v1.1.1

func (r *MmsVariableSpecificationRef) GetStructureElements() []string

GetStructureElements returns a list of structure element names for MMS_STRUCTURE types. Caller must not free the returned strings (they are valid while the spec exists).

func (*MmsVariableSpecificationRef) GetType added in v1.1.1

func (r *MmsVariableSpecificationRef) GetType() MmsType

GetType returns the MMS type of the variable.

func (*MmsVariableSpecificationRef) IsValueOfType added in v1.1.1

func (r *MmsVariableSpecificationRef) IsValueOfType(v *MmsValueRef) bool

IsValueOfType checks whether the given value has exactly the same type as this variable specification.

type ModelNode

type ModelNode struct {
	ObjectReference string
	// contains filtered or unexported fields
}

func (*ModelNode) ConvertToDataObject

func (m *ModelNode) ConvertToDataObject() *DataObject

func (*ModelNode) GetLogicalNode

func (m *ModelNode) GetLogicalNode(node string) *LogicalNode

type ObtainFileHandler added in v1.1.1

type ObtainFileHandler func(sourceFilename, destinationFilename string) bool

ObtainFileHandler is called when a client uploads a file (obtainFile). Return true to allow, false to deny.

type OptFlds

type OptFlds struct {
	SequenceNumber     bool // 顺序号
	TimeOfEntry        bool // 报告时标
	ReasonForInclusion bool // 原因码
	DataSetName        bool // 数据集
	DataReference      bool // 数据引用
	BufferOverflow     bool // 缓存溢出标识
	EntryID            bool // 报告标识符
	ConfigRevision     bool // 配置版本号
}

type PhyComAddress added in v1.1.0

type PhyComAddress struct {
	Addr         [6]byte // MAC address (6 bytes)
	VlanPriority uint8   // VLAN priority (0-7)
	VlanId       uint16  // VLAN ID
	AppId        uint16  // Application ID (APPID)
}

PhyComAddress represents Ethernet address and VLAN attributes for GOOSE/SV

type Quality

type Quality uint16
const (
	QUALITY_VALIDITY_GOOD         Quality = 0
	QUALITY_VALIDITY_INVALID      Quality = 2
	QUALITY_VALIDITY_RESERVED     Quality = 1
	QUALITY_VALIDITY_QUESTIONABLE Quality = 3
	QUALITY_DETAIL_OVERFLOW       Quality = 4
	QUALITY_DETAIL_OUT_OF_RANGE   Quality = 8
	QUALITY_DETAIL_BAD_REFERENCE  Quality = 16
	QUALITY_DETAIL_OSCILLATORY    Quality = 32
	QUALITY_DETAIL_FAILURE        Quality = 64
	QUALITY_DETAIL_OLD_DATA       Quality = 128
	QUALITY_DETAIL_INCONSISTENT   Quality = 256
	QUALITY_DETAIL_INACCURATE     Quality = 512
	QUALITY_SOURCE_SUBSTITUTED    Quality = 1024
	QUALITY_TEST                  Quality = 2048
	QUALITY_OPERATOR_BLOCKED      Quality = 4096
	QUALITY_DERIVED               Quality = 8192
)

func (Quality) GetValidity

func (receiver Quality) GetValidity() Validity

type ReadJournalHandler added in v1.1.1

type ReadJournalHandler func(domainID, logName string) bool

ReadJournalHandler is called when a client accesses a journal. Return true to allow, false to deny.

type ReasonForInclusion

type ReasonForInclusion int
const (
	IEC61850_REASON_NOT_INCLUDED   ReasonForInclusion = 0
	IEC61850_REASON_DATA_CHANGE    ReasonForInclusion = 1
	IEC61850_REASON_QUALITY_CHANGE ReasonForInclusion = 2
	IEC61850_REASON_DATA_UPDATE    ReasonForInclusion = 4
	IEC61850_REASON_INTEGRITY      ReasonForInclusion = 8
	IEC61850_REASON_GI             ReasonForInclusion = 16
	IEC61850_REASON_UNKNOWN        ReasonForInclusion = 32
)

func (ReasonForInclusion) GetValueAsString

func (reason ReasonForInclusion) GetValueAsString() string

type ReportCallbackFunction

type ReportCallbackFunction func(clientReport ClientReport)

type ReportSetting

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

type SVPublisher

type SVPublisher struct {
	sync.RWMutex

	Conf SvPublisherConf
	// contains filtered or unexported fields
}

func NewSVPublisher

func NewSVPublisher(conf SvPublisherConf) *SVPublisher

func (*SVPublisher) AddSvASDU

func (receiver *SVPublisher) AddSvASDU(svID string, dataset string, confRev uint32) *SvPublisherASDU

func (*SVPublisher) Destroy

func (receiver *SVPublisher) Destroy()

func (*SVPublisher) Publish

func (receiver *SVPublisher) Publish()

func (*SVPublisher) SetupComplete

func (receiver *SVPublisher) SetupComplete() *SVPublisher

type ServerConfig

type ServerConfig struct {
	Edition                        uint8  // IEC 61850 edition (use Edition1, Edition2, or Edition21 constants)
	ReportBufferSize               int    // size of the report buffer associated with a buffered report control block
	ReportBufferSizeForURCBs       int    // size of the report buffer associated with an unbuffered report control block
	MaxConnections                 int    // maximum number of MMS (TCP) connections
	SyncIntegrityReportTimes       bool   // integrity report start times will by synchronized with straight numbers
	EnableFileService              bool   // when true (default) enable MMS file service
	FileServiceBasePath            string // Base path (directory where the file service serves files
	EnableDynamicDataSetService    bool   // when true (default) enable dynamic data set services for MMS
	MaxAssociationSpecificDataSets int    // the maximum number of allowed association specific data sets
	MaxDomainSpecificDataSets      int    // the maximum number of allowed domain specific data sets
	MaxDataSetEntries              int    // maximum number of data set entries of dynamic data sets
	EnableLogService               bool   // when true (default) enable log service
	EnableEditSG                   bool   // enable EditSG service
	EnableResvTmsForSGCB           bool   // enable visibility of SGCB.ResvTms
	EnableResvTmsForBRCB           bool   // BRCB has resvTms attribute - only edition 2
	EnableOwnerForRCB              bool   // RCB has owner attribute
	UseIntegratedGoosePublisher    bool   // when true (default) the integrated GOOSE publisher is used
	// contains filtered or unexported fields
}

func NewServerConfig

func NewServerConfig() ServerConfig

NewServerConfig creates a new ServerConfig object with default values

func (ServerConfig) SetReportSetting

func (that ServerConfig) SetReportSetting(setting uint8, isDyn bool)

SetReportSetting Make a configurable report setting writeable or read-only

Parameters:

setting: one of IEC61850_REPORTSETTINGS_RPT_ID, _BUF_TIME, _DATSET, _TRG_OPS, _OPT_FIELDS, _INTG_PD
isDyn: true, when setting is writable ("Dyn") or false, when read-only

type SettingGroup

type SettingGroup struct {
	NumOfSG int
	ActSG   int
	EditSG  int
	CnfEdit bool
}

type Settings

type Settings struct {
	Host           string
	Port           int
	ConnectTimeout uint // 连接超时配置,单位:毫秒
	RequestTimeout uint // 请求超时配置,单位:毫秒
}

Settings 连接配置

func NewSettings

func NewSettings() Settings

type SubscriberConf

type SubscriberConf struct {
	InterfaceID   string
	DstMacAddr    [6]uint8
	AppID         uint16
	Subscriber    string
	ReportHandler GooseReportCallback
}

type SvPublisherASDU

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

func (*SvPublisherASDU) AddFloat

func (receiver *SvPublisherASDU) AddFloat() int

func (*SvPublisherASDU) AddFloat64

func (receiver *SvPublisherASDU) AddFloat64() int

func (*SvPublisherASDU) AddInt8

func (receiver *SvPublisherASDU) AddInt8() int

func (*SvPublisherASDU) AddInt32

func (receiver *SvPublisherASDU) AddInt32() int

func (*SvPublisherASDU) AddInt64

func (receiver *SvPublisherASDU) AddInt64() int

func (*SvPublisherASDU) AddQuality

func (receiver *SvPublisherASDU) AddQuality() int

func (*SvPublisherASDU) AddTimestamp

func (receiver *SvPublisherASDU) AddTimestamp() int

func (*SvPublisherASDU) EnableRefrTm

func (receiver *SvPublisherASDU) EnableRefrTm()

func (*SvPublisherASDU) GetSmpCnt

func (receiver *SvPublisherASDU) GetSmpCnt() uint16

func (*SvPublisherASDU) IncreaseSmpCnt

func (receiver *SvPublisherASDU) IncreaseSmpCnt()

func (*SvPublisherASDU) ResetBuffer

func (receiver *SvPublisherASDU) ResetBuffer()

func (*SvPublisherASDU) SetFloat

func (receiver *SvPublisherASDU) SetFloat(index int, value float32)

func (*SvPublisherASDU) SetFloat64

func (receiver *SvPublisherASDU) SetFloat64(index int, value float64)

func (*SvPublisherASDU) SetInt8

func (receiver *SvPublisherASDU) SetInt8(index int, value int8)

func (*SvPublisherASDU) SetInt32

func (receiver *SvPublisherASDU) SetInt32(index int, value int32)

func (*SvPublisherASDU) SetInt64

func (receiver *SvPublisherASDU) SetInt64(index int, value int64)

func (*SvPublisherASDU) SetQuality

func (receiver *SvPublisherASDU) SetQuality(index int, quality Quality)

func (*SvPublisherASDU) SetRefrTmByTimestamp

func (receiver *SvPublisherASDU) SetRefrTmByTimestamp(ts Timestamp)

func (*SvPublisherASDU) SetRefrTmMs

func (receiver *SvPublisherASDU) SetRefrTmMs(ms int64)

func (*SvPublisherASDU) SetRefrTmNs

func (receiver *SvPublisherASDU) SetRefrTmNs(nano int64)

func (*SvPublisherASDU) SetSmpCnt

func (receiver *SvPublisherASDU) SetSmpCnt(value uint16)

func (*SvPublisherASDU) SetSmpCntWrap

func (receiver *SvPublisherASDU) SetSmpCntWrap(limit uint16)

func (*SvPublisherASDU) SetSmpMod

func (receiver *SvPublisherASDU) SetSmpMod(mode uint8)

func (*SvPublisherASDU) SetSmpRate

func (receiver *SvPublisherASDU) SetSmpRate(rate uint16)

func (*SvPublisherASDU) SetSmpSynch

func (receiver *SvPublisherASDU) SetSmpSynch(sync uint16)

func (*SvPublisherASDU) SetTimestamp

func (receiver *SvPublisherASDU) SetTimestamp(index int, ts *Timestamp)

type SvPublisherConf

type SvPublisherConf struct {
	EtherName    string
	AppID        uint16
	DstAddr      [6]uint8
	VlanID       uint16
	VlanPriority uint8
}

type SvReceiver

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

func NewSvReceiver

func NewSvReceiver(conf SvReceiverConf) *SvReceiver

func (*SvReceiver) AddSubscriber

func (receiver *SvReceiver) AddSubscriber(subscriber *SvSubscriber) *SvReceiver

func (*SvReceiver) Destroy

func (receiver *SvReceiver) Destroy()

func (*SvReceiver) DisableAddrCheck

func (receiver *SvReceiver) DisableAddrCheck() *SvReceiver

func (*SvReceiver) EnableAddrCheck

func (receiver *SvReceiver) EnableAddrCheck() *SvReceiver

func (*SvReceiver) IsRunning

func (receiver *SvReceiver) IsRunning() bool

func (*SvReceiver) RemoveSubscriber

func (receiver *SvReceiver) RemoveSubscriber(subscriber *SvSubscriber) *SvReceiver

func (*SvReceiver) Start

func (receiver *SvReceiver) Start() *SvReceiver

func (*SvReceiver) Stop

func (receiver *SvReceiver) Stop() *SvReceiver

func (*SvReceiver) Tick

func (receiver *SvReceiver) Tick() bool

type SvReceiverConf

type SvReceiverConf struct {
	InterfaceID string
}

type SvReport

type SvReport struct {
	ReceiverASDU SvSubscriberASDU
}

type SvReportHandler

type SvReportHandler func(report *SvReport)

type SvSubscriber

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

func NewSvSubscriber

func NewSvSubscriber(conf SvSubscriberConf) *SvSubscriber

type SvSubscriberASDU

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

func (*SvSubscriberASDU) GetConfRev

func (receiver *SvSubscriberASDU) GetConfRev() uint32

func (*SvSubscriberASDU) GetDatSet

func (receiver *SvSubscriberASDU) GetDatSet() string

func (*SvSubscriberASDU) GetDataSize

func (receiver *SvSubscriberASDU) GetDataSize() int

func (*SvSubscriberASDU) GetFloat32

func (receiver *SvSubscriberASDU) GetFloat32(index int) float32

func (*SvSubscriberASDU) GetFloat64

func (receiver *SvSubscriberASDU) GetFloat64(index int) float64

func (*SvSubscriberASDU) GetInt8

func (receiver *SvSubscriberASDU) GetInt8(index int) int8

func (*SvSubscriberASDU) GetInt16

func (receiver *SvSubscriberASDU) GetInt16(index int) int16

func (*SvSubscriberASDU) GetInt32

func (receiver *SvSubscriberASDU) GetInt32(index int) int32

func (*SvSubscriberASDU) GetInt64

func (receiver *SvSubscriberASDU) GetInt64(index int) int64

func (*SvSubscriberASDU) GetQuality

func (receiver *SvSubscriberASDU) GetQuality(index int) Quality

func (*SvSubscriberASDU) GetRefrTmAsMs

func (receiver *SvSubscriberASDU) GetRefrTmAsMs() uint64

func (*SvSubscriberASDU) GetRefrTmAsNs

func (receiver *SvSubscriberASDU) GetRefrTmAsNs() uint64

func (*SvSubscriberASDU) GetSmpCnt

func (receiver *SvSubscriberASDU) GetSmpCnt() uint16

func (*SvSubscriberASDU) GetSmpMod

func (receiver *SvSubscriberASDU) GetSmpMod() uint8

func (*SvSubscriberASDU) GetSmpRate

func (receiver *SvSubscriberASDU) GetSmpRate() uint16

func (*SvSubscriberASDU) GetSmpSynch

func (receiver *SvSubscriberASDU) GetSmpSynch() uint8

func (*SvSubscriberASDU) GetSvID

func (receiver *SvSubscriberASDU) GetSvID() string

func (*SvSubscriberASDU) GetTimestamp

func (receiver *SvSubscriberASDU) GetTimestamp(index int) *Timestamp

func (*SvSubscriberASDU) GetUint8

func (receiver *SvSubscriberASDU) GetUint8(index int) uint8

func (*SvSubscriberASDU) GetUint16

func (receiver *SvSubscriberASDU) GetUint16(index int) uint16

func (*SvSubscriberASDU) GetUint32

func (receiver *SvSubscriberASDU) GetUint32(index int) uint32

func (*SvSubscriberASDU) GetUint64

func (receiver *SvSubscriberASDU) GetUint64(index int) uint64

func (*SvSubscriberASDU) HasDatSet

func (receiver *SvSubscriberASDU) HasDatSet() bool

func (*SvSubscriberASDU) HasRefrTm

func (receiver *SvSubscriberASDU) HasRefrTm() bool

func (*SvSubscriberASDU) HasSmpMod

func (receiver *SvSubscriberASDU) HasSmpMod() bool

func (*SvSubscriberASDU) HasSmpRate

func (receiver *SvSubscriberASDU) HasSmpRate() bool

type SvSubscriberCallbackID

type SvSubscriberCallbackID uintptr

type SvSubscriberConf

type SvSubscriberConf struct {
	EthAddr [6]uint8
	AppID   uint16
	Handler SvReportHandler
}

type TLSConfig

type TLSConfig struct {
	KeyFile                    string // Path to the key file
	KeyPassword                string // Password for the key file
	CertFile                   string // Path to the certificate file
	ChainValidation            bool   // Enable chain validation
	AllowOnlyKnownCertificates bool   // Allow only known certificates
	MinTlsVersion              TLSConfigVersion
	MaxTlsVersion              TLSConfigVersion
	// contains filtered or unexported fields
}

func NewTLSConfig

func NewTLSConfig() *TLSConfig

func (*TLSConfig) AddAllowedCertificateFromFile

func (that *TLSConfig) AddAllowedCertificateFromFile(filename string)

func (*TLSConfig) AddCACertificateFromFile

func (that *TLSConfig) AddCACertificateFromFile(filename string)

func (*TLSConfig) SetEventHandler

func (that *TLSConfig) SetEventHandler(handler *TLSConfigurationEventHandler)

type TLSConfigVersion

type TLSConfigVersion int
const (
	TLS_VERSION_NOT_SELECTED TLSConfigVersion = 0
	TLS_VERSION_SSL_3_0      TLSConfigVersion = 3
	TLS_VERSION_TLS_1_0      TLSConfigVersion = 4
	TLS_VERSION_TLS_1_1      TLSConfigVersion = 5
	TLS_VERSION_TLS_1_2      TLSConfigVersion = 6
	TLS_VERSION_TLS_1_3      TLSConfigVersion = 7
)

type TLSConfiguration added in v1.1.1

type TLSConfiguration struct {
	ChainValidation     bool     // Enable certificate chain validation
	AllowOnlyKnownCerts bool     // Allow only known (explicitly added) certificates
	CACertificates      [][]byte // CA certificates (PEM or DER)
	OwnCertificate      []byte   // Own certificate (PEM or DER)
	OwnKey              []byte   // Own private key (PEM; optional password empty)
}

TLSConfiguration holds TLS settings and in-memory certificates for secure MMS connections.

type TLSConfigurationEventHandler

type TLSConfigurationEventHandler func(parameter unsafe.Pointer, eventLevel, eventCode int, message string, conn C.TLSConnection)

type Timestamp

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

func NewTimestamp

func NewTimestamp(time ...time.Time) *Timestamp

func (*Timestamp) GetSubSecondPrecision

func (receiver *Timestamp) GetSubSecondPrecision() int

func (*Timestamp) GetTime

func (receiver *Timestamp) GetTime() time.Time

func (*Timestamp) GetTimeInMs

func (receiver *Timestamp) GetTimeInMs() uint64

func (*Timestamp) GetTimeInNs

func (receiver *Timestamp) GetTimeInNs() uint64

func (*Timestamp) GetTimeInSeconds

func (receiver *Timestamp) GetTimeInSeconds() uint32

func (*Timestamp) HasClockFailure

func (receiver *Timestamp) HasClockFailure() bool

func (*Timestamp) IsClockNotSynchronized

func (receiver *Timestamp) IsClockNotSynchronized() bool

func (*Timestamp) IsLeapSecondKnown

func (receiver *Timestamp) IsLeapSecondKnown() bool

func (*Timestamp) SetClockFailure

func (receiver *Timestamp) SetClockFailure(value bool) *Timestamp

func (*Timestamp) SetClockNotSynchronized

func (receiver *Timestamp) SetClockNotSynchronized(value bool) *Timestamp

func (*Timestamp) SetLeapSecondKnown

func (receiver *Timestamp) SetLeapSecondKnown(value bool) *Timestamp

func (*Timestamp) SetSubsecondPrecision added in v1.1.6

func (receiver *Timestamp) SetSubsecondPrecision(precision int) *Timestamp

SetSubsecondPrecision sets the number of significant bits of the fractionOfSecond part (IEC 61850 time quality bits 0-4).

func (*Timestamp) SetTime

func (receiver *Timestamp) SetTime(time time.Time) *Timestamp

func (*Timestamp) SetTimeInMilliseconds added in v1.1.6

func (receiver *Timestamp) SetTimeInMilliseconds(epochMs int64) *Timestamp

SetTimeInMilliseconds sets the time from milliseconds since Unix epoch (1970-01-01 00:00:00 UTC).

func (*Timestamp) SetTimeQuality added in v1.1.6

func (receiver *Timestamp) SetTimeQuality(timeQuality uint8) *Timestamp

SetTimeQuality sets the IEC 61850 time quality flags from a single byte: bit 7 = leap seconds known, bit 6 = clock failure, bit 5 = clock not synchronized, bits 0-4 = subsecond precision.

type TrgOps

type TrgOps struct {
	DataChange            bool // 值变化
	QualityChange         bool // 品质变化
	DataUpdate            bool // 数据修改
	TriggeredPeriodically bool // 周期触发
	Gi                    bool // GI(一般审问)请求触发
	Transient             bool // 瞬变
}

type URReport

type URReport struct {
	Data string
}

type UtcTimeValue added in v1.0.13

type UtcTimeValue struct {
	Milliseconds uint64 // Milliseconds since Unix epoch (1970-01-01 00:00:00 UTC)
	TimeQuality  uint8  // IEC 61850 time quality (leapSecondsKnown, clockFailure, clockNotSynchronized, subsecond accuracy)
}

UtcTimeValue holds a UTC time from an MMS UTCTime with millisecond precision and time quality. Returned when reading a UTCTime attribute via Client.Read() or related APIs.

type Validity

type Validity uint16
const (
	VALIDITY_GOOD Validity = iota
	VALIDITY_INVALID
	VALIDITY_RESERVED
	VALIDITY_QUESTIONABLE
)

type VariableAccessSpec added in v1.1.1

type VariableAccessSpec struct {
	DomainID      string
	ItemID        string
	ArrayIndex    int32  // -1 for no array index
	ComponentName string // optional component of array element
}

VariableAccessSpec describes a single variable for defining a named variable list. Use ArrayIndex -1 and ComponentName "" for simple variables; set them for array/component access.

type VariableListAccessHandler added in v1.1.1

type VariableListAccessHandler func(accessType MmsVariableListAccessType, listType MmsVariableListType, domainID, listName string) error

VariableListAccessHandler is called when a client accesses a named variable list. Return nil to allow, or an MmsError to deny. DomainID is empty for association- or VMD-specific lists.

type VariableListEntry added in v1.1.1

type VariableListEntry struct {
	DomainID      string
	ItemID        string
	ArrayIndex    int32
	ComponentName string
}

VariableListEntry is one entry from ReadNamedVariableListDirectory.

type VariableSpec

type VariableSpec struct {
	Name    string
	Type    MmsType
	IsArray bool
	// For arrays
	ArraySize int
	// For structures
	StructureElements []VariableSpec
}

VariableSpec represents MMS variable specification with type information

type WriteAccessHandler

type WriteAccessHandler func(node *ModelNode, mmsValue *MmsValue) MmsDataAccessError

type WriteAccessHandlerForDataObject added in v1.1.1

type WriteAccessHandlerForDataObject func(dataObject *DataObject, dataAttribute *DataAttribute, value *MmsValue) MmsDataAccessError

WriteAccessHandlerForDataObject is called when a client writes to any data attribute of a data object with the given FC.

Jump to

Keyboard shortcuts

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