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

Function new_cond_info

plugins/commando.c:243–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241};
242
243static struct cond_info *new_cond_info(const tal_t *ctx,
244 struct commando *incoming,
245 const jsmntok_t *toks STEALS,
246 const jsmntok_t *method,
247 const jsmntok_t *params,
248 const jsmntok_t *id,
249 const jsmntok_t *filter)
250{
251 struct cond_info *cinfo = tal(ctx, struct cond_info);
252
253 cinfo->incoming = incoming;
254 /* Convenience pointer, since contents is u8 */
255 cinfo->buf = cast_signed(const char *, incoming->contents);
256 cinfo->toks = tal_steal(cinfo, toks);
257 cinfo->method = method;
258 cinfo->params = params;
259 cinfo->filter = filter;
260
261 if (!id) {
262 cinfo->cmdid_prefix = NULL;
263 incoming->json_id = NULL;
264 } else {
265 cinfo->cmdid_prefix = json_strdup(cinfo, cinfo->buf, id);
266 /* Includes quotes, if any! */
267 incoming->json_id = tal_strndup(incoming,
268 json_tok_full(cinfo->buf, id),
269 json_tok_full_len(id));
270 }
271 return cinfo;
272}
273
274static struct command_result *execute_command(struct command *cmd,
275 struct cond_info *cinfo)

Callers 1

try_commandFunction · 0.85

Calls 3

json_strdupFunction · 0.50
json_tok_fullFunction · 0.50
json_tok_full_lenFunction · 0.50

Tested by

no test coverage detected