pr-message:'Push requests and other code contributions can only be accepted from authorized persons that have signed our contributor license agreement(CLA). When in doubt please write to info@libiec61850.com.'
- RCBEventHandler: replaced GI event by purgeBuf event when client disables RCB instance (LIB61850-316)
- enabled TLS 1.2 support in mbedtls configuration
- improved MmsValue handling; fixed MmsValue(OCTET-STRIG) maximum size problem (LIB61850-150)
- IED server: improved control state machine performance (LIB61850-312)
Fixed bugs and vulnerabilities:
- fixed - dynamic model helper functions: Check added to Cancel object for CDC APC
- fixed wrong number in TLS event code define (LIB61850_366)
- fixed - servers sends object-access-unsupported on GetAllData when ReadAccessHandler is installed (LIB61850-370)
- fixed - endless loop sending reports when MMS PDU size is too small (LIB61850-365)
- fixed path traversal vulnerability in MMS file services (LIB61850-357)
- IED server: added missing call to getNextRoundedStartTime (LIB61850-323)
- fixed - server crashs when SyncIntegrityReportTimes is active and IntgPd=0 (LIB61850-355)
- fixed - missing API export declarations for functions IedServerConfig_setSyncIntegrityReportTimes and IedServerConfig_getSyncIntegrityReportTimes (LIB61850-353)
- IED server: fixed - possible deadlock when IedServer_lockDataModel is used from multiple threads (LIB61850-352)
- MMS server: fixed - possible deadlock in obtainFile-service/file upload task (LIB61850-351)
- MMS server: fixed potential null pointer dereference when confirmeServiceResponse for fileOpen is received with invoke-id 0 (LIB61850-348)
- MMS_SERVER: fixed bug in getNameList request handling when domain ID is too long (LIB61850-346)
- GOOSE subscriber: fixed vulnerabilities related to malformed bit-string, integer, and unsigned values (LIB61850-342)
- MMS server: fixed bug in handling of continueAfter parameter of getNameList request (LIB61850-341)
- fixed sscanf format string in config_file_parser.c
- fixed locking mechanism in logging.c (LIB61850-327)
- fixed problem: negative presentation layer and ACSE results are ignored by client
- fixed wrong buffer size in client side report handling
- fixed memory leak in server read request handling (LIB61850-325)
- fixed memory leak in reuse of client connection (related to socket extension buffer)
- fixed - TLS: CRL is ignored
- fixed wrong MMS protocol version check (#379)
- fixed - SV publisher encoding problem when svID or datset length > 127 bytes (LIB61850-315)(#382)
- MMS server: fixed potential crash when client connection closed during file upload (LIB61850-2)
- MMS client: fixed problem - doesn't close file when the setFile (obtainFile) service is interrupted e.g. due to connection loss (LIB61850-230)
- Ethernet Socket (Windows): fixed bug and added workaround for problem on Windows (most GOOSE/SV messages are not received when waiting with WaitForMultipleObjects - observed with winpcap 4.1.3 and Windows 10
- fixed problem in BER integer decoder (problem with GOOSE fixed length message decoding)
- .NET API: Fixed memory release problem in method ModelNode.GetObjectReference
- IED server: fixed bug in GoCBEventHandler
- fixed problem in BSD ethernet layer (#328)
- fixed bug in cmake file for BSD
- fixed compilation problem when compiling without GOOSE support (#325)
- IED server: control handling - fixed problem in test flag handling
- IED server: For SBOes check test flag match when accepting operate (sSBOes8)
- IED server: Reject Cancel/SBOw in WaitForChange state - fixed problem with test case sCtl26
Changes to version 1.5.0
------------------------
- added support for time with ns resolution
- IEC 61850 server: control models - allow delaying select response with check handler (new handler return value CONTROL_WAITING_FOR_SELECT)
- IEC 61850 server: added support to listen on multiple IP addresses and ports (new function IedServer_addAccessPoint)
- added support for service tracking
- added tool support for transient data objects
- .NET API: added more functions to create and access server data model
- IED server - control model - send AddCause with operate- for DOes, SBOes control models
- IED server: integrated GOOSE publisher - lock data model during GOOSE retransmission to avoid corrupted GOOSE data
- added server example for dead band handling
- IED server: make presence of RCB.Owner configurable at runtime with function IedServerConfig_enableOwnerForRCB (B1502/S1634)
- IED server: make presence of BRCB.ResvTms configurable at runtime with function IedServerConfig_enableResvTmsForBRCB (F1558)
- restrict maximum recursion depth in BerDecoder_decodeLength when indefinite length encoding is used to avoid stack overflow when receiving malformed messages
- IED server: fixed bug in log service - old-entry and old-entry-time not updated
- IED server: added new function IedServer_handleWriteAccessForComplexAttribute. Changed WriteAccessHandler behavior when ACCESS_POLICY_ALLOW.
- MMS server: add compile time configuration options to enable/disable fileDelete and fileRename services (fileRename is now disabled by default)
- MMS server: better data model lock handling for performance improvements
- Linux - Ethernet: replace IFF_PROMISC by IFF_ALLMULTI
- improvements in Python wrapper code
- IED server: control models - fixed bug that only one control is unselected when connection closes
- IED server: fixed bug - logs (journals) are added to all logical devices instead of just the parents
- IED Server: prevent integrated GOOSE publisher to crash when ethernet socket cannot be created
- IED server: make compatible with tissue 1178
- IED server: reporting - implemented behavior according to tissue 1432
- IED server: WriteAccessHandler can tell the stack not to update the value when returning DATA_ACCESS_ERROR_SUCCESS_NO_UPDATE
- IED server: fixed problem that BL FC is not writable (#287)
- IEC 61850 client: fixed dead lock in IedConnection_getFileAsync when fileRead times out (#285)
- IED server: added ControlSelectStateChangedHandler callback for control mode
- Client: fixed - IedConnection_getRCBValues doesn't check type of server response (#283)
- GOOSE subscriber: changed maximum GoID size according to tissue 770 (129 bytes)
- IED server: send AddCause for invalid origin also in case of direct control models
- IED server: support for configuration of EditSG service and online visibility of SGCB.ResvTms at runtime
- IED server: changed types TrkOps and OptFlds to variable length bit strings
- MMS: changed handling of variable sized bit strings (now also accepts bit strings of larger size, ignoring the bits that exceed the specified size)
- IED server: add support for correct CBB handling (required for test case sAss4) and initiate error PDU
- IED server: add support for tissue 807 (owner attribute in RCB is only present when ReportSettings@owner attribute is true)
- IED server: implemented tissue 1453 also for writing to "RptId" (purgeBuf only executed when value changes)
- GOOSE subscriber: always copy GoID and DatSet from GOOSE message; always create new MmsValue instance for GOOSE data set when subscriber is observer
- IED server: added configuration file support for data set entries with array elements or array element components
- fixed problems in handling array elements and array element components
- fixed bug in MmsConnection_readMultipleVariables: send invaid messsage and memory access errors when too many items are passed to the function exhausting MMS payload size
- IEC 61850 server: fixed problem with test case sRp4 - RCB RptID attribute is not empty after writing empty string
- fixed program crash when normal mode parameers are missing in presentation layer (#252)
- IED Server/GOOSE: Don't send GOOSE message with new event while data model is locked
- GOOSE: added GOOSE observer feature (GooseSubscriber listening to all GOOSE messages) and GOOSE observer example
- COTP: fixed possible heap buffer overflow when handling message with invalid (zero) value in length field (#250)
- IEC 61850 server: fixed - cancel command for time activated control returns object-access-denied even in case of success
- MMS: fixed problem in handling of indefinite length encoded BER elements
- IEC 61850 client: reporting - support data set entries with multiple reasons for inclusion
- Java tools: moved minTime, maxTime from GSEControl to GSE; updated GOOSE server example CID file
- IEC 61850 server: Added ControlAction_setError function - with this function the user application can control the error code used in LastApplError and CommandTermination messages
- IEC 61850 server: fixed problem with logging when log data set contains FCDO (#225)
Changes to version 1.4.2.1
--------------------------
- IEC 61850 server: RCB - fixed problem that other client can "steal" reservation
- MMS client: fixed bug in log entry parsing (#224)
- IEC 61850 server: fixed potential null pointer dereference in multi-thread mode when server is stopped
- IEC 61850 server: fixed bug in single threaded mode (windows)
- IEC 61850 server: fixed compilation error in single thread mode (was new in release 1.4.2)
Changes to version 1.4.2
-------------------------
- IEC 61850 server: wait for background thread termination before data model is released
- MMS server: fixed potential crash when get-named-variable-list-attributes response doesn't fit in MMS PDU. Server returns service error in this case
- IEC 61850 server: unbuffered reporting - send first integrity report after integrity timeout (before it was sent when the RCB was enabled)
- IEC 61850 server: allow server to start without logical devices in data model (#218)
- IEC 61850 client: fixed bug in ClientReportControlBlock - some allowed structures for RCB were rejected
- IEC 61850 server: control - unselect when operate with wrong origin parameters, check if check parameter matches for SBO
- .NET API: fixed problem in ReportControlBlock.SetRCBValues (see #184)
- MMS server: fixed possible crash when client disconnects during file upload
- MMS server: fixed file upload error with multi-threaded server, added some NULL checks to file-handling.
- IEC 61850 server: added function ConfigFileParser_createModelFromConfigFileEx with filename as argument to avoid dependency on FileSystem_... functions
- IEC 61850 server: Add check call before starting a timeactivated operate, so operates can be denied before the waiting state
- IEC 61850 client: improved error handling and fixed potential memory leak in IedConnection_getDeviceModelFromServer
- replaced timegm implementation on windows. Fixes bug with MMS file times
Changes to version 1.4.0
------------------------
- IEC 61850 client: added asynchronous client API (can handle multiple outstanding requests in a single thread)
- IEC 61850 client: added support for non-thread mode (for use with asynchronous API)
- IEC 61850 client: added IedConnection_StateChangedHandler callback that is called for each connection state change
- .NET API: Added support for IedConnection.GetState and StateChangedHandler
- modelviewer: show full hierarchy including sub data objects
- IEC 61850 server: added IedServer_updateCtlModel function to change control model at runtime
- IEC 61850 client: added functions IedConnection_getLogicalDeviceVariables, IedConnection_getLogicalDeviceDataSets, and IedConnection_getLogicalDeviceDataSetsAsync to address #89
- .NET API: extended MmsValue.ToString method to print arrays and data access errors
- common: MmsVariableSpecification_getChildValue now also accepts "." as separator
- .NET API: ReportControlBlock.GetOwner returns null when no owner available (#79)
- IEC 61850 client: IedConnection - added CONNECTING AND CLOSING states - removed IDLE state (CLOSED, CONNECTING, CONNECTED, CLOSING)
- now using mbedtls 2.16
- TLS renegotiation disabled by default
- fixed bug in BerInteger_setUint16
- IEC 61850 client: Added functions IedConnection_setRequestTimeout and IedConnection_getRequestTimeout to C API and IedConnection.RequestTimeout property to .NET API
- MMS client: fixed problem with obtain file timeout with large files
- IEC 61850 server: Control model callback signature changed. Added ControlAction object to access control related parameters in control callbacks
- IEC 61850 server: added support for segmented reporting
- fixed bug in windows socket abstraction
- fixed client TCP keep alive problem (see github #115)
- MMS server: read service - return data access error for component access to simple variable
- GOOSE receiver: fixed potential deadlock when GooseReceiver_stop is called directly after GooseReceiver_start
Changes to version 1.3.2
------------------------
- MMS client/server: added support for component alternate access for generic variable read requests
- MMS client: improved handling/stability when receiving malformed messages from the server
- IEC 61850 server: fixed problem with wrong purge buffer invocation when using dynamic data set in buffered report control block
- .NET API: add GetFileDirectoryEx function
- modelviewer: show full hierarchy including sub data objects
- .NET API: DataSet implements IDisposable interface, Report/DataSet GetValues methods return now clones of the original native values to prevent GC issues
- IEC 61850 client: implemented tissue 1178 client side (select-response+ is
non-NULL)
- SV publisher: fixed RefrTm and SmpSynch handling
- IEC 61850 client: improved support for handling segmented reports
- .NET API: Added some additional access function to ReportControlBlock
- Java SCL parser: added support for timestamp values in "Val" elements
- fixed bug in cmake file (winpcap support)
- added C# example code for client side setting group handling
- .NET API: added some additional wrapper code for MmsVariableSpecification functions
Changes to version 1.3.0
------------------------
- IEC 61850 server: more features configurable at runtime
- IEC 61850 server: control objects - fixed bug in select response for SBO control model
- IEC 61850 client: add support for single array element access (with component specification)
- MMS server: add support for array element (index) access with nested component
- IEC 61850 server: made IEC 61850 edition configurable at runtime
- IEC 61850 server: added ReadAccessHandler to control read access
- HAL: unified platform abstraction layer (to simplify using the library together with lib60870)
- IEC 61850 server: fixed bug when calling write access handler (wrong pointer for ClientConnection object)
- updated IEC 61850-9-2 LE example to be more realistic
- added server side example for the substitution service
- MMS server: fixed wrong preprocessor defines that can cause problems in some configurations (unlimited number of client connections/ multi-threaded server)
- IEC 61850 client: added new function ControlObjectClient_getCtlValType to simplify control handling
- IEC 61850 server: reporting - don't delete pending events when buffered report is enabled and dataset didn't change
- fixed bug in MmsValue_update
- MMS server: fixed bug in delete variable list service - scope of delete was not considered optional
- some more small bug fixes and optimizations
Changes to version 1.2.2
------------------------
- IEC 61850 server: added support to configure report buffer size at runtime
- IEC 61850 server: new IedServerConfig type and new IedServer constructor
- .NET API: added support for IedServerConfig
- IEC 61850 server: prevent sending reports when data model is locked (updated)
- TLS client: fixed problem with high CPU load
- ISO connection: fixed race condition that can cause corrupted messages
- .NET API: added project files for .NET core 2.0
- .NET API: added server side support for TLS
Changes to version 1.2.1
------------------------
- IEC 61850 server: fixed bug in report module when RCB was enabled multiple times (was new in 1.2.0)
- .NET API: Added destructor and Dispose method to ReportControlBlock (fixed memory leak)
- .NET API: Changed ReportControlBlock access to IedConnection to improve stability when connection closes unexpectedly
Changes to version 1.2.0
------------------------
- IEC 61850/MMS client/server: Added TLS support (TLS API and implementation for mbedtls)
- The Sampled Values APIs have been renamed. The old version of the API is deprecated but still supported and will be removed in the next major version of the library.
- SV Publisher/Subscriber: a lot of small fixed and improvements
- .NET API: Added support for sampled values (SV) subscriber
- .NET API: Added support for GOOSE subscriber
- SV subscriber: added function SVReceiver_enableDestAddrCheck
- IEC 61850 server: fixed bug in buffered report module - report can be lost under some circumstances when BRCB is enabled
- SV subscriber: replaced code that caused unaligned memory access
- IEC 61850 server: added memory alignement for buffered reporting
- MmsValue_update function now allows adjusting octet-string size of target object
- .NET API: Added DeleteFile
- CDC helper functions: added helper functions for VSS and VSG CDC
- added additional locks in client and server
Changes to version 1.1.1
------------------------
- IEC 61850 client: fixed bug in APC control handling
- IEC 61850 client: ClientReportControlBlock now accepts "$" and "." as seperator for RCB object reference
- MMS client: fixed bug in MmsConnection_connect (COTP payload buffer was not reset in case of an error during connect -> connection failed in case of reuse of MmsConnection object
- MMS client: delete named variable list service supports VMD specific lists
- SV subscriber/publisher: additional features and bug fixes
- SV: fixed data type for smpRate
- SV: fixed encoding of optional smpMod attribute
- SV receiver: Added semaphore to make subscriber list thread-safe
- .NET API: Added missing UpdateAttribute methods to IedServer
- common: added support for Currency BasicType
- MMS file services: fixed problem with negative frsmId
- java scl tools: fixed bug with SDOs in dynamic code generator
- java scl tools: fixed parsing bug in OptionFields.java
- server: added functions to restrict local IP address IedServer_setLocalIpAddress, IedServer.SetLocalIpAddress
- .NET: IedConnection: added internal reference to IsoConnectionParameters object to avoid deletion of internal AcseAuthenticationParameters by garbage collector
Changes to version 1.0.1
------------------------
- server: fixed problem in COTP src/dst reference handling (returning zero src reference)
option(CONFIG_INCLUDE_GOOSE_SUPPORT"Build with GOOSE support"ON)
option(CONFIG_USE_EXTERNAL_MBEDTLS_DYNLIB"Build with pre-compiled mbedtls dynamic library"OFF)
set(CONFIG_EXTERNAL_MBEDTLS_DYNLIB_PATH"${CMAKE_CURRENT_LIST_DIR}/third_party/mbedtls/mbedtls-2.28/library"CACHESTRING"Path to search for the mbedtls dynamic libraries")
set(CONFIG_EXTERNAL_MBEDTLS_INCLUDE_PATH"${CMAKE_CURRENT_LIST_DIR}/third_party/mbedtls/mbedtls-2.28/include"CACHESTRING"Path to search for the mbedtls include files")
#choosethelibraryfeatureswhichshallbeincluded
option(CONFIG_IEC61850_CONTROL_SERVICE"Build with support for IEC 61850 control features"ON)
option(CONFIG_IEC61850_REPORT_SERVICE"Build with support for IEC 61850 reporting services"ON)
option(CONFIG_IEC61850_LOG_SERVICE"Build with support for IEC 61850 logging services"ON)
option(CONFIG_IEC61850_SERVICE_TRACKING"Build with support for IEC 61850 service tracking"ON)
option(CONFIG_IEC61850_SETTING_GROUPS"Build with support for IEC 61850 setting group services"ON)
option(CONFIG_IEC61850_SUPPORT_USER_READ_ACCESS_CONTROL"Allow user provided callback to control read access"ON)
option(CONFIG_IEC61850_RCB_ALLOW_ONLY_PRECONFIGURED_CLIENT"allow only configured clients (when pre-configured by ClientLN)"OFF)
set(CONFIG_IEC61850_SG_RESVTMS300CACHESTRING"Configure the maximum number of SG RESVTMS")
set(CONFIG_REPORTING_DEFAULT_REPORT_BUFFER_SIZE"65536"CACHESTRING"Default buffer size for buffered reports in byte")
Also consider to review the examples to understand how to use the library.
This file is part of the documentation of **libIEC61850**. More documentation can be found online at http://libiec61850.com or in the provided doxygen documentation. Also consider to review the examples to understand how to use the library
Content:
* [Overview](#overview)
* [Features](#features)
* [Examples](#examples)
* [Building and running the examples](#building-and-running-the-examples-with-the-provided-makefiles)
* [Building the library with TLS support](#building-the-library-with-tls-support)
* [Installing the library and the API headers](#installing-the-library-and-the-api-headers)
* [Building on Windows with GOOSE support](#building-on-windows-with-goose-support)
* [Building with the cmake build script](#building-with-the-cmake-build-script)
* [Using the log service with sqlite](#using-the-log-service-with-sqlite)
libiec61850 is an open-source (GPLv3) implementation of an IEC 61850 client and server library implementing the protocols MMS, GOOSE and SV. It is implemented in C (according to the C99 standard) to provide maximum portability. It can be used to implement IEC 61850 compliant client and server applications on embedded systems and PCs running Linux, Windows, and MacOS. Included is a set of simple example applications that can be used as a starting point to implement own IEC 61850 compliant devices or to communicate with IEC 61850 devices. The library has been successfully used in many commercial software products and devices.
For commercial projects licenses and support is provided by MZ Automation GmbH. Please contact info@mz-automation.de for more details on licensing options.
## 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
* 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
** flexible API to connect custom data bases
** comes with sqlite implementation
* MMS file services (browse, get file, set file, delete/rename file)
** required to download COMTRADE files
* Setting group handling
* Support for service tracking
* GOOSE and SV control block handling
* TLS support
* C and C#/.NET API
## Examples
The examples are built automatically when CMake is used to build the library.
NOTE: Most examples are intended to show a specific function of the library. They are designed to show this function as simple as possible and may miss error handling that has to be present in real applications!
## Building and running the examples with the provided makefiles
In the project root directory type
In the project root directoy type
```
make examples
@ -76,27 +36,14 @@ If the build succeeds you can find a few binary files in the projects root direc
Run the sample applications in the example folders. E.g.:
```
cd examples/server_example_basic_io
sudo ./server_example_basic_io
cd examples/server_example1
sudo ./server_example1
```
on the Linux command line.
You can test the server examples by using a generic client or the provided client example applications.
## Building the library with TLS support
Download, unpack, and copy mbedtls-2.28 into the third_party/mbedtls folder.
NOTE: The current version support mbedtls version 2.28. When you download the source archive from https://tls.mbed.org/ you have to rename the extracted folder to "mbedtls-2.28".
In the main libiec61850 folder run
```
make WITH_MBEDTLS=1
```
When using CMake the library is built automatically with TLS support when the folder third_party/mbedtls/mbedtls-2.28 is present.
## Installing the library and the API headers
@ -126,17 +73,15 @@ To build the library and run libiec61850 applications with GOOSE support on Wind
## Building with the cmake build script
With the help of the cmake build script it is possible to create platform independent project descriptions and let cmake create specific project or build files for other tools like Make or Visual Studio.
With the help of the cmake build script it is possible to create platform independet project descriptions and let cmake create specific project or build files for other tools like Make or Visual Studio.
If you have cmake installed fire up a command line (cmd.exe) and create a new subdirectory in the libiec61850 folder. Change to this subdirectory. Then you can invoke cmake. As an command line argument you have to supply a "generator" that is used by cmake to create the project file for the actual build tool (in our case Visual Studio 2015).
If you have cmake installed fire up a command line (cmd.exe) and create a new subdirectory in the libiec61850 folder. Change to this subdirectory. Then you can invoke cmake. As an command line argument you have to supply a "generator" that is used by cmake to create the project file for the actual build tool (in our case Visual Studio).
`cmake -G "Visual Studio 14 2015" ..`
`cmake -G "Visual Studio 11" ..`
will instruct cmake to create a "solution" for Visual Studio 2015. The resulting project files will be 32 bit.
will instruct cmake to create a "solution" for Visual Studio 2012. To do the same thing for Visual Studio 2010 type
To build 64 bit libraries the "Win64" generator option has to be added.
`cmake -G "Visual Studio 14 2015 Win64" ..`
`cmake -G "Visual Studio 10" ..`
Note: The ".." at the end of the command line tells cmake where to find the main build script file (called CMakeLists.txt). This should point to the folder libiec61850 which is in our case the parent directory (..).
@ -144,16 +89,6 @@ Depending on the system you don't have to provide a generator to the cmake comma
To select some configuration options you can use ccmake or cmake-gui.
For newer version of Visual Studio you can use one of the following commands (for 64 bit builds):
For Visual Studio 2017:
cmake -G "Visual Studio 15 2017 Win64" ..
For Visual Studio 2019 (new way to specify the x64 platform):
cmake -G "Visual Studio 16 2019" .. -A x64
## Using the log service with sqlite
@ -176,8 +111,6 @@ The experimental Python binding can be created using SWIG with cmake.
To enable the bindings you have to select the phyton configuration option with ccmake of cmake-gui.
We don't provide any support for the Python bindings!
## Commercial licenses and support
Support and commercial license options are provided by MZ Automation GmbH. Please contact info@mz-automation.de for more details.
@ -186,4 +119,10 @@ Support and commercial license options are provided by MZ Automation GmbH. Pleas
If you want to contribute to the improvement and development of the library please send me comments, feature requests, bug reports, or patches. For more than trivial contributions I require you to sign a Contributor License Agreement. Please contact info@libiec61850.com.
Please don't send pull requests before signing the Contributor License Agreement! Such pull requests may be silently ignored.
## Third-party contributions
- The Mac OS X socket and ethernet layer has been kindly contributed by Michael Clausen, HES-SO Valais-Wallis, http://www.hevs.ch