Concord - C Discord API library
A Discord API wrapper library written in C
Internal implementation details

Documentation useful when developing or debugging Concord itself. More...

Collaboration diagram for Internal implementation details:

Modules

 Timer API
 Callback scheduling API.
 
 REST API
 Wrapper to the Discord REST API.
 
 WebSockets API
 Wrapper to the Discord Gateway API.
 
 Reference counter
 Handle automatic cleanup of user's data.
 
 Message Commands API
 The Message Commands API for registering and parsing user commands.
 
 Cache API
 The Cache API for storage and retrieval of Discord data.
 
 Global threadpool
 A global threadpool for worker-threads handling.
 

Files

file  discord-internal.h
 Internal functions and datatypes.
 

Data Structures

struct  discord
 The Discord client handler. More...
 

Macros

#define CLIENT(ptr, path)   CONTAINEROF(ptr, struct discord, path)
 Get client from its nested field. More...
 
#define CCORD_EXPECT(client, expect, code, reason)
 log and return code if expect condition is false More...
 
#define ASSERT_NOT_OOB(nbytes, destsz)    ASSERT_S((size_t)nbytes < (size_t)destsz, "Out of bounds write attempt");
 Shortcut for checking OOB-write attempts. More...
 
#define DISCORD_ENDPT_LEN   512
 
#define DISCORD_ROUTE_LEN   256
 

Detailed Description

Documentation useful when developing or debugging Concord itself.

Macro Definition Documentation

◆ CLIENT

#define CLIENT (   ptr,
  path 
)    CONTAINEROF(ptr, struct discord, path)

Get client from its nested field.

◆ CCORD_EXPECT

#define CCORD_EXPECT (   client,
  expect,
  code,
  reason 
)
Value:
do { \
if (!(expect)) { \
logconf_error(&(client)->conf, "Expected: " #expect ": " reason); \
return code; \
} \
} while (0)

log and return code if expect condition is false

Parameters
[in]clientthe Discord client
[in]expectthe expected outcome
[in]codereturn CCORDcode error code
[in]reasonfor return
Returns
the provided CCORDcode code parameter

◆ ASSERT_NOT_OOB

#define ASSERT_NOT_OOB (   nbytes,
  destsz 
)     ASSERT_S((size_t)nbytes < (size_t)destsz, "Out of bounds write attempt");

Shortcut for checking OOB-write attempts.

Note
unsigned values are expected
Parameters
[in]nbytesamount of bytes to be written
[in]destszsize of dest in bytes

◆ DISCORD_ENDPT_LEN

#define DISCORD_ENDPT_LEN   512

URL endpoint threshold length

◆ DISCORD_ROUTE_LEN

#define DISCORD_ROUTE_LEN   256

Route's unique key threshold length