Skip to content
Start free evaluation

pdcomm_license_status

Function

Copies the license status of this library as a JSON object.

PdcommStatus pdcomm_license_status(uint8_t *output, size_t capacity, size_t *required)

Declared in: #include <pdcomm.h>

The object has schema_version 1 and reports build_date (UTC date of this SDK build), host_id (or null with host_id_error), program (the executable name), keys (accepted signing keys), sources (each license source found, with location, blocks and error), licenses (every license block with its verification result and fields), and modules: for each module id (secs-gem, gem300, modbus, modbus-security, mqtt, opcua-client, opcua-server) an object with state (licensed, evaluation, missing, expired, not-yet-valid, updates-expired, program-mismatch or host-mismatch), granted, days_left, rejected, license_id, kind, expires_at and host_bound. The bytes are UTF-8 JSON without a terminating NUL.

Parameters

NameDescription
outputDestination for the JSON bytes. May be NULL only when capacity is 0.
capacitySize of output in bytes.
requiredReceives the length of the JSON text. Must not be NULL.

Returns

#PDCOMM_OK when the text was copied; #PDCOMM_BUFFER_TOO_SMALL when capacity is smaller than *required (output untouched); #PDCOMM_INVALID_ARGUMENT when required is NULL, or output is NULL with a nonzero capacity (*required is not written); #PDCOMM_INTERNAL_ERROR when serialization failed or a panic was contained.

Notes

  • The status is evaluated at the time of each call (the current time and the license files present then), so its length can change between a size query and the copy. Allocate some headroom and repeat the call when it returns #PDCOMM_BUFFER_TOO_SMALL.
  • Thread safety: may be called from any thread.