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