#include "includes.h"
#include "common.h"
#include "crypto/sha1.h"
#include "rsn_supp/wpa.h"
#include "eap_peer/eap.h"
#include "config.h"
Go to the source code of this file.
Classes | |
struct | parse_data |
Defines | |
#define | _FUNC(f) |
#define | _INT(f) |
#define | _INTe(f) |
#define | _STR(f) #f, wpa_config_parse_str, wpa_config_write_str, OFFSET(f) |
#define | _STR_LEN(f) _STR(f), OFFSET(f ## _len) |
#define | _STR_LENe(f) _STRe(f), OFFSET(eap.f ## _len) |
#define | _STR_RANGE(f, min, max) _STR_LEN(f), (void *) (min), (void *) (max) |
#define | _STRe(f) #f, wpa_config_parse_str, wpa_config_write_str, OFFSET(eap.f) |
#define | FUNC(f) _FUNC(f), 0 |
#define | FUNC_KEY(f) _FUNC(f), 1 |
#define | INT(f) _INT(f), NULL, NULL, 0 |
#define | INT_RANGE(f, min, max) _INT(f), (void *) (min), (void *) (max), 0 |
#define | INTe(f) _INTe(f), NULL, NULL, 0 |
#define | NUM_SSID_FIELDS (sizeof(ssid_fields) / sizeof(ssid_fields[0])) |
#define | OFFSET(v) ((void *) &((struct wpa_ssid *) 0)->v) |
#define | STR(f) _STR(f), NULL, NULL, NULL, 0 |
#define | STR_KEY(f) _STR(f), NULL, NULL, NULL, 1 |
#define | STR_KEYe(f) _STRe(f), NULL, NULL, NULL, 1 |
#define | STR_LEN(f) _STR_LEN(f), NULL, NULL, 0 |
#define | STR_LEN_KEY(f) _STR_LEN(f), NULL, NULL, 1 |
#define | STR_LENe(f) _STR_LENe(f), NULL, NULL, 0 |
#define | STR_RANGE(f, min, max) _STR_RANGE(f, min, max), 0 |
#define | STR_RANGE_KEY(f, min, max) _STR_RANGE(f, min, max), 1 |
#define | STRe(f) _STRe(f), NULL, NULL, NULL, 0 |
Functions | |
static int | is_hex (const u8 *data, size_t len) |
struct wpa_ssid * | wpa_config_add_network (struct wpa_config *config) |
int | wpa_config_add_prio_network (struct wpa_config *config, struct wpa_ssid *ssid) |
void | wpa_config_free (struct wpa_config *config) |
void | wpa_config_free_ssid (struct wpa_ssid *ssid) |
char * | wpa_config_get (struct wpa_ssid *ssid, const char *var) |
char ** | wpa_config_get_all (struct wpa_ssid *ssid, int get_keys) |
struct wpa_ssid * | wpa_config_get_network (struct wpa_config *config, int id) |
char * | wpa_config_get_no_key (struct wpa_ssid *ssid, const char *var) |
static int | wpa_config_parse_auth_alg (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_bssid (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_cipher (int line, const char *value) |
static int | wpa_config_parse_freq_list (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int * | wpa_config_parse_freqs (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_group (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_int (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_key_mgmt (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_pairwise (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_proto (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_psk (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_scan_freq (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_str (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static char * | wpa_config_parse_string (const char *value, size_t *len) |
static int | wpa_config_parse_wep_key (u8 *key, size_t *len, int line, const char *value, int idx) |
static int | wpa_config_parse_wep_key0 (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_wep_key1 (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_wep_key2 (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
static int | wpa_config_parse_wep_key3 (const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) |
int | wpa_config_remove_network (struct wpa_config *config, int id) |
int | wpa_config_set (struct wpa_ssid *ssid, const char *var, const char *value, int line) |
void | wpa_config_set_network_defaults (struct wpa_ssid *ssid) |
int | wpa_config_update_prio_list (struct wpa_config *config) |
void | wpa_config_update_psk (struct wpa_ssid *ssid) |
static char * | wpa_config_write_auth_alg (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_bssid (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_cipher (int cipher) |
static char * | wpa_config_write_freq_list (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_freqs (const struct parse_data *data, const int *freqs) |
static char * | wpa_config_write_group (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_int (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_key_mgmt (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_pairwise (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_proto (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_psk (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_scan_freq (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_str (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_string (const u8 *value, size_t len) |
static char * | wpa_config_write_string_ascii (const u8 *value, size_t len) |
static char * | wpa_config_write_string_hex (const u8 *value, size_t len) |
static char * | wpa_config_write_wep_key (struct wpa_ssid *ssid, int idx) |
static char * | wpa_config_write_wep_key0 (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_wep_key1 (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_wep_key2 (const struct parse_data *data, struct wpa_ssid *ssid) |
static char * | wpa_config_write_wep_key3 (const struct parse_data *data, struct wpa_ssid *ssid) |
: Name of the blob | |
wpa_config_get_blob - Get a named configuration blob : Configuration data from wpa_config_read() Returns: Pointer to blob data or NULL if not found | |
struct wpa_config_blob * | wpa_config_get_blob (struct wpa_config *config, const char *name) |
void | wpa_config_set_blob (struct wpa_config *config, struct wpa_config_blob *blob) |
void | wpa_config_free_blob (struct wpa_config_blob *blob) |
: Name of the blob to remove | |
wpa_config_remove_blob - Remove a named configuration blob : Configuration data from wpa_config_read() Returns: 0 if blob was removed or -1 if blob was not found | |
int | wpa_config_remove_blob (struct wpa_config *config, const char *name) |
struct wpa_config * | wpa_config_alloc_empty (const char *ctrl_interface, const char *driver_param) |
void | wpa_config_debug_dump_networks (struct wpa_config *config) |
Variables | |
static struct parse_data | ssid_fields [] |
#define _STR | ( | f | ) | #f, wpa_config_parse_str, wpa_config_write_str, OFFSET(f) |
#define _STR_RANGE | ( | f, | |
min, | |||
max | |||
) | _STR_LEN(f), (void *) (min), (void *) (max) |
#define _STRe | ( | f | ) | #f, wpa_config_parse_str, wpa_config_write_str, OFFSET(eap.f) |
#define NUM_SSID_FIELDS (sizeof(ssid_fields) / sizeof(ssid_fields[0])) |
#define STR_RANGE | ( | f, | |
min, | |||
max | |||
) | _STR_RANGE(f, min, max), 0 |
#define STR_RANGE_KEY | ( | f, | |
min, | |||
max | |||
) | _STR_RANGE(f, min, max), 1 |
struct wpa_ssid* wpa_config_add_network | ( | struct wpa_config * | config | ) | [read] |
wpa_config_add_network - Add a new network with empty configuration : Configuration data from wpa_config_read() Returns: The new network configuration or NULL if operation failed
int wpa_config_add_prio_network | ( | struct wpa_config * | config, |
struct wpa_ssid * | ssid | ||
) |
wpa_config_add_prio_network - Add a network to priority lists : Configuration data from wpa_config_read() : Pointer to the network configuration to be added to the list Returns: 0 on success, -1 on failure
This function is used to add a network block to the priority list of networks. This must be called for each network when reading in the full configuration. In addition, this can be used indirectly when updating priorities by calling wpa_config_update_prio_list().
struct wpa_config* wpa_config_alloc_empty | ( | const char * | ctrl_interface, |
const char * | driver_param | ||
) | [read] |
void wpa_config_debug_dump_networks | ( | struct wpa_config * | config | ) |
wpa_config_debug_dump_networks - Debug dump of configured networks : Configuration data from wpa_config_read()
void wpa_config_free | ( | struct wpa_config * | config | ) |
wpa_config_free - Free configuration data : Configuration data from wpa_config_read()
This function frees all resources allocated for the configuration data by wpa_config_read().
void wpa_config_free_blob | ( | struct wpa_config_blob * | blob | ) |
void wpa_config_free_ssid | ( | struct wpa_ssid * | ssid | ) |
char* wpa_config_get | ( | struct wpa_ssid * | ssid, |
const char * | var | ||
) |
char** wpa_config_get_all | ( | struct wpa_ssid * | ssid, |
int | get_keys | ||
) |
wpa_config_get_all - Get all options from network configuration : Pointer to network configuration data : Determines if keys/passwords will be included in returned list Returns: NULL terminated list of all set keys and their values in the form of [key1, val1, key2, val2, ... , NULL]
This function can be used to get list of all configured network properties. The caller is responsible for freeing the returned list and all its elements.
struct wpa_config_blob* wpa_config_get_blob | ( | struct wpa_config * | config, |
const char * | name | ||
) | [read] |
struct wpa_ssid* wpa_config_get_network | ( | struct wpa_config * | config, |
int | id | ||
) | [read] |
wpa_config_get_network - Get configured network based on id : Configuration data from wpa_config_read() : Unique network id to search for Returns: Network configuration or NULL if not found
char* wpa_config_get_no_key | ( | struct wpa_ssid * | ssid, |
const char * | var | ||
) |
static int wpa_config_parse_auth_alg | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_bssid | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_cipher | ( | int | line, |
const char * | value | ||
) | [static] |
static int wpa_config_parse_freq_list | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int* wpa_config_parse_freqs | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_group | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_int | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_key_mgmt | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_pairwise | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_proto | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_psk | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_scan_freq | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_str | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static char* wpa_config_parse_string | ( | const char * | value, |
size_t * | len | ||
) | [static] |
static int wpa_config_parse_wep_key | ( | u8 * | key, |
size_t * | len, | ||
int | line, | ||
const char * | value, | ||
int | idx | ||
) | [static] |
static int wpa_config_parse_wep_key0 | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_wep_key1 | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_wep_key2 | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
static int wpa_config_parse_wep_key3 | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid, | ||
int | line, | ||
const char * | value | ||
) | [static] |
int wpa_config_remove_blob | ( | struct wpa_config * | config, |
const char * | name | ||
) |
int wpa_config_remove_network | ( | struct wpa_config * | config, |
int | id | ||
) |
wpa_config_remove_network - Remove a configured network based on id : Configuration data from wpa_config_read() : Unique network id to search for Returns: 0 on success, or -1 if the network was not found
int wpa_config_set | ( | struct wpa_ssid * | ssid, |
const char * | var, | ||
const char * | value, | ||
int | line | ||
) |
void wpa_config_set_blob | ( | struct wpa_config * | config, |
struct wpa_config_blob * | blob | ||
) |
wpa_config_set_blob - Set or add a named configuration blob : Configuration data from wpa_config_read() : New value for the blob
Adds a new configuration blob or replaces the current value of an existing blob.
void wpa_config_set_network_defaults | ( | struct wpa_ssid * | ssid | ) |
int wpa_config_update_prio_list | ( | struct wpa_config * | config | ) |
wpa_config_update_prio_list - Update network priority list : Configuration data from wpa_config_read() Returns: 0 on success, -1 on failure
This function is called to update the priority list of networks in the configuration when a network is being added or removed. This is also called if a priority for a network is changed.
void wpa_config_update_psk | ( | struct wpa_ssid * | ssid | ) |
static char* wpa_config_write_auth_alg | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_bssid | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_cipher | ( | int | cipher | ) | [static] |
static char* wpa_config_write_freq_list | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_freqs | ( | const struct parse_data * | data, |
const int * | freqs | ||
) | [static] |
static char* wpa_config_write_group | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_int | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_key_mgmt | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_pairwise | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_proto | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_psk | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_scan_freq | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_str | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_string | ( | const u8 * | value, |
size_t | len | ||
) | [static] |
static char* wpa_config_write_string_ascii | ( | const u8 * | value, |
size_t | len | ||
) | [static] |
static char* wpa_config_write_string_hex | ( | const u8 * | value, |
size_t | len | ||
) | [static] |
static char* wpa_config_write_wep_key | ( | struct wpa_ssid * | ssid, |
int | idx | ||
) | [static] |
static char* wpa_config_write_wep_key0 | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_wep_key1 | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_wep_key2 | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
static char* wpa_config_write_wep_key3 | ( | const struct parse_data * | data, |
struct wpa_ssid * | ssid | ||
) | [static] |
struct parse_data ssid_fields[] [static] |