2
* WPA Supplicant / dbus-based control interface
3
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation.
9
* Alternatively, this software may be distributed under the terms of BSD
12
* See README and COPYING for more details.
15
#ifndef DBUS_DICT_HELPERS_H
16
#define DBUS_DICT_HELPERS_H
19
* Adding a dict to a DBusMessage
22
dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter,
23
DBusMessageIter *iter_dict);
25
dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter,
26
DBusMessageIter *iter_dict);
28
dbus_bool_t wpa_dbus_dict_append_string(DBusMessageIter *iter_dict,
29
const char *key, const char *value);
31
dbus_bool_t wpa_dbus_dict_append_byte(DBusMessageIter *iter_dict,
32
const char *key, const char value);
34
dbus_bool_t wpa_dbus_dict_append_bool(DBusMessageIter *iter_dict,
36
const dbus_bool_t value);
38
dbus_bool_t wpa_dbus_dict_append_int16(DBusMessageIter *iter_dict,
40
const dbus_int16_t value);
42
dbus_bool_t wpa_dbus_dict_append_uint16(DBusMessageIter *iter_dict,
44
const dbus_uint16_t value);
46
dbus_bool_t wpa_dbus_dict_append_int32(DBusMessageIter *iter_dict,
48
const dbus_int32_t value);
50
dbus_bool_t wpa_dbus_dict_append_uint32(DBusMessageIter *iter_dict,
52
const dbus_uint32_t value);
54
dbus_bool_t wpa_dbus_dict_append_int64(DBusMessageIter *iter_dict,
56
const dbus_int64_t value);
58
dbus_bool_t wpa_dbus_dict_append_uint64(DBusMessageIter *iter_dict,
60
const dbus_uint64_t value);
62
dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
66
dbus_bool_t wpa_dbus_dict_append_object_path(DBusMessageIter *iter_dict,
70
dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
73
const dbus_uint32_t value_len);
75
/* Manual construction and addition of string array elements */
76
dbus_bool_t wpa_dbus_dict_begin_string_array(DBusMessageIter *iter_dict,
78
DBusMessageIter *iter_dict_entry,
79
DBusMessageIter *iter_dict_val,
80
DBusMessageIter *iter_array);
82
dbus_bool_t wpa_dbus_dict_string_array_add_element(DBusMessageIter *iter_array,
85
dbus_bool_t wpa_dbus_dict_end_string_array(DBusMessageIter *iter_dict,
86
DBusMessageIter *iter_dict_entry,
87
DBusMessageIter *iter_dict_val,
88
DBusMessageIter *iter_array);
90
/* Convenience function to add a whole string list */
91
dbus_bool_t wpa_dbus_dict_append_string_array(DBusMessageIter *iter_dict,
94
const dbus_uint32_t num_items);
97
* Reading a dict from a DBusMessage
100
struct wpa_dbus_dict_entry {
101
int type; /** the dbus type of the dict entry's value */
102
int array_type; /** the dbus type of the array elements if the dict
103
entry value contains an array */
104
const char *key; /** key of the dict entry */
106
/** Possible values of the property */
110
dbus_bool_t bool_value;
111
dbus_int16_t int16_value;
112
dbus_uint16_t uint16_value;
113
dbus_int32_t int32_value;
114
dbus_uint32_t uint32_value;
115
dbus_int64_t int64_value;
116
dbus_uint64_t uint64_value;
118
char *bytearray_value;
119
char **strarray_value;
121
dbus_uint32_t array_len; /** length of the array if the dict entry's
122
value contains an array */
125
dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
126
DBusMessageIter *iter_dict);
128
dbus_bool_t wpa_dbus_dict_get_entry(DBusMessageIter *iter_dict,
129
struct wpa_dbus_dict_entry *entry);
131
dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict);
133
void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry);
135
#endif /* DBUS_DICT_HELPERS_H */