Versions in this module Expand all Collapse all v1 v1.0.8 Jul 30, 2026 v1.0.7 Jul 30, 2026 v1.0.6 Jul 26, 2026 v1.0.5 Jul 26, 2026 v1.0.4 Jul 20, 2026 v1.0.3 Jul 20, 2026 v1.0.2 Jul 20, 2026 Changes in this version type ControlHandler + SelectTimeout time.Duration type ReportEngine + func (re *ReportEngine) SetRCBBufMax(ldName, rcbItemID string, max int) bool v1.0.1 Jul 20, 2026 Changes in this version + const DefaultSelectTimeout + var ErrCancelFailed = errors.New("iec61850: cancel failed") + var ErrClosed = errors.New("iec61850: connection closed") + var ErrControlFailed = errors.New("iec61850: control failed") + var ErrDataAccess = errors.New("iec61850: data access error") + var ErrDatasetDecode = errors.New("iec61850: dataset decode error") + var ErrInvalidArgument = errors.New("iec61850: invalid argument") + var ErrInvalidFunctionalConstraint = errors.New("iec61850: invalid functional constraint") + var ErrInvalidReference = errors.New("iec61850: invalid reference") + var ErrModelMismatch = errors.New("iec61850: model mismatch") + var ErrNotControllable = errors.New("iec61850: not controllable") + var ErrNotFound = errors.New("iec61850: not found") + var ErrOperateFailed = errors.New("iec61850: operate failed") + var ErrProtocol = errors.New("iec61850: protocol error") + var ErrReportDecode = errors.New("iec61850: report decode error") + var ErrSCLParse = errors.New("iec61850: SCL parse error") + var ErrSelectFailed = errors.New("iec61850: select failed") + var ErrSubscriptionClosed = errors.New("iec61850: subscription closed") + var ErrTypeMismatch = errors.New("iec61850: type mismatch") + var ErrUnsupportedCDC = errors.New("iec61850: unsupported CDC") + var ErrUnsupportedService = errors.New("iec61850: unsupported service") + func BoolCtlVal(v bool) *mms.Value + func BspCtlVal(bits []byte, bitLen int) *mms.Value + func DpCtlVal(on bool) *mms.Value + func EncodeQuality(q Quality) *mms.Value + func EncodeTimestamp(ts Timestamp) *mms.Value + func EnumCtlVal(v int32) *mms.Value + func FloatCtlVal(v float32) *mms.Value + func HasDuplicateRefs(refs []Ref) bool + func IntCtlVal(v int32) *mms.Value + func NewServerModelFromSCL(s *scl.SCL, iedName, apName string) (*servermodel.Model, error) + func StringCtlVal(v string) *mms.Value + type AddCause int + const AddCause1of1 + const AddCauseAbort + const AddCauseBlocked + const AddCauseBlockedByHealth + const AddCauseBlockedByInterlocking + const AddCauseBlockedByMode + const AddCauseBlockedByProcess + const AddCauseBlockedBySwitch + const AddCauseBlockedBySynchrocheck + const AddCauseCommandAlreadyExec + const AddCauseInvalidPosition + const AddCauseNotSupported + const AddCauseParameterChange + const AddCausePositionReached + const AddCauseSelectFailed + const AddCauseStepLimit + const AddCauseTimeLimit + const AddCauseUnknown + func (c AddCause) String() string + type BrowseNode struct + Name string + Reference Ref + type CacheStrategy int + const CacheExplicit + const CacheLazy + const CacheNone + type CancelParams struct + CtlNum uint8 + CtlVal *mms.Value + OperTm time.Time + Origin *Origin + type CheckConditions uint8 + const CheckInterlockCheck + const CheckSynchroCheck + func (c CheckConditions) Has(flag CheckConditions) bool + type Client struct + func Dial(ctx context.Context, addr string, opts DialOptions) (*Client, error) + func NewClient(mmsClient *mms.Client, opts ClientOptions) (*Client, error) + func (c *Client) Abort(ctx context.Context) error + func (c *Client) Cancel(ctx context.Context, ref Ref, params CancelParams) error + func (c *Client) Close(ctx context.Context) error + func (c *Client) ConfirmEditSG(ctx context.Context, ld string) error + func (c *Client) CreateDataSet(ctx context.Context, ld, dsName string, members []DataSetMember) error + func (c *Client) DeleteDataSet(ctx context.Context, ld, dsName string) error + func (c *Client) DeleteFile(ctx context.Context, fileName string) error + func (c *Client) DownloadFile(ctx context.Context, fileName string, w io.Writer) (*FileEntry, error) + func (c *Client) FindPaths(ctx context.Context, query FindQuery) ([]Ref, error) + func (c *Client) GetActiveSGValue(ctx context.Context, ref Ref) (*Value, error) + func (c *Client) GetDataSet(ctx context.Context, ld, dsName string) (*DataSet, error) + func (c *Client) GetEditSGValue(ctx context.Context, ref Ref) (*Value, error) + func (c *Client) GetFileAttributes(ctx context.Context, fileName string) (*FileEntry, error) + func (c *Client) GetReportControlBlock(ctx context.Context, ld, rcbItemID string) (*ReportControlBlock, error) + func (c *Client) GetSettingGroupInfo(ctx context.Context, ld string) (*SettingGroupInfo, error) + func (c *Client) GetVariableType(ctx context.Context, ref Ref) (*mms.TypeSpec, error) + func (c *Client) InvalidateCache() + func (c *Client) InvalidateLDCache(ld string) + func (c *Client) ListChildren(ctx context.Context, ref Ref) ([]BrowseNode, error) + func (c *Client) ListDataObjects(ctx context.Context, ld, ln string) ([]DataObject, error) + func (c *Client) ListDataSets(ctx context.Context, ld string) ([]string, error) + func (c *Client) ListFiles(ctx context.Context, pattern string) ([]FileEntry, error) + func (c *Client) ListJournals(ctx context.Context, ld string) ([]string, error) + func (c *Client) ListLogicalDevices(ctx context.Context) ([]LogicalDevice, error) + func (c *Client) ListLogicalNodes(ctx context.Context, ld string) ([]LogicalNode, error) + func (c *Client) ListReports(ctx context.Context, ld string) ([]string, error) + func (c *Client) ListReportsVerified(ctx context.Context, ld string) ([]string, error) + func (c *Client) MMS() *mms.Client + func (c *Client) ObtainFile(ctx context.Context, sourceFile, destinationFile string) error + func (c *Client) Operate(ctx context.Context, ref Ref, params OperateParams) error + func (c *Client) Read(ctx context.Context, ref Ref) (*Value, error) + func (c *Client) ReadComponent(ctx context.Context, ref Ref, component string) (*Value, error) + func (c *Client) ReadCtlModel(ctx context.Context, ref Ref) (CtlModel, error) + func (c *Client) ReadDataSet(ctx context.Context, ld, dsName string) ([]DataSetValue, error) + func (c *Client) ReadFile(ctx context.Context, fileName string) ([]byte, *FileEntry, error) + func (c *Client) ReadJournal(ctx context.Context, ld, journal string, start, stop time.Time) (*JournalReadResult, error) + func (c *Client) ReadJournalAfter(ctx context.Context, ld, journal string, afterTime time.Time, afterID []byte) (*JournalReadResult, error) + func (c *Client) ReadJournalAfterAll(ctx context.Context, ld, journal string, afterTime time.Time, afterID []byte) ([]JournalEntry, error) + func (c *Client) ReadJournalAll(ctx context.Context, ld, journal string, start, stop time.Time) ([]JournalEntry, error) + func (c *Client) ReadLastApplError(ctx context.Context, ref Ref) (*LastApplError, error) + func (c *Client) ReadMultiple(ctx context.Context, refs []Ref) ([]ReadResult, error) + func (c *Client) ReadRaw(ctx context.Context, ref Ref) (*mms.Value, error) + func (c *Client) RefreshCache(ctx context.Context) error + func (c *Client) RefreshLDCache(ctx context.Context, ld string) error + func (c *Client) ReleaseURCB(ctx context.Context, ld, rcbItemID string) error + func (c *Client) RenameFile(ctx context.Context, currentName, newName string) error + func (c *Client) ReserveURCB(ctx context.Context, ld, rcbItemID string) error + func (c *Client) Select(ctx context.Context, ref Ref) (string, error) + func (c *Client) SelectActiveSG(ctx context.Context, ld string, sg uint8) error + func (c *Client) SelectEditSG(ctx context.Context, ld string, sg uint8) error + func (c *Client) SelectWithValue(ctx context.Context, ref Ref, params OperateParams) error + func (c *Client) SetEditSGValue(ctx context.Context, ref Ref, value *mms.Value) error + func (c *Client) SetReportControlBlock(ctx context.Context, ld, rcbItemID string, update RCBUpdate) error + func (c *Client) SubscribeReport(ctx context.Context, rptID string, opts SubscribeReportOptions) (*ReportSubscription, error) + func (c *Client) Tree(ctx context.Context) (*ModelNode, error) + func (c *Client) TreeWithOptions(ctx context.Context, opts TreeOptions) (*ModelNode, error) + func (c *Client) TriggerGI(ctx context.Context, ld, rcbItemID string) error + func (c *Client) Write(ctx context.Context, ref Ref, value *mms.Value) error + func (c *Client) WriteMultiple(ctx context.Context, requests []WriteRequest) ([]WriteResult, error) + type ClientOptions struct + Cache CacheStrategy + IEDName string + Logger *slog.Logger + Strictness StrictnessOptions + type ConnectionEvent struct + type ControlError struct + AddCause AddCause + Operation string + Ref string + Wrapped error + func (e *ControlError) Error() string + func (e *ControlError) Unwrap() []error + type ControlHandler struct + OnCancel func(ctx context.Context, req ControlRequest) error + OnOperate func(ctx context.Context, req ControlRequest) error + OnSelect func(ctx context.Context, req ControlRequest) error + type ControlRequest struct + Check CheckConditions + CtlNum uint8 + CtlVal *mms.Value + OperTm time.Time + Operation string + Origin Origin + Ref string + Test bool + type CtlModel int + const CtlModelDirectEnhanced + const CtlModelDirectNormal + const CtlModelSBOEnhanced + const CtlModelSBONormal + const CtlModelStatusOnly + func (m CtlModel) IsControllable() bool + func (m CtlModel) IsEnhanced() bool + func (m CtlModel) IsSBO() bool + func (m CtlModel) String() string + type DataAccessError struct + ErrorCode int + Operation string + Ref string + func (e *DataAccessError) Error() string + func (e *DataAccessError) Unwrap() error + type DataObject struct + Children []DataObject + FC FunctionalConstraint + Name string + Reference Ref + type DataSet struct + Deletable bool + Members []DataSetMember + Reference string + type DataSetMember struct + DomainID string + ItemID string + Ref Ref + type DataSetValue struct + Err error + Member DataSetMember + Value *Value + type DecodeError struct + Message string + Ref string + Type string + Wrapped error + func (e *DecodeError) Error() string + func (e *DecodeError) Unwrap() error + type DialOptions struct + Cache CacheStrategy + IEDName string + Logger *slog.Logger + MMS mms.DialOptions + Strictness StrictnessOptions + type FileEntry struct + LastModified time.Time + Name string + Size int64 + type FindQuery struct + FC FunctionalConstraint + LDFilter string + MatchMode MatchMode + MaxDepth int + Pattern string + type FunctionalConstraint string + const FCBL + const FCBR + const FCCF + const FCCO + const FCDC + const FCEX + const FCGO + const FCLG + const FCMS + const FCMX + const FCOR + const FCRP + const FCSE + const FCSG + const FCSP + const FCSR + const FCST + const FCSV + const FCUS + func AllFunctionalConstraints() []FunctionalConstraint + func ParseFC(s string) (FunctionalConstraint, error) + func (fc FunctionalConstraint) Description() string + func (fc FunctionalConstraint) IsValid() bool + func (fc FunctionalConstraint) String() string + type JournalEngine struct + func (e *JournalEngine) LogEvent(domain, journal string, occTime time.Time, vars []mms.JournalVariable) []byte + func (e *JournalEngine) LogValueWrite(ctx context.Context, storeKey string, occTime time.Time) + func (e *JournalEngine) Provider() *MemoryJournalProvider + type JournalEngineOption func(*JournalEngine) + func WithJournalMaxEntries(n int) JournalEngineOption + func WithJournalProvider(p *MemoryJournalProvider) JournalEngineOption + type JournalEntry struct + EntryID []byte + OccurrenceTime time.Time + Variables []JournalVariable + type JournalReadResult struct + Entries []JournalEntry + MoreFollows bool + type JournalVariable struct + Tag string + Value *Value + type LastApplError struct + AddCause AddCause + CntrlObj string + Error int + Origin Origin + type LogicalDevice struct + Name string + type LogicalNode struct + LD string + Name string + func (ln LogicalNode) Ref() Ref + type MatchMode int + const MatchGlob + const MatchRegex + type MemoryJournalOption func(*MemoryJournalProvider) + func WithMaxEntries(n int) MemoryJournalOption + type MemoryJournalProvider struct + func NewMemoryJournalProvider(opts ...MemoryJournalOption) *MemoryJournalProvider + func (p *MemoryJournalProvider) AddEntry(domain, journal string, occTime time.Time, vars []mms.JournalVariable) []byte + func (p *MemoryJournalProvider) EntryCount(domain, journal string) int + func (p *MemoryJournalProvider) ListJournals(_ context.Context, domain string) ([]string, error) + func (p *MemoryJournalProvider) ReadStartAfter(_ context.Context, domain, journal string, afterID []byte, afterTime time.Time, ...) (*mms.JournalResult, error) + func (p *MemoryJournalProvider) ReadTimeRange(_ context.Context, domain, journal string, start, stop time.Time, ...) (*mms.JournalResult, error) + func (p *MemoryJournalProvider) RegisterJournal(domain, journal string) + type ModelError struct + Message string + Ref string + Wrapped error + func (e *ModelError) Error() string + func (e *ModelError) Unwrap() error + type ModelNode struct + Children []*ModelNode + FC FunctionalConstraint + FCs []FunctionalConstraint + Name string + Reference Ref + Type *mms.TypeSpec + type OperateParams struct + Check CheckConditions + CtlNum uint8 + CtlVal *mms.Value + OperTm time.Time + Origin *Origin + Test bool + type OptFlds uint16 + const OptFldBufOvfl + const OptFldConfRev + const OptFldDataRef + const OptFldDataSet + const OptFldEntryID + const OptFldReasonCode + const OptFldSegmentation + const OptFldSeqNum + const OptFldTimeStamp + func (o OptFlds) Has(flag OptFlds) bool + func (o OptFlds) String() string + type OrCat int + const OrCatAutomaticBay + const OrCatAutomaticRemote + const OrCatAutomaticStation + const OrCatBayControl + const OrCatMaintenance + const OrCatNotSupported + const OrCatProcess + const OrCatRemoteControl + const OrCatStationControl + func (c OrCat) String() string + type Origin struct + OrCat OrCat + OrIdent []byte + type OverflowPolicy int + const OverflowBlock + const OverflowCallback + const OverflowDropNewest + const OverflowDropOldest + type Quality uint16 + const QualityBadReference + const QualityFailure + const QualityInaccurate + const QualityInconsistent + const QualityOldData + const QualityOperatorBlocked + const QualityOscillatory + const QualityOutOfRange + const QualityOverflow + const QualitySourceSubstituted + const QualityTest + func DecodeQuality(v *mms.Value) (Quality, error) + func (q Quality) Has(flag Quality) bool + func (q Quality) IsGood() bool + func (q Quality) String() string + func (q Quality) Validity() Validity + func (q Quality) WithValidity(v Validity) Quality + type RCBFieldMask uint32 + const RCBFieldBufTm + const RCBFieldDatSet + const RCBFieldEntryID + const RCBFieldGI + const RCBFieldIntgPd + const RCBFieldOptFlds + const RCBFieldPurgeBuf + const RCBFieldResv + const RCBFieldResvTms + const RCBFieldRptEna + const RCBFieldRptID + const RCBFieldTrgOps + type RCBType int + const RCBBuffered + const RCBUnbuffered + func (t RCBType) FC() FunctionalConstraint + func (t RCBType) String() string + type RCBUpdate struct + BufTm uint32 + DatSet string + EntryID []byte + Fields RCBFieldMask + GI bool + IntgPd uint32 + OptFlds OptFlds + PurgeBuf bool + Resv bool + ResvTms int32 + RptEna bool + RptID string + TrgOps TrgOps + type ReadResult struct + Err error + Ref Ref + Value *Value + type ReasonCode uint8 + const ReasonDataChanged + const ReasonDataUpdate + const ReasonGI + const ReasonIntegrity + const ReasonQualityChanged + func (r ReasonCode) String() string + type Ref struct + FC FunctionalConstraint + LD string + LN string + Path []string + func ParseRef(s string) (Ref, error) + func ParseRefStrict(s string) (Ref, error) + func RefFromMMS(domain mms.DomainID, itemID mms.ItemID) (Ref, error) + func (r Ref) Child(name string) (Ref, error) + func (r Ref) Depth() int + func (r Ref) HasPath() bool + func (r Ref) IsLD() bool + func (r Ref) IsLN() bool + func (r Ref) IsObject() bool + func (r Ref) ObjectReference() string + func (r Ref) Parent() (Ref, bool) + func (r Ref) String() string + func (r Ref) ToMMS() (domain mms.DomainID, itemID mms.ItemID, err error) + func (r Ref) Validate() error + func (r Ref) WithFC(fc FunctionalConstraint) Ref + type ReferenceError struct + Input string + Reason string + Wrapped error + func (e *ReferenceError) Error() string + func (e *ReferenceError) Unwrap() error + type ReportControlBlock struct + BufTm uint32 + ConfRev uint32 + DatSet string + EntryID []byte + GI bool + IntgPd uint32 + OptFlds OptFlds + Owner []byte + PurgeBuf bool + Reference string + Resv bool + ResvTms int32 + RptEna bool + RptID string + SqNum uint32 + TrgOps TrgOps + Type RCBType + type ReportEngine struct + func (re *ReportEngine) HandleRCBWrite(ctx context.Context, ldName, rcbItemID, subfield string, val *mms.Value, ...) error + func (re *ReportEngine) NotifyValueChanged(ctx context.Context, storeKey string) + func (re *ReportEngine) Stop() + type ReportError struct + Message string + RCBRef string + Wrapped error + func (e *ReportError) Error() string + func (e *ReportError) Unwrap() error + type ReportIndication struct + BufOvfl bool + ConfRev uint32 + DatSet string + DataReferences []string + EntryID []byte + Inclusion []bool + MoreSegments bool + OptFlds OptFlds + ReasonCodes []ReasonCode + RptID string + SeqNum uint32 + SubSeqNum uint32 + Timestamp time.Time + Values []*Value + type ReportSubscription struct + func (s *ReportSubscription) Close() error + func (s *ReportSubscription) Reports() <-chan *ReportIndication + type RptMatchMode int + const RptMatchExact + const RptMatchGlob + type SCLParseError struct + File string + Line int + Message string + Wrapped error + func (e *SCLParseError) Error() string + func (e *SCLParseError) Unwrap() error + type Server struct + func NewServer(model *servermodel.Model, opts ServerOptions) (*Server, error) + func (s *Server) Capabilities() ServiceCapabilities + func (s *Server) ChangeActiveSettingGroup(ctx context.Context, ld string, sg uint8) error + func (s *Server) Close() + func (s *Server) EnableJournals(opts ...JournalEngineOption) *JournalEngine + func (s *Server) EnableReports() *ReportEngine + func (s *Server) EnableSettingGroups(handler SettingGroupHandler) + func (s *Server) HandleIdentify(id ServerIdentity) + func (s *Server) HandleStatus() + func (s *Server) JournalEngine() *JournalEngine + func (s *Server) ListenAndServe(ctx context.Context, ln mms.TransportListener) error + func (s *Server) MMS() *mms.Server + func (s *Server) Model() *servermodel.Model + func (s *Server) RegisterControl(ldName, doRef string, ctlModel CtlModel, handler ControlHandler) error + func (s *Server) ReportEngine() *ReportEngine + func (s *Server) Serve(ctx context.Context, conn mms.Transport) error + func (s *Server) SetValue(ctx context.Context, storeKey string, val *mms.Value) + func (s *Server) SettingGroupEngine() *SettingGroupEngine + func (s *Server) ValueStore() *servermodel.ValueStore + type ServerIdentity struct + Model string + Revision string + Vendor string + type ServerOptions struct + Authenticate mms.Authenticator + FileProvider mms.FileProvider + Identity *ServerIdentity + Logger *slog.Logger + MMS mms.ServerOptions + OnConnect func(ConnectionEvent) + OnDisconnect func(ConnectionEvent) + type ServiceCapabilities struct + Controls bool + DataSets bool + Files bool + Identify bool + Journals bool + Reports bool + SettingGroups bool + Variables bool + func (c ServiceCapabilities) String() string + type SettingGroupEngine struct + func (e *SettingGroupEngine) GetActiveSettingGroup(ldName string) uint8 + func (e *SettingGroupEngine) GetEditSettingGroup(ldName string) uint8 + func (e *SettingGroupEngine) HandleSGCBWrite(ctx context.Context, ldName, subfield string, val *mms.Value) error + type SettingGroupHandler struct + OnActiveSGChanged func(ctx context.Context, ld string, newSG uint8) error + OnConfirmEdit func(ctx context.Context, ld string, editSG uint8) error + OnEditSGSelected func(ctx context.Context, ld string, editSG uint8) error + type SettingGroupInfo struct + ActSG uint8 + CnfEdit bool + EditSG uint8 + NumOfSGs uint8 + ResvTms uint16 + type StrictnessOptions struct + RejectUnknownFC bool + VerifyReportCandidates bool + type SubscribeReportOptions struct + AutoEnable bool + CloneReports bool + GIOnSubscribe bool + LD string + MatchMode RptMatchMode + OnOverflow func(*ReportIndication) + OverflowPolicy OverflowPolicy + QueueSize int + RCBItemID string + ReserveURCB bool + type TimeQuality struct + ClockFailure bool + ClockNotSynchronized bool + LeapSecondKnown bool + TimeAccuracy int + type Timestamp struct + Quality TimeQuality + Time time.Time + func DecodeTimestamp(v *mms.Value) (Timestamp, error) + func (ts Timestamp) IsZero() bool + func (ts Timestamp) String() string + type TreeOptions struct + IncludeFCs bool + LDFilter string + MaxDepth int + type TrgOps uint8 + const TrgOpDataChanged + const TrgOpDataUpdate + const TrgOpGI + const TrgOpIntegrity + const TrgOpQualityChanged + func (t TrgOps) Has(flag TrgOps) bool + func (t TrgOps) String() string + type Validity int + const ValidityGood + const ValidityInvalid + const ValidityQuestionable + const ValidityReserved + type Value struct + func ArrayValue(elements []*Value) (*Value, error) + func BoolValue(b bool) *Value + func FloatValue(f float64) *Value + func IntValue(i int64) *Value + func NewValue(v *mms.Value) *Value + func OctetStringValue(data []byte) *Value + func QualityValue(q Quality) *Value + func StringValue(s string) *Value + func StructureValue(elements []*Value) (*Value, error) + func TimestampValue(ts Timestamp) *Value + func UintValue(u uint64) *Value + func UnsafeArrayValue(elements []*Value) *Value + func UnsafeStructureValue(elements []*Value) *Value + func (v *Value) BitString() ([]byte, error) + func (v *Value) Bool() (bool, error) + func (v *Value) Elements() ([]*Value, error) + func (v *Value) Float32() (float32, error) + func (v *Value) Float64() (float64, error) + func (v *Value) Int32() (int32, error) + func (v *Value) Int64() (int64, error) + func (v *Value) IsArray() bool + func (v *Value) IsStructure() bool + func (v *Value) MMS() *mms.Value + func (v *Value) MmsString() (string, error) + func (v *Value) OctetString() ([]byte, error) + func (v *Value) Quality() (Quality, error) + func (v *Value) String() string + func (v *Value) Timestamp() (Timestamp, error) + func (v *Value) Type() mms.ValueType + func (v *Value) Uint32() (uint32, error) + func (v *Value) Uint64() (uint64, error) + func (v *Value) VisibleString() (string, error) + type WriteRequest struct + Ref Ref + Value *mms.Value + type WriteResult struct + Err error + Ref Ref + Success bool v1.0.0 Jul 20, 2026 v0 v0.1.3 Mar 23, 2026 v0.1.2 Mar 23, 2026 v0.1.1 Mar 20, 2026 v0.1.0 Mar 20, 2026