static void imgr_hash_jsonstr(struct json_encoder *enc, char *key, uint8_t *hash) { struct json_value jv; char hash_str[IMGMGR_HASH_STR + 1]; base64_encode(hash, IMGMGR_HASH_LEN, hash_str, 1); JSON_VALUE_STRING(&jv, hash_str); json_encode_object_entry(enc, key, &jv); }
/** * Log encode function * @param log structure, the encoder, json_value, * timestamp, index * @return 0 on success; non-zero on failure */ static int log_encode(struct log *log, struct json_encoder *encoder, struct json_value *jv, int64_t ts, uint32_t index) { int rc; json_encode_object_start(encoder); JSON_VALUE_STRING(jv, log->l_name); json_encode_object_entry(encoder, "name", jv); JSON_VALUE_UINT(jv, log->l_log->log_type); json_encode_object_entry(encoder, "type", jv); rc = log_encode_entries(log, encoder, ts, index); json_encode_object_finish(encoder); return rc; }