~cyphermox/ubuntu/natty/connman/release-0.64

« back to all changes in this revision

Viewing changes to gsupplicant/dbus.h

  • Committer: Mathieu Trudel-Lapierre
  • Date: 2010-11-30 15:51:10 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: mathieu.trudel-lapierre@canonical.com-20101130155110-32g0usyc4jbl131x
New upstream release 0.64.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 *  WPA supplicant library with GLib integration
 
4
 *
 
5
 *  Copyright (C) 2010  Intel Corporation. All rights reserved.
 
6
 *
 
7
 *  This program is free software; you can redistribute it and/or modify
 
8
 *  it under the terms of the GNU General Public License version 2 as
 
9
 *  published by the Free Software Foundation.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
19
 *
 
20
 */
 
21
 
 
22
#include <dbus/dbus.h>
 
23
 
 
24
#define SUPPLICANT_SERVICE      "fi.w1.wpa_supplicant1"
 
25
#define SUPPLICANT_INTERFACE    "fi.w1.wpa_supplicant1"
 
26
#define SUPPLICANT_PATH         "/fi/w1/wpa_supplicant1"
 
27
 
 
28
typedef void (*supplicant_dbus_array_function) (DBusMessageIter *iter,
 
29
                                                        void *user_data);
 
30
 
 
31
typedef void (*supplicant_dbus_property_function) (const char *key,
 
32
                                DBusMessageIter *iter, void *user_data);
 
33
 
 
34
typedef void (*supplicant_dbus_setup_function) (DBusMessageIter *iter,
 
35
                                                        void *user_data);
 
36
 
 
37
typedef void (*supplicant_dbus_result_function) (const char *error,
 
38
                                DBusMessageIter *iter, void *user_data);
 
39
 
 
40
void supplicant_dbus_setup(DBusConnection *conn);
 
41
 
 
42
void supplicant_dbus_array_foreach(DBusMessageIter *iter,
 
43
                                supplicant_dbus_array_function function,
 
44
                                                        void *user_data);
 
45
 
 
46
void supplicant_dbus_property_foreach(DBusMessageIter *iter,
 
47
                                supplicant_dbus_property_function function,
 
48
                                                        void *user_data);
 
49
 
 
50
int supplicant_dbus_property_get_all(const char *path, const char *interface,
 
51
                                supplicant_dbus_property_function function,
 
52
                                                        void *user_data);
 
53
 
 
54
int supplicant_dbus_property_get(const char *path, const char *interface,
 
55
                                const char *method,
 
56
                                supplicant_dbus_property_function function,
 
57
                                                        void *user_data);
 
58
 
 
59
int supplicant_dbus_property_set(const char *path, const char *interface,
 
60
                                const char *key, const char *signature,
 
61
                                supplicant_dbus_setup_function setup,
 
62
                                supplicant_dbus_result_function function,
 
63
                                                        void *user_data);
 
64
 
 
65
int supplicant_dbus_method_call(const char *path,
 
66
                                const char *interface, const char *method,
 
67
                                supplicant_dbus_setup_function setup,
 
68
                                supplicant_dbus_result_function function,
 
69
                                                        void *user_data);
 
70
 
 
71
void supplicant_dbus_property_append_basic(DBusMessageIter *iter,
 
72
                                        const char *key, int type, void *val);
 
73
 
 
74
void supplicant_dbus_property_append_fixed_array(DBusMessageIter *iter,
 
75
                                const char *key, int type, void *val, int len);
 
76
 
 
77
static inline void supplicant_dbus_dict_open(DBusMessageIter *iter,
 
78
                                                        DBusMessageIter *dict)
 
79
{
 
80
        dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
 
81
                        DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
 
82
                        DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
 
83
                        DBUS_DICT_ENTRY_END_CHAR_AS_STRING, dict);
 
84
}
 
85
 
 
86
static inline void supplicant_dbus_dict_close(DBusMessageIter *iter,
 
87
                                                        DBusMessageIter *dict)
 
88
{
 
89
        dbus_message_iter_close_container(iter, dict);
 
90
}
 
91
 
 
92
static inline void supplicant_dbus_dict_append_basic(DBusMessageIter *dict,
 
93
                                        const char *key, int type, void *val)
 
94
{
 
95
        DBusMessageIter entry;
 
96
 
 
97
        dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
 
98
                                                                NULL, &entry);
 
99
        supplicant_dbus_property_append_basic(&entry, key, type, val);
 
100
        dbus_message_iter_close_container(dict, &entry);
 
101
}
 
102
 
 
103
static inline void
 
104
supplicant_dbus_dict_append_fixed_array(DBusMessageIter *dict,
 
105
                                const char *key, int type, void *val, int len)
 
106
{
 
107
        DBusMessageIter entry;
 
108
 
 
109
        dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
 
110
                                                        NULL, &entry);
 
111
        supplicant_dbus_property_append_fixed_array(&entry, key, type, val, len);
 
112
        dbus_message_iter_close_container(dict, &entry);
 
113
}