Config

#ifndef ch_global_config_h
#define ch_global_config_h
CH_VERSION

Version of chirp.

#define CH_VERSION "XVERSIONX"
CH_TLS_CLEANUP

In release-mode we do not cleanup the TLS library. If you want to check for memory leaks in your application define CH_TLS_CLEANUP or call ch_en_tls_cleanup() manually.

/* #define CH_TLS_CLEANUP */
CH_BUFFER_SIZE

Buffer-size when allocating communication buffers, can be overridden in ch_config_t.

/* 64k */
#define CH_BUFFER_SIZE 65536
CH_MIN_BUFFER_SIZE

Minimal buffersize we require when allocating communication buffers.

#define CH_MIN_BUFFER_SIZE 1024
CH_ENC_BUFFER_SIZE

Encryption buffer size. Only change if it doesn’t match with your TLS library.

/* 16k */
#define CH_ENC_BUFFER_SIZE 16384
CH_BF_PREALLOC_HEADER

Preallocated buffer size for header. If the header is bigger memory will be allocated.

#define CH_BF_PREALLOC_HEADER 32
CH_BF_PREALLOC_DATA

Preallocated buffer size for data. If the data is bigger memory will be allocated.

#define CH_BF_PREALLOC_DATA 1024
CH_TCP_KEEPALIVE

TCP keep-alive time.

#define CH_TCP_KEEPALIVE 60
CH_MAX_MSG_SIZE

Hard limit for message size. Can be overridden in ch_config_t.

#define CH_MAX_MSG_SIZE 1024 * 1024 * 100 // 100M
CH_WITHOUT_TLS

Build chirp without SSL code. The functions from encryption.h become no-ops.

/* #define CH_WITHOUT_TLS */
CH_ENABLE_LOGGING

Logging is done via a macro which is disabled by default. You can enable it here for debug purposes.

/* #define CH_ENABLE_LOGGING */
CH_ENABLE_ASSERTS

Chirp asserts a lot of conditions. Asserting is done via a macro which is disabled by default. You can enable it here for debug purposes.

/* #define CH_ENABLE_ASSERTS */
CH_CN_PRINT_CIPHERS

Log available ciphers. Used to debug connections failures.

/* #define CH_CN_PRINT_CIPHERS */
CH_DISABLE_SIGNALS

Disable SIGINT and SIGTERM to close chirp. Used for compatibility with existing applications: When you use chirp in an existing application that uses SIGINT and SIGTERM signals and the handlers added by chirp somehow conflict. Can be overridden in ch_config_t.

/* #define CH_DISABLE_SIGNALS */

#ifndef CH_REMOVE_DEBUGDEFS

Only used for testing, ignore if you only build the library

/* SDS allocator selection.
 *
 * This file is used in order to change the SDS allocator at compile time.
 * Just define the following defines to what you want to use. Also add
 * the include of your alternate allocator if needed (not needed in order
 * to use the default libc allocator).
 */

#define s_malloc malloc
#define s_realloc realloc
#define s_free free

#endif // CH_REMOVE_DEBUGDEFS

#endif // ch_global_config_h