- IEC 61850/MMS: added TLS for IedConnection

- fixed Makefile to use correct TLS configuration
pull/143/head
Michael Zillgith 8 years ago
parent 8fcd266be5
commit 214bcaa39d

@ -70,7 +70,7 @@ LIB_SOURCE_DIRS += third_party/mbedtls/mbedtls-2.6.0/library
LIB_SOURCE_DIRS += src/tls/mbedtls LIB_SOURCE_DIRS += src/tls/mbedtls
LIB_INCLUDE_DIRS += third_party/mbedtls/mbedtls-2.6.0/include LIB_INCLUDE_DIRS += third_party/mbedtls/mbedtls-2.6.0/include
LIB_INCLUDE_DIRS += src/tls/mbedtls LIB_INCLUDE_DIRS += src/tls/mbedtls
MBEDTLS_CONFIG_FILE = "mbedtls_config.h" CFLAGS += -D'MBEDTLS_CONFIG_FILE="mbedtls_config.h"'
CFLAGS += -D'CONFIG_MMS_SUPPORT_TLS=1' CFLAGS += -D'CONFIG_MMS_SUPPORT_TLS=1'
endif endif

@ -470,15 +470,19 @@ informationReportHandler(void* parameter, char* domainName,
MmsValue_delete(value); MmsValue_delete(value);
} }
IedConnection static IedConnection
IedConnection_create() createNewConnectionObject(TLSConfiguration tlsConfig)
{ {
IedConnection self = (IedConnection) GLOBAL_CALLOC(1, sizeof(struct sIedConnection)); IedConnection self = (IedConnection) GLOBAL_CALLOC(1, sizeof(struct sIedConnection));
if (self) {
self->enabledReports = LinkedList_create(); self->enabledReports = LinkedList_create();
self->logicalDevices = NULL; self->logicalDevices = NULL;
self->clientControls = LinkedList_create(); self->clientControls = LinkedList_create();
if (tlsConfig)
self->connection = MmsConnection_createSecure(tlsConfig);
else
self->connection = MmsConnection_create(); self->connection = MmsConnection_create();
self->state = IED_STATE_IDLE; self->state = IED_STATE_IDLE;
@ -487,10 +491,24 @@ IedConnection_create()
self->reportHandlerMutex = Semaphore_create(1); self->reportHandlerMutex = Semaphore_create(1);
self->connectionTimeout = DEFAULT_CONNECTION_TIMEOUT; self->connectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
}
return self; return self;
} }
IedConnection
IedConnection_create()
{
return createNewConnectionObject(NULL);
}
IedConnection
IedConnection_createWithTlsSupport(TLSConfiguration tlsConfig)
{
return createNewConnectionObject(tlsConfig);
}
void void
IedConnection_setConnectTimeout(IedConnection self, uint32_t timeoutInMs) IedConnection_setConnectTimeout(IedConnection self, uint32_t timeoutInMs)
{ {

@ -178,6 +178,21 @@ typedef enum {
IedConnection IedConnection
IedConnection_create(void); IedConnection_create(void);
/**
* \brief create a new IedConnection instance that has support for TLS
*
* This function creates a new IedConnection instance that is used to handle a connection to an IED.
* It allocated all required resources. The new connection is in the "idle" state. Before it can be used
* the connect method has to be called. The connection will use TLS when a TLSConfiguration object is
* provided.
*
* \param tlsConfig the TLS configuration to be used
*
* \return the new IedConnection instance
*/
IedConnection
IedConnection_createWithTlsSupport(TLSConfiguration tlsConfig);
/** /**
* \brief destroy an IedConnection instance. * \brief destroy an IedConnection instance.
* *

@ -575,3 +575,4 @@ EXPORTS
MmsServer_setLocalIpAddress MmsServer_setLocalIpAddress
MmsServer_isRunning MmsServer_isRunning
IedServer_createWithTlsSupport IedServer_createWithTlsSupport
IedConnection_createWithTlsSupport

@ -656,3 +656,4 @@ EXPORTS
MmsServer_setLocalIpAddress MmsServer_setLocalIpAddress
MmsServer_isRunning MmsServer_isRunning
IedServer_createWithTlsSupport IedServer_createWithTlsSupport
IedConnection_createWithTlsSupport
Loading…
Cancel
Save