ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
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 <stdint.h>
10#include <stdbool.h>
11
12/* ============================================================================
13 * Magic Number Definitions
14 * ============================================================================ */
15
17#define MAGIC_FRAME_VALID 0xA5C11C4A1ULL
18
20#define MAGIC_FRAME_FREED 0xFEEDFACEU
21
23#define MAGIC_PACKET_VALID 0xA5C11C4A1ULL
24
25/* ============================================================================
26 * Validation Macros
27 * ============================================================================ */
28
30#define IS_MAGIC_VALID(magic, expected) ((magic) == (expected))
31
33#define IS_FRAME_VALID(frame) ((frame)->magic == MAGIC_FRAME_VALID && (frame)->data != NULL)
34
36#define IS_FRAME_FREED(frame) ((frame)->magic == MAGIC_FRAME_FREED)
37
39#define MARK_FRAME_FREED(frame) ((frame)->magic = MAGIC_FRAME_FREED)
40