dbus_dict_helpers.c File Reference

#include "includes.h"
#include <dbus/dbus.h>
#include "common.h"
#include "dbus_dict_helpers.h"
Include dependency graph for dbus_dict_helpers.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#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 *))

Functions

static dbus_bool_t _wpa_dbus_add_dict_entry_basic (DBusMessageIter *iter_dict, const char *key, const int value_type, const void *value)
static dbus_bool_t _wpa_dbus_add_dict_entry_byte_array (DBusMessageIter *iter_dict, const char *key, const char *value, const dbus_uint32_t value_len)
static dbus_bool_t _wpa_dbus_add_dict_entry_end (DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry, DBusMessageIter *iter_dict_val)
static dbus_bool_t _wpa_dbus_add_dict_entry_start (DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry, const char *key, const int value_type)
static dbus_bool_t _wpa_dbus_dict_entry_get_array (DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry)
static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array (DBusMessageIter *iter, int array_type, struct wpa_dbus_dict_entry *entry)
static dbus_bool_t _wpa_dbus_dict_entry_get_string_array (DBusMessageIter *iter, int array_type, struct wpa_dbus_dict_entry *entry)
static dbus_bool_t _wpa_dbus_dict_fill_value_from_variant (struct wpa_dbus_dict_entry *entry, DBusMessageIter *iter)
dbus_bool_t wpa_dbus_dict_append_bool (DBusMessageIter *iter_dict, const char *key, const dbus_bool_t value)
dbus_bool_t wpa_dbus_dict_append_byte (DBusMessageIter *iter_dict, const char *key, const char value)
dbus_bool_t wpa_dbus_dict_append_byte_array (DBusMessageIter *iter_dict, const char *key, const char *value, const dbus_uint32_t value_len)
dbus_bool_t wpa_dbus_dict_append_double (DBusMessageIter *iter_dict, const char *key, const double value)
dbus_bool_t wpa_dbus_dict_append_int16 (DBusMessageIter *iter_dict, const char *key, const dbus_int16_t value)
dbus_bool_t wpa_dbus_dict_append_int32 (DBusMessageIter *iter_dict, const char *key, const dbus_int32_t value)
dbus_bool_t wpa_dbus_dict_append_int64 (DBusMessageIter *iter_dict, const char *key, const dbus_int64_t value)
dbus_bool_t wpa_dbus_dict_append_object_path (DBusMessageIter *iter_dict, const char *key, const char *value)
dbus_bool_t wpa_dbus_dict_append_string (DBusMessageIter *iter_dict, const char *key, const char *value)
dbus_bool_t wpa_dbus_dict_append_string_array (DBusMessageIter *iter_dict, const char *key, const char **items, const dbus_uint32_t num_items)
dbus_bool_t wpa_dbus_dict_append_uint16 (DBusMessageIter *iter_dict, const char *key, const dbus_uint16_t value)
dbus_bool_t wpa_dbus_dict_append_uint32 (DBusMessageIter *iter_dict, const char *key, const dbus_uint32_t value)
dbus_bool_t wpa_dbus_dict_append_uint64 (DBusMessageIter *iter_dict, const char *key, const dbus_uint64_t value)
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_close_write (DBusMessageIter *iter, DBusMessageIter *iter_dict)
dbus_bool_t wpa_dbus_dict_end_string_array (DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry, DBusMessageIter *iter_dict_val, DBusMessageIter *iter_array)
void wpa_dbus_dict_entry_clear (struct wpa_dbus_dict_entry *entry)
dbus_bool_t wpa_dbus_dict_get_entry (DBusMessageIter *iter_dict, struct wpa_dbus_dict_entry *entry)
dbus_bool_t wpa_dbus_dict_has_dict_entry (DBusMessageIter *iter_dict)
dbus_bool_t wpa_dbus_dict_open_read (DBusMessageIter *iter, DBusMessageIter *iter_dict)
dbus_bool_t wpa_dbus_dict_open_write (DBusMessageIter *iter, DBusMessageIter *iter_dict)
dbus_bool_t wpa_dbus_dict_string_array_add_element (DBusMessageIter *iter_array, const char *elem)
const char * wpa_dbus_type_as_string (const int type)

