[common,settings] new settings (de)serialization API

* Add rdpKey to PEM conversion
* Modify WINPR_JSON_Version to return -1 if not supported
* Add rdpSettings serialize and deserialize functions
This commit is contained in:
Armin Novak
2025-04-16 08:47:35 +02:00
committed by akallabeth
parent 2fb2e5f9c5
commit a4c4bad132
8 changed files with 2595 additions and 143 deletions

View File

@@ -773,6 +773,28 @@ extern "C"
const rdpMonitor* monitors,
size_t count);
/** @brief A function that converts a \b rdpSettings struct to a \b JSON serialized string.
*
* @param settings The settings instance to serialize
* @param pretty Format the resulting \b JSON human readable
* @param plength An optional pointer that receives the length (strlen) of the returned string.
* @return A \b JSON string representing the serialized form of the \b rdpSettings or \b NULL
* in case of an error.
* @since version 3.16.0
*/
FREERDP_API char* freerdp_settings_serialize(const rdpSettings* settings, BOOL pretty,
size_t* plength);
/** @brief A function that converts a \b JSON string to a \b rdpSettings struct
*
* @param json The \b JSON string
* @param length The strlen of the \b JSON string
* @return An allocated \b rdpSettings struct or \b NULL in case of an error
* @since version 3.16.0
*/
WINPR_ATTR_MALLOC(freerdp_settings_free, 1)
FREERDP_API rdpSettings* freerdp_settings_deserialize(const char* json, size_t length);
#ifdef __cplusplus
}
#endif