pull/179/head
Michael Zillgith 6 years ago
commit 4f59099c59

@ -31,8 +31,6 @@
#include "libiec61850_platform_includes.h" #include "libiec61850_platform_includes.h"
#include <inttypes.h>
struct sClientReport struct sClientReport
{ {
ReportCallbackFunction callback; ReportCallbackFunction callback;
@ -462,7 +460,7 @@ iedConnection_handleReport(IedConnection self, MmsValue* value)
matchingReport->timestamp = MmsValue_getBinaryTimeAsUtcMs(timeStampValue); matchingReport->timestamp = MmsValue_getBinaryTimeAsUtcMs(timeStampValue);
if (DEBUG_IED_CLIENT) if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: report has timestamp %" PRIu64 "\n", matchingReport->timestamp); printf("IED_CLIENT: report has timestamp %lu\n", matchingReport->timestamp);
inclusionIndex++; inclusionIndex++;
} }

@ -128,13 +128,13 @@ getState(IsoClientConnection self)
return stateVal; return stateVal;
} }
static inline void static void
setIntState(IsoClientConnection self, eIsoClientInternalState newState) setIntState(IsoClientConnection self, eIsoClientInternalState newState)
{ {
self->intState = newState; self->intState = newState;
} }
static inline eIsoClientInternalState static eIsoClientInternalState
getIntState(IsoClientConnection self) getIntState(IsoClientConnection self)
{ {
return self->intState; return self->intState;

@ -48,13 +48,13 @@
static bool static bool
addPayloadToBuffer(CotpConnection* self, uint8_t* buffer, int payloadLength); addPayloadToBuffer(CotpConnection* self, uint8_t* buffer, int payloadLength);
static inline uint16_t static uint16_t
getUint16(uint8_t* buffer) getUint16(uint8_t* buffer)
{ {
return (buffer[0] * 0x100) + buffer[1]; return (buffer[0] * 0x100) + buffer[1];
} }
static inline uint8_t static uint8_t
getUint8(uint8_t* buffer) getUint8(uint8_t* buffer)
{ {
return buffer[0]; return buffer[0];
@ -115,7 +115,7 @@ getOptionsLength(CotpConnection* self)
return optionsLength; return optionsLength;
} }
static inline void static void
writeStaticConnectResponseHeader(CotpConnection* self, int optionsLength) writeStaticConnectResponseHeader(CotpConnection* self, int optionsLength)
{ {
/* always same size (7) and same position in buffer */ /* always same size (7) and same position in buffer */
@ -161,7 +161,7 @@ writeDataTpduHeader(CotpConnection* self, int isLastUnit)
self->writeBuffer->size = 7; self->writeBuffer->size = 7;
} }
static inline int static int
writeToSocket(CotpConnection* self, uint8_t* buf, int size) writeToSocket(CotpConnection* self, uint8_t* buf, int size)
{ {
#if (CONFIG_MMS_SUPPORT_TLS == 1) #if (CONFIG_MMS_SUPPORT_TLS == 1)
@ -659,7 +659,7 @@ CotpConnection_resetPayload(CotpConnection* self)
} }
static inline int static int
readFromSocket(CotpConnection* self, uint8_t* buf, int size) readFromSocket(CotpConnection* self, uint8_t* buf, int size)
{ {
#if (CONFIG_MMS_SUPPORT_TLS == 1) #if (CONFIG_MMS_SUPPORT_TLS == 1)

@ -36,7 +36,7 @@
#include <time.h> /* for ctime_r */ #include <time.h> /* for ctime_r */
static inline int static int
bitStringByteSize(const MmsValue* value) bitStringByteSize(const MmsValue* value)
{ {
int bitSize = value->value.bitString.size; int bitSize = value->value.bitString.size;
@ -1492,7 +1492,7 @@ exit_function:
return self; return self;
} }
static inline void static void
setVisibleStringValue(MmsValue* self, const char* string) setVisibleStringValue(MmsValue* self, const char* string)
{ {
if (self->value.visibleString.buf != NULL) { if (self->value.visibleString.buf != NULL) {

@ -532,8 +532,12 @@ mmsServer_fileUploadTask(MmsServer self, MmsObtainFileTask task)
IsoConnection_sendMessage(task->connection->isoConnection, response, false); IsoConnection_sendMessage(task->connection->isoConnection, response, false);
if (task->fileHandle) {
FileSystem_closeFile(task->fileHandle); FileSystem_closeFile(task->fileHandle);
if (task->destinationFilename)
deleteFile(MmsServerConnection_getFilesystemBasepath(task->connection), task->destinationFilename); deleteFile(MmsServerConnection_getFilesystemBasepath(task->connection), task->destinationFilename);
}
MmsServer_releaseTransmitBuffer(self); MmsServer_releaseTransmitBuffer(self);
@ -657,15 +661,16 @@ mmsServer_handleObtainFileRequest(
FileHandle fileHandle = openFile(MmsServerConnection_getFilesystemBasepath(connection), FileHandle fileHandle = openFile(MmsServerConnection_getFilesystemBasepath(connection),
destinationFilename, true); destinationFilename, true);
task->connection = connection;
task->obtainFileRequestInvokeId = invokeId;
if (fileHandle == NULL) { if (fileHandle == NULL) {
task->state = MMS_FILE_UPLOAD_STATE_SEND_OBTAIN_FILE_ERROR_DESTINATION; task->state = MMS_FILE_UPLOAD_STATE_SEND_OBTAIN_FILE_ERROR_DESTINATION;
} }
else { else {
/* send file open request */ /* send file open request */
task->lastRequestInvokeId = MmsServerConnection_getNextRequestInvokeId(connection); task->lastRequestInvokeId = MmsServerConnection_getNextRequestInvokeId(connection);
task->connection = connection;
task->fileHandle = fileHandle; task->fileHandle = fileHandle;
task->obtainFileRequestInvokeId = invokeId;
strcpy(task->destinationFilename, destinationFilename); strcpy(task->destinationFilename, destinationFilename);

Loading…
Cancel
Save