- refactoring for MmsServerConnection - removed struct from API

This commit is contained in:
Michael Zillgith 2015-02-12 17:32:25 +01:00
parent 0fb4ed0efc
commit 6bc7b48e9f
22 changed files with 200 additions and 182 deletions

View file

@ -86,10 +86,10 @@ MmsDomain*
ControlObject_getDomain(ControlObject* self);
bool
ControlObject_select(ControlObject* self, MmsServerConnection* connection);
ControlObject_select(ControlObject* self, MmsServerConnection connection);
bool
ControlObject_unselect(ControlObject* self, MmsServerConnection* connection);
ControlObject_unselect(ControlObject* self, MmsServerConnection connection);
void
ControlObject_installListener(ControlObject* self, ControlHandler listener, void* parameter);

View file

@ -143,7 +143,7 @@ MmsMapping_installWriteAccessHandler(MmsMapping* self, DataAttribute* dataAttrib
MmsDataAccessError
Control_writeAccessControlObject(MmsMapping* self, MmsDomain* domain, char* variableIdOrig,
MmsValue* value, MmsServerConnection* connection);
MmsValue* value, MmsServerConnection connection);
ControlObject*
Control_lookupControlObject(MmsMapping* self, MmsDomain* domain, char* lnName, char* objectName);

View file

@ -69,7 +69,7 @@ typedef struct {
uint32_t bufTm;
uint64_t nextIntgReportTime;
uint64_t reservationTimeout;
MmsServerConnection* clientConnection;
MmsServerConnection clientConnection;
uint64_t lastEntryId;
@ -112,7 +112,7 @@ Reporting_createMmsUnbufferedRCBs(MmsMapping* self, MmsDomain* domain,
MmsDataAccessError
Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* elementName, MmsValue* value,
MmsServerConnection* connection);
MmsServerConnection connection);
void
Reporting_activateBufferedReports(MmsMapping* self);
@ -121,6 +121,6 @@ void
Reporting_processReportEvents(MmsMapping* self, uint64_t currentTimeInMs);
void
Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection* connection);
Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection connection);
#endif /* REPORTING_H_ */

View file

