| 671 | } |
| 672 | |
| 673 | struct command_result *jsonrpc_set_datastore_(struct plugin *plugin, |
| 674 | struct command *cmd, |
| 675 | const char *path, |
| 676 | const void *value, |
| 677 | bool value_is_string, |
| 678 | const char *mode, |
| 679 | struct command_result *(*cb)(struct command *command, |
| 680 | const char *buf, |
| 681 | const jsmntok_t *result, |
| 682 | void *arg), |
| 683 | struct command_result *(*errcb)(struct command *command, |
| 684 | const char *buf, |
| 685 | const jsmntok_t *result, |
| 686 | void *arg), |
| 687 | void *arg) |
| 688 | { |
| 689 | struct out_req *req; |
| 690 | |
| 691 | if (!cb) |
| 692 | cb = ignore_cb; |
| 693 | if (!errcb) |
| 694 | errcb = datastore_fail; |
| 695 | |
| 696 | req = jsonrpc_request_start(plugin, cmd, "datastore", cb, errcb, arg); |
| 697 | |
| 698 | json_add_keypath(req->js->jout, "key", path); |
| 699 | if (value_is_string) |
| 700 | json_add_string(req->js, "string", value); |
| 701 | else |
| 702 | json_add_hex_talarr(req->js, "hex", value); |
| 703 | json_add_string(req->js, "mode", mode); |
| 704 | return send_outreq(plugin, req); |
| 705 | } |
| 706 | |
| 707 | static void handle_rpc_reply(struct plugin *plugin, const jsmntok_t *toks) |
| 708 | { |
nothing calls this directly
no test coverage detected