Tchatator413 server configuration - Interface.
More...
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
|
#define | cfg_log(cfg, lvl, fmt, ...) _cfg_log(__FILE_NAME__, __LINE__, cfg, lvl, fmt __VA_OPT__(,) __VA_ARGS__) |
|
|
typedef struct cfg | cfg_t |
| An opaque handle to a configuration object.
|
|
Tchatator413 server configuration - Interface.
- Author
- Raphaƫl
- Date
- 29/01/2025
Definition in file cfg.h.
◆ cfg_log
#define cfg_log |
( |
|
cfg, |
|
|
|
lvl, |
|
|
|
fmt, |
|
|
|
... |
|
) |
| _cfg_log(__FILE_NAME__, __LINE__, cfg, lvl, fmt __VA_OPT__(,) __VA_ARGS__) |
Definition at line 58 of file cfg.h.
◆ cfg_t
An opaque handle to a configuration object.
Definition at line 14 of file cfg.h.
◆ log_lvl_t
Level of a log entry.
Enumerator |
---|
log_error | Error. Always logged.
|
log_info | Informational. Logged when verbosity is > 0 .
|
log_warning | Warning. Logged when verbosity is >= 0 .
|
Definition at line 41 of file cfg.h.
41 {
log_lvl_t
Level of a log entry.
@ log_warning
Warning. Logged when verbosity is >= 0.
@ log_error
Error. Always logged.
@ log_info
Informational. Logged when verbosity is > 0.
◆ _cfg_log()
bool _cfg_log |
( |
char const * |
file, |
|
|
int |
line, |
|
|
cfg_t * |
cfg, |
|
|
log_lvl_t |
lvl, |
|
|
char const * |
fmt, |
|
|
|
... |
|
) |
| |
Log a formatted string.
- Parameters
-
file | The file. |
line | The line. |
cfg | The configuration. |
lvl | The logging level. With the configured verbosity, this determines whether an entry will be logged or not. |
fmt | The format string. |
... | Arguments to the format string. |
- Returns
true
if an entry has been logged.
-
false
if no entry has been logged.
◆ cfg_backlog()
int cfg_backlog |
( |
cfg_t const * |
cfg | ) |
|
Get the configuration backlog.
- Parameters
-
- Returns
- the configuration backlog.
◆ cfg_block_for()
int cfg_block_for |
( |
cfg_t const * |
cfg | ) |
|
Get the configuration block_for.
- Parameters
-
- Returns
- the configuration block_for.
◆ cfg_defaults()
cfg_t * cfg_defaults |
( |
void |
| ) |
|
Load the default configuration.
- Returns
- A new configuration object.
The default verbosity is 0.
◆ cfg_destroy()
void cfg_destroy |
( |
cfg_t * |
cfg | ) |
|
Destroy a configuration.
- Parameters
-
cfg | The configuration to destroy. No-op if NULL . |
◆ cfg_dump()
void cfg_dump |
( |
cfg_t const * |
cfg | ) |
|
Dump a configuration to standard output.
- Parameters
-
cfg | The configuration to dump. |
◆ cfg_from_file()
cfg_t * cfg_from_file |
( |
char const * |
filename | ) |
|
Load configuration from a file.
- Parameters
-
filename | The filename to read the config from. |
- Returns
- A new configuration object.
◆ cfg_log_putc()
void cfg_log_putc |
( |
cfg_t * |
cfg, |
|
|
char |
c |
|
) |
| |
Log a single character.
- Parameters
-
cfg | The configuration. |
c | A character. |
◆ cfg_max_msg_length()
size_t cfg_max_msg_length |
( |
cfg_t const * |
cfg | ) |
|
Get the configuration max_msg_length.
- Parameters
-
- Returns
- the configuration max_msg_length.
◆ cfg_page_inbox()
int cfg_page_inbox |
( |
cfg_t const * |
cfg | ) |
|
Get the configuration page_inbox.
- Parameters
-
- Returns
- the configuration page_inbox.
◆ cfg_page_outbox()
int cfg_page_outbox |
( |
cfg_t const * |
cfg | ) |
|
Get the configuration page_outbox.
- Parameters
-
- Returns
- the configuration page_outbox.
◆ cfg_port()
uint16_t cfg_port |
( |
cfg_t const * |
cfg | ) |
|
Get the configuration port.
- Parameters
-
- Returns
- the configuration port.
◆ cfg_rate_limit_h()
int cfg_rate_limit_h |
( |
cfg_t const * |
cfg | ) |
|
Get the configuration rate_limit_h.
- Parameters
-
- Returns
- the configuration rate_limit_h.
◆ cfg_rate_limit_m()
int cfg_rate_limit_m |
( |
cfg_t const * |
cfg | ) |
|
Get the configuration rate_limit_m.
- Parameters
-
- Returns
- the configuration rate_limit_m.
◆ cfg_set_verbosity()
void cfg_set_verbosity |
( |
cfg_t * |
cfg, |
|
|
int |
verbosity |
|
) |
| |
Set the logging verbosity.
- Parameters
-
cfg | The configuration. |
verbosity | The logging verbosity. |