Skip to main content

Linux with C++

Build the C++17 source preview with OpenSSL and apply a device-bound signed license before processing frames.

SDK 0.1.0-RC5 · Preview

Status: Preview Language: C++17 Distribution: Source only

The Linux host exposes a C++ session facade, batch processing, metrics, and signed-license verification. RC2 does not publish a certified Debian package, RPM, shared-library bundle, or customer container.

Preview contract map

Contract Input Result RC2 boundary
register_trusted_public_key_pem Key ID, exact algorithm, trusted public-key PEM Key becomes eligible for JWS verification Unknown algorithms or malformed keys fail without weakening verification.
apply_signed_license_jws Compact JWS, expected tenant/device IDs, current epoch EntitlementEvaluationResult OpenSSL absence, bad signature/claims, wrong binding, revocation, expiry, rollback, or grace expiry deny access.
LinuxHostSession::ProcessFrame Valid LinuxFrameDescriptor with stride >= width and sufficient luminance bytes LinuxDetectionResult with evidence, timing, review flag, or deterministic error Media decoding and production packaging remain host responsibilities; this source preview is not a certified binary.
ProcessBatch / metrics Bounded frame collection and initialized session Ordered result collection and host metrics The host must bound queues and cannot treat dropped or failed frames as successful empty scans.

The portal contract table is generated from contracts/sdk-public-contracts.json ; these C++ headers remain the exact preview signatures.

Build from source

OpenSSL is required for signed-license activation. A build without OpenSSL is allowed for development diagnostics, but license activation fails closed.

add_subdirectory(path/to/PrxVision PrxVision-build)
target_link_libraries(my_worker PRIVATE vision_scan_host_linux)
target_compile_features(my_worker PRIVATE cxx_std_17)

The top-level VisionScan build controls whether the Linux target is included. Pin the source revision used by your application.

Apply a backend-signed license

#include <vision_scan/host_linux_entitlement.hpp>
#include <stdexcept>

using vision_scan::host_linux::VisionScanLinuxEntitlementManager;

VisionScanLinuxEntitlementManager entitlement;
std::string error;
if (!entitlement.register_trusted_public_key_pem(
        key_id, "RS256", public_key_pem, &error)) {
    throw std::runtime_error(error);
}

auto result = entitlement.apply_signed_license_jws(
    compact_jws, tenant_id, device_id, now_epoch_seconds);
if (!result.is_allowed) {
    throw std::runtime_error(result.denial_reason);
}

The legacy object-based apply_signed_license path denies activation. A Boolean flag on a caller-created object cannot establish cryptographic trust.

Process a frame

#include <vision_scan/host_linux.hpp>

using namespace vision_scan::host_linux;

LinuxHostSession session;
if (!session.Initialize() || !session.Start()) {
    return 1;
}

LinuxFrameDescriptor frame{
    frame_id,
    width,
    height,
    stride,
    luma_bytes,
    timestamp_us
};

LinuxDetectionResult result = session.ProcessFrame(frame);
session.Stop();

Media decoding, image orientation, pixel conversion, persistence, networking, and token storage remain host responsibilities. Supply a valid luma buffer with stride >= width .

Failure checks

Condition Expected behavior
OpenSSL absent JWS activation fails closed
Unknown or mismatched kid / algorithm License is denied
Wrong tenant or device License is denied
Revoked, expired, or rollback revision Feature evaluation is denied
Invalid frame dimensions or buffer Processing reports a deterministic error

Native MatrixScan usage adapter

The legacy LinuxHostSession::ProcessFrame currently emits placeholder detection fields; those results must not be counted as real scans. MatrixUsageCollector instead consumes actual portable MatrixScanSession results, counting one-shot accepted events, not visible tracks or cumulative count state.

#include <vision_scan/matrix_usage.hpp>

using prx::tracking::session::MatrixScanMode;
vision_scan::host_linux::MatrixUsageCollector usage(MatrixScanMode::AR);
if (!usage.RecordNative(native_matrix_result)) {
    // Wrong session mode: do not schedule this snapshot.
    return;
}
const std::string diagnostic_payload = usage.SnapshotJson();
// Host-owned enqueue callback; failure retains counters for retry.
if (durably_enqueue_usage(diagnostic_payload)) {
    usage.ResetAfterScheduled();
}

durably_enqueue_usage represents your host's persistence callback, not an SDK method. Access is caller-serialized. Use one collector per session/mode. The adapter shares the portable accumulator and emits the same versioned JSON as Android. It never retains payloads, geometry, images, tenant IDs, keys, or tokens, and performs no networking.

Host enrollment, HTTPS/token management, encrypted offline outboxes, and Linux-target/device delivery validation are not implemented by this adapter. The existing legacy commercial emitter is not a conforming replacement. The additive native ABI is specified in contracts/c/vision_scan_matrix_usage.h ; ownership and test commands are in docs/architecture/cross-platform-matrix-usage-conformance.md .

PRXV-0132-S06 adds vision_scan/native_matrix_session.hpp , an owned real-engine facade around contracts/c/vision_scan_matrix_session.h . Link visionscan_matrix_native and supply the host include directory. Process requires explicit byte length and monotonic nanosecond timestamp, returning private native result JSON. UsageJson returns content-free counters separately. The host must enforce verified entitlement before calling this raw engine boundary. Serialize all calls; reset usage only after durable enqueue. This path is not the legacy placeholder detector and contains no HTTP/storage. Its Windows C++ consumer test is not Linux runtime certification.

