]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/lib/librte_cmdline/cmdline.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / dpdk / lib / librte_cmdline / cmdline.h
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
12 #include <termios.h>
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 struct cmdline {
27 int s_in;
28 int s_out;
29 cmdline_parse_ctx_t *ctx;
30 struct rdline rdl;
31 char prompt[RDLINE_PROMPT_SIZE];
32 struct termios oldterm;
33 };
34
35 struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out);
36 void cmdline_set_prompt(struct cmdline *cl, const char *prompt);
37 void cmdline_free(struct cmdline *cl);
38 void cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
39 __rte_format_printf(2, 3);
40 int cmdline_in(struct cmdline *cl, const char *buf, int size);
41 int cmdline_write_char(struct rdline *rdl, char c);
42
43 /**
44 * This function is nonblocking equivalent of ``cmdline_interact()``. It polls
45 * *cl* for one character and interpret it. If return value is *RDLINE_EXITED*
46 * it mean that ``cmdline_quit()`` was invoked.
47 *
48 * @param cl
49 * The command line object.
50 *
51 * @return
52 * On success return object status - one of *enum rdline_status*.
53 * On error return negative value.
54 */
55 int cmdline_poll(struct cmdline *cl);
56
57 void cmdline_interact(struct cmdline *cl);
58 void cmdline_quit(struct cmdline *cl);
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64 #endif /* _CMDLINE_SOCKET_H_ */