diff --git a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs index fc08dd8f..0e245f6d 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs @@ -474,9 +474,9 @@ namespace IEC61850 public IntPtr self = IntPtr.Zero; public ReportControlBlock(string name, LogicalNode parent, string rptId, bool isBuffered, - string dataSetName, uint confRef, byte trgOps, byte options, uint bufTm, uint intgPd) + string dataSetName, uint confRev, byte trgOps, byte options, uint bufTm, uint intgPd) { - self = ReportControlBlock_create(name, parent.self, rptId, isBuffered, dataSetName, confRef, trgOps, options, bufTm, intgPd); + self = ReportControlBlock_create(name, parent.self, rptId, isBuffered, dataSetName, confRev, trgOps, options, bufTm, intgPd); } } diff --git a/dotnet/IEC61850forCSharp/MmsValue.cs b/dotnet/IEC61850forCSharp/MmsValue.cs index ed9787ab..ee9de699 100644 --- a/dotnet/IEC61850forCSharp/MmsValue.cs +++ b/dotnet/IEC61850forCSharp/MmsValue.cs @@ -430,9 +430,13 @@ namespace IEC61850 public MmsDataAccessError GetDataAccessError () { - int errorCode = MmsValue_getDataAccessError (valueReference); + if (GetType () == MmsType.MMS_DATA_ACCESS_ERROR) { + int errorCode = MmsValue_getDataAccessError (valueReference); - return (MmsDataAccessError)errorCode; + return (MmsDataAccessError)errorCode; + } + else + throw new MmsValueException ("Value is of wrong type"); } /// diff --git a/dotnet/IEC61850forCSharp/TLS.cs b/dotnet/IEC61850forCSharp/TLS.cs index a10d4c23..9beccc4b 100644 --- a/dotnet/IEC61850forCSharp/TLS.cs +++ b/dotnet/IEC61850forCSharp/TLS.cs @@ -90,6 +90,11 @@ namespace IEC61850 self = TLSConfiguration_create (); } + ~TLSConfiguration() + { + Dispose (); + } + internal IntPtr GetNativeInstance() { return self; @@ -197,7 +202,12 @@ namespace IEC61850 public void Dispose() { - TLSConfiguration_destroy (self); + lock (self) { + if (self != IntPtr.Zero) { + TLSConfiguration_destroy (self); + self = IntPtr.Zero; + } + } } } diff --git a/src/tls/mbedtls/tls_mbedtls.c b/src/tls/mbedtls/tls_mbedtls.c index 3c40098a..c026f2a4 100644 --- a/src/tls/mbedtls/tls_mbedtls.c +++ b/src/tls/mbedtls/tls_mbedtls.c @@ -12,6 +12,7 @@ #include #include "tls_api.h" +#include "tls_socket.h" #include "hal_thread.h" #include "lib_memory.h" #include "linked_list.h" diff --git a/src/tls/tls_api.h b/src/tls/tls_api.h index 28bc7304..e2392369 100644 --- a/src/tls/tls_api.h +++ b/src/tls/tls_api.h @@ -16,6 +16,7 @@ #define SRC_TLS_TLS_API_H_ #include +#include #ifdef __cplusplus extern "C" {