Path to supported release

Support requires signed binary packaging, SBOM and checksums, ABI compatibility policy, runtime dependency declaration, a licensed production engine path, tenant download controls, container and distribution certification, and repeatable Linux benchmark evidence.

Support matrix

Full API contract reference

Public contract reference

These are the callable methods and HTTP operations used by this guide. Inputs, results, lifecycle rules, and denial behavior are part of the versioned customer contract.

Linux signed-license preview

The C++ source preview requires OpenSSL-backed asymmetric verification.

VisionScanLinuxEntitlementManager::apply_signed_license_jws(compact_jws, expected_tenant_id, expected_device_id, now_epoch_seconds)

method

Verify and apply a backend-issued compact JWS to the Linux host entitlement manager.

Inputs for VisionScanLinuxEntitlementManager::apply_signed_license_jws(compact_jws, expected_tenant_id, expected_device_id, now_epoch_seconds)
InputTypeRequiredMeaning
compact_jwsstd::stringYesBackend-signed compact license token.
expected_tenant_idstd::stringYesAuthenticated tenant binding.
expected_device_idstd::stringYesActivated host/device binding.
now_epoch_secondsint64_tYesCurrent Unix time.
Result
EntitlementEvaluationResult with deterministic allow/deny and remediation fields.
Lifecycle
Register the trusted key ID and algorithm, then apply before starting licensed processing.
Trust boundary
The legacy object path and is_cryptographically_verified Boolean cannot establish trust.
Failure behavior
  • OpenSSL absence, unknown key, algorithm mismatch, bad signature, wrong tenant/device, expiry, revocation, or rollback deny access.

Linux frame-processing preview

The legacy frame facade is a placeholder. A separate native MatrixScan adapter exposes privacy-safe usage without claiming Linux delivery certification.

LinuxHostSession::ProcessFrame(const LinuxFrameDescriptor&): LinuxDetectionResult

method

Exercise legacy preview lifecycle and layout validation; placeholder detections are not real decoder evidence.

Inputs for LinuxHostSession::ProcessFrame(const LinuxFrameDescriptor&): LinuxDetectionResult
InputTypeRequiredMeaning
frame_idstd::stringYesHost correlation identifier.
width / height / strideint32_tYesPositive dimensions with stride at least width.
datastd::vector<uint8_t>YesEnough luminance bytes for the declared layout.
Result
LinuxDetectionResult with placeholder detection fields, timing, and deterministic error text; excluded from scan-usage telemetry.
Lifecycle
Initialize, start, process frames or batches, inspect metrics, then stop before destruction.
Trust boundary
Media decoding, persistence, networking, credentials, and tenant isolation remain host responsibilities.
Failure behavior
  • Invalid lifecycle or frame layout returns an error result.
  • RC2 source preview is not a certified customer binary or container.

MatrixUsageCollector(mode); RecordNative(const MatrixScanResult&): bool; SnapshotJson(): std::string; ResetAfterScheduled(): void

method

Count one-shot accepted events from real portable MatrixScan results using the shared native accumulator.

Inputs for MatrixUsageCollector(mode); RecordNative(const MatrixScanResult&): bool; SnapshotJson(): std::string; ResetAfterScheduled(): void
InputTypeRequiredMeaning
resultprx::tracking::session::MatrixScanResultYesReal native session result matching the collector mode; visible tracks and cumulative count state are not admissions.
Result
Content-free visionscan-matrix-usage/v1 delta with signed 64-bit saturating counters and 19 closed accounting buckets.
Lifecycle
Serialize access; retain counters on persistence failure, reset only after durable host enqueue. Automatic licensed session integration and secure transport remain pending.
Trust boundary
No payloads, images, quads, tenant IDs, raw license keys, or tokens; tenant attribution is backend-authoritative.
Failure behavior
  • Wrong-mode results return false without mutation.
  • Failed frames contribute diagnostics but no admissions; unknown symbology text becomes Unknown.
  • MSVC builds do not certify Linux runtime or delivery.

vs_matrix_usage_create_v1 / record_v1 / json_v1 / reset_v1 / destroy_v1 (contracts/c/vision_scan_matrix_usage.h)

method

Provide additive content-free portable usage counters through a source-built static C ABI, independently of the bootstrap scan ABI.

Inputs for vs_matrix_usage_create_v1 / record_v1 / json_v1 / reset_v1 / destroy_v1 (contracts/c/vision_scan_matrix_usage.h)
InputTypeRequiredMeaning
framevs_matrix_usage_frame_v1YesExact struct_size and ABI version 1, status OK/capacity/failed, budget flag, and non-negative native frame counters.
Result
Opaque handle and caller-owned NUL-terminated JSON buffer; size queries include NUL and return BUFFER_TOO_SMALL.
Lifecycle
Caller serializes record/peek/durable host enqueue/reset; destroy via the same library, never free the handle directly. Shared-library packaging and native host wiring remain release tasks.
Trust boundary
Portable counters perform no I/O or licensing. Backend authorizes tenant/device and hosts own encrypted retry and credentials. This ABI is not a supported Windows SDK.
Failure behavior
  • Null or invalid descriptors fail atomically.
  • Short output buffers are untouched; peeks are non-consuming.
  • Allocation failure is typed and exceptions never cross C.