Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Built-in Modules

Optional modules that extend the kernel with additional GClasses. Each module is controlled by a CONFIG_MODULE_* option in .config (enable/disable via menuconfig). All are enabled by default.

Source: modules/c/

ModuleKconfigGClassesDescription
ConsoleCONFIG_MODULE_CONSOLEC_EDITLINEInteractive terminal line editing with history (based on linenoise). Used by ycli, ycommand and mqtt_tui.
ModbusCONFIG_MODULE_MODBUSC_PROT_MODBUS_MModbus protocol master — reads/writes device registers (coils, discrete inputs, input/holding registers). For industrial IoT.
MQTTCONFIG_MODULE_MQTTC_PROT_MQTT, C_PROT_MQTT2, C_MQTT_BROKERFull MQTT protocol implementation (v3.1.1 + v5.0) with a persistent message broker backed by TreeDB.
PostgresCONFIG_MODULE_POSTGRESC_POSTGRESPostgreSQL integration — async query execution with automatic JSON-to-SQL type mapping. Requires libpq.
TestCONFIG_MODULE_TESTC_PEPON, C_TESTONPaired test server/client for functional testing and traffic generation.

Module GClasses detail

C_EDITLINE (Console)

Line editor with keyboard input handling, cursor movement, text manipulation, completion, and history navigation. Provides the input layer for the ycli, ycommand and mqtt_tui clients.

Events handled: EV_KEYCHAR, EV_EDITLINE_MOVE_START / _END / _LEFT / _RIGHT, EV_EDITLINE_DEL_CHAR / _EOL / _LINE / _PREV_WORD, EV_EDITLINE_BACKSPACE, EV_EDITLINE_COMPLETE_LINE, EV_EDITLINE_ENTER, EV_EDITLINE_PREV_HIST / _NEXT_HIST, EV_EDITLINE_REVERSE_SEARCH / _FORWARD_SEARCH (incremental Ctrl+R / Ctrl+S history search), EV_EDITLINE_SWAP_CHAR, EV_SETTEXT / EV_GETTEXT, EV_CLEAR_HISTORY.

Public helpers (for clients):

FunctionPurpose
editline_set_completion_callback(gobj, cb, user_data)Register a TAB-completion callback; cb fills an editline_completions_t with candidates + optional descriptions via editline_add_completion(lc, str, desc).
editline_set_hints_callback(gobj, cb, free_cb, user_data)Register an inline-hint callback; cb returns a heap-allocated string (plus optional ANSI colour/bold) rendered to the right of the cursor in gray. free_cb releases the string after draw.
editline_history_count(gobj) / editline_history_get(gobj, idx)Read-only access to the in-memory history (1-based) for bang expansion (!N), !history-style listings, or custom search UIs.

History entries are de-duplicated on insert (bash HISTCONTROL=erasedups style) and the file is overwritten from memory on EV_EDITLINE_ENTER.

C_PROT_MODBUS_M (Modbus)

Modbus master protocol — supports four object types:

ObjectAccessSize
Coilsread-write1 bit
Discrete Inputsread-only1 bit
Input Registersread-only16 bits
Holding Registersread-write16 bits

Address range 0x00000xFFFF. Configuration-driven slave device mapping with data-format conversion and multiplier support.

C_PROT_MQTT / C_PROT_MQTT2 (MQTT)

MQTT protocol with publish, subscribe, QoS levels, and event-driven message handling. C_PROT_MQTT2 is the current implementation; C_PROT_MQTT is the legacy version kept for backward compatibility.

C_MQTT_BROKER (MQTT)

Full MQTT message broker — subscriber management, message routing, session handling, and persistent storage using TreeDB on timeranger2. Used by the mqtt_broker yuno.

C_POSTGRES (Postgres)

Async PostgreSQL client with an internal query queue. Maps JSON types to PostgreSQL types:

JSON typePostgreSQL type
stringtext
integerbigint
realdouble precision
booleanboolean
objecttext (JSON serialized)

Requires libpq-dev and CONFIG_MODULE_POSTGRES=y.

C_PEPON / C_TESTON (Test)

Paired test components: C_PEPON is a test server that responds to requests, C_TESTON is a test client that generates traffic (via EV_START_TRAFFIC). Used for functional testing and validation of Yuneta transport and protocol stacks.