wpa_supplicant / hostapd
2.5
|
WPA Supplicant / dbus-based control interface. More...
#include "includes.h"
#include <dbus/dbus.h>
#include "common.h"
#include "wpabuf.h"
#include "dbus_dict_helpers.h"
Macros | |
#define | BYTE_ARRAY_CHUNK_SIZE 34 |
#define | BYTE_ARRAY_ITEM_SIZE (sizeof(char)) |
#define | STR_ARRAY_CHUNK_SIZE 8 |
#define | STR_ARRAY_ITEM_SIZE (sizeof(char *)) |
#define | BIN_ARRAY_CHUNK_SIZE 10 |
#define | BIN_ARRAY_ITEM_SIZE (sizeof(struct wpabuf *)) |
Functions | |
dbus_bool_t | wpa_dbus_dict_open_write (DBusMessageIter *iter, DBusMessageIter *iter_dict) |
Start a dict in a dbus message. Should be paired with a call to wpa_dbus_dict_close_write(). More... | |
dbus_bool_t | wpa_dbus_dict_close_write (DBusMessageIter *iter, DBusMessageIter *iter_dict) |
End a dict element in a dbus message. Should be paired with a call to wpa_dbus_dict_open_write(). More... | |
const char * | wpa_dbus_type_as_string (const int type) |
dbus_bool_t | wpa_dbus_dict_append_string (DBusMessageIter *iter_dict, const char *key, const char *value) |
Add a string entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_byte (DBusMessageIter *iter_dict, const char *key, const char value) |
Add a byte entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_bool (DBusMessageIter *iter_dict, const char *key, const dbus_bool_t value) |
Add a boolean entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_int16 (DBusMessageIter *iter_dict, const char *key, const dbus_int16_t value) |
Add a 16-bit signed integer entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_uint16 (DBusMessageIter *iter_dict, const char *key, const dbus_uint16_t value) |
Add a 16-bit unsigned integer entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_int32 (DBusMessageIter *iter_dict, const char *key, const dbus_int32_t value) |
Add a 32-bit signed integer to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_uint32 (DBusMessageIter *iter_dict, const char *key, const dbus_uint32_t value) |
Add a 32-bit unsigned integer entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_int64 (DBusMessageIter *iter_dict, const char *key, const dbus_int64_t value) |
Add a 64-bit integer entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_uint64 (DBusMessageIter *iter_dict, const char *key, const dbus_uint64_t value) |
Add a 64-bit unsigned integer entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_double (DBusMessageIter *iter_dict, const char *key, const double value) |
Add a double-precision floating point entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_object_path (DBusMessageIter *iter_dict, const char *key, const char *value) |
Add a DBus object path entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_byte_array (DBusMessageIter *iter_dict, const char *key, const char *value, const dbus_uint32_t value_len) |
Add a byte array entry to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_begin_array (DBusMessageIter *iter_dict, const char *key, const char *type, DBusMessageIter *iter_dict_entry, DBusMessageIter *iter_dict_val, DBusMessageIter *iter_array) |
Begin an array entry in the dict. More... | |
dbus_bool_t | wpa_dbus_dict_begin_string_array (DBusMessageIter *iter_dict, const char *key, DBusMessageIter *iter_dict_entry, DBusMessageIter *iter_dict_val, DBusMessageIter *iter_array) |
dbus_bool_t | wpa_dbus_dict_string_array_add_element (DBusMessageIter *iter_array, const char *elem) |
Add a single string element to a string array dict entry. More... | |
dbus_bool_t | wpa_dbus_dict_bin_array_add_element (DBusMessageIter *iter_array, const u8 *value, size_t value_len) |
Add a single byte array element to a string array dict entry. More... | |
dbus_bool_t | wpa_dbus_dict_end_array (DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry, DBusMessageIter *iter_dict_val, DBusMessageIter *iter_array) |
End an array dict entry. More... | |
dbus_bool_t | wpa_dbus_dict_append_string_array (DBusMessageIter *iter_dict, const char *key, const char **items, const dbus_uint32_t num_items) |
Convenience function to add an entire string array to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_append_wpabuf_array (DBusMessageIter *iter_dict, const char *key, const struct wpabuf **items, const dbus_uint32_t num_items) |
Convenience function to add an wpabuf binary array to the dict. More... | |
dbus_bool_t | wpa_dbus_dict_open_read (DBusMessageIter *iter, DBusMessageIter *iter_dict, DBusError *error) |
Start reading from a dbus dict. More... | |
dbus_bool_t | wpa_dbus_dict_get_entry (DBusMessageIter *iter_dict, struct wpa_dbus_dict_entry *entry) |
Read the current key/value entry from the dict. Entries are dynamically allocated when needed and must be freed after use with the wpa_dbus_dict_entry_clear() function. More... | |
dbus_bool_t | wpa_dbus_dict_has_dict_entry (DBusMessageIter *iter_dict) |
Return whether or not there are additional dictionary entries. More... | |
void | wpa_dbus_dict_entry_clear (struct wpa_dbus_dict_entry *entry) |
Free any memory used by the entry object. More... | |
WPA Supplicant / dbus-based control interface.
dbus_bool_t wpa_dbus_dict_append_bool | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const dbus_bool_t | value | ||
) |
Add a boolean entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The boolean value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_byte | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const char | value | ||
) |
Add a byte entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The byte value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_byte_array | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const char * | value, | ||
const dbus_uint32_t | value_len | ||
) |
Add a byte array entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The byte array |
param | value_len The length of the byte array, in bytes |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_double | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const double | value | ||
) |
Add a double-precision floating point entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The double-precision floating point value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_int16 | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const dbus_int16_t | value | ||
) |
Add a 16-bit signed integer entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The 16-bit signed integer value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_int32 | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const dbus_int32_t | value | ||
) |
Add a 32-bit signed integer to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The 32-bit signed integer value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_int64 | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const dbus_int64_t | value | ||
) |
Add a 64-bit integer entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The 64-bit integer value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_object_path | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const char * | value | ||
) |
Add a DBus object path entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The DBus object path value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_string | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const char * | value | ||
) |
Add a string entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The string value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_string_array | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const char ** | items, | ||
const dbus_uint32_t | num_items | ||
) |
Convenience function to add an entire string array to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | items The array of strings |
param | num_items The number of strings in the array |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_uint16 | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const dbus_uint16_t | value | ||
) |
Add a 16-bit unsigned integer entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The 16-bit unsigned integer value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_uint32 | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const dbus_uint32_t | value | ||
) |
Add a 32-bit unsigned integer entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The 32-bit unsigned integer value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_uint64 | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const dbus_uint64_t | value | ||
) |
Add a 64-bit unsigned integer entry to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | value The 64-bit unsigned integer value |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_append_wpabuf_array | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const struct wpabuf ** | items, | ||
const dbus_uint32_t | num_items | ||
) |
Convenience function to add an wpabuf binary array to the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | items The array of wpabuf structures |
param | num_items The number of strings in the array |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_begin_array | ( | DBusMessageIter * | iter_dict, |
const char * | key, | ||
const char * | type, | ||
DBusMessageIter * | iter_dict_entry, | ||
DBusMessageIter * | iter_dict_val, | ||
DBusMessageIter * | iter_array | ||
) |
Begin an array entry in the dict.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | key The key of the dict item |
param | type The type of the contained data |
param | iter_dict_entry A private DBusMessageIter provided by the caller to be passed to wpa_dbus_dict_end_string_array() |
param | iter_dict_val A private DBusMessageIter provided by the caller to be passed to wpa_dbus_dict_end_string_array() |
param | iter_array On return, the DBusMessageIter to be passed to wpa_dbus_dict_string_array_add_element() |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_bin_array_add_element | ( | DBusMessageIter * | iter_array, |
const u8 * | value, | ||
size_t | value_len | ||
) |
Add a single byte array element to a string array dict entry.
param | iter_array A valid DBusMessageIter returned from wpa_dbus_dict_begin_array()'s iter_array parameter – note that wpa_dbus_dict_begin_array() must have been called with "ay" as the type |
param | value The data to be added to the dict entry's array |
param | value_len The length of the data |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_close_write | ( | DBusMessageIter * | iter, |
DBusMessageIter * | iter_dict | ||
) |
End a dict element in a dbus message. Should be paired with a call to wpa_dbus_dict_open_write().
param | iter valid dbus message iterator, same as passed to wpa_dbus_dict_open_write() |
param | iter_dict a dbus dict iterator returned from wpa_dbus_dict_open_write() |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_end_array | ( | DBusMessageIter * | iter_dict, |
DBusMessageIter * | iter_dict_entry, | ||
DBusMessageIter * | iter_dict_val, | ||
DBusMessageIter * | iter_array | ||
) |
End an array dict entry.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write() |
param | iter_dict_entry A private DBusMessageIter returned from wpa_dbus_dict_begin_string_array() or wpa_dbus_dict_begin_array() |
param | iter_dict_val A private DBusMessageIter returned from wpa_dbus_dict_begin_string_array() or wpa_dbus_dict_begin_array() |
param | iter_array A DBusMessageIter returned from wpa_dbus_dict_begin_string_array() or wpa_dbus_dict_begin_array() |
return | TRUE on success, FALSE on failure |
void wpa_dbus_dict_entry_clear | ( | struct wpa_dbus_dict_entry * | entry | ) |
Free any memory used by the entry object.
param | entry The entry object |
dbus_bool_t wpa_dbus_dict_get_entry | ( | DBusMessageIter * | iter_dict, |
struct wpa_dbus_dict_entry * | entry | ||
) |
Read the current key/value entry from the dict. Entries are dynamically allocated when needed and must be freed after use with the wpa_dbus_dict_entry_clear() function.
The returned entry object will be filled with the type and value of the next entry in the dict, or the type will be DBUS_TYPE_INVALID if an error occurred.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_read() |
param | entry A valid dict entry object into which the dict key and value will be placed |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_has_dict_entry | ( | DBusMessageIter * | iter_dict | ) |
Return whether or not there are additional dictionary entries.
param | iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_read() |
return | TRUE if more dict entries exists, FALSE if no more dict entries exist |
dbus_bool_t wpa_dbus_dict_open_read | ( | DBusMessageIter * | iter, |
DBusMessageIter * | iter_dict, | ||
DBusError * | error | ||
) |
Start reading from a dbus dict.
param | iter A valid DBusMessageIter pointing to the start of the dict |
param | iter_dict (out) A DBusMessageIter to be passed to wpa_dbus_dict_read_next_entry() |
error | on failure a descriptive error |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_open_write | ( | DBusMessageIter * | iter, |
DBusMessageIter * | iter_dict | ||
) |
Start a dict in a dbus message. Should be paired with a call to wpa_dbus_dict_close_write().
param | iter A valid dbus message iterator |
param | iter_dict (out) A dict iterator to pass to further dict functions |
return | TRUE on success, FALSE on failure |
dbus_bool_t wpa_dbus_dict_string_array_add_element | ( | DBusMessageIter * | iter_array, |
const char * | elem | ||
) |
Add a single string element to a string array dict entry.
param | iter_array A valid DBusMessageIter returned from wpa_dbus_dict_begin_string_array()'s iter_array parameter |
param | elem The string element to be added to the dict entry's string array |
return | TRUE on success, FALSE on failure |