Classes | Defines | Functions | Variables
config.c File Reference
#include "includes.h"
#include "common.h"
#include "crypto/sha1.h"
#include "rsn_supp/wpa.h"
#include "eap_peer/eap.h"
#include "config.h"
Include dependency graph for config.c:

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_ssidwpa_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_ssidwpa_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_blobwpa_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_configwpa_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 Documentation

#define _FUNC (   f)
Value:
#f, wpa_config_parse_ ## f, wpa_config_write_ ## f, \
        NULL, NULL, NULL, NULL

Definition at line 1405 of file config.c.

#define _INT (   f)
Value:
#f, wpa_config_parse_int, wpa_config_write_int, \
        OFFSET(f), (void *) 0

Definition at line 1387 of file config.c.

#define _INTe (   f)
Value:
#f, wpa_config_parse_int, wpa_config_write_int, \
        OFFSET(eap.f), (void *) 0

Definition at line 1389 of file config.c.

Definition at line 1360 of file config.c.

#define _STR_LEN (   f)    _STR(f), OFFSET(f ## _len)

Definition at line 1371 of file config.c.

#define _STR_LENe (   f)    _STRe(f), OFFSET(eap.f ## _len)

Definition at line 1372 of file config.c.

#define _STR_RANGE (   f,
  min,
  max 
)    _STR_LEN(f), (void *) (min), (void *) (max)

Definition at line 1379 of file config.c.

Definition at line 1361 of file config.c.

#define FUNC (   f)    _FUNC(f), 0

Definition at line 1408 of file config.c.

#define FUNC_KEY (   f)    _FUNC(f), 1

Definition at line 1409 of file config.c.

#define INT (   f)    _INT(f), NULL, NULL, 0

Definition at line 1394 of file config.c.

#define INT_RANGE (   f,
  min,
  max 
)    _INT(f), (void *) (min), (void *) (max), 0

Definition at line 1398 of file config.c.

#define INTe (   f)    _INTe(f), NULL, NULL, 0

Definition at line 1395 of file config.c.

#define NUM_SSID_FIELDS   (sizeof(ssid_fields) / sizeof(ssid_fields[0]))

Definition at line 1525 of file config.c.

#define OFFSET (   v)    ((void *) &((struct wpa_ssid *) 0)->v)

Definition at line 1353 of file config.c.

#define STR (   f)    _STR(f), NULL, NULL, NULL, 0

Definition at line 1363 of file config.c.

#define STR_KEY (   f)    _STR(f), NULL, NULL, NULL, 1

Definition at line 1365 of file config.c.

#define STR_KEYe (   f)    _STRe(f), NULL, NULL, NULL, 1

Definition at line 1366 of file config.c.

#define STR_LEN (   f)    _STR_LEN(f), NULL, NULL, 0

Definition at line 1373 of file config.c.

#define STR_LEN_KEY (   f)    _STR_LEN(f), NULL, NULL, 1

Definition at line 1375 of file config.c.

#define STR_LENe (   f)    _STR_LENe(f), NULL, NULL, 0

Definition at line 1374 of file config.c.

#define STR_RANGE (   f,
  min,
  max 
)    _STR_RANGE(f, min, max), 0

Definition at line 1380 of file config.c.

#define STR_RANGE_KEY (   f,
  min,
  max 
)    _STR_RANGE(f, min, max), 1

Definition at line 1381 of file config.c.

#define STRe (   f)    _STRe(f), NULL, NULL, NULL, 0

Definition at line 1364 of file config.c.


Function Documentation

static int is_hex ( const u8 *  data,
size_t  len 
) [static]

Definition at line 156 of file config.c.

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

Definition at line 1751 of file config.c.

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().

Definition at line 1539 of file config.c.

struct wpa_config* wpa_config_alloc_empty ( const char *  ctrl_interface,
const char *  driver_param 
) [read]

wpa_config_alloc_empty - Allocate an empty configuration : Control interface parameters, e.g., path to UNIX domain socket : Driver parameters Returns: Pointer to allocated configuration data or NULL on failure

Definition at line 2123 of file config.c.

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()

Definition at line 2150 of file config.c.

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().

Definition at line 1684 of file config.c.

void wpa_config_free_blob ( struct wpa_config_blob blob)

wpa_config_free_blob - Free blob data : Pointer to blob to be freed

Definition at line 2078 of file config.c.

void wpa_config_free_ssid ( struct wpa_ssid ssid)

wpa_config_free_ssid - Free network/ssid configuration data : Configuration data for the network

This function frees all resources allocated for the network configuration data.

Definition at line 1662 of file config.c.

char* wpa_config_get ( struct wpa_ssid ssid,
const char *  var 
)

Definition at line 1951 of file config.c.

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.

Definition at line 1890 of file config.c.

