Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: ics
Fetching contributors…

Cannot retrieve contributors at this time

file 135 lines (107 sloc) 4.557 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
/*
* WPA Supplicant / dbus-based control interface
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*/

#ifndef DBUS_DICT_HELPERS_H
#define DBUS_DICT_HELPERS_H

/*
* Adding a dict to a DBusMessage
*/

dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter,
DBusMessageIter *iter_dict);

dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter,
DBusMessageIter *iter_dict);

dbus_bool_t wpa_dbus_dict_append_string(DBusMessageIter *iter_dict,
const char *key, const char *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_bool(DBusMessageIter *iter_dict,
const char *key,
const dbus_bool_t 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_uint16(DBusMessageIter *iter_dict,
const char *key,
const dbus_uint16_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_uint32(DBusMessageIter *iter_dict,
const char *key,
const dbus_uint32_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_uint64(DBusMessageIter *iter_dict,
const char *key,
const dbus_uint64_t value);

dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
const char *key,
const double 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_byte_array(DBusMessageIter *iter_dict,
const char *key,
const char *value,
const dbus_uint32_t value_len);

/* Manual construction and addition of string array elements */
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);

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

/* Convenience function to add a whole string list */
dbus_bool_t wpa_dbus_dict_append_string_array(DBusMessageIter *iter_dict,
const char *key,
const char **items,
const dbus_uint32_t num_items);

/*
* Reading a dict from a DBusMessage
*/

struct wpa_dbus_dict_entry {
int type; /** the dbus type of the dict entry's value */
int array_type; /** the dbus type of the array elements if the dict
entry value contains an array */
const char *key; /** key of the dict entry */

/** Possible values of the property */
union {
char *str_value;
char byte_value;
dbus_bool_t bool_value;
dbus_int16_t int16_value;
dbus_uint16_t uint16_value;
dbus_int32_t int32_value;
dbus_uint32_t uint32_value;
dbus_int64_t int64_value;
dbus_uint64_t uint64_value;
double double_value;
char *bytearray_value;
char **strarray_value;
};
dbus_uint32_t array_len; /** length of the array if the dict entry's
value contains an array */
};

dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
DBusMessageIter *iter_dict);

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

void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry);

#endif /* DBUS_DICT_HELPERS_H */
Something went wrong with that request. Please try again.