Loading src/lib/kinetic_logger.c +5 −2 Original line number Diff line number Diff line Loading @@ -39,11 +39,14 @@ void KineticLogger_Init(const char* logFile) { fprintf(stderr, "Failed to initialize logger with file: " "fopen('%s') => FileDesc=%zd", "fopen('%s') => FileDesc=%zd\n", logFile, (size_t)FileDesc); } else { fprintf(stderr, "Logging output to %s\n", logFile); LogToConsole = false; } } Loading @@ -52,7 +55,7 @@ void KineticLogger_Init(const char* logFile) void KineticLogger_Close(void) { // Don't close std/already-opened streams if (LogFile != NULL && if (!LogToConsole && strlen(LogFile) > 0 && FileDesc != stdout && FileDesc != stderr && FileDesc != stdin) { fclose(FileDesc); Loading src/lib/kinetic_socket.c +10 −5 Original line number Diff line number Diff line Loading @@ -21,16 +21,19 @@ #include "kinetic_socket.h" #include "kinetic_logger.h" #include "protobuf-c/protobuf-c.h" #include <stdlib.h> #include <errno.h> #include <string.h> #include <stdio.h> #include <string.h> #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif // _BSD_SOURCE #include <unistd.h> #include "socket99/socket99.h" #include <sys/types.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/select.h> #include <netinet/in.h> Loading @@ -42,6 +45,8 @@ #include <stdio.h> #include <string.h> #include "socket99/socket99.h" static void* KineticProto_Alloc(void* buf, size_t size) { // LOG_LOCATION; LOGF(">>>> Allocating %zu bytes...", size); Loading src/lib/kinetic_types.h +4 −4 Original line number Diff line number Diff line Loading @@ -173,8 +173,8 @@ typedef struct _KineticMessage uint8_t hmacData[KINETIC_HMAC_MAX_LEN]; } KineticMessage; #define KINETIC_MESSAGE_HEADER_INIT(_hdr, _con) { \ assert((_hdr) != NULL); \ assert((_con) != NULL); \ assert((void *)(_hdr) != NULL); \ assert((void *)(_con) != NULL); \ *(_hdr) = (KineticProto_Header) { \ .base = PROTOBUF_C_MESSAGE_INIT(&KineticProto_header__descriptor), \ .has_clusterVersion = true, \ Loading Loading @@ -271,8 +271,8 @@ typedef struct _KineticPDU } KineticPDU; #define KINETIC_PDU_INIT(_pdu, _con) { \ assert((_pdu) != NULL); \ assert((_con) != NULL); \ assert((void *)(_pdu) != NULL); \ assert((void *)(_con) != NULL); \ (_pdu)->connection = (_con); \ (_pdu)->header = KINETIC_PDU_HEADER_INIT; \ (_pdu)->headerNBO = KINETIC_PDU_HEADER_INIT; \ Loading test/integration/test_kinetic_logger.c +1 −0 Original line number Diff line number Diff line Loading @@ -75,3 +75,4 @@ void test_KineticLogger_Log_should_write_log_message_to_file(void) TEST_ASSERT_EQUAL_FILE_CONTENT(TEST_LOG_FILE, content, length); } test/integration/test_kinetic_socket.c +19 −17 Original line number Diff line number Diff line Loading @@ -18,31 +18,33 @@ * */ #include "unity_helper.h" #include "kinetic_types.h" #include "kinetic_socket.h" #include "kinetic_logger.h" #include "kinetic_proto.h" #include "kinetic_message.h" #include "protobuf-c/protobuf-c.h" #include <stdlib.h> #include <errno.h> #include <string.h> #include <stdio.h> #include <string.h> #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif // _BSD_SOURCE #include <unistd.h> #include <sys/types.h> #include "socket99/socket99.h" #include <errno.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include <signal.h> #include "socket99/socket99.h" #include "protobuf-c/protobuf-c.h" #include "unity_helper.h" #include "kinetic_types.h" #include "kinetic_socket.h" #include "kinetic_logger.h" #include "kinetic_proto.h" #include "kinetic_message.h" static int FileDesc; static int KineticTestPort = KINETIC_PORT; Loading Loading
src/lib/kinetic_logger.c +5 −2 Original line number Diff line number Diff line Loading @@ -39,11 +39,14 @@ void KineticLogger_Init(const char* logFile) { fprintf(stderr, "Failed to initialize logger with file: " "fopen('%s') => FileDesc=%zd", "fopen('%s') => FileDesc=%zd\n", logFile, (size_t)FileDesc); } else { fprintf(stderr, "Logging output to %s\n", logFile); LogToConsole = false; } } Loading @@ -52,7 +55,7 @@ void KineticLogger_Init(const char* logFile) void KineticLogger_Close(void) { // Don't close std/already-opened streams if (LogFile != NULL && if (!LogToConsole && strlen(LogFile) > 0 && FileDesc != stdout && FileDesc != stderr && FileDesc != stdin) { fclose(FileDesc); Loading
src/lib/kinetic_socket.c +10 −5 Original line number Diff line number Diff line Loading @@ -21,16 +21,19 @@ #include "kinetic_socket.h" #include "kinetic_logger.h" #include "protobuf-c/protobuf-c.h" #include <stdlib.h> #include <errno.h> #include <string.h> #include <stdio.h> #include <string.h> #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif // _BSD_SOURCE #include <unistd.h> #include "socket99/socket99.h" #include <sys/types.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/select.h> #include <netinet/in.h> Loading @@ -42,6 +45,8 @@ #include <stdio.h> #include <string.h> #include "socket99/socket99.h" static void* KineticProto_Alloc(void* buf, size_t size) { // LOG_LOCATION; LOGF(">>>> Allocating %zu bytes...", size); Loading
src/lib/kinetic_types.h +4 −4 Original line number Diff line number Diff line Loading @@ -173,8 +173,8 @@ typedef struct _KineticMessage uint8_t hmacData[KINETIC_HMAC_MAX_LEN]; } KineticMessage; #define KINETIC_MESSAGE_HEADER_INIT(_hdr, _con) { \ assert((_hdr) != NULL); \ assert((_con) != NULL); \ assert((void *)(_hdr) != NULL); \ assert((void *)(_con) != NULL); \ *(_hdr) = (KineticProto_Header) { \ .base = PROTOBUF_C_MESSAGE_INIT(&KineticProto_header__descriptor), \ .has_clusterVersion = true, \ Loading Loading @@ -271,8 +271,8 @@ typedef struct _KineticPDU } KineticPDU; #define KINETIC_PDU_INIT(_pdu, _con) { \ assert((_pdu) != NULL); \ assert((_con) != NULL); \ assert((void *)(_pdu) != NULL); \ assert((void *)(_con) != NULL); \ (_pdu)->connection = (_con); \ (_pdu)->header = KINETIC_PDU_HEADER_INIT; \ (_pdu)->headerNBO = KINETIC_PDU_HEADER_INIT; \ Loading
test/integration/test_kinetic_logger.c +1 −0 Original line number Diff line number Diff line Loading @@ -75,3 +75,4 @@ void test_KineticLogger_Log_should_write_log_message_to_file(void) TEST_ASSERT_EQUAL_FILE_CONTENT(TEST_LOG_FILE, content, length); }
test/integration/test_kinetic_socket.c +19 −17 Original line number Diff line number Diff line Loading @@ -18,31 +18,33 @@ * */ #include "unity_helper.h" #include "kinetic_types.h" #include "kinetic_socket.h" #include "kinetic_logger.h" #include "kinetic_proto.h" #include "kinetic_message.h" #include "protobuf-c/protobuf-c.h" #include <stdlib.h> #include <errno.h> #include <string.h> #include <stdio.h> #include <string.h> #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif // _BSD_SOURCE #include <unistd.h> #include <sys/types.h> #include "socket99/socket99.h" #include <errno.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include <signal.h> #include "socket99/socket99.h" #include "protobuf-c/protobuf-c.h" #include "unity_helper.h" #include "kinetic_types.h" #include "kinetic_socket.h" #include "kinetic_logger.h" #include "kinetic_proto.h" #include "kinetic_message.h" static int FileDesc; static int KineticTestPort = KINETIC_PORT; Loading