* Question about librte_cmdline
@ 2014-11-14 8:52 Igor Ryzhov
[not found] ` <D12B450C-961B-4BF7-9D81-AC8F69DF3E55-p3dJzl6UAic@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Igor Ryzhov @ 2014-11-14 8:52 UTC (permalink / raw)
To: dev-VfR2kkLFssw@public.gmane.org
Hello.
Are there any docs with detailed description of cmdline library?
I found only some information in «DPDK Sample Apps» document, but it describes only a couple of features.
Best regards,
Igor Ryzhov
^ permalink raw reply [flat|nested] 3+ messages in thread[parent not found: <D12B450C-961B-4BF7-9D81-AC8F69DF3E55-p3dJzl6UAic@public.gmane.org>]
* Re: Question about librte_cmdline [not found] ` <D12B450C-961B-4BF7-9D81-AC8F69DF3E55-p3dJzl6UAic@public.gmane.org> @ 2014-11-14 11:14 ` Olivier MATZ [not found] ` <5465E3F8.5070606-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Olivier MATZ @ 2014-11-14 11:14 UTC (permalink / raw) To: Igor Ryzhov, dev-VfR2kkLFssw@public.gmane.org Hi Igor, Adding-back the list to the discussion, I removed it by mistake in my first answer. >> 14 нояб. 2014 г., в 12:20, Olivier MATZ <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> написал(а): >> >> Hi Igor, >> >> On 11/14/2014 09:52 AM, Igor Ryzhov wrote: >>> Are there any docs with detailed description of cmdline library? >>> I found only some information in «DPDK Sample Apps» document, but it describes only a couple of features. >> >> In my knowledge, there is no such documentation. >> You can also refer to testpmd that gives a lot of different commands. >> >> If you have any question, you can ask on the list. >> >> Regards, >> Olivier > > Thank you, I’ll check testpmd. > > At the moment I have a question - is there a possibility to have optional tokens in one command? > > For example: > > I have one command - «object» and two subcommands - «add» and «del»: > > object add name IP > object del name > > And the question is - can I have just one context instruction for this? Something like that: > > Result struct: > > struct object_result { > cmdline_fixed_string_t object; > cmdline_fixed_string_t cmd; > cmdline_fixed_string_t name; > cmdline_ipaddr_t ip; // I need it optional - only for «add» case > } > > And tokens: > > cmdline_parse_token_string_t object = > TOKEN_STRING_INITIALIZER(struct object_result, object, "object"); > cmdline_parse_token_string_t cmd = > TOKEN_STRING_INITIALIZER(struct object_result, cmd, "add#del"); > cmdline_parse_token_string_t name = > TOKEN_STRING_INITIALIZER(struct object_result, name, NULL); > cmdline_parse_token_ipaddr_t ip = > TOKEN_IPV4_INITIALIZER(struct object_result, ip, NULL); > > As I understand investigating the code of sample application - all tokens are required (because there are two different instructions - for «add» and for «del/show»). > And in this example configuration there is no possibility for string «object del name» without last IP token. > So I need to have two different context instructions - one for «add» and one for «del». > Am I right? Right, there is no way to declare an optional token in one instruction. But if there are few case (ex: a "set" and a "show" intructions), you can factorize the structure and the callback function. There is an example in my latest TSO patch: http://dpdk.org/ml/archives/dev/2014-November/007962.html Regards, Olivier ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <5465E3F8.5070606-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>]
* Re: Question about librte_cmdline [not found] ` <5465E3F8.5070606-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> @ 2014-11-14 11:47 ` Igor Ryzhov 0 siblings, 0 replies; 3+ messages in thread From: Igor Ryzhov @ 2014-11-14 11:47 UTC (permalink / raw) To: Olivier MATZ; +Cc: dev-VfR2kkLFssw@public.gmane.org Thank you. That’s not a really big problem that we need it’s own structure for every command, but the lack of optional parameters is a problem. For example: object add IP [port] it’s just one command, but we need two different structures - with and without «port» Maybe I’ll work on it sometime later. > 14 нояб. 2014 г., в 14:14, Olivier MATZ <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> написал(а): > > Hi Igor, > > Adding-back the list to the discussion, I removed it by mistake in my > first answer. > >>> 14 нояб. 2014 г., в 12:20, Olivier MATZ <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> написал(а): >>> >>> Hi Igor, >>> >>> On 11/14/2014 09:52 AM, Igor Ryzhov wrote: >>>> Are there any docs with detailed description of cmdline library? >>>> I found only some information in «DPDK Sample Apps» document, but it describes only a couple of features. >>> >>> In my knowledge, there is no such documentation. >>> You can also refer to testpmd that gives a lot of different commands. >>> >>> If you have any question, you can ask on the list. >>> >>> Regards, >>> Olivier >> >> Thank you, I’ll check testpmd. >> >> At the moment I have a question - is there a possibility to have optional tokens in one command? >> >> For example: >> >> I have one command - «object» and two subcommands - «add» and «del»: >> >> object add name IP >> object del name >> >> And the question is - can I have just one context instruction for this? Something like that: >> >> Result struct: >> >> struct object_result { >> cmdline_fixed_string_t object; >> cmdline_fixed_string_t cmd; >> cmdline_fixed_string_t name; >> cmdline_ipaddr_t ip; // I need it optional - only for «add» case >> } >> >> And tokens: >> >> cmdline_parse_token_string_t object = >> TOKEN_STRING_INITIALIZER(struct object_result, object, "object"); >> cmdline_parse_token_string_t cmd = >> TOKEN_STRING_INITIALIZER(struct object_result, cmd, "add#del"); >> cmdline_parse_token_string_t name = >> TOKEN_STRING_INITIALIZER(struct object_result, name, NULL); >> cmdline_parse_token_ipaddr_t ip = >> TOKEN_IPV4_INITIALIZER(struct object_result, ip, NULL); >> >> As I understand investigating the code of sample application - all tokens are required (because there are two different instructions - for «add» and for «del/show»). >> And in this example configuration there is no possibility for string «object del name» without last IP token. >> So I need to have two different context instructions - one for «add» and one for «del». >> Am I right? > > Right, there is no way to declare an optional token in one instruction. > But if there are few case (ex: a "set" and a "show" intructions), you > can factorize the structure and the callback function. There is an > example in my latest TSO patch: > http://dpdk.org/ml/archives/dev/2014-November/007962.html > > Regards, > Olivier ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-14 11:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14 8:52 Question about librte_cmdline Igor Ryzhov
[not found] ` <D12B450C-961B-4BF7-9D81-AC8F69DF3E55-p3dJzl6UAic@public.gmane.org>
2014-11-14 11:14 ` Olivier MATZ
[not found] ` <5465E3F8.5070606-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-11-14 11:47 ` Igor Ryzhov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).