From 60aa022d543a9a9e8b53eb337c133823d6bfc613 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Thu, 19 Apr 2018 08:03:35 +0200 Subject: [PATCH] - updated documentation --- src/iec61850/client/ied_connection.c | 2 +- src/iec61850/inc/iec61850_client.h | 35 ++++++++++++++++++++++++++-- src/tls/mbedtls/tls_mbedtls.c | 11 +++++++-- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/iec61850/client/ied_connection.c b/src/iec61850/client/ied_connection.c index 2fd5f491..269474ad 100644 --- a/src/iec61850/client/ied_connection.c +++ b/src/iec61850/client/ied_connection.c @@ -2530,7 +2530,7 @@ FileDirectoryEntry_destroy(FileDirectoryEntry self) GLOBAL_FREEMEM(self); } -char* +const char* FileDirectoryEntry_getFileName(FileDirectoryEntry self) { return self->fileName; diff --git a/src/iec61850/inc/iec61850_client.h b/src/iec61850/inc/iec61850_client.h index 4dccdcd8..09c4852d 100644 --- a/src/iec61850/inc/iec61850_client.h +++ b/src/iec61850/inc/iec61850_client.h @@ -1,7 +1,7 @@ /* * iec61850_client.h * - * Copyright 2013, 2014, 2015 Michael Zillgith + * Copyright 2013-2018 Michael Zillgith * * This file is part of libIEC61850. * @@ -1949,18 +1949,49 @@ IedConnection_queryLogAfter(IedConnection self, IedClientError* error, const cha typedef struct sFileDirectoryEntry* FileDirectoryEntry; +/** + * @deprecated Will be removed from API + */ FileDirectoryEntry FileDirectoryEntry_create(const char* fileName, uint32_t fileSize, uint64_t lastModified); +/** + * \brief Destroy a FileDirectoryEntry object (free all resources) + * + * NOTE: Usually is called as a parameter of the \ref LinkedList_destroyDeep function. + * + * \param self the FileDirectoryEntry object + */ void FileDirectoryEntry_destroy(FileDirectoryEntry self); -char* +/** + * \brief Get the name of the file + * + * \param self the FileDirectoryEntry object + * + * \return name of the file as null terminated string + */ +const char* FileDirectoryEntry_getFileName(FileDirectoryEntry self); +/** + * \brief Get the file size in bytes + * + * \param self the FileDirectoryEntry object + * + * \return size of the file in bytes, or 0 if file size is unknown + */ uint32_t FileDirectoryEntry_getFileSize(FileDirectoryEntry self); +/** + * \brief Get the timestamp of last modification of the file + * + * \param self the FileDirectoryEntry object + * + * \return UTC timestamp in milliseconds + */ uint64_t FileDirectoryEntry_getLastModified(FileDirectoryEntry self); diff --git a/src/tls/mbedtls/tls_mbedtls.c b/src/tls/mbedtls/tls_mbedtls.c index c026f2a4..8ee8ace8 100644 --- a/src/tls/mbedtls/tls_mbedtls.c +++ b/src/tls/mbedtls/tls_mbedtls.c @@ -51,6 +51,9 @@ struct sTLSConfiguration { bool chainValidation; bool allowOnlyKnownCertificates; + + /* TLS session renegotioation time in milliseconds */ + int renegotiationTimeInMs; }; struct sTLSSocket { @@ -305,6 +308,12 @@ TLSConfiguration_addCACertificateFromFile(TLSConfiguration self, const char* fil return (ret == 0); } +void +TLSConfiguration_setRenegotiationTime(TLSConfiguration self, int timeInMs) +{ + self->renegotiationTimeInMs = timeInMs; +} + void TLSConfiguration_destroy(TLSConfiguration self) { @@ -402,8 +411,6 @@ TLSSocket_getPeerCertificate(TLSSocket self, int* certSize) bool TLSSocket_performHandshake(TLSSocket self) { - //TODO evaluate return value - if (mbedtls_ssl_renegotiate(&(self->ssl)) == 0) return true; else