Macros

Core macros. More...

Macros

#define ZOS_LOG(msg, ...)   zn_log(msg, ## __VA_ARGS__)
 General logging macro.
 
#define ZOS_VLOG(msg, arg_list)   zn_vlog(msg, arg_list)
 General logging macro.
 
#define ZOS_DEBUG(level, msg, ...)
 Debug logging macro. More...
 
#define BUILD_ASSERTION(condition)   ((void)sizeof(char[1 - 2*!(condition)]))
 Compile-time assertion if given condition is NOT true.
 
#define ZOS_NEVER_TIMEOUT   0xFFFFFFFFULL
 Used for APIs that require a timeout, never timeout.
 
#define ZOS_WAIT_FOREVER   ZOS_NEVER_TIMEOUT
 Used for APIs that require a timeout, never timeout.
 
#define ZOS_NO_WAIT   0
 Used for APIs that require a timeout, timeout immediately.
 
#define ZOS_FAILED(result, func)   ((result = (func)) != ZOS_SUCCESS)
 Store the result of API call, return TRUE if API was successful, FALSE else.
 
#define ZOS_VERIFY(func)   { zos_result_t _result = (func); if(_result != ZOS_SUCCESS) return _result; } while(0)
 Verify the result of an API call, return the result on failure.
 
#define MIN(x, y)   ((x) < (y) ? (x) : (y))
 Return minimum of two integers.
 
#define MAX(x, y)   ((x) > (y) ? (x) : (y))
 Return maximum of two integers.
 
#define ROUND_UP(x, y)   ((x) % (y) ? (x) + (y)-((x)%(y)) : (x))
 Divide x by y rounding up.
 
#define DIV_ROUND_UP(m, n)   (((m) + (n) - 1) / (n))
 Divide x by y rounding up.
 
#define OFFSETOF(type, member)   ((uintptr_t)&((type *)0)->member)
 Get offset (i.e. More...
 
#define ARRAY_COUNT(x)   (sizeof (x) / sizeof *(x))
 Return number of elements in static array.
 
#define ALIGN_n(x, n)   ((((uint32_t)x) + ((n)-1)) & ~((n)-1))
 Align x to a multiple of n (rounding up) where n is a power of two.
 
#define ALIGN_8(x)   ALIGN_n(x, 8)
 Align x to a multiple of 8 (rounding up)
 
#define ALIGN_4(x)   ALIGN_n(x, 4)
 Align x to a multiple of 4 (rounding up)
 
#define UNUSED_PARAMETER(x)   (void)x
 Removes complier warning for unused function parameters.
 
#define MAX_STREAM_COUNT   8
 Max number of simulatenous streams.
 
#define ZOS_INVALID_HANDLE   MAX_STREAM_COUNT
 Invalid handle, this value is considered invalid when reading/writing streams.
 
#define DEVICE_UUID_LEN   40
 The module's UUID length in hex characters. More...
 
#define URL_MAX_LENGTH   128
 The maximum size of a URL.
 
#define ZOS_CREATE_OBJECT(object_type)   zn_malloc_ptr(sizeof(object_type))
 Allocate object memory on heap Call ZOS_DESTROY_OBJECT() to cleanup allocated memory.
 
#define ZOS_DESTROY_OBJECT(object_ptr)   zn_free(object_ptr)
 De-allocate object memory from heap.
 
#define htons   __REV16
 Host-to-Network ShortConverts a 16bit integer from host endianess (little) to network endianess (big)
 
#define htonl   __REV
 Host-to-Network LongConverts a 32bit integer from host endianess (little) to network endianess (big)
 
#define ntohs   __REV16
 Network-to-Host ShortConverts a 16bit integer from network endianess (big) to host endianess (little) More...
 

Detailed Description

Core macros.

Macro Definition Documentation

#define DEVICE_UUID_LEN   40

The module's UUID length in hex characters.

This is the number of characters returned by the command: 'get system.uuid' See Wi-Fi Command API, system.uuid

Examples:
cloud/simplemq/main.c.
#define ntohs   __REV16

Network-to-Host ShortConverts a 16bit integer from network endianess (big) to host endianess (little)

Network-to-Host Long

Converts a 32bit integer from network endianess (big) to host endianess (little)

#define OFFSETOF (   type,
  member 
)    ((uintptr_t)&((type *)0)->member)

Get offset (i.e.

index) of member of struct

#define ZOS_DEBUG (   level,
  msg,
  ... 
)

Debug logging macro.

ZAP must be built with debugging enabled for macro to take effect