- 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,8 +1100,9 @@ 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]; uint8_t ipV4Addr[4];
int addrElementCount = 0; int addrElementCount = 0;
@ -1111,9 +1112,12 @@ updateOwner(ReportControl* rc, MmsServerConnection connection)
while (separator != NULL && addrElementCount < 4) { while (separator != NULL && addrElementCount < 4) {
int intVal = atoi(separator); int intVal = atoi(separator);
ipV4Addr[addrElementCount] = intVal;
separator = strchr(separator, '.'); separator = strchr(separator, '.');
ipV4Addr[addrElementCount] = intVal; if (separator != NULL)
separator++; // skip '.' character
addrElementCount ++; addrElementCount ++;
} }
@ -1122,7 +1126,7 @@ updateOwner(ReportControl* rc, MmsServerConnection connection)
MmsValue_setOctetString(owner, ipV4Addr, 4); MmsValue_setOctetString(owner, ipV4Addr, 4);
else else
MmsValue_setOctetString(owner, ipV4Addr, 0); 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;
} }
} }