| 277 | } |
| 278 | |
| 279 | static struct command_result *param_arr(struct command *cmd, const char *buffer, |
| 280 | const jsmntok_t tokens[], |
| 281 | struct param *params, |
| 282 | bool allow_extra) |
| 283 | { |
| 284 | if (tokens->type == JSMN_ARRAY) |
| 285 | return parse_by_position(cmd, params, buffer, tokens, allow_extra); |
| 286 | else if (tokens->type == JSMN_OBJECT) |
| 287 | return parse_by_name(cmd, params, buffer, tokens, allow_extra); |
| 288 | |
| 289 | return command_fail(cmd, JSONRPC2_INVALID_PARAMS, |
| 290 | "Expected array or object for params"); |
| 291 | } |
| 292 | |
| 293 | const char *param_subcommand(struct command *cmd, const char *buffer, |
| 294 | const jsmntok_t tokens[], |