CNDP  22.08.0
cli_search.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2019-2022 Intel Corporation.
3  */
4 
5 #ifndef _CLI_SEARCH_H_
6 #define _CLI_SEARCH_H_
7 
8 #include <stdio.h>
9 #include <stdint.h> // for uint32_t, uint16_t, uint64_t
10 #include <stdlib.h>
11 #include <string.h>
12 #include <stdarg.h>
13 #include <unistd.h>
14 #include <inttypes.h>
15 
16 #include "cne_common.h" // for CNDP_API
17 
18 // IWYU pragma: no_forward_declare cli_node
19 struct cli_node;
20 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 typedef union {
32  void *voidp;
33  char chr[8];
34  uint64_t u64;
35  uint32_t u32[2];
36  uint16_t u16[4];
37 } arg_u;
39 typedef struct {
40  arg_u arg1; /* Argument Word 1 */
41  arg_u arg2; /* Argument Word 2 */
42  arg_u arg3; /* Argument Word 3 */
43  arg_u arg4; /* Argument Word 4 */
44 } args_t; /* 32 bytes of arguments */
45 
46 struct cli;
47 struct cli_node;
48 
49 typedef int (*cli_scan_t)(struct cli_node *node, uint32_t flags, args_t *args);
68 CNDP_API int cli_scan_directory(struct cli_node *dir, cli_scan_t func, uint32_t flags,
69  args_t *args);
70 
83 CNDP_API int cli_find_node(const char *path, struct cli_node **ret);
84 
95 CNDP_API struct cli_node *cli_find_cmd(const char *path);
96 
109 CNDP_API uint32_t cli_dir_item_count(struct cli_node *node, uint32_t types);
110 
119 CNDP_API uint32_t cli_path_cmd_count(void);
120 
135 CNDP_API uint32_t cli_node_list_with_type(struct cli_node *node, uint32_t flags, void **ret);
136 
147 CNDP_API void cli_node_list_free(void *node);
148 
159 CNDP_API uint32_t cli_path_item_count(uint32_t types);
160 
171 CNDP_API struct cli_node *cli_last_dir_in_path(const char *path);
172 
187 CNDP_API struct cli_node *cli_search_dir(struct cli_node *dir, const char *name, uint32_t type);
188 
205 CNDP_API int cli_scan_path(const char *path, cli_scan_t func, uint32_t flags, args_t *args);
206 
207 #ifdef __cplusplus
208 }
209 #endif
210 
211 #endif /* _CLI_SEARCH_H_ */
CNDP_API int cli_find_node(const char *path, struct cli_node **ret)
CNDP_API uint32_t cli_dir_item_count(struct cli_node *node, uint32_t types)
CNDP_API uint32_t cli_path_cmd_count(void)
CNDP_API uint32_t cli_path_item_count(uint32_t types)
CNDP_API struct cli_node * cli_find_cmd(const char *path)
CNDP_API struct cli_node * cli_search_dir(struct cli_node *dir, const char *name, uint32_t type)
CNDP_API void cli_node_list_free(void *node)
CNDP_API int cli_scan_path(const char *path, cli_scan_t func, uint32_t flags, args_t *args)
CNDP_API struct cli_node * cli_last_dir_in_path(const char *path)
CNDP_API uint32_t cli_node_list_with_type(struct cli_node *node, uint32_t flags, void **ret)
CNDP_API int cli_scan_directory(struct cli_node *dir, cli_scan_t func, uint32_t flags, args_t *args)