#include <json/json.h>
#include <string.h>
-int ykp_json_export_cfg(const YKP_CONFIG *cfg, char *json, size_t len) {
+int _ykp_json_export_cfg(const YKP_CONFIG *cfg, char *json, size_t len) {
json_object *jobj = json_object_new_object();
json_object *yprod_json = json_object_new_object();
json_object *options_json = json_object_new_object();
return strlen(json);
}
-int ykp_json_import_cfg(const char *json, size_t len, YKP_CONFIG *cfg) {
+int _ykp_json_import_cfg(const char *json, size_t len, YKP_CONFIG *cfg) {
if(cfg) {
json_object *jobj = json_tokener_parse(json);
json_object *yprod_json = json_object_object_get(jobj, "yubiProdConfig");
extern "C" {
# endif
-int ykp_json_export_cfg(const YKP_CONFIG *cfg, char *json, size_t len);
-int ykp_json_import_cfg(const char *json, size_t len, YKP_CONFIG *cfg);
+int _ykp_json_export_cfg(const YKP_CONFIG *cfg, char *json, size_t len);
+int _ykp_json_import_cfg(const char *json, size_t len, YKP_CONFIG *cfg);
# ifdef __cplusplus
}
static const char str_extended_flags[] = "extended_flags";
-static int ykp_legacy_export_config(const YKP_CONFIG *cfg, char *buf, size_t len) {
+static int _ykp_legacy_export_config(const YKP_CONFIG *cfg, char *buf, size_t len) {
if (cfg) {
char buffer[256];
struct map_st *p;
int ykp_export_config(const YKP_CONFIG *cfg, char *buf, size_t len,
int format) {
if(format == YKP_FORMAT_YCFG) {
- return ykp_json_export_cfg(cfg, buf, len);
+ return _ykp_json_export_cfg(cfg, buf, len);
} else if(format == YKP_FORMAT_LEGACY) {
- return ykp_legacy_export_config(cfg, buf, len);
+ return _ykp_legacy_export_config(cfg, buf, len);
}
ykp_errno = YKP_EINVAL;
return 0;
int ykp_import_config(const char *buf, size_t len, YKP_CONFIG *cfg,
int format) {
if(format == YKP_FORMAT_YCFG) {
- return ykp_json_import_cfg(buf, len, cfg);
+ return _ykp_json_import_cfg(buf, len, cfg);
} else if(format == YKP_FORMAT_LEGACY) {
ykp_errno = YKP_ENOTYETIMPL;
}
void *userdata) {
if(cfg) {
char buffer[1024];
- int ret = ykp_legacy_export_config(cfg, buffer, 1024);
+ int ret = _ykp_legacy_export_config(cfg, buffer, 1024);
if(ret) {
writer(buffer, strlen(buffer), userdata);
return 1;