X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=lib%2Flibrte_cmdline%2Fcmdline_parse.h;fp=lib%2Flibrte_cmdline%2Fcmdline_parse.h;h=65b18d4f6ba8902324e0ced8f2aa7d32b4cbf441;hb=7595afa4d30097c1177b69257118d8ad89a539be;hp=4ac05d6b8964ad09bc7a161d7e578ab7a62c893e;hpb=ce3d555e43e3795b5d9507fcfc76b7a0a92fd0d6;p=deb_dpdk.git diff --git a/lib/librte_cmdline/cmdline_parse.h b/lib/librte_cmdline/cmdline_parse.h index 4ac05d6b..65b18d4f 100644 --- a/lib/librte_cmdline/cmdline_parse.h +++ b/lib/librte_cmdline/cmdline_parse.h @@ -83,6 +83,9 @@ extern "C" { /* maximum buffer size for parsed result */ #define CMDLINE_PARSE_RESULT_BUFSIZE 8192 +/* maximum number of dynamic tokens */ +#define CMDLINE_PARSE_DYNAMIC_TOKENS 128 + /** * Stores a pointer to the ops struct, and the offset: the place to * write the parsed result in the destination structure. @@ -130,6 +133,24 @@ struct cmdline; * Store a instruction, which is a pointer to a callback function and * its parameter that is called when the instruction is parsed, a help * string, and a list of token composing this instruction. + * + * When no tokens are defined (tokens[0] == NULL), they are retrieved + * dynamically by calling f() as follows: + * + * f((struct cmdline_token_hdr **)&token_hdr, + * NULL, + * (struct cmdline_token_hdr *[])tokens)); + * + * The address of the resulting token is expected at the location pointed by + * the first argument. Can be set to NULL to end the list. + * + * The cmdline argument (struct cmdline *) is always NULL. + * + * The last argument points to the NULL-terminated list of dynamic tokens + * defined so far. Since token_hdr points to an index of that list, the + * current index can be derived as follows: + * + * int index = token_hdr - &(*tokens)[0]; */ struct cmdline_inst { /* f(parsed_struct, data) */