xref: /freebsd/contrib/wpa/src/common/cli.h (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1 /*
2  * Common hostapd/wpa_supplicant command line interface functionality
3  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef CLI_H
10 #define CLI_H
11 
12 #include "utils/list.h"
13 
14 extern const char *const cli_license;
15 extern const char *const cli_full_license;
16 
17 struct cli_txt_entry {
18 	struct dl_list list;
19 	char *txt;
20 };
21 
22 void cli_txt_list_free(struct cli_txt_entry *e);
23 void cli_txt_list_flush(struct dl_list *list);
24 
25 struct cli_txt_entry *
26 cli_txt_list_get(struct dl_list *txt_list, const char *txt);
27 
28 void cli_txt_list_del(struct dl_list *txt_list, const char *txt);
29 void cli_txt_list_del_addr(struct dl_list *txt_list, const char *txt);
30 void cli_txt_list_del_word(struct dl_list *txt_list, const char *txt,
31 			   int separator);
32 
33 int cli_txt_list_add(struct dl_list *txt_list, const char *txt);
34 int cli_txt_list_add_addr(struct dl_list *txt_list, const char *txt);
35 int cli_txt_list_add_word(struct dl_list *txt_list, const char *txt,
36 			  int separator);
37 
38 char ** cli_txt_list_array(struct dl_list *txt_list);
39 
40 int get_cmd_arg_num(const char *str, int pos);
41 int write_cmd(char *buf, size_t buflen, const char *cmd, int argc,
42 	      char *argv[]);
43 
44 #define max_args 10
45 int tokenize_cmd(char *cmd, char *argv[]);
46 
47 #endif /* CLI_H */
48