dbus_dict_helpers.h
Go to the documentation of this file.
00001 /*
00002  * WPA Supplicant / dbus-based control interface
00003  * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  */
00014 
00015 #ifndef DBUS_DICT_HELPERS_H
00016 #define DBUS_DICT_HELPERS_H
00017 
00018 /*
00019  * Adding a dict to a DBusMessage
00020  */
00021 
00022 dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter,
00023                                      DBusMessageIter *iter_dict);
00024 
00025 dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter,
00026                                       DBusMessageIter *iter_dict);
00027 
00028 const char * wpa_dbus_type_as_string(const int type);
00029 
00030 dbus_bool_t wpa_dbus_dict_append_string(DBusMessageIter *iter_dict,
00031                                         const char *key, const char *value);
00032 
00033 dbus_bool_t wpa_dbus_dict_append_byte(DBusMessageIter *iter_dict,
00034                                       const char *key, const char value);
00035 
00036 dbus_bool_t wpa_dbus_dict_append_bool(DBusMessageIter *iter_dict,
00037                                       const char *key,
00038                                       const dbus_bool_t value);
00039 
00040 dbus_bool_t wpa_dbus_dict_append_int16(DBusMessageIter *iter_dict,
00041                                        const char *key,
00042                                        const dbus_int16_t value);
00043 
00044 dbus_bool_t wpa_dbus_dict_append_uint16(DBusMessageIter *iter_dict,
00045                                         const char *key,
00046                                         const dbus_uint16_t value);
00047 
00048 dbus_bool_t wpa_dbus_dict_append_int32(DBusMessageIter *iter_dict,
00049                                        const char *key,
00050                                        const dbus_int32_t value);
00051 
00052 dbus_bool_t wpa_dbus_dict_append_uint32(DBusMessageIter *iter_dict,
00053                                         const char *key,
00054                                         const dbus_uint32_t value);
00055 
00056 dbus_bool_t wpa_dbus_dict_append_int64(DBusMessageIter *iter_dict,
00057                                        const char *key,
00058                                        const dbus_int64_t value);
00059 
00060 dbus_bool_t wpa_dbus_dict_append_uint64(DBusMessageIter *iter_dict,
00061                                         const char *key,
00062                                         const dbus_uint64_t value);
00063 
00064 dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
00065                                         const char *key,
00066                                         const double value);
00067 
00068 dbus_bool_t wpa_dbus_dict_append_object_path(DBusMessageIter *iter_dict,
00069                                              const char *key,
00070                                              const char *value);
00071 
00072 dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
00073                                             const char *key,
00074                                             const char *value,
00075                                             const dbus_uint32_t value_len);
00076 
00077 /* Manual construction and addition of string array elements */
00078 dbus_bool_t wpa_dbus_dict_begin_string_array(DBusMessageIter *iter_dict,
00079                                              const char *key,
00080                                              DBusMessageIter *iter_dict_entry,
00081                                              DBusMessageIter *iter_dict_val,
00082                                              DBusMessageIter *iter_array);
00083 
00084 dbus_bool_t wpa_dbus_dict_string_array_add_element(DBusMessageIter *iter_array,
00085                                              const char *elem);
00086 
00087 dbus_bool_t wpa_dbus_dict_end_string_array(DBusMessageIter *iter_dict,
00088                                            DBusMessageIter *iter_dict_entry,
00089                                            DBusMessageIter *iter_dict_val,
00090                                            DBusMessageIter *iter_array);
00091 
00092 /* Convenience function to add a whole string list */
00093 dbus_bool_t wpa_dbus_dict_append_string_array(DBusMessageIter *iter_dict,
00094                                               const char *key,
00095                                               const char **items,
00096                                               const dbus_uint32_t num_items);
00097 
00098 /*
00099  * Reading a dict from a DBusMessage
00100  */
00101 
00102 struct wpa_dbus_dict_entry {
00103         int type;         
00104         int array_type;   
00106         const char *key;  
00109         union {
00110                 char *str_value;
00111                 char byte_value;
00112                 dbus_bool_t bool_value;
00113                 dbus_int16_t int16_value;
00114                 dbus_uint16_t uint16_value;
00115                 dbus_int32_t int32_value;
00116                 dbus_uint32_t uint32_value;
00117                 dbus_int64_t int64_value;
00118                 dbus_uint64_t uint64_value;
00119                 double double_value;
00120                 char *bytearray_value;
00121                 char **strarray_value;
00122         };
00123         dbus_uint32_t array_len; 
00125 };
00126 
00127 dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
00128                                     DBusMessageIter *iter_dict);
00129 
00130 dbus_bool_t wpa_dbus_dict_get_entry(DBusMessageIter *iter_dict,
00131                                     struct wpa_dbus_dict_entry *entry);
00132 
00133 dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict);
00134 
00135 void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry);
00136 
00137 #endif  /* DBUS_DICT_HELPERS_H */


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:33:19