![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Wire codec for KCMCP, the Knowledge Compiler / Model Counter Protocol (see doc/source/dev/kc-server-protocol.rst). More...
#include <cstdint>#include <stdexcept>#include <string>

Go to the source code of this file.
Classes | |
| struct | kcmcp::ProtocolError |
| Thrown by Connection on a protocol violation that warrants an ERROR frame (e.g. More... | |
| struct | kcmcp::Message |
| A fully reassembled inbound message (MORE frames concatenated). More... | |
| struct | kcmcp::Request |
| Decoded REQUEST payload. More... | |
| class | kcmcp::Connection |
| Framed message transport over one connected socket fd. More... | |
Namespaces | |
| namespace | kcmcp |
Enumerations | |
| enum class | kcmcp::Type : uint8_t { kcmcp::HELLO = 0x00 , kcmcp::REQUEST = 0x01 , kcmcp::RESULT = 0x02 , kcmcp::ERROR = 0x03 , kcmcp::PROGRESS = 0x04 , kcmcp::CANCEL = 0x05 , kcmcp::PING = 0x06 , kcmcp::PONG = 0x07 , kcmcp::BYE = 0x08 } |
| Frame type (header byte 0). More... | |
| enum | kcmcp::Flag : uint8_t { kcmcp::FLAG_MORE = 0x01 , kcmcp::FLAG_COMPRESSED = 0x02 } |
| Frame flags (header byte 1). More... | |
| enum class | kcmcp::Operation : uint8_t { kcmcp::COUNT = 0 , kcmcp::WMC = 1 , kcmcp::COMPILE = 2 } |
Operation registry (REQUEST byte 0 / HELLO operations names). More... | |
| enum class | kcmcp::InputFormat : uint8_t { kcmcp::DIMACS_CNF = 0 , kcmcp::CIRCUIT_BCS12 = 1 } |
| Input-format registry (REQUEST byte 1). More... | |
| enum class | kcmcp::OutputFormat : uint8_t { kcmcp::DECIMAL = 0 , kcmcp::RATIONAL = 1 , kcmcp::DOUBLE = 2 , kcmcp::BIGINT = 3 , kcmcp::DDNNF_NNF = 4 } |
| Output-format registry (REQUEST byte 2 / RESULT byte 0; one shared space). More... | |
| enum class | kcmcp::ErrorCode : uint16_t { kcmcp::UNSUPPORTED_OPERATION = 1 , kcmcp::UNSUPPORTED_FORMAT = 2 , kcmcp::PARSE = 3 , kcmcp::TIMEOUT = 4 , kcmcp::CANCELLED = 5 , kcmcp::INTERNAL = 6 , kcmcp::PAYLOAD_TOO_LARGE = 7 , kcmcp::UNSUPPORTED_VERSION = 8 , kcmcp::COMPRESSION_UNSUPPORTED = 9 } |
| ERROR codes. More... | |
Functions | |
| const char * | kcmcp::operation_name (Operation op) |
| const char * | kcmcp::input_format_name (InputFormat fmt) |
| const char * | kcmcp::output_format_name (OutputFormat fmt) |
| bool | kcmcp::parse_request (const std::string &payload, Request &out) |
| Decode a REQUEST payload; returns false if structurally malformed. | |
| std::string | kcmcp::build_result (OutputFormat fmt, const std::string &meta_json, const std::string &result) |
| Build a RESULT payload (result_format byte + meta JSON + result bytes). | |
| std::string | kcmcp::build_error (ErrorCode code, const std::string &message) |
| Build an ERROR payload (u16 code + UTF-8 message). | |
Wire codec for KCMCP, the Knowledge Compiler / Model Counter Protocol (see doc/source/dev/kc-server-protocol.rst).
A small, dependency-free C++ layer over a connected stream socket: the 10-byte frame header, MORE-chunked message reassembly, and pack/unpack of the REQUEST / RESULT / ERROR payloads and the operation / format / error registries. It is used by the tdkc reference server and is written to be reusable by a future ProvSQL client. No PostgreSQL dependency.
Definition in file kcmcp_protocol.h.