From 713ae20c3d398253986135834b9ed5e6214c2dd6 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Mon, 3 Feb 2025 10:24:20 -0500 Subject: [PATCH 1/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index b63d8d34..b8faf540 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -183,6 +183,11 @@ msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) return MSGPACK_UNPACK_NOMEM_ERROR; msgpack_zone_init(&mempool, 2048); + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: MYYYY PRRRRIINNNTTSSSS : : : : \n", __FUNCTION__, __LINE__); + for (size_t i = 0; i < size; ++i) { + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: %02x ", __FUNCTION__, __LINE__, (unsigned char)decodebuf[i]); + } + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "\n"); unpack_ret = msgpack_unpack(decodedbuf, size, NULL, &mempool, &deserialized); switch(unpack_ret) From f22932be3790cea4c5e7fe93644ff27ea7683896 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Mon, 3 Feb 2025 10:54:04 -0500 Subject: [PATCH 2/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index b8faf540..70dc2307 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -185,7 +185,7 @@ msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) msgpack_zone_init(&mempool, 2048); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: MYYYY PRRRRIINNNTTSSSS : : : : \n", __FUNCTION__, __LINE__); for (size_t i = 0; i < size; ++i) { - RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: %02x ", __FUNCTION__, __LINE__, (unsigned char)decodebuf[i]); + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: %02x ", __FUNCTION__, __LINE__, (unsigned char)decodedbuf[i]); } RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "\n"); unpack_ret = msgpack_unpack(decodedbuf, size, NULL, &mempool, &deserialized); From 4190176b6b3442cd4a5180df402f27da85fe53e3 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Mon, 3 Feb 2025 13:41:03 -0500 Subject: [PATCH 3/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index 70dc2307..7b34da58 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -185,7 +185,7 @@ msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) msgpack_zone_init(&mempool, 2048); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: MYYYY PRRRRIINNNTTSSSS : : : : \n", __FUNCTION__, __LINE__); for (size_t i = 0; i < size; ++i) { - RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: %02x ", __FUNCTION__, __LINE__, (unsigned char)decodedbuf[i]); + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "%02x ", (unsigned char)decodedbuf[i]); } RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "\n"); unpack_ret = msgpack_unpack(decodedbuf, size, NULL, &mempool, &deserialized); From f2f869d4fef3a6727ce9afee0ccb8a4277e41913 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Mon, 3 Feb 2025 14:18:29 -0500 Subject: [PATCH 4/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index 7b34da58..364ffce6 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -184,12 +184,10 @@ msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) msgpack_zone_init(&mempool, 2048); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: MYYYY PRRRRIINNNTTSSSS : : : : \n", __FUNCTION__, __LINE__); - for (size_t i = 0; i < size; ++i) { - RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "%02x ", (unsigned char)decodedbuf[i]); - } + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Decoded Buffer = %s \n", __FUNCTION__, __LINE__, decodedbuf); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "\n"); unpack_ret = msgpack_unpack(decodedbuf, size, NULL, &mempool, &deserialized); - + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: String: %.*s\n", __FUNCTION__, __LINE__, deserialized.via.str.size, deserialized.via.str.ptr); switch(unpack_ret) { case MSGPACK_UNPACK_SUCCESS: @@ -518,7 +516,8 @@ int get_base64_decodedbuffer(char *pString, char **buffer, int *size) if (buffer == NULL || size == NULL || pString == NULL) return -1; - + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Encoded Message before b64_decode is = %s\n", __FUNCTION__, __LINE__, pString); + decodeMsgSize = b64_get_decoded_buffer_size(strlen(pString)); decodeMsg = (char *)malloc((decodeMsgSize + 1) * sizeof(char)); if (decodeMsg == NULL) @@ -536,6 +535,8 @@ int get_base64_decodedbuffer(char *pString, char **buffer, int *size) } *buffer = decodeMsg; + RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Decoded Message after b64_decode is = %s\n", __FUNCTION__, __LINE__, decodeMsg); + return 0; } From 075f764a2d35f93fbd247df99b5dfab362098cce Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Tue, 4 Feb 2025 09:31:51 -0500 Subject: [PATCH 5/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index 364ffce6..3656a2d7 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -175,18 +175,19 @@ void *helper_convert(const void *buf, size_t len, msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) { - msgpack_zone mempool; - msgpack_object deserialized; + //msgpack_zone mempool; + msgpack_unpacked deserialized; msgpack_unpack_return unpack_ret; if (decodedbuf == NULL || !size) return MSGPACK_UNPACK_NOMEM_ERROR; - msgpack_zone_init(&mempool, 2048); + msgpack_zone_init(deserialized.zone, 2048); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: MYYYY PRRRRIINNNTTSSSS : : : : \n", __FUNCTION__, __LINE__); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Decoded Buffer = %s \n", __FUNCTION__, __LINE__, decodedbuf); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "\n"); - unpack_ret = msgpack_unpack(decodedbuf, size, NULL, &mempool, &deserialized); + //unpack_ret = msgpack_unpack(decodedbuf, size, NULL, &mempool, &deserialized); + unpack_ret = msgpack_unpack_next(&deserialized, decodedbuf, size, NULL); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: String: %.*s\n", __FUNCTION__, __LINE__, deserialized.via.str.size, deserialized.via.str.ptr); switch(unpack_ret) { From 53c71c27b57943095830515e0dae8a3514ffd1f3 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Tue, 4 Feb 2025 09:59:54 -0500 Subject: [PATCH 6/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index 3656a2d7..bebf5c12 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -175,20 +175,20 @@ void *helper_convert(const void *buf, size_t len, msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) { - //msgpack_zone mempool; + msgpack_zone mempool; msgpack_unpacked deserialized; msgpack_unpack_return unpack_ret; if (decodedbuf == NULL || !size) return MSGPACK_UNPACK_NOMEM_ERROR; - msgpack_zone_init(deserialized.zone, 2048); + msgpack_zone_init(&mempool, 2048); + deserialized.zone = &mempool; RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: MYYYY PRRRRIINNNTTSSSS : : : : \n", __FUNCTION__, __LINE__); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Decoded Buffer = %s \n", __FUNCTION__, __LINE__, decodedbuf); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "\n"); //unpack_ret = msgpack_unpack(decodedbuf, size, NULL, &mempool, &deserialized); unpack_ret = msgpack_unpack_next(&deserialized, decodedbuf, size, NULL); - RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: String: %.*s\n", __FUNCTION__, __LINE__, deserialized.via.str.size, deserialized.via.str.ptr); switch(unpack_ret) { case MSGPACK_UNPACK_SUCCESS: From d80e750245712c4bb6eaaa927ccd7e0e597aec2b Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Tue, 4 Feb 2025 12:15:49 -0500 Subject: [PATCH 7/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index bebf5c12..a3d97340 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -177,13 +177,14 @@ msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) msgpack_zone mempool; msgpack_unpacked deserialized; + msgpack_unpacked_init(&deserialized); msgpack_unpack_return unpack_ret; if (decodedbuf == NULL || !size) return MSGPACK_UNPACK_NOMEM_ERROR; - msgpack_zone_init(&mempool, 2048); - deserialized.zone = &mempool; + //msgpack_zone_init(&mempool, 2048); + //deserialized.zone = &mempool; RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: MYYYY PRRRRIINNNTTSSSS : : : : \n", __FUNCTION__, __LINE__); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Decoded Buffer = %s \n", __FUNCTION__, __LINE__, decodedbuf); RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "\n"); From 976f1a9c72ac2c31eba22c3cf9dd9e3848aca6ef Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Tue, 4 Feb 2025 13:44:04 -0500 Subject: [PATCH 8/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index a3d97340..b4e44b9d 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -175,7 +175,7 @@ void *helper_convert(const void *buf, size_t len, msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) { - msgpack_zone mempool; + //msgpack_zone mempool; msgpack_unpacked deserialized; msgpack_unpacked_init(&deserialized); msgpack_unpack_return unpack_ret; @@ -211,7 +211,7 @@ msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Message Pack decode failed with error\n", __FUNCTION__, __LINE__); } - msgpack_zone_destroy(&mempool); + //msgpack_zone_destroy(&mempool); // End of msgpack decoding return unpack_ret; From 1d5e3a445dba0e4234431929e5b9c86873c16865 Mon Sep 17 00:00:00 2001 From: Aravindan NC <35158113+AravindanNC@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:51:51 -0500 Subject: [PATCH 9/9] Update rrdMsgPackDecoder.c --- src/rrdMsgPackDecoder.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rrdMsgPackDecoder.c b/src/rrdMsgPackDecoder.c index b4e44b9d..1b289479 100644 --- a/src/rrdMsgPackDecoder.c +++ b/src/rrdMsgPackDecoder.c @@ -175,6 +175,7 @@ void *helper_convert(const void *buf, size_t len, msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) { + FILE *fd = fopen("/tmp/RRD_MSGPACK_OP.bin", "w+"); //msgpack_zone mempool; msgpack_unpacked deserialized; msgpack_unpacked_init(&deserialized); @@ -190,6 +191,8 @@ msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "\n"); //unpack_ret = msgpack_unpack(decodedbuf, size, NULL, &mempool, &deserialized); unpack_ret = msgpack_unpack_next(&deserialized, decodedbuf, size, NULL); + msgpack_object obj = deserialized.data; + msgpack_object_print(fd, obj); switch(unpack_ret) { case MSGPACK_UNPACK_SUCCESS: @@ -212,6 +215,8 @@ msgpack_unpack_return get_msgpack_unpack_status(char *decodedbuf, int size) } //msgpack_zone_destroy(&mempool); + msgpack_unpacked_destroy( &deserialized ); + fclose(fd); // End of msgpack decoding return unpack_ret;