~ubuntu-branches/ubuntu/gutsy/wpasupplicant/gutsy

« back to all changes in this revision

Viewing changes to ctrl_iface_dbus.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler, Alexander Sack
  • Date: 2007-08-26 16:06:57 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070826160657-2m8pxoweuxe8f93t
Tags: 0.6.0+0.5.8-0ubuntu1
* New upstream release
* remove patch 11_erroneous_manpage_ref, applied upstream
* remove patch 25_wpas_dbus_unregister_iface_fix, applied upstream

[ Alexander Sack ]
* bumping upstream version to replace development version 0.6.0 with
  this package from stable release branch.
* attempt to fix wierd timeout and high latency issues by going
  back to stable upstream version (0.5.9) (LP: #140763,
  LP: #141233).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * WPA Supplicant / dbus-based control interface
 
3
 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
 
4
 *
 
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.
 
8
 *
 
9
 * Alternatively, this software may be distributed under the terms of BSD
 
10
 * license.
 
11
 *
 
12
 * See README and COPYING for more details.
 
13
 */
 
14
 
 
15
#ifndef CTRL_IFACE_DBUS_H
 
16
#define CTRL_IFACE_DBUS_H
 
17
 
 
18
#ifdef CONFIG_CTRL_IFACE_DBUS
 
19
 
 
20
#ifndef SIGPOLL
 
21
#ifdef SIGIO
 
22
/*
 
23
 * If we do not have SIGPOLL, try to use SIGIO instead. This is needed for
 
24
 * FreeBSD.
 
25
 */
 
26
#define SIGPOLL SIGIO
 
27
#endif
 
28
#endif
 
29
 
 
30
#include <dbus/dbus.h>
 
31
 
 
32
#define WPAS_DBUS_OBJECT_PATH_MAX 150
 
33
 
 
34
#define WPAS_DBUS_SERVICE       "fi.epitest.hostap.WPASupplicant"
 
35
#define WPAS_DBUS_PATH          "/fi/epitest/hostap/WPASupplicant"
 
36
#define WPAS_DBUS_INTERFACE     "fi.epitest.hostap.WPASupplicant"
 
37
 
 
38
#define WPAS_DBUS_PATH_INTERFACES       WPAS_DBUS_PATH "/Interfaces"
 
39
#define WPAS_DBUS_IFACE_INTERFACE       WPAS_DBUS_INTERFACE ".Interface"
 
40
 
 
41
#define WPAS_DBUS_NETWORKS_PART "Networks"
 
42
#define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network"
 
43
 
 
44
#define WPAS_DBUS_BSSIDS_PART   "BSSIDs"
 
45
#define WPAS_DBUS_IFACE_BSSID   WPAS_DBUS_INTERFACE ".BSSID"
 
46
 
 
47
 
 
48
/* Errors */
 
49
#define WPAS_ERROR_INVALID_NETWORK \
 
50
        WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork"
 
51
#define WPAS_ERROR_INVALID_BSSID \
 
52
        WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID"
 
53
 
 
54
#define WPAS_ERROR_INVALID_OPTS \
 
55
        WPAS_DBUS_INTERFACE ".InvalidOptions"
 
56
#define WPAS_ERROR_INVALID_IFACE \
 
57
        WPAS_DBUS_INTERFACE ".InvalidInterface"
 
58
 
 
59
#define WPAS_ERROR_ADD_ERROR \
 
60
        WPAS_DBUS_INTERFACE ".AddError"
 
61
#define WPAS_ERROR_EXISTS_ERROR \
 
62
        WPAS_DBUS_INTERFACE ".ExistsError"
 
63
#define WPAS_ERROR_REMOVE_ERROR \
 
64
        WPAS_DBUS_INTERFACE ".RemoveError"
 
65
 
 
66
#define WPAS_ERROR_SCAN_ERROR \
 
67
        WPAS_DBUS_IFACE_INTERFACE ".ScanError"
 
68
#define WPAS_ERROR_ADD_NETWORK_ERROR \
 
69
        WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError"
 
70
#define WPAS_ERROR_INTERNAL_ERROR \
 
71
        WPAS_DBUS_IFACE_INTERFACE ".InternalError"
 
72
#define WPAS_ERROR_REMOVE_NETWORK_ERROR \
 
73
        WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError"
 
74
 
 
75
#define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x"
 
76
 
 
77
struct wpa_global;
 
78
struct wpa_supplicant;
 
79
 
 
80
struct ctrl_iface_dbus_priv *
 
81
wpa_supplicant_dbus_ctrl_iface_init(struct wpa_global *global);
 
82
void wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface);
 
83
void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s);
 
84
void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
 
85
                                             wpa_states new_state,
 
86
                                             wpa_states old_state);
 
87
 
 
88
char * wpas_dbus_decompose_object_path(const char *path, char **network,
 
89
                                       char **bssid);
 
90
 
 
91
int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s);
 
92
int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s);
 
93
 
 
94
 
 
95
/* Methods internal to the dbus control interface */
 
96
u32 wpa_supplicant_dbus_next_objid(struct ctrl_iface_dbus_priv *iface);
 
97
 
 
98
int wpa_supplicant_set_dbus_path(struct wpa_supplicant *wpa_s,
 
99
                                 const char *path);
 
100
const char *wpa_supplicant_get_dbus_path(struct wpa_supplicant *wpa_s);
 
101
struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
 
102
        struct wpa_global *global, const char *path);
 
103
 
 
104
DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message);
 
105
DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message);
 
106
 
 
107
#else /* CONFIG_CTRL_IFACE_DBUS */
 
108
 
 
109
static inline struct ctrl_iface_dbus_priv *
 
110
wpa_supplicant_dbus_ctrl_iface_init(struct wpa_global *global)
 
111
{
 
112
        return (struct ctrl_iface_dbus_priv *) 1;
 
113
}
 
114
 
 
115
static inline void
 
116
wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface)
 
117
{
 
118
}
 
119
 
 
120
static inline void
 
121
wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
 
122
{
 
123
}
 
124
 
 
125
static inline void
 
126
wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
 
127
                                        wpa_states new_state,
 
128
                                        wpa_states old_state)
 
129
{
 
130
}
 
131
 
 
132
static inline int
 
133
wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
 
134
{
 
135
        return 0;
 
136
}
 
137
 
 
138
static inline int
 
139
wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
 
140
{
 
141
        return 0;
 
142
}
 
143
 
 
144
#endif /* CONFIG_CTRL_IFACE_DBUS */
 
145
 
 
146
#endif /* CTRL_IFACE_DBUS_H */