pdcomm_license_install
Function
Installs PDComm license text for this library.
PdcommStatus pdcomm_license_install(const uint8_t *text, size_t size)The text holds one or more -----BEGIN PDCOMM LICENSE----- blocks; text outside the blocks is ignored. It replaces text installed earlier through this function and is merged with the other license sources: the PDCOMM_LICENSE environment variable (text), PDCOMM_LICENSE_FILE (path), pdcomm.license next to the executable or this library, the user configuration directory, and the system configuration directory. An empty text (size 0) removes the installed text.
The text is accepted when at least one block has a valid signature, even if that license is expired or for another host; pdcomm_license_status() reports the resulting module states. The installation lasts until the process exits and applies only to this library, not to the Modbus or OPC UA libraries.
Parameters
| Name | Description |
|---|---|
text | UTF-8 license text, not NUL-terminated. May be NULL when size is 0. |
size | Number of bytes at text, at most 1048576. |
Returns
#PDCOMM_OK when the text was installed or removed; #PDCOMM_INVALID_ARGUMENT when text is NULL with a nonzero size, size exceeds 1048576, or the text is not UTF-8; #PDCOMM_INVALID_DATA when no block has a valid signature (the earlier installation is kept); #PDCOMM_INTERNAL_ERROR when a panic was contained.
Notes
- Thread safety: may be called from any thread. Endpoints that are already running are not affected by a new installation.
- No pointer is retained after the call returns.