- added -Wextra to Makefile and changed code to avoid resulting warnings

pull/266/head
Michael Zillgith 5 years ago
parent 036f60e4f1
commit 42802db6f1

@ -135,7 +135,7 @@ CFLAGS += -Wnested-externs
CFLAGS += -Wmissing-declarations CFLAGS += -Wmissing-declarations
CFLAGS += -Wshadow CFLAGS += -Wshadow
CFLAGS += -Wall CFLAGS += -Wall
CGLAGS += -Wextra CFLAGS += -Wextra
#CFLAGS += -Werror #CFLAGS += -Werror
all: lib all: lib

@ -841,7 +841,7 @@ parseGooseMessage(GooseReceiver self, uint8_t* buffer, int numbytes)
} }
#if (CONFIG_MMS_THREADLESS_STACK == 0) #if (CONFIG_MMS_THREADLESS_STACK == 0)
static void static void*
gooseReceiverLoop(void *threadParameter) gooseReceiverLoop(void *threadParameter)
{ {
GooseReceiver self = (GooseReceiver) threadParameter; GooseReceiver self = (GooseReceiver) threadParameter;
@ -870,6 +870,8 @@ gooseReceiverLoop(void *threadParameter)
} }
EthernetHandleSet_destroy(handleSet); EthernetHandleSet_destroy(handleSet);
return NULL;
} }
#endif #endif

