xref: /dpdk/lib/cmdline/cmdline.h (revision 60531a2c53f4d2b4b96ebb10ca813f62d0a5508d)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation.
3  * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
4  * All rights reserved.
5  */
6 
7 #ifndef _CMDLINE_H_
8 #define _CMDLINE_H_
9 
10 #include <rte_common.h>
11 #include <rte_compat.h>
12 
13 #include <cmdline_rdline.h>
14 #include <cmdline_parse.h>
15 
16 /**
17  * @file
18  *
19  * Command line API
20  */
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 enum rdline_status {
27 	RDLINE_INIT,
28 	RDLINE_RUNNING,
29 	RDLINE_EXITED
30 };
31 
32 struct cmdline;
33 
34 struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out);
35 void cmdline_set_prompt(struct cmdline *cl, const char *prompt);
36 void cmdline_free(struct cmdline *cl);
37 void cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
38 	__rte_format_printf(2, 3);
39 int cmdline_in(struct cmdline *cl, const char *buf, int size);
40 int cmdline_write_char(struct rdline *rdl, char c);
41 
42 __rte_experimental
43 struct rdline *
44 cmdline_get_rdline(struct cmdline *cl);
45 
46 
47 void cmdline_interact(struct cmdline *cl);
48 void cmdline_quit(struct cmdline *cl);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif /* _CMDLINE_SOCKET_H_ */
55