MCPcopy Create free account
hub / github.com/ElementsProject/lightning / param

Function param

common/json_param.c:339–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339bool param(struct command *cmd, const char *buffer,
340 const jsmntok_t tokens[], ...)
341{
342 struct param *params = tal_arr(tmpctx, struct param, 0);
343 const char *name;
344 va_list ap;
345 bool allow_extra = false;
346
347 va_start(ap, tokens);
348 while ((name = va_arg(ap, const char *)) != NULL) {
349 enum param_style style = va_arg(ap, enum param_style);
350 param_cbx cbx = va_arg(ap, param_cbx);
351 void *arg = va_arg(ap, void *);
352 if (streq(name, "")) {
353 allow_extra = true;
354 continue;
355 }
356 if (!param_add(&params, name, style, cbx, arg)) {
357 /* We really do ignore this return! */
358 struct command_result *ignore;
359 ignore = command_fail(cmd, PARAM_DEV_ERROR,
360 "developer error: param_add %s", name);
361 assert(ignore);
362 va_end(ap);
363 return false;
364 }
365 }
366 va_end(ap);
367
368 if (command_usage_only(cmd)) {
369 command_set_usage(cmd, param_usage(cmd, params));
370 return false;
371 }
372
373 /* Always return false if we're simply checking command parameters;
374 * normally this returns true if all parameters are valid. */
375 return param_arr(cmd, buffer, tokens, params, allow_extra) == NULL
376 && !command_check_only(cmd);
377}
378
379struct command_result *param_array(struct command *cmd, const char *name,
380 const char *buffer, const jsmntok_t *tok,

Callers 15

json_helloworldFunction · 0.50
json_testrpcFunction · 0.50
json_keysendFunction · 0.50
json_txprepareFunction · 0.50
json_txdiscardFunction · 0.50
json_txsendFunction · 0.50
json_withdrawFunction · 0.50
json_paystatusFunction · 0.50
json_listpaysFunction · 0.50
json_payFunction · 0.50
getrawblockbyheightFunction · 0.50
getchaininfoFunction · 0.50

Calls 7

param_addFunction · 0.85
param_usageFunction · 0.85
param_arrFunction · 0.85
command_failFunction · 0.50
command_usage_onlyFunction · 0.50
command_set_usageFunction · 0.50
command_check_onlyFunction · 0.50

Tested by 2

json_helloworldFunction · 0.40
json_testrpcFunction · 0.40