@ -1,7 +1,7 @@
/*
* client_connection.c
*
* Copyright 2013 Michael Zillgith
* Copyright 2013, 2014, 2015 Michael Zillgith
*
* This file is part of libIEC61850.
*
@ -29,6 +29,7 @@
#include "hal_thread.h"
#include "ied_server_private.h"
#include "mms_server.h"
struct sClientConnection {
@ -121,16 +122,16 @@ private_ClientConnection_getServerConnectionHandle(ClientConnection self)
const char*
ClientConnection_getPeerAddress(ClientConnection self)
{
MmsServerConnection* mmsConnection = (MmsServerConnection*) self->serverConnectionHandle;
MmsServerConnection mmsConnection = (MmsServerConnection) self->serverConnectionHandle;
return IsoConnection_getPeerAddress(mmsConnection->isoConnection);
return IsoConnection_getPeerAddress(MmsServerConnection_getIsoConnection(mmsConnection));
}
void*
ClientConnection_getSecurityToken(ClientConnection self)
{
MmsServerConnection* mmsConnection = (MmsServerConnection*) self->serverConnectionHandle;
MmsServerConnection mmsConnection = (MmsServerConnection) self->serverConnectionHandle;
return IsoConnection_getSecurityToken(mmsConnection->isoConnection);
return IsoConnection_getSecurityToken(MmsServerConnection_getIsoConnection(mmsConnection));
}

View file

@ -91,7 +91,7 @@ struct sControlObject
uint64_t operateTime;
bool operateOnce;
MmsServerConnection* mmsConnection;
MmsServerConnection mmsConnection;
MmsValue* emptyString;
@ -115,7 +115,7 @@ struct sControlObject
};
void
ControlObject_sendLastApplError(ControlObject* self, MmsServerConnection* connection, char* ctlVariable, int error,
ControlObject_sendLastApplError(ControlObject* self, MmsServerConnection connection, char* ctlVariable, int error,
ControlAddCause addCause, MmsValue* ctlNum, MmsValue* origin, bool handlerMode);
void
@ -126,7 +126,7 @@ ControlObject_sendCommandTerminationNegative(ControlObject* self);
MmsValue*
Control_readAccessControlObject(MmsMapping* self, MmsDomain* domain, char* variableIdOrig,
MmsServerConnection* connection);
MmsServerConnection connection);
static void
setState(ControlObject* self, int newState)
@ -600,7 +600,7 @@ ControlObject_getMmsValue(ControlObject* self)
}
static void
selectObject(ControlObject* self, uint64_t selectTime, MmsServerConnection* connection)
selectObject(ControlObject* self, uint64_t selectTime, MmsServerConnection connection)
{
updateSboTimeoutValue(self);
self->selected = true;
@ -627,7 +627,7 @@ checkSelectTimeout(ControlObject* self, uint64_t currentTime)
}
bool
ControlObject_unselect(ControlObject* self, MmsServerConnection* connection)
ControlObject_unselect(ControlObject* self, MmsServerConnection connection)
{
if (self->mmsConnection == connection) {
abortControlOperation(self);
@ -949,7 +949,7 @@ ControlObject_sendCommandTerminationNegative(ControlObject* self)
void
ControlObject_sendLastApplError(ControlObject* self, MmsServerConnection* connection, char* ctlVariable, int error,
ControlObject_sendLastApplError(ControlObject* self, MmsServerConnection connection, char* ctlVariable, int error,
ControlAddCause addCause, MmsValue* ctlNum, MmsValue* origin, bool handlerMode)
{
MmsValue lastApplErrorMemory;
@ -1033,7 +1033,7 @@ doesElementEquals(char* element, char* name)
MmsValue*
Control_readAccessControlObject(MmsMapping* self, MmsDomain* domain, char* variableIdOrig,
MmsServerConnection* connection)
MmsServerConnection connection)
{
MmsValue* value = NULL;
@ -1207,7 +1207,7 @@ getDataAccessErrorFromCheckHandlerResult(CheckHandlerResult checkResult)
MmsDataAccessError
Control_writeAccessControlObject(MmsMapping* self, MmsDomain* domain, char* variableIdOrig,
MmsValue* value, MmsServerConnection* connection)
MmsValue* value, MmsServerConnection connection)
{
MmsDataAccessError indication = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;

View file

@ -75,7 +75,7 @@ typedef struct
#if (CONFIG_IEC61850_CONTROL_SERVICE == 1)
MmsValue*
Control_readAccessControlObject(MmsMapping* self, MmsDomain* domain, char* variableIdOrig,
MmsServerConnection* connection);
MmsServerConnection connection);
#endif
void /* Create PHYCOMADDR ACSI type instance */
@ -559,7 +559,7 @@ unselectSettingGroup(SettingGroup* settingGroup)
}
static void
unselectAllSettingGroups(MmsMapping* self, MmsServerConnection* serverCon)
unselectAllSettingGroups(MmsMapping* self, MmsServerConnection serverCon)
{
LinkedList settingGroupElement = LinkedList_getNext(self->settingGroups);
@ -1459,7 +1459,7 @@ getAccessPolicyForFC(MmsMapping* self, FunctionalConstraint fc)
static MmsDataAccessError
mmsWriteHandler(void* parameter, MmsDomain* domain,
char* variableId, MmsValue* value, MmsServerConnection* connection)
char* variableId, MmsValue* value, MmsServerConnection connection)
{
MmsMapping* self = (MmsMapping*) parameter;
@ -1865,31 +1865,35 @@ readAccessGooseControlBlock(MmsMapping* self, MmsDomain* domain, char* variableI
#endif /* (CONFIG_INCLUDE_GOOSE_SUPPORT == 1) */
static MmsValue*
mmsReadHandler(void* parameter, MmsDomain* domain, char* variableId, MmsServerConnection* connection)
mmsReadHandler(void* parameter, MmsDomain* domain, char* variableId, MmsServerConnection connection)
{
MmsMapping* self = (MmsMapping*) parameter;
MmsValue* retValue = NULL;
if (DEBUG_IED_SERVER)
printf("IED_SERVER: mmsReadHandler: Requested %s\n", variableId);
char* separator = strchr(variableId, '$');
if (separator == NULL)
return NULL;
goto exit_function;
int lnNameLength = separator - variableId;
#if (CONFIG_IEC61850_CONTROL_SERVICE == 1)
/* Controllable objects - CO */
if (isControllable(separator)) {
return Control_readAccessControlObject(self, domain, variableId, connection);
retValue = Control_readAccessControlObject(self, domain, variableId, connection);
goto exit_function;
}
#endif
/* GOOSE control blocks - GO */
#if (CONFIG_INCLUDE_GOOSE_SUPPORT == 1)
if (isGooseControlBlock(separator)) {
return readAccessGooseControlBlock(self, domain, variableId);
retValue = readAccessGooseControlBlock(self, domain, variableId);
goto exit_function;
}
#endif
@ -1903,8 +1907,10 @@ mmsReadHandler(void* parameter, MmsDomain* domain, char* variableId, MmsServerCo
char* reportName = MmsMapping_getNextNameElement(separator + 1);
if (reportName == NULL)
return NULL;
if (reportName == NULL) {
retValue = NULL;
goto exit_function;
}
separator = strchr(reportName, '$');
@ -1940,7 +1946,9 @@ mmsReadHandler(void* parameter, MmsDomain* domain, char* variableId, MmsServerCo
else
value = rc->rcbValues;
return value;
retValue = value;
goto exit_function;
}
}
@ -1950,7 +1958,8 @@ mmsReadHandler(void* parameter, MmsDomain* domain, char* variableId, MmsServerCo
}
#endif /* (CONFIG_IEC61850_REPORT_SERVICE == 1) */
return NULL;
exit_function:
return retValue;
}
void
@ -1961,7 +1970,7 @@ MmsMapping_setMmsServer(MmsMapping* self, MmsServer server)
#if (CONFIG_IEC61850_CONTROL_SERVICE == 1)
static void
unselectControlsForConnection(MmsMapping* self, MmsServerConnection* connection)
unselectControlsForConnection(MmsMapping* self, MmsServerConnection connection)
{
LinkedList controlObjectElement = LinkedList_getNext(self->controlObjects);
@ -1977,7 +1986,7 @@ unselectControlsForConnection(MmsMapping* self, MmsServerConnection* connection)
#endif /* (CONFIG_IEC61850_CONTROL_SERVICE == 1) */
static void /* is called by MMS server layer */
mmsConnectionHandler(void* parameter, MmsServerConnection* connection, MmsServerEvent event)
mmsConnectionHandler(void* parameter, MmsServerConnection connection, MmsServerEvent event)
{
MmsMapping* self = (MmsMapping*) parameter;
@ -2025,7 +2034,7 @@ mmsConnectionHandler(void* parameter, MmsServerConnection* connection, MmsServer
}
static MmsDataAccessError
mmsReadAccessHandler (void* parameter, MmsDomain* domain, char* variableId, MmsServerConnection* connection)
mmsReadAccessHandler (void* parameter, MmsDomain* domain, char* variableId, MmsServerConnection connection)
{
MmsMapping* self = (MmsMapping*) parameter;
@ -2054,7 +2063,7 @@ mmsReadAccessHandler (void* parameter, MmsDomain* domain, char* variableId, MmsS
static bool
variableListChangedHandler (void* parameter, bool create, MmsVariableListType listType, MmsDomain* domain,
char* listName, MmsServerConnection* connection)
char* listName, MmsServerConnection connection)
{
bool allow = true;

View file

@ -462,7 +462,7 @@ createDataSetValuesShadowBuffer(ReportControl* rc)
}
static bool
updateReportDataset(MmsMapping* mapping, ReportControl* rc, MmsValue* newDatSet, MmsServerConnection* connection)
updateReportDataset(MmsMapping* mapping, ReportControl* rc, MmsValue* newDatSet, MmsServerConnection connection)
{
bool success = false;
@ -1084,7 +1084,7 @@ Reporting_createMmsUnbufferedRCBs(MmsMapping* self, MmsDomain* domain,
#define CONFIG_REPORTING_SUPPORTS_OWNER 1
static void
updateOwner(ReportControl* rc, MmsServerConnection* connection)
updateOwner(ReportControl* rc, MmsServerConnection connection)
{
rc->clientConnection = connection;
@ -1182,7 +1182,7 @@ increaseConfRev(ReportControl* self)
MmsDataAccessError
Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* elementName, MmsValue* value,
MmsServerConnection* connection)
MmsServerConnection connection)
{
MmsDataAccessError retVal = DATA_ACCESS_ERROR_SUCCESS;
@ -1428,7 +1428,7 @@ exit_function:
}
void
Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection* connection)
Reporting_deactivateReportsForConnection(MmsMapping* self, MmsServerConnection connection)
{
LinkedList reportControl = self->reportControls;

View file

@ -32,8 +32,6 @@
extern "C" {
#endif
#include "stack_config.h"
#include "mms_device_model.h"
#include "mms_value.h"
#include "iso_server.h"
@ -44,42 +42,7 @@ typedef enum {
typedef struct sMmsServer* MmsServer;
#if (MMS_FILE_SERVICE == 1)
#ifndef CONFIG_MMS_MAX_NUMBER_OF_OPEN_FILES_PER_CONNECTION
#define CONFIG_MMS_MAX_NUMBER_OF_OPEN_FILES_PER_CONNECTION 5
#endif
#include "hal_filesystem.h"
typedef struct {
int32_t frsmId;
uint32_t readPosition;
uint32_t fileSize;
FileHandle fileHandle;
} MmsFileReadStateMachine;
#endif /* (MMS_FILE_SERVICE == 1) */
typedef struct sMmsServerConnection {
int maxServOutstandingCalling;
int maxServOutstandingCalled;
int dataStructureNestingLevel;
int maxPduSize; /* local detail */
IsoConnection isoConnection;
MmsServer server;
uint32_t lastInvokeId;
#if (MMS_DYNAMIC_DATA_SETS == 1)
LinkedList /*<MmsNamedVariableList>*/namedVariableLists; /* aa-specific named variable lists */
#endif
#if (MMS_FILE_SERVICE == 1)
int32_t nextFrsmId;
MmsFileReadStateMachine frsms[CONFIG_MMS_MAX_NUMBER_OF_OPEN_FILES_PER_CONNECTION];
#endif
} MmsServerConnection;
typedef struct sMmsServerConnection* MmsServerConnection;
typedef enum {
MMS_DOMAIN_SPECIFIC,
@ -88,17 +51,17 @@ typedef enum {
} MmsVariableListType;
typedef MmsValue* (*MmsReadVariableHandler)(void* parameter, MmsDomain* domain,
char* variableId, MmsServerConnection* connection);
char* variableId, MmsServerConnection connection);
typedef MmsDataAccessError (*MmsReadAccessHandler) (void* parameter, MmsDomain* domain,
char* variableId, MmsServerConnection* connection);
char* variableId, MmsServerConnection connection);
typedef MmsDataAccessError (*MmsWriteVariableHandler)(void* parameter,
MmsDomain* domain, char* variableId, MmsValue* value,
MmsServerConnection* connection);
MmsServerConnection connection);
typedef void (*MmsConnectionHandler)(void* parameter,
MmsServerConnection* connection, MmsServerEvent event);
MmsServerConnection connection, MmsServerEvent event);
MmsServer
MmsServer_create(IsoServer isoServer, MmsDevice* device);
@ -150,7 +113,7 @@ MmsServer_isLocked(MmsServer self);
* is returned to the client.
*/
typedef bool (*MmsNamedVariableListChangedHandler)(void* parameter, bool create, MmsVariableListType listType, MmsDomain* domain,
char* listName, MmsServerConnection* connection);
char* listName, MmsServerConnection connection);
/**
* \brief Install callback handler that is called when a named variable list changes (is created or deleted)
@ -326,7 +289,7 @@ MmsServer_getRevision(MmsServer self);
* \param connection is the MmsServerConnection instance that received the MMS status request
* \param extendedDerivation indicates if the request contains the extendedDerivation parameter
*/
typedef void (*MmsStatusRequestListener)(void* parameter, MmsServer mmsServer, MmsServerConnection* connection, bool extendedDerivation);
typedef void (*MmsStatusRequestListener)(void* parameter, MmsServer mmsServer, MmsServerConnection connection, bool extendedDerivation);
/**
* \brief set the VMD state values for the VMD status service
@ -368,6 +331,12 @@ MmsServer_getVMDPhysicalStatus(MmsServer self);
void
MmsServer_setStatusRequestListener(MmsServer self, MmsStatusRequestListener listener, void* parameter);
char*
MmsServerConnection_getClientAddress(MmsServerConnection self);
IsoConnection
MmsServerConnection_getIsoConnection(MmsServerConnection self);
/**@}*/
#ifdef __cplusplus

View file

@ -39,30 +39,26 @@
#include "linked_list.h"
#include "byte_buffer.h"
MmsServerConnection*
MmsServerConnection_init(MmsServerConnection* connection, MmsServer server, IsoConnection isoCon);
MmsServerConnection
MmsServerConnection_init(MmsServerConnection connection, MmsServer server, IsoConnection isoCon);
void
MmsServerConnection_destroy(MmsServerConnection* connection);
MmsServerConnection_destroy(MmsServerConnection connection);
bool
MmsServerConnection_addNamedVariableList(MmsServerConnection* self, MmsNamedVariableList variableList);
MmsServerConnection_addNamedVariableList(MmsServerConnection self, MmsNamedVariableList variableList);
MmsNamedVariableList
MmsServerConnection_getNamedVariableList(MmsServerConnection* self, char* variableListName);
MmsServerConnection_getNamedVariableList(MmsServerConnection self, char* variableListName);
LinkedList
MmsServerConnection_getNamedVariableLists(MmsServerConnection* self);
MmsServerConnection_getNamedVariableLists(MmsServerConnection self);
void
MmsServerConnection_deleteNamedVariableList(MmsServerConnection* self, char* listName);
char*
MmsServerConnection_getClientAddress(MmsServerConnection* self);
MmsServerConnection_deleteNamedVariableList(MmsServerConnection self, char* listName);
MmsIndication
MmsServerConnection_parseMessage
(MmsServerConnection* connection, ByteBuffer* message, ByteBuffer* response);
MmsServerConnection_parseMessage(MmsServerConnection connection, ByteBuffer* message, ByteBuffer* response);
/** \brief send information report for a single VMD specific variable
@ -70,7 +66,7 @@ MmsServerConnection_parseMessage
* \param handlerMode send this message in the context of a stack callback handler
*/
void
MmsServerConnection_sendInformationReportSingleVariableVMDSpecific(MmsServerConnection* self,
MmsServerConnection_sendInformationReportSingleVariableVMDSpecific(MmsServerConnection self,
char* itemId, MmsValue* value, bool handlerMode);
@ -79,7 +75,7 @@ MmsServerConnection_sendInformationReportSingleVariableVMDSpecific(MmsServerConn
* \param handlerMode send this message in the context of a stack callback handler
*/
void /* send information report for a VMD specific named variable list */
MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection* self, char* itemId, LinkedList values
MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection self, char* itemId, LinkedList values
, bool handlerMode);
/** \brief send information report for list of variables
@ -88,19 +84,19 @@ MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection* self,
*/
void
MmsServerConnection_sendInformationReportListOfVariables(
MmsServerConnection* self,
MmsServerConnection self,
LinkedList /* MmsVariableAccessSpecification */ variableAccessDeclarations,
LinkedList /* MmsValue */ values,
bool handlerMode
);
void
MmsServerConnection_sendWriteResponse(MmsServerConnection* self, uint32_t invokeId, MmsDataAccessError indication,
MmsServerConnection_sendWriteResponse(MmsServerConnection self, uint32_t invokeId, MmsDataAccessError indication,
bool handlerMode);
uint32_t
MmsServerConnection_getLastInvokeId(MmsServerConnection* self);
MmsServerConnection_getLastInvokeId(MmsServerConnection self);
#endif /* MMS_SERVER_CONNECTION_H_ */

View file

@ -99,26 +99,63 @@ struct sMmsServer {
#endif /* MMS_IDENTIFY_SERVICE == 1 */
};
#if (MMS_FILE_SERVICE == 1)
#ifndef CONFIG_MMS_MAX_NUMBER_OF_OPEN_FILES_PER_CONNECTION
#define CONFIG_MMS_MAX_NUMBER_OF_OPEN_FILES_PER_CONNECTION 5
#endif
#include "hal_filesystem.h"
typedef struct {
int32_t frsmId;
uint32_t readPosition;
uint32_t fileSize;
FileHandle fileHandle;
} MmsFileReadStateMachine;
#endif /* (MMS_FILE_SERVICE == 1) */
struct sMmsServerConnection {
int maxServOutstandingCalling;
int maxServOutstandingCalled;
int dataStructureNestingLevel;
int maxPduSize; /* local detail */
IsoConnection isoConnection;
MmsServer server;
uint32_t lastInvokeId;
#if (MMS_DYNAMIC_DATA_SETS == 1)
LinkedList /*<MmsNamedVariableList>*/namedVariableLists; /* aa-specific named variable lists */
#endif
#if (MMS_FILE_SERVICE == 1)
int32_t nextFrsmId;
MmsFileReadStateMachine frsms[CONFIG_MMS_MAX_NUMBER_OF_OPEN_FILES_PER_CONNECTION];
#endif
};
/* write_out function required for ASN.1 encoding */
int
mmsServer_write_out(const void *buffer, size_t size, void *app_key);
void
mmsServer_handleDeleteNamedVariableListRequest(MmsServerConnection* connection,
mmsServer_handleDeleteNamedVariableListRequest(MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleGetNamedVariableListAttributesRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleReadRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
@ -134,47 +171,47 @@ mmsServer_writeConcludeResponsePdu(ByteBuffer* response);
void
mmsServer_handleInitiateRequest (
MmsServerConnection* self,
MmsServerConnection self,
uint8_t* buffer, int bufPos, int maxBufPos,
ByteBuffer* response);
int
mmsServer_handleGetVariableAccessAttributesRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleDefineNamedVariableListRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleGetNameListRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleWriteRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleIdentifyRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
int invokeId,
ByteBuffer* response);
void
mmsServer_handleStatusRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* requestBuffer,
int bufPos,
int invokeId,
@ -182,42 +219,42 @@ mmsServer_handleStatusRequest(
void
mmsServer_handleFileDirectoryRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleFileOpenRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleFileDeleteRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleFileRenameRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleFileReadRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
void
mmsServer_handleFileCloseRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response);
@ -236,13 +273,13 @@ mmsServer_deleteVariableList(LinkedList namedVariableLists, char* variableListNa
MmsDataAccessError
mmsServer_setValue(MmsServer self, MmsDomain* domain, char* itemId, MmsValue* value,
MmsServerConnection* connection);
MmsServerConnection connection);
MmsValue*
mmsServer_getValue(MmsServer self, MmsDomain* domain, char* itemId, MmsServerConnection* connection);
mmsServer_getValue(MmsServer self, MmsDomain* domain, char* itemId, MmsServerConnection connection);
int
mmsServer_createMmsWriteResponse(MmsServerConnection* connection,
mmsServer_createMmsWriteResponse(MmsServerConnection connection,
int invokeId, ByteBuffer* response, int numberOfItems, MmsDataAccessError* accessResults);
void
@ -250,6 +287,6 @@ mmsServer_writeMmsRejectPdu(uint32_t* invokeId, int reason, ByteBuffer* response
bool
mmsServer_callVariableListChangedHandler(bool create, MmsVariableListType listType, MmsDomain* domain,
char* listName, MmsServerConnection* connection);
char* listName, MmsServerConnection connection);
#endif /* MMS_SERVER_INTERNAL_H_ */

View file

@ -134,7 +134,7 @@ encodeInitResponseDetail(uint8_t* buffer, int bufPos, bool encode)
static int
createInitiateResponse(MmsServerConnection* self, ByteBuffer* writeBuffer)
createInitiateResponse(MmsServerConnection self, ByteBuffer* writeBuffer)
{
uint8_t* buffer = writeBuffer->buffer;
int bufPos = 0;
@ -167,7 +167,7 @@ createInitiateResponse(MmsServerConnection* self, ByteBuffer* writeBuffer)
}
static bool
parseInitiateRequestPdu(MmsServerConnection* self, uint8_t* buffer, int bufPos, int maxBufPos)
parseInitiateRequestPdu(MmsServerConnection self, uint8_t* buffer, int bufPos, int maxBufPos)
{
self->maxPduSize = CONFIG_MMS_MAXIMUM_PDU_SIZE;
@ -230,7 +230,7 @@ parseInitiateRequestPdu(MmsServerConnection* self, uint8_t* buffer, int bufPos,
void
mmsServer_handleInitiateRequest (
MmsServerConnection* self,
MmsServerConnection self,
uint8_t* buffer, int bufPos, int maxBufPos,
ByteBuffer* response)
{

View file

@ -53,7 +53,7 @@ createNullResponseExtendedTag(uint32_t invokeId, ByteBuffer* response, uint8_t t
}
static MmsFileReadStateMachine*
getFreeFrsm(MmsServerConnection* connection)
getFreeFrsm(MmsServerConnection connection)
{
int i;
@ -71,7 +71,7 @@ getFreeFrsm(MmsServerConnection* connection)
static MmsFileReadStateMachine*
getFrsm(MmsServerConnection* connection, int32_t frsmId)
getFrsm(MmsServerConnection connection, int32_t frsmId)
{
int i;
@ -90,7 +90,7 @@ getFrsm(MmsServerConnection* connection, int32_t frsmId)
}
static int32_t
getNextFrsmId(MmsServerConnection* connection)
getNextFrsmId(MmsServerConnection connection)
{
uint32_t nextFrsmId = connection->nextFrsmId;
connection->nextFrsmId++;
@ -195,7 +195,7 @@ parseFileName(char* filename, uint8_t* buffer, int* bufPos, int maxBufPos , uint
void
mmsServer_handleFileDeleteRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)
@ -240,7 +240,7 @@ exit_reject_invalid_pdu:
void
mmsServer_handleFileOpenRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)
@ -315,7 +315,7 @@ exit_reject_invalid_pdu:
static void
createFileReadResponse(MmsServerConnection* connection, uint32_t invokeId,
createFileReadResponse(MmsServerConnection connection, uint32_t invokeId,
ByteBuffer* response, MmsFileReadStateMachine* frsm)
{
/* determine remaining bytes in file */
@ -372,7 +372,7 @@ createFileReadResponse(MmsServerConnection* connection, uint32_t invokeId,
void
mmsServer_handleFileReadRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)
@ -399,7 +399,7 @@ createFileCloseResponse(uint32_t invokeId, ByteBuffer* response)
void
mmsServer_handleFileCloseRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)
@ -582,7 +582,7 @@ createFileDirectoryResponse(uint32_t invokeId, ByteBuffer* response, char* direc
void
mmsServer_handleFileRenameRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)
@ -648,7 +648,7 @@ mmsServer_handleFileRenameRequest(
void
mmsServer_handleFileDirectoryRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)

View file

@ -41,7 +41,7 @@
#define OBJECT_SCOPE_ASSOCIATION 2
static LinkedList
getDomainNames(MmsServerConnection* connection)
getDomainNames(MmsServerConnection connection)
{
MmsDevice* device = MmsServer_getDevice(connection->server);
@ -59,7 +59,7 @@ getDomainNames(MmsServerConnection* connection)
#if (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1)
static LinkedList
getNameListVMDSpecific(MmsServerConnection* connection)
getNameListVMDSpecific(MmsServerConnection connection)
{
MmsDevice* device = MmsServer_getDevice(connection->server);
@ -127,7 +127,7 @@ addSubNamedVaribleNamesToList(LinkedList nameList, char* prefix, MmsVariableSpec
#endif /* (CONFIG_MMS_SUPPORT_FLATTED_NAME_SPACE == 1) */
static LinkedList
getNameListDomainSpecific(MmsServerConnection* connection, char* domainName) {
getNameListDomainSpecific(MmsServerConnection connection, char* domainName) {
MmsDevice* device = MmsServer_getDevice(connection->server);
LinkedList nameList = NULL;
@ -176,7 +176,7 @@ createStringsFromNamedVariableList(LinkedList nameList, LinkedList variableLists
}
static LinkedList
getNamedVariableListsDomainSpecific(MmsServerConnection* connection, char* domainName)
getNamedVariableListsDomainSpecific(MmsServerConnection connection, char* domainName)
{
MmsDevice* device = MmsServer_getDevice(connection->server);
@ -194,7 +194,7 @@ getNamedVariableListsDomainSpecific(MmsServerConnection* connection, char* domai
}
static LinkedList
getnamedVariableListsVMDSpecific(MmsServerConnection* connection)
getnamedVariableListsVMDSpecific(MmsServerConnection connection)
{
MmsDevice* device = MmsServer_getDevice(connection->server);
@ -209,7 +209,7 @@ getnamedVariableListsVMDSpecific(MmsServerConnection* connection)
#if (MMS_DYNAMIC_DATA_SETS == 1)
static LinkedList
getNamedVariableListAssociationSpecific(MmsServerConnection* connection)
getNamedVariableListAssociationSpecific(MmsServerConnection connection)
{
LinkedList nameList = NULL;
@ -225,7 +225,7 @@ getNamedVariableListAssociationSpecific(MmsServerConnection* connection)
static void
createNameListResponse(
MmsServerConnection* connection,
MmsServerConnection connection,
int invokeId,
LinkedList nameList,
ByteBuffer* response,
@ -329,7 +329,7 @@ createNameListResponse(
void
mmsServer_handleGetNameListRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)

View file

@ -204,7 +204,7 @@ deleteVariableAccessAttributesResponse(
static void
createVariableAccessAttributesResponse(
MmsServerConnection* connection,
MmsServerConnection connection,
char* domainId,
char* nameId,
int invokeId,
@ -281,7 +281,7 @@ exit_function:
int
mmsServer_handleGetVariableAccessAttributesRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)

View file

@ -27,7 +27,7 @@
void
mmsServer_handleIdentifyRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
int invokeId,
ByteBuffer* response)
{

View file

@ -30,7 +30,7 @@
#include "ber_encoder.h"
void
MmsServerConnection_sendInformationReportSingleVariableVMDSpecific(MmsServerConnection* self,
MmsServerConnection_sendInformationReportSingleVariableVMDSpecific(MmsServerConnection self,
char* itemId, MmsValue* value, bool handlerMode)
{
uint32_t itemIdSize = strlen(itemId);
@ -79,7 +79,7 @@ MmsServerConnection_sendInformationReportSingleVariableVMDSpecific(MmsServerConn
void
MmsServerConnection_sendInformationReportListOfVariables(
MmsServerConnection* self,
MmsServerConnection self,
LinkedList /* MmsVariableAccessSpecification */ variableAccessDeclarations,
LinkedList /* MmsValue */ values,
bool handlerMode
@ -201,7 +201,7 @@ MmsServerConnection_sendInformationReportListOfVariables(
void /* send information report for a named variable list */
MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection* self, char* itemId, LinkedList values,
MmsServerConnection_sendInformationReportVMDSpecific(MmsServerConnection self, char* itemId, LinkedList values,
bool handlerMode)
{
uint32_t variableAccessSpecSize = 0;

View file

@ -49,7 +49,7 @@
bool
mmsServer_callVariableListChangedHandler(bool create, MmsVariableListType listType, MmsDomain* domain,
char* listName, MmsServerConnection* connection)
char* listName, MmsServerConnection connection)
{
MmsServer self = connection->server;
@ -96,7 +96,7 @@ createDeleteNamedVariableListResponse(uint32_t invokeId, ByteBuffer* response,
}
void
mmsServer_handleDeleteNamedVariableListRequest(MmsServerConnection* connection,
mmsServer_handleDeleteNamedVariableListRequest(MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)
@ -354,7 +354,7 @@ exit_function:
void
mmsServer_handleDefineNamedVariableListRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)
@ -556,7 +556,7 @@ createGetNamedVariableListAttributesResponse(int invokeId, ByteBuffer* response,
void
mmsServer_handleGetNamedVariableListAttributesRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)

View file

@ -46,7 +46,7 @@ typedef struct sVarAccessSpec {
} VarAccessSpec;
static MmsValue*
addNamedVariableValue(MmsVariableSpecification* namedVariable, MmsServerConnection* connection,
addNamedVariableValue(MmsVariableSpecification* namedVariable, MmsServerConnection connection,
MmsDomain* domain, char* itemId)
{
MmsValue* value = NULL;
@ -97,7 +97,7 @@ addNamedVariableValue(MmsVariableSpecification* namedVariable, MmsServerConnecti
static void
addComplexValueToResultList(MmsVariableSpecification* namedVariable,
LinkedList typedValues, MmsServerConnection* connection,
LinkedList typedValues, MmsServerConnection connection,
MmsDomain* domain, char* nameIdStr)
{
@ -181,7 +181,7 @@ getComponentOfArrayElement(AlternateAccess_t* alternateAccess, MmsVariableSpecif
}
static void
alternateArrayAccess(MmsServerConnection* connection,
alternateArrayAccess(MmsServerConnection connection,
AlternateAccess_t* alternateAccess, MmsDomain* domain,
char* itemId, LinkedList values,
MmsVariableSpecification* namedVariable)
@ -252,7 +252,7 @@ alternateArrayAccess(MmsServerConnection* connection,
static void
addNamedVariableToResultList(MmsVariableSpecification* namedVariable, MmsDomain* domain, char* nameIdStr,
LinkedList /*<MmsValue>*/ values, MmsServerConnection* connection, AlternateAccess_t* alternateAccess)
LinkedList /*<MmsValue>*/ values, MmsServerConnection connection, AlternateAccess_t* alternateAccess)
{
if (namedVariable != NULL) {
@ -371,7 +371,7 @@ encodeVariableAccessSpecification(VarAccessSpec* accessSpec, uint8_t* buffer, in
}
static void
encodeReadResponse(MmsServerConnection* connection,
encodeReadResponse(MmsServerConnection connection,
uint32_t invokeId, ByteBuffer* response, LinkedList values,
VarAccessSpec* accessSpec)
{
@ -469,7 +469,7 @@ encodeReadResponse(MmsServerConnection* connection,
static void
handleReadListOfVariablesRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
ReadRequest_t* read,
uint32_t invokeId,
ByteBuffer* response)
@ -568,7 +568,7 @@ exit:
#if (MMS_DATA_SET_SERVICE == 1)
static void
createNamedVariableListResponse(MmsServerConnection* connection, MmsNamedVariableList namedList,
createNamedVariableListResponse(MmsServerConnection connection, MmsNamedVariableList namedList,
int invokeId, ByteBuffer* response, ReadRequest_t* read, VarAccessSpec* accessSpec)
{
@ -607,7 +607,7 @@ createNamedVariableListResponse(MmsServerConnection* connection, MmsNamedVariabl
static void
handleReadNamedVariableListRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
ReadRequest_t* read,
int invokeId,
ByteBuffer* response)
@ -682,7 +682,7 @@ handleReadNamedVariableListRequest(
void
mmsServer_handleReadRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)

View file

@ -129,7 +129,7 @@ MmsServer_setClientAuthenticator(MmsServer self, AcseAuthenticator authenticator
static void
closeConnection(void* con)
{
MmsServerConnection* connection = (MmsServerConnection*) con;
MmsServerConnection connection = (MmsServerConnection) con;
MmsServerConnection_destroy(connection);
}
@ -176,7 +176,7 @@ MmsServer_insertIntoCache(MmsServer self, MmsDomain* domain, char* itemId, MmsVa
MmsDataAccessError
mmsServer_setValue(MmsServer self, MmsDomain* domain, char* itemId, MmsValue* value,
MmsServerConnection* connection)
MmsServerConnection connection)
{
MmsDataAccessError indication;
@ -203,7 +203,7 @@ mmsServer_setValue(MmsServer self, MmsDomain* domain, char* itemId, MmsValue* va
MmsValue*
mmsServer_getValue(MmsServer self, MmsDomain* domain, char* itemId, MmsServerConnection* connection)
mmsServer_getValue(MmsServer self, MmsDomain* domain, char* itemId, MmsServerConnection connection)
{
MmsValue* value = NULL;
@ -249,7 +249,7 @@ isoConnectionIndicationHandler(IsoConnectionIndication indication,
MmsServer mmsServer = (MmsServer) parameter;
if (indication == ISO_CONNECTION_OPENED) {
MmsServerConnection* mmsCon = MmsServerConnection_init(0, mmsServer, connection);
MmsServerConnection mmsCon = MmsServerConnection_init(0, mmsServer, connection);
Map_addEntry(mmsServer->openConnections, connection, mmsCon);
@ -258,7 +258,7 @@ isoConnectionIndicationHandler(IsoConnectionIndication indication,
mmsCon, MMS_SERVER_NEW_CONNECTION);
}
else if (indication == ISO_CONNECTION_CLOSED) {
MmsServerConnection* mmsCon = (MmsServerConnection*)
MmsServerConnection mmsCon = (MmsServerConnection)
Map_removeEntry(mmsServer->openConnections, connection, false);
if (mmsServer->connectionHandler != NULL)

View file

@ -79,7 +79,7 @@ mmsServer_writeMmsRejectPdu(uint32_t* invokeId, int reason, ByteBuffer* response
static void
handleConfirmedRequestPdu(
MmsServerConnection* self,
MmsServerConnection self,
uint8_t* buffer, int bufPos, int maxBufPos,
ByteBuffer* response)
{
@ -225,7 +225,7 @@ handleConfirmedRequestPdu(
}
MmsIndication
MmsServerConnection_parseMessage(MmsServerConnection* self, ByteBuffer* message, ByteBuffer* response)
MmsServerConnection_parseMessage(MmsServerConnection self, ByteBuffer* message, ByteBuffer* response)
{
MmsIndication retVal;
@ -276,7 +276,7 @@ MmsServerConnection_parseMessage(MmsServerConnection* self, ByteBuffer* message,
static void /* will be called by IsoConnection */
messageReceived(void* parameter, ByteBuffer* message, ByteBuffer* response)
{
MmsServerConnection* self = (MmsServerConnection*) parameter;
MmsServerConnection self = (MmsServerConnection) parameter;
MmsServerConnection_parseMessage(self, message, response);
}
@ -285,13 +285,13 @@ messageReceived(void* parameter, ByteBuffer* message, ByteBuffer* response)
* MMS server connection public API functions
*********************************************************************************************/
MmsServerConnection*
MmsServerConnection_init(MmsServerConnection* connection, MmsServer server, IsoConnection isoCon)
MmsServerConnection
MmsServerConnection_init(MmsServerConnection connection, MmsServer server, IsoConnection isoCon)
{
MmsServerConnection* self;
MmsServerConnection self;
if (connection == NULL)
self = (MmsServerConnection*) GLOBAL_CALLOC(1, sizeof(MmsServerConnection));
self = (MmsServerConnection) GLOBAL_CALLOC(1, sizeof(struct sMmsServerConnection));
else
self = connection;
@ -312,7 +312,7 @@ MmsServerConnection_init(MmsServerConnection* connection, MmsServer server, IsoC
}
void
MmsServerConnection_destroy(MmsServerConnection* self)
MmsServerConnection_destroy(MmsServerConnection self)
{
#if (MMS_FILE_SERVICE == 1)
@ -332,7 +332,7 @@ MmsServerConnection_destroy(MmsServerConnection* self)
#if (MMS_DYNAMIC_DATA_SETS == 1)
bool
MmsServerConnection_addNamedVariableList(MmsServerConnection* self, MmsNamedVariableList variableList)
MmsServerConnection_addNamedVariableList(MmsServerConnection self, MmsNamedVariableList variableList)
{
//TODO check if operation is allowed!
@ -342,13 +342,13 @@ MmsServerConnection_addNamedVariableList(MmsServerConnection* self, MmsNamedVari
}
void
MmsServerConnection_deleteNamedVariableList(MmsServerConnection* self, char* listName)
MmsServerConnection_deleteNamedVariableList(MmsServerConnection self, char* listName)
{
mmsServer_deleteVariableList(self->namedVariableLists, listName);
}
MmsNamedVariableList
MmsServerConnection_getNamedVariableList(MmsServerConnection* self, char* variableListName)
MmsServerConnection_getNamedVariableList(MmsServerConnection self, char* variableListName)
{
//TODO remove code duplication - similar to MmsDomain_getNamedVariableList !
MmsNamedVariableList variableList = NULL;
@ -372,21 +372,27 @@ MmsServerConnection_getNamedVariableList(MmsServerConnection* self, char* variab
char*
MmsServerConnection_getClientAddress(MmsServerConnection* self)
MmsServerConnection_getClientAddress(MmsServerConnection self)
{
return IsoConnection_getPeerAddress(self->isoConnection);
}
IsoConnection
MmsServerConnection_getIsoConnection(MmsServerConnection self)
{
return self->isoConnection;
}
#if (MMS_DYNAMIC_DATA_SETS == 1)
LinkedList
MmsServerConnection_getNamedVariableLists(MmsServerConnection* self)
MmsServerConnection_getNamedVariableLists(MmsServerConnection self)
{
return self->namedVariableLists;
}
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
uint32_t
MmsServerConnection_getLastInvokeId(MmsServerConnection* self)
MmsServerConnection_getLastInvokeId(MmsServerConnection self)
{
return self->lastInvokeId;
}

View file

@ -27,7 +27,7 @@
void
mmsServer_handleStatusRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* requestBuffer,
int bufPos,
int invokeId,

View file

@ -34,7 +34,7 @@
*********************************************************************************************/
int
mmsServer_createMmsWriteResponse(MmsServerConnection* connection,
mmsServer_createMmsWriteResponse(MmsServerConnection connection,
int invokeId, ByteBuffer* response, int numberOfItems, MmsDataAccessError* accessResults)
{
MmsPdu_t* mmsPdu = mmsServer_createConfirmedResponse(invokeId);
@ -72,7 +72,7 @@ mmsServer_createMmsWriteResponse(MmsServerConnection* connection,
void
MmsServerConnection_sendWriteResponse(MmsServerConnection* self, uint32_t invokeId, MmsDataAccessError indication, bool handlerMode)
MmsServerConnection_sendWriteResponse(MmsServerConnection self, uint32_t invokeId, MmsDataAccessError indication, bool handlerMode)
{
ByteBuffer* response = ByteBuffer_create(NULL, self->maxPduSize);
@ -85,7 +85,7 @@ MmsServerConnection_sendWriteResponse(MmsServerConnection* self, uint32_t invoke
void
mmsServer_handleWriteRequest(
MmsServerConnection* connection,
MmsServerConnection connection,
uint8_t* buffer, int bufPos, int maxBufPos,
uint32_t invokeId,
ByteBuffer* response)