@ -555,6 +555,8 @@ IedConnection_setState(IedConnection self, IedConnectionState newState)
static void static void
mmsConnectionStateChangedHandler(MmsConnection connection, void* parameter, MmsConnectionState newState) mmsConnectionStateChangedHandler(MmsConnection connection, void* parameter, MmsConnectionState newState)
{ {
(void)connection;
IedConnection self = (IedConnection) parameter; IedConnection self = (IedConnection) parameter;
if (newState == MMS_CONNECTION_STATE_CONNECTED) { if (newState == MMS_CONNECTION_STATE_CONNECTED) {
@ -1894,6 +1896,8 @@ struct sClientProvidedFileReadHandler {
static void static void
mmsFileReadHandler(void* parameter, int32_t frsmId, uint8_t* buffer, uint32_t bytesReceived) mmsFileReadHandler(void* parameter, int32_t frsmId, uint8_t* buffer, uint32_t bytesReceived)
{ {
(void)frsmId;
struct sClientProvidedFileReadHandler* handler = (struct sClientProvidedFileReadHandler*) parameter; struct sClientProvidedFileReadHandler* handler = (struct sClientProvidedFileReadHandler*) parameter;
handler->retVal = handler->handler(handler->handlerParameter, buffer, bytesReceived); handler->retVal = handler->handler(handler->handlerParameter, buffer, bytesReceived);
@ -1955,6 +1959,11 @@ IedConnection_getFile(IedConnection self, IedClientError* error, const char* fil
static void static void
mmsConnectionFileCloseHandler (uint32_t invokeId, void* parameter, MmsError mmsError, bool success) mmsConnectionFileCloseHandler (uint32_t invokeId, void* parameter, MmsError mmsError, bool success)
{ {
(void)mmsError;
(void)success;
/* TODO log error */
IedConnection self = (IedConnection) parameter; IedConnection self = (IedConnection) parameter;
IedConnectionOutstandingCall call = iedConnection_lookupOutstandingCall(self, invokeId); IedConnectionOutstandingCall call = iedConnection_lookupOutstandingCall(self, invokeId);
@ -2033,6 +2042,9 @@ mmsConnectionFileReadHandler (uint32_t invokeId, void* parameter, MmsError mmsEr
static void static void
mmsConnectionFileOpenHandler (uint32_t invokeId, void* parameter, MmsError mmsError, int32_t frsmId, uint32_t fileSize, uint64_t lastModified) mmsConnectionFileOpenHandler (uint32_t invokeId, void* parameter, MmsError mmsError, int32_t frsmId, uint32_t fileSize, uint64_t lastModified)
{ {
(void)fileSize;
(void)lastModified;
IedConnection self = (IedConnection) parameter; IedConnection self = (IedConnection) parameter;
IedConnectionOutstandingCall call = iedConnection_lookupOutstandingCall(self, invokeId); IedConnectionOutstandingCall call = iedConnection_lookupOutstandingCall(self, invokeId);
@ -2131,6 +2143,8 @@ IedConnection_setFile(IedConnection self, IedClientError* error, const char* sou
static void static void
deleteFileAndSetFileHandler (uint32_t invokeId, void* parameter, MmsError mmsError, bool success) deleteFileAndSetFileHandler (uint32_t invokeId, void* parameter, MmsError mmsError, bool success)
{ {
(void)success;
IedConnection self = (IedConnection) parameter; IedConnection self = (IedConnection) parameter;
IedConnectionOutstandingCall call = iedConnection_lookupOutstandingCall(self, invokeId); IedConnectionOutstandingCall call = iedConnection_lookupOutstandingCall(self, invokeId);

@ -906,12 +906,15 @@ IedServer_setGoCBHandler(IedServer self, GoCBEventHandler handler, void* paramet
MmsValue* MmsValue*
IedServer_getAttributeValue(IedServer self, DataAttribute* dataAttribute) IedServer_getAttributeValue(IedServer self, DataAttribute* dataAttribute)
{ {
(void)self;
return dataAttribute->mmsValue; return dataAttribute->mmsValue;
} }
bool bool
IedServer_getBooleanAttributeValue(IedServer self, const DataAttribute* dataAttribute) IedServer_getBooleanAttributeValue(IedServer self, const DataAttribute* dataAttribute)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(dataAttribute != NULL); assert(dataAttribute != NULL);
assert(dataAttribute->mmsValue != NULL); assert(dataAttribute->mmsValue != NULL);
@ -923,6 +926,8 @@ IedServer_getBooleanAttributeValue(IedServer self, const DataAttribute* dataAttr
int32_t int32_t
IedServer_getInt32AttributeValue(IedServer self, const DataAttribute* dataAttribute) IedServer_getInt32AttributeValue(IedServer self, const DataAttribute* dataAttribute)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(dataAttribute != NULL); assert(dataAttribute != NULL);
assert(dataAttribute->mmsValue != NULL); assert(dataAttribute->mmsValue != NULL);
@ -935,6 +940,8 @@ IedServer_getInt32AttributeValue(IedServer self, const DataAttribute* dataAttrib
int64_t int64_t
IedServer_getInt64AttributeValue(IedServer self, const DataAttribute* dataAttribute) IedServer_getInt64AttributeValue(IedServer self, const DataAttribute* dataAttribute)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(dataAttribute != NULL); assert(dataAttribute != NULL);
assert(dataAttribute->mmsValue != NULL); assert(dataAttribute->mmsValue != NULL);
@ -947,6 +954,8 @@ IedServer_getInt64AttributeValue(IedServer self, const DataAttribute* dataAttrib
uint32_t uint32_t
IedServer_getUInt32AttributeValue(IedServer self, const DataAttribute* dataAttribute) IedServer_getUInt32AttributeValue(IedServer self, const DataAttribute* dataAttribute)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(dataAttribute != NULL); assert(dataAttribute != NULL);
assert(dataAttribute->mmsValue != NULL); assert(dataAttribute->mmsValue != NULL);
@ -959,6 +968,8 @@ IedServer_getUInt32AttributeValue(IedServer self, const DataAttribute* dataAttri
float float
IedServer_getFloatAttributeValue(IedServer self, const DataAttribute* dataAttribute) IedServer_getFloatAttributeValue(IedServer self, const DataAttribute* dataAttribute)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(dataAttribute != NULL); assert(dataAttribute != NULL);
assert(dataAttribute->mmsValue != NULL); assert(dataAttribute->mmsValue != NULL);
@ -970,6 +981,8 @@ IedServer_getFloatAttributeValue(IedServer self, const DataAttribute* dataAttrib
uint64_t uint64_t
IedServer_getUTCTimeAttributeValue(IedServer self, const DataAttribute* dataAttribute) IedServer_getUTCTimeAttributeValue(IedServer self, const DataAttribute* dataAttribute)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(dataAttribute != NULL); assert(dataAttribute != NULL);
assert(dataAttribute->mmsValue != NULL); assert(dataAttribute->mmsValue != NULL);
@ -981,6 +994,8 @@ IedServer_getUTCTimeAttributeValue(IedServer self, const DataAttribute* dataAttr
uint32_t uint32_t
IedServer_getBitStringAttributeValue(IedServer self, const DataAttribute* dataAttribute) IedServer_getBitStringAttributeValue(IedServer self, const DataAttribute* dataAttribute)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(dataAttribute != NULL); assert(dataAttribute != NULL);
assert(dataAttribute->mmsValue != NULL); assert(dataAttribute->mmsValue != NULL);
@ -993,6 +1008,8 @@ IedServer_getBitStringAttributeValue(IedServer self, const DataAttribute* dataAt
const char* const char*
IedServer_getStringAttributeValue(IedServer self, const DataAttribute* dataAttribute) IedServer_getStringAttributeValue(IedServer self, const DataAttribute* dataAttribute)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(dataAttribute != NULL); assert(dataAttribute != NULL);
assert(dataAttribute->mmsValue != NULL); assert(dataAttribute->mmsValue != NULL);
@ -1571,6 +1588,8 @@ IedServer_changeActiveSettingGroup(IedServer self, SettingGroupControlBlock* sgc
uint8_t uint8_t
IedServer_getActiveSettingGroup(IedServer self, SettingGroupControlBlock* sgcb) IedServer_getActiveSettingGroup(IedServer self, SettingGroupControlBlock* sgcb)
{ {
(void)self;
return sgcb->actSG; return sgcb->actSG;
} }

@ -49,9 +49,9 @@
#define PENDING_EVENT_OP_OK_TRUE 16 #define PENDING_EVENT_OP_OK_TRUE 16
#define PENDING_EVENT_OP_OK_FALSE 32 #define PENDING_EVENT_OP_OK_FALSE 32
static MmsValue emptyString = {MMS_STRUCTURE}; static MmsValue emptyString = {MMS_STRUCTURE, false, {0}};
static MmsValue delayedResponse = {MMS_DATA_ACCESS_ERROR, 0, {DATA_ACCESS_ERROR_NO_RESPONSE}}; static MmsValue delayedResponse = {MMS_DATA_ACCESS_ERROR, false, {DATA_ACCESS_ERROR_NO_RESPONSE}};
void void
ControlObject_sendLastApplError(ControlObject* self, MmsServerConnection connection, char* ctlVariable, int error, ControlObject_sendLastApplError(ControlObject* self, MmsServerConnection connection, char* ctlVariable, int error,

@ -154,6 +154,8 @@ LogInstance_logEntryData(LogInstance* self, uint64_t entryID, const char* dataRe
void void
LogInstance_logEntryFinished(LogInstance* self, uint64_t entryID) LogInstance_logEntryFinished(LogInstance* self, uint64_t entryID)
{ {
(void)entryID;
self->locked = false; self->locked = false;
} }
@ -451,6 +453,8 @@ MmsDataAccessError
LIBIEC61850_LOG_SVC_writeAccessLogControlBlock(MmsMapping* self, MmsDomain* domain, char* variableIdOrig, LIBIEC61850_LOG_SVC_writeAccessLogControlBlock(MmsMapping* self, MmsDomain* domain, char* variableIdOrig,
MmsValue* value, MmsServerConnection connection) MmsValue* value, MmsServerConnection connection)
{ {
(void)connection;
MmsDataAccessError retVal = DATA_ACCESS_ERROR_SUCCESS; MmsDataAccessError retVal = DATA_ACCESS_ERROR_SUCCESS;
bool updateValue = false; bool updateValue = false;

@ -2423,7 +2423,7 @@ checkIfValueBelongsToModelNode(DataAttribute* dataAttribute, MmsValue* value, Mm
} }
static FunctionalConstraint static FunctionalConstraint
getFunctionalConstraintForWritableNode(MmsMapping* self, char* separator) getFunctionalConstraintForWritableNode(char* separator)
{ {
if (isFunctionalConstraintCF(separator)) if (isFunctionalConstraintCF(separator))
return IEC61850_FC_CF; return IEC61850_FC_CF;
@ -2739,7 +2739,7 @@ mmsWriteHandler(void* parameter, MmsDomain* domain,
} }
#endif /* (CONFIG_IEC61850_SETTING_GROUPS == 1) */ #endif /* (CONFIG_IEC61850_SETTING_GROUPS == 1) */
FunctionalConstraint fc = getFunctionalConstraintForWritableNode(self, separator); FunctionalConstraint fc = getFunctionalConstraintForWritableNode(separator);
#if (CONFIG_IEC61850_SETTING_GROUPS == 1) #if (CONFIG_IEC61850_SETTING_GROUPS == 1)
if (fc == IEC61850_FC_SE) { if (fc == IEC61850_FC_SE) {
@ -3141,6 +3141,8 @@ mmsReadAccessHandler (void* parameter, MmsDomain* domain, char* variableId, MmsS
{ {
MmsMapping* self = (MmsMapping*) parameter; MmsMapping* self = (MmsMapping*) parameter;
(void)isDirectAccess;
if (DEBUG_IED_SERVER) if (DEBUG_IED_SERVER)
printf("IED_SERVER: mmsReadAccessHandler: Requested %s\n", variableId); printf("IED_SERVER: mmsReadAccessHandler: Requested %s\n", variableId);
@ -3247,6 +3249,10 @@ variableListChangedHandler (void* parameter, bool create, MmsVariableListType li
{ {
MmsError allow = MMS_ERROR_NONE; MmsError allow = MMS_ERROR_NONE;
(void)connection;
/* TODO add log message */
#if (DEBUG_IED_SERVER == 1) #if (DEBUG_IED_SERVER == 1)
if (create) if (create)
printf("IED_SERVER: create data set "); printf("IED_SERVER: create data set ");
@ -3784,7 +3790,7 @@ IedServer_performPeriodicTasks(IedServer self)
#if (CONFIG_MMS_THREADLESS_STACK != 1) #if (CONFIG_MMS_THREADLESS_STACK != 1)
/* single worker thread for all enabled GOOSE and report control blocks */ /* single worker thread for all enabled GOOSE and report control blocks */
static void static void*
eventWorkerThread(MmsMapping* self) eventWorkerThread(MmsMapping* self)
{ {
bool running = true; bool running = true;
@ -3800,6 +3806,8 @@ eventWorkerThread(MmsMapping* self)
if (DEBUG_IED_SERVER) if (DEBUG_IED_SERVER)
printf("IED_SERVER: event worker thread finished!\n"); printf("IED_SERVER: event worker thread finished!\n");
return NULL;
} }
void void

@ -1102,7 +1102,7 @@ createUnbufferedReportControlBlock(ReportControlBlock* reportControlBlock,
static MmsVariableSpecification* static MmsVariableSpecification*
createBufferedReportControlBlock(ReportControlBlock* reportControlBlock, createBufferedReportControlBlock(ReportControlBlock* reportControlBlock,
ReportControl* reportControl, MmsMapping* mmsMapping) ReportControl* reportControl)
{ {
MmsVariableSpecification* rcb = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification)); MmsVariableSpecification* rcb = (MmsVariableSpecification*) GLOBAL_CALLOC(1, sizeof(MmsVariableSpecification));
rcb->name = StringUtils_copyString(reportControlBlock->name); rcb->name = StringUtils_copyString(reportControlBlock->name);
@ -1346,7 +1346,7 @@ Reporting_createMmsBufferedRCBs(MmsMapping* self, MmsDomain* domain,
reportControlBlock->name); reportControlBlock->name);
namedVariable->typeSpec.structure.elements[currentReport] = namedVariable->typeSpec.structure.elements[currentReport] =
createBufferedReportControlBlock(reportControlBlock, rc, self); createBufferedReportControlBlock(reportControlBlock, rc);
LinkedList_add(self->reportControls, rc); LinkedList_add(self->reportControls, rc);
@ -1565,6 +1565,10 @@ checkReservationTimeout(MmsMapping* self, ReportControl* rc)
void void
ReportControl_readAccess(ReportControl* rc, MmsMapping* mmsMapping, char* elementName) ReportControl_readAccess(ReportControl* rc, MmsMapping* mmsMapping, char* elementName)
{ {
(void)elementName;
/* TODO add log message */
/* check reservation timeout */ /* check reservation timeout */
if (rc->buffered) { if (rc->buffered) {
checkReservationTimeout(mmsMapping, rc); checkReservationTimeout(mmsMapping, rc);

@ -1195,6 +1195,9 @@ CDC_STV_create(const char* dataObjectName, ModelNode* parent,
uint32_t wpOptions, uint32_t wpOptions,
bool hasOldStatus) bool hasOldStatus)
{ {
(void)controlOptions; /* TODO implement */
(void)wpOptions; /* TODO implement */
DataObject* newSTV = DataObject_create(dataObjectName, parent, 0); DataObject* newSTV = DataObject_create(dataObjectName, parent, 0);
CDC_INS_create("actSt", (ModelNode*) newSTV, 0); CDC_INS_create("actSt", (ModelNode*) newSTV, 0);
@ -1214,6 +1217,9 @@ CDC_ALM_create(const char* dataObjectName, ModelNode* parent,
uint32_t wpOptions, uint32_t wpOptions,
bool hasOldStatus) bool hasOldStatus)
{ {
(void)controlOptions; /* TODO implement */
(void)wpOptions; /* TODO implement */
DataObject* newALM = DataObject_create(dataObjectName, parent, 0); DataObject* newALM = DataObject_create(dataObjectName, parent, 0);
CDC_SPC_create("almAck", (ModelNode*) newALM, 0, CDC_CTL_MODEL_DIRECT_NORMAL | CDC_CTL_OPTION_ORIGIN); CDC_SPC_create("almAck", (ModelNode*) newALM, 0, CDC_CTL_MODEL_DIRECT_NORMAL | CDC_CTL_OPTION_ORIGIN);
@ -1237,6 +1243,9 @@ CDC_CMD_create(const char* dataObjectName, ModelNode* parent,
bool hasCmTm, bool hasCmTm,
bool hasCmCt) bool hasCmCt)
{ {
(void)hasCmTm; /* TODO implement */
(void)hasCmCt; /* TODO implement */
DataObject* newCMD = DataObject_create(dataObjectName, parent, 0); DataObject* newCMD = DataObject_create(dataObjectName, parent, 0);
CDC_INC_create("actSt", (ModelNode*) newCMD, 0, controlOptions); CDC_INC_create("actSt", (ModelNode*) newCMD, 0, controlOptions);
@ -1263,6 +1272,8 @@ CDC_CTE_create(const char* dataObjectName, ModelNode* parent,
uint32_t wpOptions, uint32_t wpOptions,
bool hasHisRs) bool hasHisRs)
{ {
(void)controlOptions; /* TODO implement */
DataObject* newCTE = DataObject_create(dataObjectName, parent, 0); DataObject* newCTE = DataObject_create(dataObjectName, parent, 0);
CDC_SPC_create("manRs", (ModelNode*) newCTE, 0, CDC_CTL_MODEL_DIRECT_NORMAL | CDC_CTL_OPTION_ORIGIN); CDC_SPC_create("manRs", (ModelNode*) newCTE, 0, CDC_CTL_MODEL_DIRECT_NORMAL | CDC_CTL_OPTION_ORIGIN);
@ -1302,6 +1313,8 @@ CDC_TMS_create(const char* dataObjectName, ModelNode* parent,
uint32_t wpOptions, uint32_t wpOptions,
bool hasHisRs) bool hasHisRs)
{ {
(void)controlOptions; /* TODO implement */
DataObject* newTMS = DataObject_create(dataObjectName, parent, 0); DataObject* newTMS = DataObject_create(dataObjectName, parent, 0);
CDC_SPC_create("manRs", (ModelNode*) newTMS, 0, CDC_CTL_MODEL_DIRECT_NORMAL | CDC_CTL_OPTION_ORIGIN); CDC_SPC_create("manRs", (ModelNode*) newTMS, 0, CDC_CTL_MODEL_DIRECT_NORMAL | CDC_CTL_OPTION_ORIGIN);

@ -43,6 +43,10 @@ readLine(FileHandle fileHandle, uint8_t* buffer, int maxSize)
/* eat up leading cr or lf */ /* eat up leading cr or lf */
while (fileReadResult > 0) { while (fileReadResult > 0) {
if (bytesRead == maxSize)
break;
fileReadResult = FileSystem_readFile(fileHandle, buffer + bufPos, 1); fileReadResult = FileSystem_readFile(fileHandle, buffer + bufPos, 1);
if (fileReadResult == 1) { if (fileReadResult == 1) {
@ -57,6 +61,10 @@ readLine(FileHandle fileHandle, uint8_t* buffer, int maxSize)
if (fileReadResult > 0) { if (fileReadResult > 0) {
while (fileReadResult > 0) { while (fileReadResult > 0) {
if (bytesRead == maxSize)
break;
fileReadResult = FileSystem_readFile(fileHandle, buffer + bufPos, 1); fileReadResult = FileSystem_readFile(fileHandle, buffer + bufPos, 1);
if (fileReadResult == 1) { if (fileReadResult == 1) {

@ -105,6 +105,9 @@ BerDecoder_decodeLength(uint8_t* buffer, int* length, int bufPos, int maxBufPos)
char* char*
BerDecoder_decodeString(uint8_t* buffer, int strlen, int bufPos, int maxBufPos) BerDecoder_decodeString(uint8_t* buffer, int strlen, int bufPos, int maxBufPos)
{ {
if (maxBufPos - bufPos < 0)
return NULL;
char* string = (char*) GLOBAL_MALLOC(strlen + 1); char* string = (char*) GLOBAL_MALLOC(strlen + 1);
memcpy(string, buffer + bufPos, strlen); memcpy(string, buffer + bufPos, strlen);
string[strlen] = 0; string[strlen] = 0;

@ -1251,19 +1251,19 @@ struct sMmsJournalVariable {
LIB61850_API void LIB61850_API void
MmsJournalEntry_destroy(MmsJournalEntry self); MmsJournalEntry_destroy(MmsJournalEntry self);
LIB61850_API const MmsValue* LIB61850_API MmsValue*
MmsJournalEntry_getEntryID(MmsJournalEntry self); MmsJournalEntry_getEntryID(MmsJournalEntry self);
LIB61850_API const MmsValue* LIB61850_API MmsValue*
MmsJournalEntry_getOccurenceTime(MmsJournalEntry self); MmsJournalEntry_getOccurenceTime(MmsJournalEntry self);
LIB61850_API const LinkedList /* <MmsJournalVariable> */ LIB61850_API LinkedList /* <MmsJournalVariable> */
MmsJournalEntry_getJournalVariables(MmsJournalEntry self); MmsJournalEntry_getJournalVariables(MmsJournalEntry self);
LIB61850_API const char* LIB61850_API const char*
MmsJournalVariable_getTag(MmsJournalVariable self); MmsJournalVariable_getTag(MmsJournalVariable self);
LIB61850_API const MmsValue* LIB61850_API MmsValue*
MmsJournalVariable_getValue(MmsJournalVariable self); MmsJournalVariable_getValue(MmsJournalVariable self);
typedef void typedef void

@ -71,9 +71,6 @@ typedef struct sAcseConnection
LIB61850_INTERNAL void LIB61850_INTERNAL void
AcseConnection_init(AcseConnection* self, AcseAuthenticator authenticator, void* parameter, TLSSocket tlsSocket); AcseConnection_init(AcseConnection* self, AcseAuthenticator authenticator, void* parameter, TLSSocket tlsSocket);
LIB61850_INTERNAL void
AcseConnection_destroy(AcseConnection* self);
LIB61850_INTERNAL AcseIndication LIB61850_INTERNAL AcseIndication
AcseConnection_parseMessage(AcseConnection* self, ByteBuffer* message); AcseConnection_parseMessage(AcseConnection* self, ByteBuffer* message);

@ -44,7 +44,7 @@ typedef enum
ISO_IND_TICK ISO_IND_TICK
} IsoIndication; } IsoIndication;
typedef void* typedef void
(*IsoIndicationCallback)(IsoIndication indication, void* param, ByteBuffer* payload); (*IsoIndicationCallback)(IsoIndication indication, void* param, ByteBuffer* payload);
/** /**

@ -58,10 +58,10 @@ LIB61850_INTERNAL void
IsoSession_createConnectSpdu(IsoSession* self, IsoConnectionParameters isoParameters, BufferChain buffer, BufferChain payload); IsoSession_createConnectSpdu(IsoSession* self, IsoConnectionParameters isoParameters, BufferChain buffer, BufferChain payload);
LIB61850_INTERNAL IsoSessionIndication LIB61850_INTERNAL IsoSessionIndication
IsoSession_parseMessage(IsoSession* session, ByteBuffer* message); IsoSession_parseMessage(IsoSession* self, ByteBuffer* message);
LIB61850_INTERNAL void LIB61850_INTERNAL void
IsoSession_createDataSpdu(IsoSession* session, BufferChain buffer, BufferChain payload); IsoSession_createDataSpdu(IsoSession* self, BufferChain buffer, BufferChain payload);
LIB61850_INTERNAL void LIB61850_INTERNAL void
IsoSession_createAcceptSpdu(IsoSession* self, BufferChain buffer, BufferChain payload); IsoSession_createAcceptSpdu(IsoSession* self, BufferChain buffer, BufferChain payload);

@ -354,7 +354,7 @@ mmsClient_createReadJournalRequestStartAfter(uint32_t invokeId, ByteBuffer* requ
MmsValue* timeSpecification, MmsValue* entrySpecification); MmsValue* timeSpecification, MmsValue* entrySpecification);
LIB61850_INTERNAL bool LIB61850_INTERNAL bool
mmsClient_parseReadJournalResponse(MmsConnection self, ByteBuffer* response, int respBufPos, bool* moreFollows, LinkedList* result); mmsClient_parseReadJournalResponse(ByteBuffer* response, int respBufPos, bool* moreFollows, LinkedList* result);
LIB61850_INTERNAL void LIB61850_INTERNAL void
mmsClient_handleFileOpenRequest(MmsConnection connection, mmsClient_handleFileOpenRequest(MmsConnection connection,

@ -407,17 +407,14 @@ AcseConnection_init(AcseConnection* self, AcseAuthenticator authenticator, void*
#if (CONFIG_MMS_SUPPORT_TLS == 1) #if (CONFIG_MMS_SUPPORT_TLS == 1)
self->tlsSocket = tlsSocket; self->tlsSocket = tlsSocket;
#else
(void)tlsSocket;
#endif #endif
memset(&(self->applicationReference), 0, memset(&(self->applicationReference), 0,
sizeof(self->applicationReference)); sizeof(self->applicationReference));
} }
void
AcseConnection_destroy(AcseConnection* connection)
{
}
AcseIndication AcseIndication
AcseConnection_parseMessage(AcseConnection* self, ByteBuffer* message) AcseConnection_parseMessage(AcseConnection* self, ByteBuffer* message)
{ {
@ -575,6 +572,8 @@ AcseConnection_createAssociateRequestMessage(AcseConnection* self,
BufferChain payload, BufferChain payload,
AcseAuthenticationParameter authParameter) AcseAuthenticationParameter authParameter)
{ {
(void)self;
assert(self != NULL); assert(self != NULL);
assert(writeBuffer != NULL); assert(writeBuffer != NULL);
assert(payload != NULL); assert(payload != NULL);
@ -777,6 +776,8 @@ AcseConnection_createAssociateRequestMessage(AcseConnection* self,
void void
AcseConnection_createAbortMessage(AcseConnection* self, BufferChain writeBuffer, bool isProvider) AcseConnection_createAbortMessage(AcseConnection* self, BufferChain writeBuffer, bool isProvider)
{ {
(void)self;
uint8_t* buffer = writeBuffer->buffer; uint8_t* buffer = writeBuffer->buffer;
buffer[0] = 0x64; /* [APPLICATION 4] */ buffer[0] = 0x64; /* [APPLICATION 4] */
@ -797,6 +798,8 @@ AcseConnection_createAbortMessage(AcseConnection* self, BufferChain writeBuffer,
void void
AcseConnection_createReleaseRequestMessage(AcseConnection* self, BufferChain writeBuffer) AcseConnection_createReleaseRequestMessage(AcseConnection* self, BufferChain writeBuffer)
{ {
(void)self;
uint8_t* buffer = writeBuffer->buffer; uint8_t* buffer = writeBuffer->buffer;
buffer[0] = 0x62; buffer[0] = 0x62;
@ -813,6 +816,8 @@ AcseConnection_createReleaseRequestMessage(AcseConnection* self, BufferChain wri
void void
AcseConnection_createReleaseResponseMessage(AcseConnection* self, BufferChain writeBuffer) AcseConnection_createReleaseResponseMessage(AcseConnection* self, BufferChain writeBuffer)
{ {
(void)self;
uint8_t* buffer = writeBuffer->buffer; uint8_t* buffer = writeBuffer->buffer;
buffer[0] = 0x63; buffer[0] = 0x63;

@ -83,6 +83,9 @@ IsoConnectionParameters_setTlsConfiguration(IsoConnectionParameters self, TLSCon
{ {
#if (CONFIG_MMS_SUPPORT_TLS == 1) #if (CONFIG_MMS_SUPPORT_TLS == 1)
self->tlsConfiguration = tlsConfig; self->tlsConfiguration = tlsConfig;
#else
(void)self;
(void)tlsConfig;
#endif #endif
} }

@ -68,36 +68,14 @@ static int32_t UTF8String_mv[7] = { 0, 0,
int int
UTF8String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, UTF8String_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) { asn_app_constraint_failed_f *ctfailcb, void *app_key)
{
(void)td;
(void)ctfailcb;
(void)app_key;
ssize_t len = UTF8String_length((const UTF8String_t *)sptr); ssize_t len = UTF8String_length((const UTF8String_t *)sptr);
#if 0
switch(len) {
case U8E_EINVAL:
_ASN_CTFAIL(app_key, td,
"%s: value not given", td->name);
break;
case U8E_TRUNC:
_ASN_CTFAIL(app_key, td,
"%s: truncated UTF-8 sequence (%s:%d)",
td->name, __FILE__, __LINE__);
break;
case U8E_ILLSTART:
_ASN_CTFAIL(app_key, td,
"%s: UTF-8 illegal start of encoding (%s:%d)",
td->name, __FILE__, __LINE__);
break;
case U8E_NOTCONT:
_ASN_CTFAIL(app_key, td,
"%s: UTF-8 not continuation (%s:%d)",
td->name, __FILE__, __LINE__);
break;
case U8E_NOTMIN:
_ASN_CTFAIL(app_key, td,
"%s: UTF-8 not minimal sequence (%s:%d)",
td->name, __FILE__, __LINE__);
break;
}
#endif
return (len < 0) ? -1 : 0; return (len < 0) ? -1 : 0;
} }

@ -873,7 +873,7 @@ handleAsyncResponse(MmsConnection self, ByteBuffer* response, uint32_t bufPos, M
bool moreFollows = false; bool moreFollows = false;
LinkedList entries = NULL; LinkedList entries = NULL;
if (mmsClient_parseReadJournalResponse(self, response, bufPos, &moreFollows, &entries) == false) { if (mmsClient_parseReadJournalResponse(response, bufPos, &moreFollows, &entries) == false) {
handler(outstandingCall->invokeId, outstandingCall->userParameter, MMS_ERROR_PARSING_RESPONSE, NULL, false); handler(outstandingCall->invokeId, outstandingCall->userParameter, MMS_ERROR_PARSING_RESPONSE, NULL, false);
} }
else { else {
@ -1463,6 +1463,8 @@ MmsConnection_createInternal(TLSConfiguration tlsConfig, bool createThread)
if (tlsConfig) { if (tlsConfig) {
IsoConnectionParameters_setTlsConfiguration(self->isoParameters, tlsConfig); IsoConnectionParameters_setTlsConfiguration(self->isoParameters, tlsConfig);
} }
#else
(void)tlsConfig;
#endif /* (CONFIG_MMS_SUPPORT_TLS == 1) */ #endif /* (CONFIG_MMS_SUPPORT_TLS == 1) */
#if (CONFIG_MMS_THREADLESS_STACK == 0) #if (CONFIG_MMS_THREADLESS_STACK == 0)
@ -1956,6 +1958,8 @@ struct getNameListParameters
static void static void
getNameListHandler(uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList nameList, bool moreFollows) getNameListHandler(uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList nameList, bool moreFollows)
{ {
(void)invokeId;
struct getNameListParameters* parameters = (struct getNameListParameters*) parameter; struct getNameListParameters* parameters = (struct getNameListParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -2129,6 +2133,8 @@ struct readNVParameters
static void static void
readVariableHandler(uint32_t invokeId, void* parameter, MmsError mmsError, MmsValue* value) readVariableHandler(uint32_t invokeId, void* parameter, MmsError mmsError, MmsValue* value)
{ {
(void)invokeId;
struct readNVParameters* parameters = (struct readNVParameters*) parameter; struct readNVParameters* parameters = (struct readNVParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -2609,6 +2615,8 @@ struct readNVLDirectoryParameters
static void static void
readNVLDirectoryHandler(uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList /* <MmsVariableAccessSpecification*> */ specs, bool deletable) readNVLDirectoryHandler(uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList /* <MmsVariableAccessSpecification*> */ specs, bool deletable)
{ {
(void)invokeId;
struct readNVLDirectoryParameters* parameters = (struct readNVLDirectoryParameters*) parameter; struct readNVLDirectoryParameters* parameters = (struct readNVLDirectoryParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -2765,6 +2773,8 @@ struct defineNVLParameters
static void static void
defineNVLHandler(uint32_t invokeId, void* parameter, MmsError mmsError, bool success) defineNVLHandler(uint32_t invokeId, void* parameter, MmsError mmsError, bool success)
{ {
(void)invokeId;
struct defineNVLParameters* parameters = (struct defineNVLParameters*) parameter; struct defineNVLParameters* parameters = (struct defineNVLParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -3022,6 +3032,8 @@ struct getVarAccessAttrParameters
static void static void
getAccessAttrHandler(uint32_t invokeId, void* parameter, MmsError mmsError, MmsVariableSpecification* typeSpec) getAccessAttrHandler(uint32_t invokeId, void* parameter, MmsError mmsError, MmsVariableSpecification* typeSpec)
{ {
(void)invokeId;
struct getVarAccessAttrParameters* parameters = (struct getVarAccessAttrParameters*) parameter; struct getVarAccessAttrParameters* parameters = (struct getVarAccessAttrParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -3102,6 +3114,8 @@ struct identifyParameters
static void static void
identifyHandler(uint32_t invokeId, void* parameter, MmsError mmsError, char* vendorName, char* modelName, char* revision) identifyHandler(uint32_t invokeId, void* parameter, MmsError mmsError, char* vendorName, char* modelName, char* revision)
{ {
(void)invokeId;
struct identifyParameters* parameters = (struct identifyParameters*) parameter; struct identifyParameters* parameters = (struct identifyParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -3188,6 +3202,8 @@ struct getServerStatusParameters
static void static void
getServerStatusHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int vmdLogicalStatus, int vmdPhysicalStatus) getServerStatusHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int vmdLogicalStatus, int vmdPhysicalStatus)
{ {
(void)invokeId;
struct getServerStatusParameters* parameters = (struct getServerStatusParameters*) parameter; struct getServerStatusParameters* parameters = (struct getServerStatusParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -3285,19 +3301,19 @@ MmsJournalEntry_destroy(MmsJournalEntry self)
} }
} }
const MmsValue* MmsValue*
MmsJournalEntry_getEntryID(MmsJournalEntry self) MmsJournalEntry_getEntryID(MmsJournalEntry self)
{ {
return self->entryID; return self->entryID;
} }
const MmsValue* MmsValue*
MmsJournalEntry_getOccurenceTime(MmsJournalEntry self) MmsJournalEntry_getOccurenceTime(MmsJournalEntry self)
{ {
return self->occurenceTime; return self->occurenceTime;
} }
const LinkedList /* <MmsJournalVariable> */ LinkedList /* <MmsJournalVariable> */
MmsJournalEntry_getJournalVariables(MmsJournalEntry self) MmsJournalEntry_getJournalVariables(MmsJournalEntry self)
{ {
return self->journalVariables; return self->journalVariables;
@ -3309,7 +3325,7 @@ MmsJournalVariable_getTag(MmsJournalVariable self)
return self->tag; return self->tag;
} }
const MmsValue* MmsValue*
MmsJournalVariable_getValue(MmsJournalVariable self) MmsJournalVariable_getValue(MmsJournalVariable self)
{ {
return self->value; return self->value;
@ -3326,6 +3342,8 @@ struct readJournalParameters
static void static void
readJournalHandler(uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList entries, bool moreFollows) readJournalHandler(uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList entries, bool moreFollows)
{ {
(void)invokeId;
struct readJournalParameters* parameters = (struct readJournalParameters*) parameter; struct readJournalParameters* parameters = (struct readJournalParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -3493,6 +3511,8 @@ struct fileOpenParameters
static void static void
fileOpenHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int32_t frsmId, uint32_t fileSize, uint64_t lastModified) fileOpenHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int32_t frsmId, uint32_t fileSize, uint64_t lastModified)
{ {
(void)invokeId;
struct fileOpenParameters* parameters = (struct fileOpenParameters*) parameter; struct fileOpenParameters* parameters = (struct fileOpenParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -3600,6 +3620,8 @@ struct fileOperationParameters
static void static void
fileOperationHandler(uint32_t invokeId, void* parameter, MmsError mmsError, bool success) fileOperationHandler(uint32_t invokeId, void* parameter, MmsError mmsError, bool success)
{ {
(void)invokeId;
struct fileOperationParameters* parameters = (struct fileOperationParameters*) parameter; struct fileOperationParameters* parameters = (struct fileOperationParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -3769,6 +3791,8 @@ static void
fileReadHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int frsmId, uint8_t* buffer, uint32_t byteReceived, fileReadHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int frsmId, uint8_t* buffer, uint32_t byteReceived,
bool moreFollows) bool moreFollows)
{ {
(void)invokeId;
struct fileReadParameters* parameters = (struct fileReadParameters*) parameter; struct fileReadParameters* parameters = (struct fileReadParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -3874,6 +3898,8 @@ static void
getFileDirHandler(uint32_t invokeId, void* parameter, MmsError mmsError, char* filename, uint32_t size, uint64_t lastModified, getFileDirHandler(uint32_t invokeId, void* parameter, MmsError mmsError, char* filename, uint32_t size, uint64_t lastModified,
bool moreFollows) bool moreFollows)
{ {
(void)invokeId;
struct getFileDirParameters* parameters = (struct getFileDirParameters*) parameter; struct getFileDirParameters* parameters = (struct getFileDirParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -4129,6 +4155,8 @@ exit_function:
static void static void
writeVariableHandler(uint32_t invokeId, void* parameter, MmsError mmsError, MmsDataAccessError accessError) writeVariableHandler(uint32_t invokeId, void* parameter, MmsError mmsError, MmsDataAccessError accessError)
{ {
(void)invokeId;
struct writeVariableParameters* parameters = (struct writeVariableParameters*) parameter; struct writeVariableParameters* parameters = (struct writeVariableParameters*) parameter;
parameters->err = mmsError; parameters->err = mmsError;
@ -4274,6 +4302,8 @@ struct writeMultipleVariablesParameter
static void static void
writeMultipleVariablesHandler(uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList /* <MmsValue*> */ accessResults) writeMultipleVariablesHandler(uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList /* <MmsValue*> */ accessResults)
{ {
(void)invokeId;
struct writeMultipleVariablesParameter* parameters = (struct writeMultipleVariablesParameter*) parameter; struct writeMultipleVariablesParameter* parameters = (struct writeMultipleVariablesParameter*) parameter;
parameters->err = mmsError; parameters->err = mmsError;

@ -52,6 +52,8 @@ mmsClient_createIdentifyRequest(uint32_t invokeId, ByteBuffer* request)
bool bool
mmsClient_parseIdentifyResponse(MmsConnection self, ByteBuffer* response, uint32_t respBufPos, uint32_t invokeId, MmsConnection_IdentifyHandler handler, void* parameter) mmsClient_parseIdentifyResponse(MmsConnection self, ByteBuffer* response, uint32_t respBufPos, uint32_t invokeId, MmsConnection_IdentifyHandler handler, void* parameter)
{ {
(void)self;
uint8_t* buffer = ByteBuffer_getBuffer(response); uint8_t* buffer = ByteBuffer_getBuffer(response);
int maxBufPos = ByteBuffer_getSize(response); int maxBufPos = ByteBuffer_getSize(response);
int length; int length;

@ -110,6 +110,8 @@ mmsClient_createInitiateRequest(MmsConnection self, ByteBuffer* message)
int int
mmsClient_createConcludeRequest(MmsConnection self, ByteBuffer* message) mmsClient_createConcludeRequest(MmsConnection self, ByteBuffer* message)
{ {
(void)self;
if (message->maxSize > 1) { if (message->maxSize > 1) {
message->buffer[0] = 0x8b; message->buffer[0] = 0x8b;
message->buffer[1] = 0; message->buffer[1] = 0;

@ -320,8 +320,10 @@ parseListOfJournalEntries(uint8_t* buffer, int bufPos, int maxLength, LinkedList
} }
bool bool
mmsClient_parseReadJournalResponse(MmsConnection self, ByteBuffer* response, int respBufPos, bool* moreFollows, LinkedList* result) mmsClient_parseReadJournalResponse(ByteBuffer* response, int respBufPos, bool* moreFollows, LinkedList* result)
{ {
uint8_t* buffer = ByteBuffer_getBuffer(response); uint8_t* buffer = ByteBuffer_getBuffer(response);
int maxBufPos = ByteBuffer_getSize(response); int maxBufPos = ByteBuffer_getSize(response);
int bufPos = respBufPos; int bufPos = respBufPos;

@ -52,6 +52,8 @@ mmsClient_createStatusRequest(uint32_t invokeId, ByteBuffer* request, bool exten
bool bool
mmsClient_parseStatusResponse(MmsConnection self, ByteBuffer* response, int bufPos, int* vmdLogicalStatus, int* vmdPhysicalStatus) mmsClient_parseStatusResponse(MmsConnection self, ByteBuffer* response, int bufPos, int* vmdLogicalStatus, int* vmdPhysicalStatus)
{ {
(void)self;
uint8_t* buffer = ByteBuffer_getBuffer(response); uint8_t* buffer = ByteBuffer_getBuffer(response);
int maxBufPos = ByteBuffer_getSize(response); int maxBufPos = ByteBuffer_getSize(response);
int length; int length;

@ -118,6 +118,8 @@ mmsServer_handleDeleteNamedVariableListRequest(MmsServerConnection connection,
uint32_t invokeId, uint32_t invokeId,
ByteBuffer* response) ByteBuffer* response)
{ {
(void)bufPos;
DeleteNamedVariableListRequest_t* request = 0; DeleteNamedVariableListRequest_t* request = 0;
MmsPdu_t* mmsPdu = 0; MmsPdu_t* mmsPdu = 0;
@ -265,6 +267,8 @@ createDefineNamedVariableListResponse(uint32_t invokeId, ByteBuffer* response)
static bool static bool
checkIfVariableExists(MmsDevice* device, MmsAccessSpecifier* accessSpecifier) checkIfVariableExists(MmsDevice* device, MmsAccessSpecifier* accessSpecifier)
{ {
(void)device;
if (accessSpecifier->domain == NULL) if (accessSpecifier->domain == NULL)
return false; return false;
@ -510,6 +514,8 @@ mmsServer_handleDefineNamedVariableListRequest(
uint32_t invokeId, uint32_t invokeId,
ByteBuffer* response) ByteBuffer* response)
{ {
(void)bufPos;
DefineNamedVariableListRequest_t* request = 0; DefineNamedVariableListRequest_t* request = 0;
MmsPdu_t* mmsPdu = 0; MmsPdu_t* mmsPdu = 0;

@ -911,6 +911,9 @@ mmsServer_handleReadRequest(
uint32_t invokeId, uint32_t invokeId,
ByteBuffer* response) ByteBuffer* response)
{ {
(void)bufPos;
(void)maxBufPos;
ReadRequest_t* request = 0; /* allow asn1c to allocate structure */ ReadRequest_t* request = 0; /* allow asn1c to allocate structure */
MmsPdu_t* mmsPdu = 0; MmsPdu_t* mmsPdu = 0;

@ -409,6 +409,8 @@ handleConfirmedErrorPdu(
uint8_t* buffer, int bufPos, int maxBufPos, uint8_t* buffer, int bufPos, int maxBufPos,
ByteBuffer* response) ByteBuffer* response)
{ {
(void)response;
uint32_t invokeId = 0; uint32_t invokeId = 0;
bool hasInvokeId = false; bool hasInvokeId = false;
MmsServiceError serviceError; MmsServiceError serviceError;
@ -457,6 +459,10 @@ getUploadTaskByInvokeId(MmsServer mmsServer, uint32_t invokeId)
static void static void
mmsFileReadHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int32_t frsmId, uint8_t* buffer, uint32_t bytesReceived, bool moreFollows) mmsFileReadHandler(uint32_t invokeId, void* parameter, MmsError mmsError, int32_t frsmId, uint8_t* buffer, uint32_t bytesReceived, bool moreFollows)
{ {
(void)invokeId;
(void)frsmId;
(void)moreFollows;
MmsObtainFileTask task = (MmsObtainFileTask) parameter; MmsObtainFileTask task = (MmsObtainFileTask) parameter;
if (mmsError == MMS_ERROR_NONE) { if (mmsError == MMS_ERROR_NONE) {

@ -34,6 +34,8 @@ void
mmsServer_createMmsWriteResponse(MmsServerConnection connection, mmsServer_createMmsWriteResponse(MmsServerConnection connection,
uint32_t invokeId, ByteBuffer* response, int numberOfItems, MmsDataAccessError* accessResults) uint32_t invokeId, ByteBuffer* response, int numberOfItems, MmsDataAccessError* accessResults)
{ {
(void)connection;
int bufPos = 0; int bufPos = 0;
uint8_t* buffer = response->buffer; uint8_t* buffer = response->buffer;
@ -55,6 +57,13 @@ mmsServer_createMmsWriteResponse(MmsServerConnection connection,
+ 1 + BerEncoder_determineLengthSize(accessResultsLength) + 1 + BerEncoder_determineLengthSize(accessResultsLength)
+ accessResultsLength; + accessResultsLength;
if ((int)(writeResponseLength + 1) > response->maxSize) {
/* TODO add log message */
response->size = 0;
return;
}
/* Encode write response */ /* Encode write response */
bufPos = BerEncoder_encodeTL(0xa1, writeResponseLength, buffer, bufPos); bufPos = BerEncoder_encodeTL(0xa1, writeResponseLength, buffer, bufPos);
@ -478,6 +487,9 @@ mmsServer_handleWriteRequest(
uint32_t invokeId, uint32_t invokeId,
ByteBuffer* response) ByteBuffer* response)
{ {
(void)bufPos;
(void)maxBufPos;
MmsPdu_t* mmsPdu = 0; MmsPdu_t* mmsPdu = 0;
asn_dec_rval_t rval; /* Decoder return value */ asn_dec_rval_t rval; /* Decoder return value */

@ -541,7 +541,7 @@ IsoPresentation_parseAcceptMessage(IsoPresentation* self, ByteBuffer* byteBuffer
void void
IsoPresentation_init(IsoPresentation* self) IsoPresentation_init(IsoPresentation* self)
{ {
(void)self;
} }
void void

@ -114,7 +114,6 @@ finalizeIsoConnection(IsoConnection self)
GLOBAL_FREEMEM(self->session); GLOBAL_FREEMEM(self->session);
GLOBAL_FREEMEM(self->presentation); GLOBAL_FREEMEM(self->presentation);
AcseConnection_destroy(self->acseConnection);
GLOBAL_FREEMEM(self->acseConnection); GLOBAL_FREEMEM(self->acseConnection);
GLOBAL_FREEMEM(self->cotpReadBuf); GLOBAL_FREEMEM(self->cotpReadBuf);
@ -462,7 +461,7 @@ exit_function:
#if ((CONFIG_MMS_SINGLE_THREADED == 0) && (CONFIG_MMS_THREADLESS_STACK == 0)) #if ((CONFIG_MMS_SINGLE_THREADED == 0) && (CONFIG_MMS_THREADLESS_STACK == 0))
/* only for multi-thread mode */ /* only for multi-thread mode */
static void static void*
handleTcpConnection(void* parameter) handleTcpConnection(void* parameter)
{ {
IsoConnection self = (IsoConnection) parameter; IsoConnection self = (IsoConnection) parameter;
@ -475,6 +474,8 @@ handleTcpConnection(void* parameter)
finalizeIsoConnection(self); finalizeIsoConnection(self);
self->state = ISO_CON_STATE_TERMINATED; self->state = ISO_CON_STATE_TERMINATED;
return NULL;
} }
#endif /* (CONFIG_MMS_SINGLE_THREADED == 0) */ #endif /* (CONFIG_MMS_SINGLE_THREADED == 0) */

@ -527,7 +527,7 @@ handleIsoConnections(IsoServer self, bool isSingleThread)
#if (CONFIG_MMS_SINGLE_THREADED == 0) && (CONFIG_MMS_THREADLESS_STACK == 0) #if (CONFIG_MMS_SINGLE_THREADED == 0) && (CONFIG_MMS_THREADLESS_STACK == 0)
/* only required for multi-threaded server! */ /* only required for multi-threaded server! */
static void static void*
isoServerThread(void* isoServerParam) isoServerThread(void* isoServerParam)
{ {
IsoServer self = (IsoServer) isoServerParam; IsoServer self = (IsoServer) isoServerParam;
@ -557,6 +557,8 @@ cleanUp:
if (DEBUG_ISO_SERVER) if (DEBUG_ISO_SERVER)
printf("ISO_SERVER: isoServerThread %p stopped\n", isoServerParam); printf("ISO_SERVER: isoServerThread %p stopped\n", isoServerParam);
return NULL;
} }
#endif #endif
@ -708,7 +710,7 @@ IsoServer_waitReady(IsoServer self, unsigned int timeoutMs)
if (getState(self) == ISO_SVR_STATE_RUNNING) { if (getState(self) == ISO_SVR_STATE_RUNNING) {
if (self->handleset) { if (self->handleset) {
result = Handleset_waitReady(self->handleset, 10); result = Handleset_waitReady(self->handleset, timeoutMs);
} }
else { else {
if (DEBUG_ISO_SERVER) if (DEBUG_ISO_SERVER)

@ -225,8 +225,10 @@ parseSessionHeaderParameters(IsoSession* session, ByteBuffer* message, int param
static const uint8_t dataSpdu[] = { 0x01, 0x00, 0x01, 0x00 }; static const uint8_t dataSpdu[] = { 0x01, 0x00, 0x01, 0x00 };
void void
IsoSession_createDataSpdu(IsoSession* session, BufferChain buffer, BufferChain payload) IsoSession_createDataSpdu(IsoSession* self, BufferChain buffer, BufferChain payload)
{ {
(void)self;
buffer->buffer = (uint8_t*) dataSpdu; buffer->buffer = (uint8_t*) dataSpdu;
buffer->partLength = 4; buffer->partLength = 4;
buffer->length = 4 + payload->length; buffer->length = 4 + payload->length;
@ -286,7 +288,7 @@ encodeCalledSessionSelector(IsoSession* self, uint8_t* buf, int offset)
} }
static int static int
encodeSessionUserData(IsoSession* self, uint8_t* buf, int offset, uint8_t payloadLength) encodeSessionUserData(uint8_t* buf, int offset, uint8_t payloadLength)
{ {
buf[offset++] = 0xc1; buf[offset++] = 0xc1;
buf[offset++] = payloadLength; buf[offset++] = payloadLength;
@ -316,7 +318,7 @@ IsoSession_createConnectSpdu(IsoSession* self, IsoConnectionParameters isoParame
offset = encodeCalledSessionSelector(self, buf, offset); offset = encodeCalledSessionSelector(self, buf, offset);
offset = encodeSessionUserData(self, buf, offset, payload->length); offset = encodeSessionUserData(buf, offset, payload->length);
int spduLength = (offset - lengthOffset - 1) + payload->length; int spduLength = (offset - lengthOffset - 1) + payload->length;
@ -330,6 +332,8 @@ IsoSession_createConnectSpdu(IsoSession* self, IsoConnectionParameters isoParame
void void
IsoSession_createAbortSpdu(IsoSession* self, BufferChain buffer, BufferChain payload) IsoSession_createAbortSpdu(IsoSession* self, BufferChain buffer, BufferChain payload)
{ {
(void)self;
int offset = 0; int offset = 0;
uint8_t* buf = buffer->buffer; uint8_t* buf = buffer->buffer;
@ -349,6 +353,8 @@ IsoSession_createAbortSpdu(IsoSession* self, BufferChain buffer, BufferChain pay
void void
IsoSession_createFinishSpdu(IsoSession* self, BufferChain buffer, BufferChain payload) IsoSession_createFinishSpdu(IsoSession* self, BufferChain buffer, BufferChain payload)
{ {
(void)self;
int offset = 0; int offset = 0;
uint8_t* buf = buffer->buffer; uint8_t* buf = buffer->buffer;
@ -366,6 +372,8 @@ IsoSession_createFinishSpdu(IsoSession* self, BufferChain buffer, BufferChain pa
void void
IsoSession_createDisconnectSpdu(IsoSession* self, BufferChain buffer, BufferChain payload) IsoSession_createDisconnectSpdu(IsoSession* self, BufferChain buffer, BufferChain payload)
{ {
(void)self;
int offset = 0; int offset = 0;
uint8_t* buf = buffer->buffer; uint8_t* buf = buffer->buffer;
@ -399,7 +407,7 @@ IsoSession_createAcceptSpdu(IsoSession* self, BufferChain buffer, BufferChain pa
offset = encodeCalledSessionSelector(self, buf, offset); offset = encodeCalledSessionSelector(self, buf, offset);
offset = encodeSessionUserData(self, buf, offset, payloadLength); offset = encodeSessionUserData(buf, offset, payloadLength);
int spduLength = (offset - lengthOffset - 1) + payloadLength; int spduLength = (offset - lengthOffset - 1) + payloadLength;
@ -432,7 +440,7 @@ IsoSession_getUserData(IsoSession* session)
} }
IsoSessionIndication IsoSessionIndication
IsoSession_parseMessage(IsoSession* session, ByteBuffer* message) IsoSession_parseMessage(IsoSession* self, ByteBuffer* message)
{ {
uint8_t* buffer = message->buffer; uint8_t* buffer = message->buffer;
uint8_t id; uint8_t id;
@ -449,7 +457,7 @@ IsoSession_parseMessage(IsoSession* session, ByteBuffer* message)
case 13: /* CONNECT(CN) SPDU */ case 13: /* CONNECT(CN) SPDU */
if (length != (message->size - 2)) if (length != (message->size - 2))
return SESSION_ERROR; return SESSION_ERROR;
if (parseSessionHeaderParameters(session, message, length) == SESSION_OK) if (parseSessionHeaderParameters(self, message, length) == SESSION_OK)
return SESSION_CONNECT; return SESSION_CONNECT;
else { else {
if (DEBUG_SESSION) if (DEBUG_SESSION)
@ -460,7 +468,7 @@ IsoSession_parseMessage(IsoSession* session, ByteBuffer* message)
case 14: /* ACCEPT SPDU */ case 14: /* ACCEPT SPDU */
if (length != (message->size - 2)) if (length != (message->size - 2))
return SESSION_ERROR; return SESSION_ERROR;
if (parseSessionHeaderParameters(session, message, length) == SESSION_OK) if (parseSessionHeaderParameters(self, message, length) == SESSION_OK)
return SESSION_CONNECT; return SESSION_CONNECT;
else { else {
if (DEBUG_SESSION) if (DEBUG_SESSION)
@ -474,7 +482,7 @@ IsoSession_parseMessage(IsoSession* session, ByteBuffer* message)
return SESSION_ERROR; return SESSION_ERROR;
if ((length == 0) && (buffer[2] == 1) && (buffer[3] == 0)) { if ((length == 0) && (buffer[2] == 1) && (buffer[3] == 0)) {
ByteBuffer_wrap(&session->userData, message->buffer + 4, message->size - 4, message->maxSize - 4); ByteBuffer_wrap(&self->userData, message->buffer + 4, message->size - 4, message->maxSize - 4);
return SESSION_DATA; return SESSION_DATA;
} }
@ -490,7 +498,7 @@ IsoSession_parseMessage(IsoSession* session, ByteBuffer* message)
if (length != (message->size - 2)) if (length != (message->size - 2))
return SESSION_ERROR; return SESSION_ERROR;
if (parseSessionHeaderParameters(session, message, length) == SESSION_OK) if (parseSessionHeaderParameters(self, message, length) == SESSION_OK)
return SESSION_FINISH; return SESSION_FINISH;
else else
return SESSION_ERROR; return SESSION_ERROR;
@ -504,7 +512,7 @@ IsoSession_parseMessage(IsoSession* session, ByteBuffer* message)
if (length != (message->size - 2)) if (length != (message->size - 2))
return SESSION_ERROR; return SESSION_ERROR;
if (parseSessionHeaderParameters(session, message, length) == SESSION_OK) if (parseSessionHeaderParameters(self, message, length) == SESSION_OK)
return SESSION_DISCONNECT; return SESSION_DISCONNECT;
else else
return SESSION_ERROR; return SESSION_ERROR;

@ -152,7 +152,7 @@ SVReceiver_removeSubscriber(SVReceiver self, SVSubscriber subscriber)
#endif #endif
} }
static void static void*
svReceiverLoop(void* threadParameter) svReceiverLoop(void* threadParameter)
{ {
SVReceiver self = (SVReceiver) threadParameter; SVReceiver self = (SVReceiver) threadParameter;
@ -166,6 +166,8 @@ svReceiverLoop(void* threadParameter)
} }
self->stopped = true; self->stopped = true;
return NULL;
} }
void void
@ -257,6 +259,8 @@ SVReceiver_stopThreadless(SVReceiver self)
static void static void
parseASDU(SVReceiver self, SVSubscriber subscriber, uint8_t* buffer, int length) parseASDU(SVReceiver self, SVSubscriber subscriber, uint8_t* buffer, int length)
{ {
(void)self;
int bufPos = 0; int bufPos = 0;
int svIdLength = 0; int svIdLength = 0;
int datSetLength = 0; int datSetLength = 0;

Loading…
Cancel
Save