Define Documentation

#define BYTE_ARRAY_CHUNK_SIZE   34

Definition at line 614 of file dbus_dict_helpers.c.

#define BYTE_ARRAY_ITEM_SIZE   (sizeof(char))

Definition at line 615 of file dbus_dict_helpers.c.

#define STR_ARRAY_CHUNK_SIZE   8

Definition at line 671 of file dbus_dict_helpers.c.

#define STR_ARRAY_ITEM_SIZE   (sizeof(char *))

Definition at line 672 of file dbus_dict_helpers.c.


Function Documentation

static dbus_bool_t _wpa_dbus_add_dict_entry_basic ( DBusMessageIter *  iter_dict,
const char *  key,
const int  value_type,
const void *  value 
) [static]

Definition at line 135 of file dbus_dict_helpers.c.

static dbus_bool_t _wpa_dbus_add_dict_entry_byte_array ( DBusMessageIter *  iter_dict,
const char *  key,
const char *  value,
const dbus_uint32_t  value_len 
) [static]

Definition at line 170 of file dbus_dict_helpers.c.

static dbus_bool_t _wpa_dbus_add_dict_entry_end ( DBusMessageIter *  iter_dict,
DBusMessageIter *  iter_dict_entry,
DBusMessageIter *  iter_dict_val 
) [static]

Definition at line 122 of file dbus_dict_helpers.c.

static dbus_bool_t _wpa_dbus_add_dict_entry_start ( DBusMessageIter *  iter_dict,
DBusMessageIter *  iter_dict_entry,
const char *  key,
const int  value_type 
) [static]

Definition at line 105 of file dbus_dict_helpers.c.

static dbus_bool_t _wpa_dbus_dict_entry_get_array ( DBusMessageIter *  iter_dict_val,
struct wpa_dbus_dict_entry entry 
) [static]

Definition at line 736 of file dbus_dict_helpers.c.

static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array ( DBusMessageIter *  iter,
int  array_type,
struct wpa_dbus_dict_entry entry 
) [static]

Definition at line 617 of file dbus_dict_helpers.c.

static dbus_bool_t _wpa_dbus_dict_entry_get_string_array ( DBusMessageIter *  iter,
int  array_type,
struct wpa_dbus_dict_entry entry 
) [static]

Definition at line 674 of file dbus_dict_helpers.c.

static dbus_bool_t _wpa_dbus_dict_fill_value_from_variant ( struct wpa_dbus_dict_entry entry,
DBusMessageIter *  iter 
) [static]

Definition at line 767 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The boolean value
Returns:
TRUE on success, FALSE on failure

Definition at line 259 of file dbus_dict_helpers.c.

dbus_bool_t wpa_dbus_dict_append_byte ( DBusMessageIter *  iter_dict,
const char *  key,
const char  value 
)

Add a byte entry to the dict.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The byte value
Returns:
TRUE on success, FALSE on failure

Definition at line 241 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The byte array
value_len The length of the byte array, in bytes
Returns:
TRUE on success, FALSE on failure

Definition at line 431 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The double-precision floating point value
Returns:
TRUE on success, FALSE on failure

Definition at line 391 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The 16-bit signed integer value
Returns:
TRUE on success, FALSE on failure

Definition at line 277 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The 32-bit signed integer value
Returns:
TRUE on success, FALSE on failure

Definition at line 315 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The 64-bit integer value
Returns:
TRUE on success, FALSE on failure

Definition at line 353 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The DBus object path value
Returns:
TRUE on success, FALSE on failure

Definition at line 409 of file dbus_dict_helpers.c.

dbus_bool_t wpa_dbus_dict_append_string ( DBusMessageIter *  iter_dict,
const char *  key,
const char *  value 
)

Add a string entry to the dict.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The string value
Returns:
TRUE on success, FALSE on failure

