- updated documentation

- tls_server_example uses AcseAuthenticator
- IsoConnectionParameters: remove TLSConfiguration when compiled without TLS support
pull/143/head
Michael Zillgith 8 years ago
parent 446cb3286a
commit 577158ec6e

@ -46,6 +46,15 @@ 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.6.0 into the third_party/mbedtls folder.
In the main libiec61850 folder run
```
make WITH_MBEDTLS=1
```
## Installing the library and the API headers

@ -37,7 +37,8 @@ void sigint_handler(int signalId)
static char* password1 = "user1@testpw";
static char* password2 = "user2@testpw";
static void printAppTitle(ItuObjectIdentifier* oid)
static void
printAppTitle(ItuObjectIdentifier* oid)
{
int i;

@ -77,6 +77,30 @@ connectionHandler (IedServer self, ClientConnection connection, bool connected,
printf("Connection closed\n");
}
static void
printAppTitle(ItuObjectIdentifier* oid)
{
int i;
for (i = 0; i < oid->arcCount; i++) {
printf("%i", oid->arc[i]);
if (i != (oid->arcCount - 1))
printf(".");
}
}
static bool
clientAuthenticator(void* parameter, AcseAuthenticationParameter authParameter, void** securityToken, IsoApplicationReference* appRef)
{
printf("ACSE Authenticator:\n");
printf(" client ap-title: "); printAppTitle(&(appRef->apTitle)); printf("\n");
printf(" client ae-qualifier: %i\n", appRef->aeQualifier);
printf(" auth-mechanism: %i\n", authParameter->mechanism);
return true;
}
int
main(int argc, char** argv)
{
@ -118,6 +142,8 @@ main(int argc, char** argv)
iedServer = IedServer_createWithTlsSupport(&iedModel, tlsConfig);
IedServer_setAuthenticator(iedServer, clientAuthenticator, NULL);
/* Install handler for operate command */
IedServer_setControlHandler(iedServer, IEDMODEL_GenericIO_GGIO1_SPCSO1,
(ControlHandler) controlHandlerForBinaryOutput,

@ -123,9 +123,9 @@ struct sIsoConnectionParameters
{
AcseAuthenticationParameter acseAuthParameter;
//#if (CONFIG_MMS_SUPPORT_TLS == 1)
#if (CONFIG_MMS_SUPPORT_TLS == 1)
TLSConfiguration tlsConfiguration;
//#endif
#endif
const char* hostname;
int tcpPort;
@ -154,7 +154,7 @@ typedef struct sIsoConnectionParameters* IsoConnectionParameters;
* NOTE: This function used internally by the MMS client library. When using the MMS or IEC 61850 API
* there should be no reason for the user to call this function.
*
* \return new IsoConnectionParameters instanceextern "C" {
* \return new IsoConnectionParameters
*/
IsoConnectionParameters
IsoConnectionParameters_create(void);

@ -155,12 +155,17 @@ typedef struct
typedef struct sMmsNamedVariableList* MmsNamedVariableList;
typedef struct sMmsAccessSpecifier* MmsNamedVariableListEntry;
/**
* \brief ITU (International Telecommunication Union) object identifier (OID)
*/
typedef struct {
uint16_t arc[10];
int arcCount;
} ItuObjectIdentifier;
/**
* \brief ISO application reference (specifies an ISO application endpoint)
*/
typedef struct {
ItuObjectIdentifier apTitle;
int aeQualifier;

@ -81,9 +81,9 @@ IsoConnectionParameters_destroy(IsoConnectionParameters self)
void
IsoConnectionParameters_setTlsConfiguration(IsoConnectionParameters self, TLSConfiguration tlsConfig)
{
//#if (CONFIG_MMS_SUPPORT_TLS == 1)
#if (CONFIG_MMS_SUPPORT_TLS == 1)
self->tlsConfiguration = tlsConfig;
//#endif
#endif
}

@ -1206,10 +1206,14 @@ bool
MmsConnection_connect(MmsConnection self, MmsError* mmsError, const char* serverName, int serverPort)
{
if (serverPort == -1) {
#if (CONFIG_MMS_SUPPORT_TLS == 1)
if (self->isoParameters->tlsConfiguration)
serverPort = 3782;
else
serverPort = 102;
#else
serverPort = 102;
#endif
}
IsoConnectionParameters_setTcpParameters(self->isoParameters, serverName, serverPort);

Loading…
Cancel
Save