struct wpa_config_blob* wpa_config_get_blob ( struct wpa_config config,
const char *  name 
) [read]

Definition at line 2043 of file config.c.

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

Definition at line 1731 of file config.c.

char* wpa_config_get_no_key ( struct wpa_ssid ssid,
const char *  var 
)

Definition at line 1984 of file config.c.

static int wpa_config_parse_auth_alg ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 821 of file config.c.

static int wpa_config_parse_bssid ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 282 of file config.c.

static int wpa_config_parse_cipher ( int  line,
const char *  value 
) [static]

Definition at line 644 of file config.c.

static int wpa_config_parse_freq_list ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 979 of file config.c.

static int* wpa_config_parse_freqs ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 920 of file config.c.

static int wpa_config_parse_group ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 791 of file config.c.

static int wpa_config_parse_int ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 229 of file config.c.

static int wpa_config_parse_key_mgmt ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 479 of file config.c.

static int wpa_config_parse_pairwise ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 762 of file config.c.

static int wpa_config_parse_proto ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 395 of file config.c.

static int wpa_config_parse_psk ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 321 of file config.c.

static int wpa_config_parse_scan_freq ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 963 of file config.c.

static int wpa_config_parse_str ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 96 of file config.c.

static char* wpa_config_parse_string ( const char *  value,
size_t *  len 
) [static]

Definition at line 60 of file config.c.

static int wpa_config_parse_wep_key ( u8 *  key,
size_t *  len,
int  line,
const char *  value,
int  idx 
) [static]

Definition at line 1241 of file config.c.

static int wpa_config_parse_wep_key0 ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 1268 of file config.c.

static int wpa_config_parse_wep_key1 ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 1278 of file config.c.

static int wpa_config_parse_wep_key2 ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 1288 of file config.c.

static int wpa_config_parse_wep_key3 ( const struct parse_data data,
struct wpa_ssid ssid,
int  line,
const char *  value 
) [static]

Definition at line 1298 of file config.c.

int wpa_config_remove_blob ( struct wpa_config config,
const char *  name 
)

Definition at line 2094 of file config.c.

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

Definition at line 1787 of file config.c.

int wpa_config_set ( struct wpa_ssid ssid,
const char *  var,
const char *  value,
int  line 
)

Definition at line 1844 of file config.c.

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.

Definition at line 2065 of file config.c.

void wpa_config_set_network_defaults ( struct wpa_ssid ssid)

wpa_config_set_network_defaults - Set network default values : Pointer to network configuration data

Definition at line 1817 of file config.c.

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.

Definition at line 1590 of file config.c.

void wpa_config_update_psk ( struct wpa_ssid ssid)

wpa_config_update_psk - Update WPA PSK based on passphrase and SSID : Pointer to network configuration data

This function must be called to update WPA PSK when either SSID or the passphrase has changed for the network configuration.

Definition at line 2023 of file config.c.

static char* wpa_config_write_auth_alg ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 874 of file config.c.

static char* wpa_config_write_bssid ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 298 of file config.c.

static char* wpa_config_write_cipher ( int  cipher) [static]

Definition at line 697 of file config.c.

static char* wpa_config_write_freq_list ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 1036 of file config.c.

static char* wpa_config_write_freqs ( const struct parse_data data,
const int *  freqs 
) [static]

Definition at line 996 of file config.c.

static char* wpa_config_write_group ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 813 of file config.c.

static char* wpa_config_write_int ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 260 of file config.c.

static char* wpa_config_write_key_mgmt ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 552 of file config.c.

static char* wpa_config_write_pairwise ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 783 of file config.c.

static char* wpa_config_write_proto ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 447 of file config.c.

static char* wpa_config_write_psk ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 379 of file config.c.

static char* wpa_config_write_scan_freq ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 1029 of file config.c.

static char* wpa_config_write_str ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 209 of file config.c.

static char* wpa_config_write_string ( const u8 *  value,
size_t  len 
) [static]

Definition at line 197 of file config.c.

static char* wpa_config_write_string_ascii ( const u8 *  value,
size_t  len 
) [static]

Definition at line 168 of file config.c.

static char* wpa_config_write_string_hex ( const u8 *  value,
size_t  len 
) [static]

Definition at line 184 of file config.c.

static char* wpa_config_write_wep_key ( struct wpa_ssid ssid,
int  idx 
) [static]

Definition at line 1309 of file config.c.

static char* wpa_config_write_wep_key0 ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 1318 of file config.c.

static char* wpa_config_write_wep_key1 ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 1325 of file config.c.

static char* wpa_config_write_wep_key2 ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 1332 of file config.c.

static char* wpa_config_write_wep_key3 ( const struct parse_data data,
struct wpa_ssid ssid 
) [static]

Definition at line 1339 of file config.c.


Variable Documentation

struct parse_data ssid_fields[] [static]

Definition at line 1434 of file config.c.



wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:25:16