ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
magic.h
Go to the documentation of this file.
1
6
7#pragma once
8
9#include <stdbool.h>
10#include <stdint.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/* ============================================================================
17 * Magic Number Definitions
18 * ============================================================================
19 */
20
23#define MAGIC_FRAME_VALID 0xA5C11C4A1ULL
24
26#define MAGIC_FRAME_FREED 0xFEEDFACEU
27
30#define MAGIC_PACKET_VALID 0xA5C11C4A1ULL
31
32/* ============================================================================
33 * Validation Macros
34 * ============================================================================
35 */
36
38#define IS_MAGIC_VALID(magic, expected) ((magic) == (expected))
39
41#define IS_FRAME_VALID(frame) \
42 ((frame)->magic == MAGIC_FRAME_VALID && (frame)->data != NULL)
43
45#define IS_FRAME_FREED(frame) ((frame)->magic == MAGIC_FRAME_FREED)
46
48#define MARK_FRAME_FREED(frame) ((frame)->magic = MAGIC_FRAME_FREED)
49
51
52#ifdef __cplusplus
53}
54#endif