Move parts of wpa_cli to a new common file

In preparation for adding further command completion support
to hostapd_cli move some cli related utility functions out of
wpa_cli into a new common cli file.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
This commit is contained in:
Mikael Kanstrup 2016-07-07 14:04:34 +02:00 committed by Jouni Malinen
parent 6cad0bff06
commit 977c0796f9
8 changed files with 203 additions and 145 deletions

37
src/common/cli.h Normal file
View file

@ -0,0 +1,37 @@
/*
* Common hostapd/wpa_supplicant command line interface functionality
* Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#ifndef CLI_H
#define CLI_H
#include "utils/list.h"
struct cli_txt_entry {
struct dl_list list;
char *txt;
};
void cli_txt_list_free(struct cli_txt_entry *e);
void cli_txt_list_flush(struct dl_list *list);
struct cli_txt_entry *
cli_txt_list_get(struct dl_list *txt_list, const char *txt);
void cli_txt_list_del(struct dl_list *txt_list, const char *txt);
void cli_txt_list_del_addr(struct dl_list *txt_list, const char *txt);
void cli_txt_list_del_word(struct dl_list *txt_list, const char *txt,
int separator);
int cli_txt_list_add(struct dl_list *txt_list, const char *txt);
int cli_txt_list_add_addr(struct dl_list *txt_list, const char *txt);
int cli_txt_list_add_word(struct dl_list *txt_list, const char *txt,
int separator);
char ** cli_txt_list_array(struct dl_list *txt_list);
#endif /* CLI_H */