Line data Source code
1 : /* SPDX-License-Identifier: BSD-3-Clause 2 : * Copyright (c) 2024 Intel Corporation. All rights reserved. 3 : */ 4 : 5 : #include "keyring_internal.h" 6 : #include "spdk/keyring.h" 7 : #include "spdk/rpc.h" 8 : #include "spdk/string.h" 9 : #include "spdk/util.h" 10 : 11 : static void 12 0 : rpc_keyring_for_each_key_cb(void *ctx, struct spdk_key *key) 13 : { 14 0 : struct spdk_json_write_ctx *w = ctx; 15 : 16 0 : spdk_json_write_object_begin(w); 17 0 : keyring_dump_key_info(key, w); 18 0 : spdk_json_write_object_end(w); 19 0 : } 20 : 21 : static void 22 0 : rpc_keyring_get_keys(struct spdk_jsonrpc_request *request, 23 : const struct spdk_json_val *params) 24 : { 25 : struct spdk_json_write_ctx *w; 26 : 27 0 : w = spdk_jsonrpc_begin_result(request); 28 0 : spdk_json_write_array_begin(w); 29 0 : spdk_keyring_for_each_key(NULL, w, rpc_keyring_for_each_key_cb, SPDK_KEYRING_FOR_EACH_ALL); 30 0 : spdk_json_write_array_end(w); 31 : 32 0 : spdk_jsonrpc_end_result(request, w); 33 : 34 0 : } 35 0 : SPDK_RPC_REGISTER("keyring_get_keys", rpc_keyring_get_keys, SPDK_RPC_RUNTIME)