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 File Reference

Magic number validation constants and macros. More...

Go to the source code of this file.

Macros

#define MAGIC_FRAME_VALID   0xA5C11C4A1ULL
 Magic number for valid ring buffer frames (0xA5C11C4A1 = "ASCIICHAT" in hex).
#define MAGIC_FRAME_FREED   0xFEEDFACEU
 Magic number for freed ring buffer frames (0xFEEDFACE).
#define MAGIC_PACKET_VALID   0xA5C11C4A1ULL
 Magic number for network packets (0xA5C11C4A1 = "ASCIICHAT" in hex).
#define IS_MAGIC_VALID(magic, expected)
 Check if magic number is valid (true if matches expected).
#define IS_FRAME_VALID(frame)
 Check if frame is valid and not freed.
#define IS_FRAME_FREED(frame)
 Check if frame has been freed (corruption detection).
#define MARK_FRAME_FREED(frame)
 Mark a frame as freed.

Detailed Description

Magic number validation constants and macros.

Definition in file magic.h.

Macro Definition Documentation

◆ IS_FRAME_FREED

#define IS_FRAME_FREED ( frame)
Value:
((frame)->magic == MAGIC_FRAME_FREED)
#define MAGIC_FRAME_FREED
Magic number for freed ring buffer frames (0xFEEDFACE).
Definition magic.h:20

Check if frame has been freed (corruption detection).

Definition at line 36 of file magic.h.

Referenced by framebuffer_read_frame().

◆ IS_FRAME_VALID

#define IS_FRAME_VALID ( frame)
Value:
((frame)->magic == MAGIC_FRAME_VALID && (frame)->data != NULL)
#define MAGIC_FRAME_VALID
Magic number for valid ring buffer frames (0xA5C11C4A1 = "ASCIICHAT" in hex).
Definition magic.h:17

Check if frame is valid and not freed.

Definition at line 33 of file magic.h.

Referenced by framebuffer_clear(), and framebuffer_write_frame().

◆ IS_MAGIC_VALID

#define IS_MAGIC_VALID ( magic,
expected )
Value:
((magic) == (expected))

Check if magic number is valid (true if matches expected).

Definition at line 30 of file magic.h.

Referenced by framebuffer_clear(), framebuffer_peek_latest_multi_frame(), framebuffer_read_frame(), framebuffer_read_multi_frame(), and framebuffer_write_frame().

◆ MAGIC_FRAME_FREED

#define MAGIC_FRAME_FREED   0xFEEDFACEU

Magic number for freed ring buffer frames (0xFEEDFACE).

Definition at line 20 of file magic.h.

◆ MAGIC_FRAME_VALID

#define MAGIC_FRAME_VALID   0xA5C11C4A1ULL

Magic number for valid ring buffer frames (0xA5C11C4A1 = "ASCIICHAT" in hex).

Definition at line 17 of file magic.h.

Referenced by framebuffer_write_frame(), and framebuffer_write_multi_frame().

◆ MAGIC_PACKET_VALID

#define MAGIC_PACKET_VALID   0xA5C11C4A1ULL

Magic number for network packets (0xA5C11C4A1 = "ASCIICHAT" in hex).

Definition at line 23 of file magic.h.

◆ MARK_FRAME_FREED

#define MARK_FRAME_FREED ( frame)
Value:
((frame)->magic = MAGIC_FRAME_FREED)

Mark a frame as freed.

Definition at line 39 of file magic.h.

Referenced by framebuffer_clear(), and framebuffer_write_frame().