xref: /dpdk/lib/cmdline/cmdline.h (revision 7ebfedf90ff7f42d463c9630c9272d383b37988f)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 2010-2014 Intel Corporation.
399a2dd95SBruce Richardson  * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
499a2dd95SBruce Richardson  * All rights reserved.
599a2dd95SBruce Richardson  */
699a2dd95SBruce Richardson 
799a2dd95SBruce Richardson #ifndef _CMDLINE_H_
899a2dd95SBruce Richardson #define _CMDLINE_H_
999a2dd95SBruce Richardson 
1099a2dd95SBruce Richardson #include <rte_common.h>
1199a2dd95SBruce Richardson 
1299a2dd95SBruce Richardson #include <cmdline_rdline.h>
1399a2dd95SBruce Richardson #include <cmdline_parse.h>
1499a2dd95SBruce Richardson 
1599a2dd95SBruce Richardson /**
1699a2dd95SBruce Richardson  * @file
1799a2dd95SBruce Richardson  *
1899a2dd95SBruce Richardson  * Command line API
1999a2dd95SBruce Richardson  */
2099a2dd95SBruce Richardson 
2199a2dd95SBruce Richardson #ifdef __cplusplus
2299a2dd95SBruce Richardson extern "C" {
2399a2dd95SBruce Richardson #endif
2499a2dd95SBruce Richardson 
25*1ac8dd1dSStephen Hemminger enum rdline_status {
26*1ac8dd1dSStephen Hemminger 	RDLINE_INIT,
27*1ac8dd1dSStephen Hemminger 	RDLINE_RUNNING,
28*1ac8dd1dSStephen Hemminger 	RDLINE_EXITED
29*1ac8dd1dSStephen Hemminger };
30*1ac8dd1dSStephen Hemminger 
3199a2dd95SBruce Richardson struct cmdline;
3299a2dd95SBruce Richardson 
3399a2dd95SBruce Richardson struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out);
3499a2dd95SBruce Richardson void cmdline_set_prompt(struct cmdline *cl, const char *prompt);
3599a2dd95SBruce Richardson void cmdline_free(struct cmdline *cl);
3699a2dd95SBruce Richardson void cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
3799a2dd95SBruce Richardson 	__rte_format_printf(2, 3);
3899a2dd95SBruce Richardson int cmdline_in(struct cmdline *cl, const char *buf, int size);
3999a2dd95SBruce Richardson int cmdline_write_char(struct rdline *rdl, char c);
4099a2dd95SBruce Richardson 
4199a2dd95SBruce Richardson struct rdline *
4299a2dd95SBruce Richardson cmdline_get_rdline(struct cmdline *cl);
4399a2dd95SBruce Richardson 
4499a2dd95SBruce Richardson 
4599a2dd95SBruce Richardson void cmdline_interact(struct cmdline *cl);
4699a2dd95SBruce Richardson void cmdline_quit(struct cmdline *cl);
4799a2dd95SBruce Richardson 
4899a2dd95SBruce Richardson #ifdef __cplusplus
4999a2dd95SBruce Richardson }
5099a2dd95SBruce Richardson #endif
5199a2dd95SBruce Richardson 
5299a2dd95SBruce Richardson #endif /* _CMDLINE_SOCKET_H_ */
53