- fixed some standard conformance issues in report module

This commit is contained in:
Michael Zillgith 2015-04-22 16:53:28 +02:00
parent 5955ae1577
commit 38711a8843
2 changed files with 21 additions and 17 deletions

View file

@ -41,7 +41,7 @@
* *
* WARNING: If set to 1 normal single- and multi-threaded server are no longer working! * WARNING: If set to 1 normal single- and multi-threaded server are no longer working!
*/ */
#define CONFIG_MMS_THREADLESS_STACK 0 #define CONFIG_MMS_THREADLESS_STACK 1
/* number of concurrent MMS client connections the server accepts, -1 for no limit */ /* number of concurrent MMS client connections the server accepts, -1 for no limit */
#define CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS 5 #define CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS 5

View file

@ -1100,29 +1100,33 @@ updateOwner(ReportControl* rc, MmsServerConnection connection)
if (DEBUG_IED_SERVER) printf("IED_SERVER: reporting.c: set owner to %s\n", clientAddressString); if (DEBUG_IED_SERVER) printf("IED_SERVER: reporting.c: set owner to %s\n", clientAddressString);
if (strchr(clientAddressString, '.') != NULL) { if (strchr(clientAddressString, '.') != NULL) {
if (DEBUG_IED_SERVER) printf("IED_SERVER: reporting.c: client address is IPv4 address\n"); if (DEBUG_IED_SERVER)
{ printf("IED_SERVER: reporting.c: client address is IPv4 address\n");
uint8_t ipV4Addr[4];
int addrElementCount = 0; uint8_t ipV4Addr[4];
char* separator = clientAddressString; int addrElementCount = 0;
while (separator != NULL && addrElementCount < 4) { char* separator = clientAddressString;
int intVal = atoi(separator);
separator = strchr(separator, '.'); while (separator != NULL && addrElementCount < 4) {
int intVal = atoi(separator);
ipV4Addr[addrElementCount] = intVal; ipV4Addr[addrElementCount] = intVal;
addrElementCount ++; separator = strchr(separator, '.');
}
if (addrElementCount == 4) if (separator != NULL)
MmsValue_setOctetString(owner, ipV4Addr, 4); separator++; // skip '.' character
else
MmsValue_setOctetString(owner, ipV4Addr, 0); addrElementCount ++;
} }
if (addrElementCount == 4)
MmsValue_setOctetString(owner, ipV4Addr, 4);
else
MmsValue_setOctetString(owner, ipV4Addr, 0);
} }
else { else {
uint8_t ipV6Addr[16]; uint8_t ipV6Addr[16];
@ -1227,7 +1231,7 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme
goto exit_function; goto exit_function;
} }
else { else {
retVal = DATA_ACCESS_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT; retVal = DATA_ACCESS_ERROR_TEMPORARILY_UNAVAILABLE;
goto exit_function; goto exit_function;
} }
} }