Skip to content

file platform/flake/FlakeConst.h

Defines

Name
FLAKE_DEBUG_LOGGINGEnable / disable verbose debug logging (1 = on, 0 = off).
FLAKE_AUTH_SUPPORTEnable / disable authentication support (1 = on, 0 = off).
FLAKE_TLSEnable / disable TLS transport (1 = on, 0 = off).
FLAKE_DTLSEnable / disable DTLS transport (1 = on, 0 = off).
FLAKE_STREAM_TIMEOUT_MSDefault timeout for stream operations, in milliseconds.
FLAKE_DEFAULT_TIMEOUT_MSDefault timeout for general request/reply operations, in milliseconds.
MAX_PENDING_REPLIESMaximum number of pending (not yet answered) request replies.
MAX_PENDING_INDICATIONSMaximum number of pending indications.
FLAKE_SUCCEEDED(e)Test whether an error code represents a logical success.

Macros Documentation

define FLAKE_DEBUG_LOGGING

cpp
#define FLAKE_DEBUG_LOGGING 1

Enable / disable verbose debug logging (1 = on, 0 = off).

define FLAKE_AUTH_SUPPORT

cpp
#define FLAKE_AUTH_SUPPORT 1

Enable / disable authentication support (1 = on, 0 = off).

define FLAKE_TLS

cpp
#define FLAKE_TLS 0

Enable / disable TLS transport (1 = on, 0 = off).

define FLAKE_DTLS

cpp
#define FLAKE_DTLS 0

Enable / disable DTLS transport (1 = on, 0 = off).

define FLAKE_STREAM_TIMEOUT_MS

cpp
#define FLAKE_STREAM_TIMEOUT_MS 30000U

Default timeout for stream operations, in milliseconds.

define FLAKE_DEFAULT_TIMEOUT_MS

cpp
#define FLAKE_DEFAULT_TIMEOUT_MS 10000U

Default timeout for general request/reply operations, in milliseconds.

define MAX_PENDING_REPLIES

cpp
#define MAX_PENDING_REPLIES 10U

Maximum number of pending (not yet answered) request replies.

define MAX_PENDING_INDICATIONS

cpp
#define MAX_PENDING_INDICATIONS 10U

Maximum number of pending indications.

Note: Should be proportional to the number of concurrent TCP connections.

define FLAKE_SUCCEEDED

cpp
#define FLAKE_SUCCEEDED(
    e
)
({ int result = (e); result == E_OK || result == E_READ_ONLY || result == E_NO_CHANGES; })

Test whether an error code represents a logical success.

Parameters:

  • e Expression that evaluates to an int error code.

Return: true if the code is a success value, false otherwise.

The following codes are treated as "succeeded": E_OK, E_READ_ONLY, E_NO_CHANGES.

Source code

cpp
/*******************************************************************************
 * @file      FlakeConst.h
 * @brief     Compile-time configuration switches, default timeouts, and
 *            library-wide error / status codes.
 * @details   Every macro in this file can be overridden by defining the value
 *            before this header is included (or via compiler flags) unless
 *            stated otherwise.
 *
 * @license   This file is part of the ImagineOn Flake software package
 *            licensed under the ImagineOn software-licensing terms available
 *            under https://www.imagineon.de/de/info/licensing-terms
 * @copyright Copyright (c) 2025 ImagineOn GmbH. www.imagineon.de.
 ******************************************************************************/

#ifndef FLAKE_CONST_H_
#define FLAKE_CONST_H_

/* -----------------------------------------------------------------------
 *  Build-time feature switches
 * ----------------------------------------------------------------------- */

#ifndef FLAKE_DEBUG_LOGGING
#define FLAKE_DEBUG_LOGGING             1
#endif

#ifndef FLAKE_AUTH_SUPPORT
#define FLAKE_AUTH_SUPPORT              1
#endif

#ifndef FLAKE_TLS
#define FLAKE_TLS                       0
#endif

#ifndef FLAKE_DTLS
#define FLAKE_DTLS                      0
#endif

/* -----------------------------------------------------------------------
 *  Default timeout values
 * ----------------------------------------------------------------------- */

#ifndef FLAKE_STREAM_TIMEOUT_MS
#define FLAKE_STREAM_TIMEOUT_MS          30000U
#endif

#ifndef FLAKE_DEFAULT_TIMEOUT_MS
#define FLAKE_DEFAULT_TIMEOUT_MS         10000U
#endif

/* -----------------------------------------------------------------------
 *  Internal queue limits
 * ----------------------------------------------------------------------- */

#define MAX_PENDING_REPLIES              10U

#define MAX_PENDING_INDICATIONS          10U

/* -----------------------------------------------------------------------
 *  Error / status codes
 * ----------------------------------------------------------------------- */

#define E_OK                             (0)    
#define E_FAILED                         (-1)   
#define E_NO_ALLOC                       (-2)   
#define E_NOT_FOUND                      (-3)   
#define E_READ_ONLY                      (-4)   
#define E_NOT_IMPL                       (-5)   
#define E_PENDING                        (-6)   
#define E_OBJECT_NOT_INITIALIZED         (-7)   
#define E_UNREGISTERED_OBJECT            (-8)   
#define E_IGNORED                        (-9)   
#define E_NO_CHANGES                     (-10)  
#define E_PARTIAL_SUCCESS                (-11)  
#define E_INCOMPLETE                     (-12)  
#define E_UNSUPPORTED                    (-13)  
#define E_UNAUTHORIZED                   (-14)  
#define E_EOF                            (-15)  
#define E_BUSY                           (-16)  
#define E_TIMEOUT                        (-101) 
#define E_NOT_CONNECTED                  (-102) 
#define E_REFUSED                        (-103) 
#define E_DONT_DISPATCH                  (-104) 
#define E_DESTINATION_UNREACHABLE        (-105) 
#define E_INVALID_PARAM                  (-106) 
#define E_FCNTL                          (-1000) 
#define E_LISTEN                         (-1001) 
#define E_SOCK                           (-1002) 
#define E_BIND                           (-1003) 
 /* end of flake_error_codes */
#define FLAKE_SUCCEEDED(e)  ({ int result = (e); result == E_OK || result == E_READ_ONLY || result == E_NO_CHANGES; })

#endif /* FLAKE_CONST_H_ */