summaryrefslogtreecommitdiff
path: root/gsupplicant
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-07-04 13:48:04 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2012-07-05 07:04:53 (GMT)
commitc1f3036eeabe20903d077f5e0069d644d93d5bfd (patch)
treea4df5af45c926e74eff06f6674121713cd8e549d /gsupplicant
parentdcbd6fa4220183280b5b94683cfe7f3033009d37 (diff)
downloadconnman-c1f3036eeabe20903d077f5e0069d644d93d5bfd.zip
connman-c1f3036eeabe20903d077f5e0069d644d93d5bfd.tar.gz
connman-c1f3036eeabe20903d077f5e0069d644d93d5bfd.tar.bz2
gsupplicant: Adapt set country callback to return a result
This is necessary for the next coming patches, to fix country setting by interface
Diffstat (limited to 'gsupplicant')
-rw-r--r--gsupplicant/gsupplicant.h4
-rw-r--r--gsupplicant/supplicant.c19
2 files changed, 12 insertions, 11 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 5dc5364..0f586a1 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -162,7 +162,9 @@ struct _GSupplicantScanParams {
typedef struct _GSupplicantScanParams GSupplicantScanParams;
/* global API */
-typedef void (*GSupplicantCountryCallback) (void *user_data);
+typedef void (*GSupplicantCountryCallback) (int result,
+ const char *alpha2,
+ void *user_data);
int g_supplicant_set_country(const char *alpha2,
GSupplicantCountryCallback callback,
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 1a10291..5b09a9d 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2321,6 +2321,7 @@ static DBusHandlerResult g_supplicant_filter(DBusConnection *conn,
struct supplicant_regdom {
GSupplicantCountryCallback callback;
+ const char *alpha2;
const void *user_data;
};
@@ -2328,22 +2329,21 @@ static void country_result(const char *error,
DBusMessageIter *iter, void *user_data)
{
struct supplicant_regdom *regdom = user_data;
- char *alpha2;
+ int result = 0;
SUPPLICANT_DBG("Country setting result");
if (user_data == NULL)
return;
- if (error == NULL) {
- alpha2 = (char *)regdom->user_data;
- } else {
+ if (error != NULL) {
SUPPLICANT_DBG("Country setting failure %s", error);
- alpha2 = NULL;
+ result = -EINVAL;
}
if (regdom->callback)
- regdom->callback(alpha2);
+ regdom->callback(result, regdom->alpha2,
+ (void *) regdom->user_data);
g_free(regdom);
}
@@ -2351,11 +2351,9 @@ static void country_result(const char *error,
static void country_params(DBusMessageIter *iter, void *user_data)
{
struct supplicant_regdom *regdom = user_data;
- const char *country;
-
- country = regdom->user_data;
- dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &country);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
+ &regdom->alpha2);
}
int g_supplicant_set_country(const char *alpha2,
@@ -2374,6 +2372,7 @@ int g_supplicant_set_country(const char *alpha2,
return -ENOMEM;
regdom->callback = callback;
+ regdom->alpha2 = alpha2;
regdom->user_data = user_data;
return supplicant_dbus_property_set(SUPPLICANT_PATH, SUPPLICANT_INTERFACE,