Definition at line 221 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
items The array of strings
num_items The number of strings in the array
Returns:
TRUE on success, FALSE on failure

Definition at line 554 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The 16-bit unsigned integer value
Returns:
TRUE on success, FALSE on failure

Definition at line 296 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The 32-bit unsigned integer value
Returns:
TRUE on success, FALSE on failure

Definition at line 334 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
value The 64-bit unsigned integer value
Returns:
TRUE on success, FALSE on failure

Definition at line 372 of file dbus_dict_helpers.c.

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 
)

Begin a string array entry in the dict

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
key The key of the dict item
iter_dict_entry A private DBusMessageIter provided by the caller to be passed to wpa_dbus_dict_end_string_array()
iter_dict_val A private DBusMessageIter provided by the caller to be passed to wpa_dbus_dict_end_string_array()
iter_array On return, the DBusMessageIter to be passed to wpa_dbus_dict_string_array_add_element()
Returns:
TRUE on success, FALSE on failure

Definition at line 460 of file dbus_dict_helpers.c.

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

Parameters:
iter valid dbus message iterator, same as passed to wpa_dbus_dict_open_write()
iter_dict a dbus dict iterator returned from wpa_dbus_dict_open_write()
Returns:
TRUE on success, FALSE on failure

Definition at line 62 of file dbus_dict_helpers.c.

dbus_bool_t wpa_dbus_dict_end_string_array ( DBusMessageIter *  iter_dict,
DBusMessageIter *  iter_dict_entry,
DBusMessageIter *  iter_dict_val,
DBusMessageIter *  iter_array 
)

End a string array dict entry

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_write()
iter_dict_entry A private DBusMessageIter returned from wpa_dbus_dict_end_string_array()
iter_dict_val A private DBusMessageIter returned from wpa_dbus_dict_end_string_array()
iter_array A DBusMessageIter returned from wpa_dbus_dict_end_string_array()
Returns:
TRUE on success, FALSE on failure

Definition at line 524 of file dbus_dict_helpers.c.

void wpa_dbus_dict_entry_clear ( struct wpa_dbus_dict_entry entry  ) 

Free any memory used by the entry object.

Parameters:
entry The entry object

Definition at line 897 of file dbus_dict_helpers.c.

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.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_read()
entry A valid dict entry object into which the dict key and value will be placed
Returns:
TRUE on success, FALSE on failure

Definition at line 833 of file dbus_dict_helpers.c.

dbus_bool_t wpa_dbus_dict_has_dict_entry ( DBusMessageIter *  iter_dict  ) 

Return whether or not there are additional dictionary entries.

Parameters:
iter_dict A valid DBusMessageIter returned from wpa_dbus_dict_open_read()
Returns:
TRUE if more dict entries exists, FALSE if no more dict entries exist

Definition at line 883 of file dbus_dict_helpers.c.

dbus_bool_t wpa_dbus_dict_open_read ( DBusMessageIter *  iter,
DBusMessageIter *  iter_dict 
)

Start reading from a dbus dict.

Parameters:
iter A valid DBusMessageIter pointing to the start of the dict
iter_dict (out) A DBusMessageIter to be passed to wpa_dbus_dict_read_next_entry()
Returns:
TRUE on success, FALSE on failure

Definition at line 599 of file dbus_dict_helpers.c.

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

Parameters:
iter A valid dbus message iterator
iter_dict (out) A dict iterator to pass to further dict functions
Returns:
TRUE on success, FALSE on failure

Definition at line 31 of file dbus_dict_helpers.c.

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

Parameters:
iter_array A valid DBusMessageIter returned from wpa_dbus_dict_begin_string_array()'s iter_array parameter
elem The string element to be added to the dict entry's string array
Returns:
TRUE on success, FALSE on failure

Definition at line 499 of file dbus_dict_helpers.c.

const char* wpa_dbus_type_as_string ( const int  type  ) 

Definition at line 72 of file dbus_dict_helpers.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Fri Jan 11 10:01:46 2013