lib: remove librte_ prefix from directory names
[dpdk.git] / lib / cmdline / cmdline_parse_num.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 _PARSE_NUM_H_
8 #define _PARSE_NUM_H_
9
10 #include <cmdline_parse.h>
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 enum cmdline_numtype {
17         RTE_UINT8 = 0,
18         RTE_UINT16,
19         RTE_UINT32,
20         RTE_UINT64,
21         RTE_INT8,
22         RTE_INT16,
23         RTE_INT32,
24         RTE_INT64
25 };
26
27 struct cmdline_token_num_data {
28         enum cmdline_numtype type;
29 };
30
31 struct cmdline_token_num {
32         struct cmdline_token_hdr hdr;
33         struct cmdline_token_num_data num_data;
34 };
35 typedef struct cmdline_token_num cmdline_parse_token_num_t;
36
37 extern struct cmdline_token_ops cmdline_token_num_ops;
38
39 int cmdline_parse_num(cmdline_parse_token_hdr_t *tk,
40         const char *srcbuf, void *res, unsigned ressize);
41 int cmdline_get_help_num(cmdline_parse_token_hdr_t *tk,
42         char *dstbuf, unsigned int size);
43
44 #define TOKEN_NUM_INITIALIZER(structure, field, numtype)    \
45 {                                                           \
46         /* hdr */                                               \
47         {                                                       \
48                 &cmdline_token_num_ops,         /* ops */           \
49                 offsetof(structure, field),     /* offset */        \
50         },                                                      \
51         /* num_data */                                          \
52         {                                                       \
53                 numtype,                        /* type */          \
54         },                                                      \
55 }
56
57 #ifdef __cplusplus
58 }
59 #endif
60
61 #endif /* _PARSE_NUM_H_ */