docs/ref/modules/utils/flatbuffers/README.md
FlatBuffers is a high-performance serialization library used throughout Wazuh for efficient data exchange between components. It enables zero-copy deserialization and provides direct access to data without unpacking or parsing overhead.
The Inventory Sync module uses FlatBuffers as its primary communication protocol for synchronizing inventory data between agents and the manager. The protocol supports multiple synchronization modes:
Module Synchronization (agent-side inventory modules):
ModuleFull: Complete inventory replacement for a module (syscollector, FIM, SCA)ModuleDelta: Incremental updates for inventory changesModuleCheck: Integrity verification using checksumsAgent Context Synchronization (agent-info module):
MetadataDelta: Agent metadata updates (name, version, IP, OS details)MetadataCheck: Disaster recovery for metadata across all indicesGroupDelta: Agent group membership updatesGroupCheck: Disaster recovery for groups across all indicesAll synchronization messages (Start, Data, End, Acknowledgments) are encoded as FlatBuffers, providing:
See Inventory Sync FlatBuffers documentation for detailed schema information.
The Vulnerability Scanner uses FlatBuffers for processing vulnerability feeds, particularly CVE5 schema data. This avoids deserialization overhead during scanning operations where performance is critical.
The Agent Info module uses FlatBuffers to communicate metadata and group information updates to the Inventory Sync module, ensuring efficient propagation of agent context changes.
FlatBuffers provides significant performance advantages over traditional serialization formats:
FlatBuffer schemas are defined in .fbs files located in src/shared_modules/utils/flatbuffers/schemas/:
inventorySync.fbs: Inventory synchronization protocol messagesThese schemas are compiled into C++ headers during the build process.
inventorySync.fbs — Status EnumThe Status enum is used in acknowledgment messages (StartAck, EndAck) to convey the outcome of a protocol phase:
| Value | Meaning |
|---|---|
Ok | Operation completed successfully |
Error | Operation failed (e.g. manager-side error) |
Offline | Agent is offline |
ChecksumMismatch | Integrity check detected a mismatch; full sync required |
Processing | Manager acknowledged receipt of End but is still processing the session; the agent must wait without resending End |
The Processing status is sent by the manager as an intermediate EndAck when the session is queued for indexing but not yet complete. This prevents the agent from interpreting the absence of a final EndAck as a timeout and retransmitting End, which would otherwise cause duplicate first-scan events.