- make rsession code compatible with MSVC (LIB61850-360)

v1.6_develop_rgoose_sntp
Michael Zillgith 3 years ago
parent 90e1ac5c63
commit cec871f2e3

@ -56,10 +56,9 @@ main(int argc, char **argv)
GoosePublisher publisher = GoosePublisher_createRemote(rSession, 0x4001); GoosePublisher publisher = GoosePublisher_createRemote(rSession, 0x4001);
//char* key = "0123456789ABCDEF";
char* key = "0123456789ABCDEF"; char* key = "0123456789ABCDEF";
RSession_addKey(rSession, 1, key, 16, R_SESSION_SEC_ALGO_AES_128_GCM, R_SESSION_SIG_ALGO_NONE); RSession_addKey(rSession, 1, (uint8_t*)key, 16, R_SESSION_SEC_ALGO_AES_128_GCM, R_SESSION_SIG_ALGO_NONE);
RSession_setActiveKey(rSession, 1); RSession_setActiveKey(rSession, 1);
if (publisher) { if (publisher) {

@ -56,7 +56,7 @@ main(int argc, char** argv)
RSession_setLocalAddress(sessionP, "0.0.0.0", 102); RSession_setLocalAddress(sessionP, "0.0.0.0", 102);
char* key = "0123456789ABCDEF"; char* key = "0123456789ABCDEF";
RSession_addKey(sessionP, 1, key, 16, R_SESSION_SEC_ALGO_AES_128_GCM, R_SESSION_SIG_ALGO_NONE); RSession_addKey(sessionP, 1, (uint8_t*)key, 16, R_SESSION_SEC_ALGO_AES_128_GCM, R_SESSION_SIG_ALGO_NONE);
RSession_addMulticastGroup(sessionP, "230.0.10.11"); RSession_addMulticastGroup(sessionP, "230.0.10.11");

@ -39,8 +39,8 @@ main(int argc, char** argv)
char* key1 = "0123456789ABCDEF"; char* key1 = "0123456789ABCDEF";
char* key2 = "FEDCBA9876543210"; char* key2 = "FEDCBA9876543210";
RSession_addKey(rSession, 1, key1, 16, R_SESSION_SEC_ALGO_AES_128_GCM, R_SESSION_SIG_ALGO_NONE); RSession_addKey(rSession, 1, (uint8_t*)key1, 16, R_SESSION_SEC_ALGO_AES_128_GCM, R_SESSION_SIG_ALGO_NONE);
RSession_addKey(rSession, 2, key2, 16, R_SESSION_SEC_ALGO_AES_128_GCM, R_SESSION_SIG_ALGO_NONE); RSession_addKey(rSession, 2, (uint8_t*)key2, 16, R_SESSION_SEC_ALGO_AES_128_GCM, R_SESSION_SIG_ALGO_NONE);
RSession_setActiveKey(rSession, activeKeyId); RSession_setActiveKey(rSession, activeKeyId);

@ -668,8 +668,8 @@ Socket_destroy(Socket self)
GLOBAL_FREEMEM(self); GLOBAL_FREEMEM(self);
} }
UdpSocket static UdpSocket
UdpSocket_create() UdpSocket_createUsingNamespace(int ns)
{ {
UdpSocket self = NULL; UdpSocket self = NULL;

@ -217,6 +217,8 @@ set_source_files_properties(${lib_asn1c_SRCS}
IF(MSVC) IF(MSVC)
set_source_files_properties(${lib_common_SRCS} ${lib_windows_SRCS} set_source_files_properties(${lib_common_SRCS} ${lib_windows_SRCS}
PROPERTIES LANGUAGE CXX) PROPERTIES LANGUAGE CXX)
set_source_files_properties(${lib_rsession_SRCS}
PROPERTIES LANGUAGE CXX)
ENDIF() ENDIF()
IF(WITH_WPCAP) IF(WITH_WPCAP)
@ -225,6 +227,7 @@ set_source_files_properties(${lib_goose_SRCS}
PROPERTIES LANGUAGE CXX) PROPERTIES LANGUAGE CXX)
set_source_files_properties(${lib_sv_SRCS} set_source_files_properties(${lib_sv_SRCS}
PROPERTIES LANGUAGE CXX) PROPERTIES LANGUAGE CXX)
ENDIF() ENDIF()
ELSE() ELSE()
add_definitions(-DEXCLUDE_ETHERNET_WINDOWS) add_definitions(-DEXCLUDE_ETHERNET_WINDOWS)

@ -506,7 +506,7 @@ parseSessionMessage(RSession self, uint8_t* buffer, int msgSize, RSessionPayload
/* parse payload elements */ /* parse payload elements */
uint32_t payloadEnd = bufPos + payloadLength; uint32_t payloadEnd = bufPos + payloadLength;
if (payloadEnd > msgSize) { if (payloadEnd > (uint32_t)msgSize) {
DEBUG_PRINTF("ERROR - payload size field invalid"); DEBUG_PRINTF("ERROR - payload size field invalid");
goto exit_error; goto exit_error;
} }
@ -549,7 +549,7 @@ parseSessionMessage(RSession self, uint8_t* buffer, int msgSize, RSessionPayload
} }
} }
while (bufPos < payloadEnd) { while ((uint32_t)bufPos < payloadEnd) {
int payloadElementType = buffer[bufPos++]; int payloadElementType = buffer[bufPos++];
bool simulation; bool simulation;
@ -639,7 +639,7 @@ parseSessionMessage(RSession self, uint8_t* buffer, int msgSize, RSessionPayload
/* parse payload elements */ /* parse payload elements */
uint32_t payloadEnd = bufPos + payloadLength; uint32_t payloadEnd = bufPos + payloadLength;
if (payloadEnd > msgSize) { if (payloadEnd > (uint32_t)msgSize) {
DEBUG_PRINTF("ERROR - payload size field invalid"); DEBUG_PRINTF("ERROR - payload size field invalid");
goto exit_error; goto exit_error;
} }
@ -685,9 +685,9 @@ parseSessionMessage(RSession self, uint8_t* buffer, int msgSize, RSessionPayload
/* Check signature and decrypt application layer */ /* Check signature and decrypt application layer */
if (secAlgo != R_SESSION_SEC_ALGO_NONE) { if (secAlgo != R_SESSION_SEC_ALGO_NONE) {
/* Check for HMAC */ /* Check for HMAC */
if (payloadEnd + 18 <= msgSize) { if (payloadEnd + 18 <= (uint32_t)msgSize) {
if (self->payloadBuffer == NULL) if (self->payloadBuffer == NULL)
self->payloadBuffer = GLOBAL_MALLOC(65000); self->payloadBuffer = (uint8_t*)GLOBAL_MALLOC(65000);
if (self->payloadBuffer) { if (self->payloadBuffer) {
//TODO check MMAC tag //TODO check MMAC tag
@ -711,7 +711,7 @@ parseSessionMessage(RSession self, uint8_t* buffer, int msgSize, RSessionPayload
} }
} }
while (bufPos < payloadEnd) { while ((uint32_t)bufPos < payloadEnd) {
int payloadElementType = buffer[bufPos++]; int payloadElementType = buffer[bufPos++];
bool simulation; bool simulation;

Loading…
Cancel
Save