From 93edf61911328939fc00036342b1efc97797f715 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 22 Nov 2023 15:40:04 +0100 Subject: [PATCH 01/10] PUBNUB_PROXY_API --- core/pbhttp_digest.c | 5 +++++ core/pbhttp_digest.h | 5 +++++ core/pbntlm_core.c | 5 +++++ core/pbntlm_core.h | 4 ++++ core/pbntlm_packer.h | 5 +++++ core/pbntlm_packer_sspi.c | 6 ++++++ core/pbntlm_packer_std.c | 5 +++++ core/pubnub_proxy.c | 5 +++++ core/pubnub_proxy.h | 5 +++++ core/pubnub_proxy_core.c | 5 +++++ core/pubnub_proxy_core.h | 5 +++++ 11 files changed, 55 insertions(+) diff --git a/core/pbhttp_digest.c b/core/pbhttp_digest.c index 67f282c3..1eb88ba9 100644 --- a/core/pbhttp_digest.c +++ b/core/pbhttp_digest.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #include "pubnub_internal.h" #include "core/pubnub_proxy_core.h" @@ -319,3 +322,5 @@ int pbhttp_digest_prep_header_to_send(struct pbhttp_digest_context* ctx, return 0; } + +#endif /* PUBNUB_PROXY_API */ diff --git a/core/pbhttp_digest.h b/core/pbhttp_digest.h index 6de5219d..2d5c0571 100644 --- a/core/pbhttp_digest.h +++ b/core/pbhttp_digest.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #if !defined INC_PBHTTP_DIGEST #define INC_PBHTTP_DIGEST @@ -152,3 +155,5 @@ char const* pbhttp_digest_algorithm2str(enum pbhttp_digest_algorithm e); #endif /* !defined INC_PBHTTP_DIGEST */ +#endif /* PUBNUB_PROXY_API */ + diff --git a/core/pbntlm_core.c b/core/pbntlm_core.c index b100aa92..465e1a07 100644 --- a/core/pbntlm_core.c +++ b/core/pbntlm_core.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #include "core/pbntlm_core.h" #include "core/pbntlm_packer.h" @@ -81,3 +84,5 @@ int pbntlm_core_prep_msg_to_send(pubnub_t *pb, pubnub_bymebl_t* data) } } +#endif /* PUBNUB_PROXY_API */ + diff --git a/core/pbntlm_core.h b/core/pbntlm_core.h index 5c246fe0..2630e7a3 100644 --- a/core/pbntlm_core.h +++ b/core/pbntlm_core.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #if !defined INC_PBNTLM_CORE #define INC_PBNTLM_CORE @@ -16,3 +19,4 @@ int pbntlm_core_prep_msg_to_send(pubnub_t *pb, pubnub_bymebl_t* data); #endif /* !defined INC_PBNTLM_CORE */ +#endif /* PUBNUB_PROXY_API */ diff --git a/core/pbntlm_packer.h b/core/pbntlm_packer.h index 2d546a94..6d315077 100644 --- a/core/pbntlm_packer.h +++ b/core/pbntlm_packer.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #if !defined INC_PBNTLM_PACKER #define INC_PBNTLM_PACKER @@ -19,3 +22,5 @@ void pbntlm_packer_deinit(pbntlm_ctx_t *pb); #endif /* !defined INC_PBNTLM_PACKER */ +#endif /* PUBNUB_PROXY_API */ + diff --git a/core/pbntlm_packer_sspi.c b/core/pbntlm_packer_sspi.c index ef946018..e09c6de3 100644 --- a/core/pbntlm_packer_sspi.c +++ b/core/pbntlm_packer_sspi.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #include "pbntlm_packer.h" #include "pubnub_log.h" @@ -212,3 +215,6 @@ void pbntlm_packer_deinit(pbntlm_ctx_t *pb) SecInvalidateHandle(&pb->hcreds); } } + +#endif /* PUBNUB_PROXY_API */ + diff --git a/core/pbntlm_packer_std.c b/core/pbntlm_packer_std.c index 39a73525..2835b933 100644 --- a/core/pbntlm_packer_std.c +++ b/core/pbntlm_packer_std.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #include "pbntlm_packer.h" #include "pubnub_log.h" @@ -51,3 +54,5 @@ void pbntlm_packer_deinit(pbntlm_ctx_t *pb) { PUBNUB_UNUSED(pb); } + +#endif /* PUBNUB_PROXY_API */ diff --git a/core/pubnub_proxy.c b/core/pubnub_proxy.c index 7f6b66a7..1d7c4447 100644 --- a/core/pubnub_proxy.c +++ b/core/pubnub_proxy.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #include "pubnub_internal.h" #include "pubnub_proxy.h" @@ -144,3 +147,5 @@ int pubnub_set_proxy_authentication_username_password(pubnub_t* p, return 0; } + +#endif /* PUBNUB_PROXY_API */ diff --git a/core/pubnub_proxy.h b/core/pubnub_proxy.h index d475dbbb..f63afc83 100644 --- a/core/pubnub_proxy.h +++ b/core/pubnub_proxy.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #if !defined INC_PUBNUB_PROXY #define INC_PUBNUB_PROXY @@ -221,3 +224,5 @@ PUBNUB_EXTERN int pubnub_proxy_get_config(pubnub_t* pb, #endif /* defined INC_PUBNUB_PROXY */ + +#endif /* PUBNUB_PROXY_API */ diff --git a/core/pubnub_proxy_core.c b/core/pubnub_proxy_core.c index 4964a083..b3dad0b0 100644 --- a/core/pubnub_proxy_core.c +++ b/core/pubnub_proxy_core.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #include "core/pubnub_proxy_core.h" #include "core/pubnub_assert.h" @@ -378,3 +381,5 @@ enum pbproxyFinInstruction pbproxy_handle_finish(pubnub_t* pb) return pbproxyFinGoOn; } + +#endif /* PUBNUB_PROXY_API */ diff --git a/core/pubnub_proxy_core.h b/core/pubnub_proxy_core.h index 508ff9d9..e819f455 100644 --- a/core/pubnub_proxy_core.h +++ b/core/pubnub_proxy_core.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_PROXY_API + #if !defined INC_PUBNUB_PROXY_CORE #define INC_PUBNUB_PROXY_CORE @@ -81,3 +84,5 @@ enum pbproxyFinInstruction pbproxy_handle_finish(pubnub_t *pb); #endif /* !defined INC_PUBNUB_PROXY_CORE */ +#endif /* PUBNUB_PROXY_API */ + From 4134de6cd6c96d0a327fe879b5cd1b5a33570c75 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Thu, 7 Dec 2023 06:58:32 +0100 Subject: [PATCH 02/10] gzip compression --- core/pbgzip_compress.c | 5 +++++ core/pbgzip_compress.h | 5 +++++ lib/miniz/miniz.c | 4 ++++ lib/miniz/miniz.h | 5 +++++ lib/miniz/miniz_tdef.c | 4 ++++ lib/miniz/miniz_tdef.h | 5 +++++ lib/pbcrc32.c | 6 ++++++ lib/pbcrc32.h | 5 +++++ 8 files changed, 39 insertions(+) diff --git a/core/pbgzip_compress.c b/core/pbgzip_compress.c index 2ef29ced..78ab08d7 100644 --- a/core/pbgzip_compress.c +++ b/core/pbgzip_compress.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_GZIP_COMPRESSION + #include "pubnub_internal.h" #include "core/pubnub_assert.h" @@ -129,3 +132,5 @@ enum pubnub_res pbgzip_compress(pubnub_t* pb, char const* message) return deflate_total_to_context_buffer(pb, message, size); } + +#endif /* PUBNUB_USE_GZIP_COMPRESSION */ diff --git a/core/pbgzip_compress.h b/core/pbgzip_compress.h index b7bf3305..783ba215 100644 --- a/core/pbgzip_compress.h +++ b/core/pbgzip_compress.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_GZIP_COMPRESSION + #if !defined INC_PUBNUB_COMPRESSION #define INC_PUBNUB_COMPRESSION @@ -12,3 +15,5 @@ enum pubnub_res pbgzip_compress(pubnub_t *pb, char const* message); #endif /* INC_PUBNUB_COMPRESSION */ + +#endif /* PUBNUB_USE_GZIP_COMPRESSION */ diff --git a/lib/miniz/miniz.c b/lib/miniz/miniz.c index 998cbf28..d813f1c2 100644 --- a/lib/miniz/miniz.c +++ b/lib/miniz/miniz.c @@ -25,6 +25,8 @@ * **************************************************************************/ +#if PUBNUB_USE_GZIP_COMPRESSION + #include "miniz.h" typedef unsigned char mz_validate_uint16[sizeof(mz_uint16) == 2 ? 1 : -1]; @@ -601,3 +603,5 @@ const char *mz_error(int err) For more information, please refer to */ + +#endif /* PUBNUB_USE_GZIP_COMPRESSION */ diff --git a/lib/miniz/miniz.h b/lib/miniz/miniz.h index 645f867c..d0d785ac 100644 --- a/lib/miniz/miniz.h +++ b/lib/miniz/miniz.h @@ -111,6 +111,9 @@ uses the 64-bit variants: fopen64(), stat64(), etc. Otherwise you won't be able to process large files (i.e. 32-bit stat() fails for me on files > 0x7FFFFFFF bytes). */ + +#if PUBNUB_USE_GZIP_COMPRESSION + #pragma once #include "miniz_common.h" @@ -468,3 +471,5 @@ typedef void *const voidpc; #ifdef __cplusplus } #endif + +#endif /* PUBNUB_USE_GZIP_COMPRESSION */ diff --git a/lib/miniz/miniz_tdef.c b/lib/miniz/miniz_tdef.c index 2c982a95..e0e8fa96 100644 --- a/lib/miniz/miniz_tdef.c +++ b/lib/miniz/miniz_tdef.c @@ -25,6 +25,8 @@ * **************************************************************************/ +#if PUBNUB_USE_GZIP_COMPRESSION + #include "miniz_tdef.h" #include "miniz.h" @@ -1562,3 +1564,5 @@ void tdefl_compressor_free(tdefl_compressor *pComp) #ifdef __cplusplus } #endif + +#endif /* MINIZ_NO_ZLIB_APIS */ diff --git a/lib/miniz/miniz_tdef.h b/lib/miniz/miniz_tdef.h index a55d9477..393440ef 100644 --- a/lib/miniz/miniz_tdef.h +++ b/lib/miniz/miniz_tdef.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_GZIP_COMPRESSION + #pragma once #include "miniz_common.h" @@ -187,3 +190,5 @@ void tdefl_compressor_free(tdefl_compressor *pComp); #ifdef __cplusplus } #endif + +#endif /* PUBNUB_USE_GZIP_COMPRESSION */ diff --git a/lib/pbcrc32.c b/lib/pbcrc32.c index af4e811f..27ad7e4d 100644 --- a/lib/pbcrc32.c +++ b/lib/pbcrc32.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_GZIP_COMPRESSION + #include "lib/pbcrc32.h" #include "core/pubnub_assert.h" @@ -32,3 +35,6 @@ uint32_t pbcrc32(const void *data, size_t n_bytes) } return crc; } + +#endif /* PUBNUB_USE_GZIP_COMPRESSION */ + diff --git a/lib/pbcrc32.h b/lib/pbcrc32.h index 805317d2..f9756ed9 100644 --- a/lib/pbcrc32.h +++ b/lib/pbcrc32.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_GZIP_COMPRESSION + #if !defined INC_PB_CRC32 #define INC_PB_CRC32 @@ -13,3 +16,5 @@ uint32_t pbcrc32(const void *data, size_t n_bytes); #endif /* INC_PB_CRC32 */ +#endif /* PUBNUB_USE_GZIP_COMPRESSION */ + From eb7ab60d9190e3022d5d0abd06f5783d92784a00 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Thu, 7 Dec 2023 08:34:13 +0100 Subject: [PATCH 03/10] gzip decompression --- core/pbgzip_decompress.c | 6 ++++++ core/pbgzip_decompress.h | 6 ++++++ lib/miniz/miniz_tinfl.c | 5 +++++ lib/miniz/miniz_tinfl.h | 4 ++++ 4 files changed, 21 insertions(+) diff --git a/core/pbgzip_decompress.c b/core/pbgzip_decompress.c index 09a7c1d7..c804a21c 100644 --- a/core/pbgzip_decompress.c +++ b/core/pbgzip_decompress.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_RECEIVE_GZIP_RESPONSE + #include "pubnub_internal.h" #include "core/pubnub_assert.h" @@ -164,3 +167,6 @@ enum pubnub_res pbgzip_decompress(pubnub_t* pb) return inflate_total( pb, data + GZIP_HEADER_LENGTH_BYTES, size, (size_t)unpacked_size); } + +#endif /* PUBNUB_RECEIVE_GZIP_RESPONSE */ + diff --git a/core/pbgzip_decompress.h b/core/pbgzip_decompress.h index 3ff4446e..d61d5e2a 100644 --- a/core/pbgzip_decompress.h +++ b/core/pbgzip_decompress.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_RECEIVE_GZIP_RESPONSE + #if !defined INC_PUBNUB_DECOMPRESSION #define INC_PUBNUB_DECOMPRESSION @@ -19,3 +22,6 @@ enum pubnub_data_compressionType{ enum pubnub_res pbgzip_decompress(pubnub_t *pb); #endif /* INC_PUBNUB_DECOMPRESSION */ + +#endif /* PUBNUB_RECEIVE_GZIP_RESPONSE */ + diff --git a/lib/miniz/miniz_tinfl.c b/lib/miniz/miniz_tinfl.c index 9af391b9..f2589ce1 100644 --- a/lib/miniz/miniz_tinfl.c +++ b/lib/miniz/miniz_tinfl.c @@ -24,6 +24,8 @@ * **************************************************************************/ +#if PUBNUB_RECEIVE_GZIP_RESPONSE + #include "lib/miniz/miniz_tinfl.h" #include "core/pubnub_log.h" @@ -734,3 +736,6 @@ void tinfl_decompressor_free(tinfl_decompressor *pDecomp) #ifdef __cplusplus } #endif + +#endif /* PUBNUB_RECEIVE_GZIP_RESPONSE */ + diff --git a/lib/miniz/miniz_tinfl.h b/lib/miniz/miniz_tinfl.h index 2dd3ec03..ca63819b 100644 --- a/lib/miniz/miniz_tinfl.h +++ b/lib/miniz/miniz_tinfl.h @@ -1,3 +1,5 @@ +#if PUBNUB_RECEIVE_GZIP_RESPONSE + #pragma once #include "lib/miniz/miniz_common.h" /* ------------------- Low-level Decompression API Definitions */ @@ -142,3 +144,5 @@ struct tinfl_decompressor_tag #ifdef __cplusplus } #endif + +#endif /* PUBNUB_RECEIVE_GZIP_RESPONSE */ From c7589d9c976d74053dbb3f130ae178d42cf347b8 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Thu, 7 Dec 2023 08:38:17 +0100 Subject: [PATCH 04/10] sub v2 --- core/pbcc_subscribe_v2.c | 6 ++++++ core/pbcc_subscribe_v2.h | 6 ++++++ core/pubnub_subscribe_v2.c | 6 ++++++ core/pubnub_subscribe_v2.h | 6 ++++++ core/pubnub_subscribe_v2_message.h | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/core/pbcc_subscribe_v2.c b/core/pbcc_subscribe_v2.c index 5c8a84eb..09a3d5d6 100644 --- a/core/pbcc_subscribe_v2.c +++ b/core/pbcc_subscribe_v2.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_SUBSCRIBE_V2 + #include "pubnub_internal.h" #include "pubnub_version.h" @@ -326,3 +329,6 @@ struct pubnub_v2_message pbcc_get_msg_v2(struct pbcc_context* p) return rslt; } + +#endif /* PUBNUB_USE_SUBSCRIBE_V2 */ + diff --git a/core/pbcc_subscribe_v2.h b/core/pbcc_subscribe_v2.h index 63800dda..642f969a 100644 --- a/core/pbcc_subscribe_v2.h +++ b/core/pbcc_subscribe_v2.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_SUBSCRIBE_V2 + #if !defined INC_PBCC_SUBSCRIBE_V2 #define INC_PBCC_SUBSCRIBE_V2 @@ -35,3 +38,6 @@ struct pubnub_v2_message pbcc_get_msg_v2(struct pbcc_context* p); #endif /* !defined INC_PBCC_SUBSCRIBE_V2 */ + +#endif /* PUBNUB_USE_SUBSCRIBE_V2 */ + diff --git a/core/pubnub_subscribe_v2.c b/core/pubnub_subscribe_v2.c index 155a061f..e4b2b2d4 100644 --- a/core/pubnub_subscribe_v2.c +++ b/core/pubnub_subscribe_v2.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_SUBSCRIBE_V2 + #include "pubnub_internal.h" #include "pubnub_server_limits.h" @@ -67,3 +70,6 @@ struct pubnub_v2_message pubnub_get_v2(pubnub_t* pb) return result; } + +#endif /* PUBNUB_USE_SUBSCRIBE_V2 */ + diff --git a/core/pubnub_subscribe_v2.h b/core/pubnub_subscribe_v2.h index b22993c9..59c1639c 100644 --- a/core/pubnub_subscribe_v2.h +++ b/core/pubnub_subscribe_v2.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_SUBSCRIBE_V2 + #if !defined INC_PUBNUB_SUBSCRIBE_V2 #define INC_PUBNUB_SUBSCRIBE_V2 @@ -102,3 +105,6 @@ PUBNUB_EXTERN struct pubnub_v2_message pubnub_get_v2(pubnub_t* pbp); #endif /* !defined INC_PUBNUB_SUBSCRIBE_V2 */ + +#endif /* PUBNUB_USE_SUBSCRIBE_V2 */ + diff --git a/core/pubnub_subscribe_v2_message.h b/core/pubnub_subscribe_v2_message.h index 1a4a654d..7f338d59 100644 --- a/core/pubnub_subscribe_v2_message.h +++ b/core/pubnub_subscribe_v2_message.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_SUBSCRIBE_V2 + #if !defined INC_PUBNUB_SUBSCRIBE_V2_MESSAGE #define INC_PUBNUB_SUBSCRIBE_V2_MESSAGE @@ -56,3 +59,6 @@ struct pubnub_v2_message { #endif /* INC_PUBNUB_SUBSCRIBE_V2_MESSAGE */ + +#endif /* PUBNUB_USE_SUBSCRIBE_V2 */ + From db2770e4de04d4f809262d8ad7c1c4d4bb3b42b1 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Thu, 7 Dec 2023 08:55:30 +0100 Subject: [PATCH 05/10] actions & objects --- core/pbcc_actions_api.c | 5 +++++ core/pbcc_actions_api.h | 5 ++++- core/pbcc_objects_api.c | 6 ++++++ core/pbcc_objects_api.h | 6 ++++++ core/pubnub_actions_api.c | 6 ++++++ core/pubnub_actions_api.h | 6 ++++++ core/pubnub_advanced_history.h | 6 ++++++ core/pubnub_objects_api.c | 6 ++++++ core/pubnub_objects_api.h | 6 ++++++ 9 files changed, 51 insertions(+), 1 deletion(-) diff --git a/core/pbcc_actions_api.c b/core/pbcc_actions_api.c index 8f1c914c..5cd52a24 100644 --- a/core/pbcc_actions_api.c +++ b/core/pbcc_actions_api.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_ACTIONS_API + #include "pubnub_internal.h" #include "pubnub_version.h" #include "pubnub_assert.h" @@ -624,3 +627,5 @@ enum pubnub_res pbcc_parse_history_with_actions_response(struct pbcc_context* pb return PNR_OK; } + +#endif /* PUBNUB_USE_ACTIONS_API */ diff --git a/core/pbcc_actions_api.h b/core/pbcc_actions_api.h index 11457149..b5c0caeb 100644 --- a/core/pbcc_actions_api.h +++ b/core/pbcc_actions_api.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_ACTIONS_API + #if !defined INC_PBCC_ACTIONS_API #define INC_PBCC_ACTIONS_API @@ -105,5 +108,5 @@ enum pubnub_res pbcc_parse_history_with_actions_response(struct pbcc_context* pb #endif /* !defined INC_PBCC_ACTIONS_API */ - +#endif /* PUBNUB_USE_ACTIONS_API */ diff --git a/core/pbcc_objects_api.c b/core/pbcc_objects_api.c index ef3fa94d..68f64c31 100644 --- a/core/pbcc_objects_api.c +++ b/core/pbcc_objects_api.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_OBJECTS_API + #include "pubnub_internal.h" #include "pubnub_version.h" #include "pubnub_assert.h" @@ -815,3 +818,6 @@ enum pubnub_res pbcc_parse_objects_api_response(struct pbcc_context* pb) return PNR_OK; } + +#endif /* PUBNUB_USE_OBJECTS_API */ + diff --git a/core/pbcc_objects_api.h b/core/pbcc_objects_api.h index f1df569a..55579285 100644 --- a/core/pbcc_objects_api.h +++ b/core/pbcc_objects_api.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_OBJECTS_API + #if !defined INC_PBCC_OBJECTS_API #define INC_PBCC_OBJECTS_API @@ -154,3 +157,6 @@ enum pubnub_res pbcc_parse_objects_api_response(struct pbcc_context* pb); #endif /* !defined INC_PBCC_OBJECTS_API */ + +#endif /* PUBNUB_USE_OBJECTS_API */ + diff --git a/core/pubnub_actions_api.c b/core/pubnub_actions_api.c index 5b5d2da1..af1c9e8f 100644 --- a/core/pubnub_actions_api.c +++ b/core/pubnub_actions_api.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_ACTIONS_API + #include "pubnub_internal.h" #include "core/pubnub_ccore.h" @@ -267,3 +270,6 @@ enum pubnub_res pubnub_history_with_message_actions_more(pubnub_t* pb) return rslt; } + +#endif /* PUBNUB_USE_ACTIONS_API */ + diff --git a/core/pubnub_actions_api.h b/core/pubnub_actions_api.h index f72dac0c..47abbfce 100644 --- a/core/pubnub_actions_api.h +++ b/core/pubnub_actions_api.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_ACTIONS_API + #if !defined INC_PUBNUB_ACTIONS_API #define INC_PUBNUB_ACTIONS_API @@ -160,3 +163,6 @@ PUBNUB_EXTERN enum pubnub_res pubnub_history_with_message_actions_more(pubnub_t* #endif /* !defined INC_PUBNUB_ACTIONS_API */ + +#endif /* PUBNUB_USE_ACTIONS_API */ + diff --git a/core/pubnub_advanced_history.h b/core/pubnub_advanced_history.h index c7c18969..234614b1 100644 --- a/core/pubnub_advanced_history.h +++ b/core/pubnub_advanced_history.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_ADVANCED_HISTORY + #if !defined INC_PUBNUB_ADVANCED_HISTORY #define INC_PUBNUB_ADVANCED_HISTORY @@ -62,3 +65,6 @@ PUBNUB_EXTERN int pubnub_get_message_counts(pubnub_t* pb, char const*channel, in #endif /* !defined INC_PUBNUB_ADVANCED_HISTORY */ + +#endif /* PUBNUB_USE_ADVANCED_HISTORY */ + diff --git a/core/pubnub_objects_api.c b/core/pubnub_objects_api.c index c1465780..6d87d93d 100644 --- a/core/pubnub_objects_api.c +++ b/core/pubnub_objects_api.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_OBJECTS_API + #include "pubnub_internal.h" #include "core/pubnub_ccore.h" @@ -563,3 +566,6 @@ enum pubnub_res pubnub_remove_members(pubnub_t* pb, return rslt; } + +#endif /* PUBNUB_USE_OBJECTS_API */ + diff --git a/core/pubnub_objects_api.h b/core/pubnub_objects_api.h index 3d81ac61..e487e174 100644 --- a/core/pubnub_objects_api.h +++ b/core/pubnub_objects_api.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_OBJECTS_API + #if !defined INC_PUBNUB_OBJECTS_API #define INC_PUBNUB_OBJECTS_API @@ -334,3 +337,6 @@ PUBNUB_EXTERN enum pubnub_res pubnub_remove_members(pubnub_t* pb, #endif /* !defined INC_PUBNUB_OBJECTS_API */ + +#endif /* PUBNUB_USE_OBJECTS_API */ + From ae49cdb720a1af900829352bfd4f7b510729ea10 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Thu, 7 Dec 2023 09:09:06 +0100 Subject: [PATCH 06/10] autoheartbeat --- core/pbauto_heartbeat.c | 5 +++++ core/pubnub_auto_heartbeat.h | 1 + posix/pbauto_heartbeat_init_posix.c | 5 +++++ windows/pbauto_heartbeat_init_windows.c | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/core/pbauto_heartbeat.c b/core/pbauto_heartbeat.c index 0f2098a5..dbdee5aa 100644 --- a/core/pbauto_heartbeat.c +++ b/core/pbauto_heartbeat.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_AUTO_HEARTBEAT + #include "pubnub_internal.h" #if !defined _WIN32 @@ -756,3 +759,5 @@ void pbauto_heartbeat_stop(void) m_watcher.stop_heartbeat_watcher_thread = true; pubnub_mutex_unlock(m_watcher.stoplock); } + +#endif /* PUBNUB_USE_AUTO_HEARTBEAT */ diff --git a/core/pubnub_auto_heartbeat.h b/core/pubnub_auto_heartbeat.h index d01479b1..586c171b 100644 --- a/core/pubnub_auto_heartbeat.h +++ b/core/pubnub_auto_heartbeat.h @@ -1,4 +1,5 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + #if !defined INC_PUBNUB_AUTO_HEARTBEAT #define INC_PUBNUB_AUTO_HEARTBEAT diff --git a/posix/pbauto_heartbeat_init_posix.c b/posix/pbauto_heartbeat_init_posix.c index 359efe7c..0c98ff4f 100644 --- a/posix/pbauto_heartbeat_init_posix.c +++ b/posix/pbauto_heartbeat_init_posix.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_AUTO_HEARTBEAT + #include "pubnub_internal.h" #include "core/pubnub_log.h" @@ -121,3 +124,5 @@ int pbauto_heartbeat_init(struct HeartbeatWatcherData* m_watcher) return 0; } + +#endif diff --git a/windows/pbauto_heartbeat_init_windows.c b/windows/pbauto_heartbeat_init_windows.c index 5715f00d..f1ecbc27 100644 --- a/windows/pbauto_heartbeat_init_windows.c +++ b/windows/pbauto_heartbeat_init_windows.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_AUTO_HEARTBEAT + #include "pubnub_internal.h" #include "core/pubnub_log.h" @@ -30,3 +33,6 @@ int pbauto_heartbeat_init(struct HeartbeatWatcherData* m_watcher) return 0; } + +#endif /* PUBNUB_USE_AUTO_HEARTBEAT */ + From f5d9f4c35faabaef5f9585690d6d682703dccd61 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Thu, 7 Dec 2023 09:12:15 +0100 Subject: [PATCH 07/10] autoheartbeat vol2 --- lib/pbstr_remove_from_list.c | 6 ++++++ lib/pbstr_remove_from_list.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lib/pbstr_remove_from_list.c b/lib/pbstr_remove_from_list.c index d92b795b..728083c1 100644 --- a/lib/pbstr_remove_from_list.c +++ b/lib/pbstr_remove_from_list.c @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_AUTO_HEARTBEAT + #include "lib/pb_strnlen_s.h" #include "core/pubnub_assert.h" @@ -77,3 +80,6 @@ void pbstr_free_if_empty(char** list) *list = NULL; } } + +#endif /* PUBNUB_USE_AUTO_HEARTBEAT */ + diff --git a/lib/pbstr_remove_from_list.h b/lib/pbstr_remove_from_list.h index 3b319484..b8fa11f5 100644 --- a/lib/pbstr_remove_from_list.h +++ b/lib/pbstr_remove_from_list.h @@ -1,4 +1,7 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ + +#if PUBNUB_USE_AUTO_HEARTBEAT + #if !defined INC_PBSTR_REMOVE_FROM_LIST #define INC_PBSTR_REMOVE_FROM_LIST @@ -12,3 +15,6 @@ void pbstr_remove_from_list(char* list, const char* leave_list); void pbstr_free_if_empty(char** list); #endif /* !defined INC_PBSTR_REMOVE_FROM_LIST */ + +#endif /* PUBNUB_USE_AUTO_HEARTBEAT */ + From c68112b2dc6c7461314af1aa5ada8d606c1c9e5b Mon Sep 17 00:00:00 2001 From: Xavrax Date: Thu, 7 Dec 2023 09:31:56 +0100 Subject: [PATCH 08/10] fetch --- core/pubnub_fetch_history.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/pubnub_fetch_history.h b/core/pubnub_fetch_history.h index 13efa072..c7f6df49 100644 --- a/core/pubnub_fetch_history.h +++ b/core/pubnub_fetch_history.h @@ -1,4 +1,6 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ +#if PUBNUB_USE_FETCH_HISTORY + #if !defined INC_PUBNUB_FETCH_HISTORY #define INC_PUBNUB_FETCH_HISTORY @@ -85,3 +87,6 @@ PUBNUB_EXTERN enum pubnub_res pubnub_fetch_history(pubnub_t* PUBNUB_EXTERN pubnub_chamebl_t pubnub_get_fetch_history(pubnub_t* pb); #endif /* !defined INC_PUBNUB_FETCH_HISTORY */ + +#endif /* PUBNUB_USE_FETCH_HISTORY */ + From f9a1a06f807ff3648c130925eb76b60d6f9f1030 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Thu, 7 Dec 2023 09:46:59 +0100 Subject: [PATCH 09/10] unittest fixes --- core/pubnub_proxy_core.c | 3 --- core/pubnub_proxy_core.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/core/pubnub_proxy_core.c b/core/pubnub_proxy_core.c index b3dad0b0..b40a4a7e 100644 --- a/core/pubnub_proxy_core.c +++ b/core/pubnub_proxy_core.c @@ -1,7 +1,5 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ -#if PUBNUB_PROXY_API - #include "core/pubnub_proxy_core.h" #include "core/pubnub_assert.h" @@ -382,4 +380,3 @@ enum pbproxyFinInstruction pbproxy_handle_finish(pubnub_t* pb) return pbproxyFinGoOn; } -#endif /* PUBNUB_PROXY_API */ diff --git a/core/pubnub_proxy_core.h b/core/pubnub_proxy_core.h index e819f455..e73c2772 100644 --- a/core/pubnub_proxy_core.h +++ b/core/pubnub_proxy_core.h @@ -1,7 +1,5 @@ /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ -#if PUBNUB_PROXY_API - #if !defined INC_PUBNUB_PROXY_CORE #define INC_PUBNUB_PROXY_CORE @@ -84,5 +82,4 @@ enum pbproxyFinInstruction pbproxy_handle_finish(pubnub_t *pb); #endif /* !defined INC_PUBNUB_PROXY_CORE */ -#endif /* PUBNUB_PROXY_API */ From a9016e36a47e611bcc3ed0ffbcb8564d64ae99d3 Mon Sep 17 00:00:00 2001 From: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com> Date: Thu, 7 Dec 2023 09:46:17 +0000 Subject: [PATCH 10/10] PubNub SDK v4.8.0 release. --- .pubnub.yml | 21 +++++++++++++-------- CHANGELOG.md | 6 ++++++ core/pubnub_version_internal.h | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.pubnub.yml b/.pubnub.yml index 0893684a..3fa88db8 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,8 +1,13 @@ name: c-core schema: 1 -version: "4.7.1" +version: "4.8.0" scm: github.com/pubnub/c-core changelog: + - date: 2023-12-07 + version: v4.8.0 + changes: + - type: feature + text: "Add `#if` switches into files that are related to PubNub features to not rely only on makefiles. [Be careful when update. It's not a breaking change at all but might fail build for custom makefiles!]." - date: 2023-11-23 version: v4.7.1 changes: @@ -768,7 +773,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.7.1 + location: https://github.com/pubnub/c-core/releases/tag/v4.8.0 requires: - name: "miniz" @@ -834,7 +839,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.7.1 + location: https://github.com/pubnub/c-core/releases/tag/v4.8.0 requires: - name: "miniz" @@ -900,7 +905,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.7.1 + location: https://github.com/pubnub/c-core/releases/tag/v4.8.0 requires: - name: "miniz" @@ -962,7 +967,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.7.1 + location: https://github.com/pubnub/c-core/releases/tag/v4.8.0 requires: - name: "miniz" @@ -1023,7 +1028,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.7.1 + location: https://github.com/pubnub/c-core/releases/tag/v4.8.0 requires: - name: "miniz" @@ -1079,7 +1084,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.7.1 + location: https://github.com/pubnub/c-core/releases/tag/v4.8.0 requires: - name: "miniz" @@ -1132,7 +1137,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.7.1 + location: https://github.com/pubnub/c-core/releases/tag/v4.8.0 requires: - name: "miniz" diff --git a/CHANGELOG.md b/CHANGELOG.md index 407f69c4..e3444027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v4.8.0 +December 07 2023 + +#### Added +- Add `#if` switches into files that are related to PubNub features to not rely only on makefiles. [Be careful when update. It's not a breaking change at all but might fail build for custom makefiles!]. + ## v4.7.1 November 23 2023 diff --git a/core/pubnub_version_internal.h b/core/pubnub_version_internal.h index b8adf3e4..4b274739 100644 --- a/core/pubnub_version_internal.h +++ b/core/pubnub_version_internal.h @@ -3,7 +3,7 @@ #define INC_PUBNUB_VERSION_INTERNAL -#define PUBNUB_SDK_VERSION "4.7.1" +#define PUBNUB_SDK_VERSION "4.8.0" #endif /* !defined INC_PUBNUB_VERSION_INTERNAL */