P2P: Coding style cleanup for D-Bus handlers

This commit is contained in:
Jouni Malinen 2011-07-15 14:18:29 +03:00
parent faa9f2cf95
commit f94a85ee33

View file

@ -135,6 +135,7 @@ error:
return reply;
}
DBusMessage * wpas_dbus_handler_p2p_stop_find(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -142,6 +143,7 @@ DBusMessage *wpas_dbus_handler_p2p_stop_find(DBusMessage * message,
return NULL;
}
DBusMessage * wpas_dbus_handler_p2p_rejectpeer(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -162,6 +164,7 @@ DBusMessage *wpas_dbus_handler_p2p_rejectpeer(DBusMessage * message,
return NULL;
}
DBusMessage * wpas_dbus_handler_p2p_listen(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -179,8 +182,9 @@ DBusMessage *wpas_dbus_handler_p2p_listen(DBusMessage * message,
return NULL;
}
DBusMessage *wpas_dbus_handler_p2p_extendedlisten(DBusMessage * message,
struct wpa_supplicant * wpa_s)
DBusMessage * wpas_dbus_handler_p2p_extendedlisten(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
unsigned int period = 0, interval = 0;
struct wpa_dbus_dict_entry entry;
@ -196,10 +200,10 @@ DBusMessage *wpas_dbus_handler_p2p_extendedlisten(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "period") &&
if (!os_strcmp(entry.key, "period") &&
(entry.type == DBUS_TYPE_INT32))
period = entry.uint32_value;
else if (!strcmp(entry.key, "interval") &&
else if (!os_strcmp(entry.key, "interval") &&
(entry.type == DBUS_TYPE_INT32))
interval = entry.uint32_value;
else
@ -208,8 +212,8 @@ DBusMessage *wpas_dbus_handler_p2p_extendedlisten(DBusMessage * message,
}
if (wpas_p2p_ext_listen(wpa_s, period, interval))
return wpas_dbus_error_unknown_error(message,
"failed to initiate a p2p_ext_listen.");
return wpas_dbus_error_unknown_error(
message, "failed to initiate a p2p_ext_listen.");
return NULL;
@ -219,9 +223,9 @@ error:
return wpas_dbus_error_invalid_args(message, entry.key);
}
DBusMessage *wpas_dbus_handler_p2p_presence_request(DBusMessage * message,
struct wpa_supplicant *
wpa_s)
DBusMessage * wpas_dbus_handler_p2p_presence_request(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
unsigned int dur1 = 0, int1 = 0, dur2 = 0, int2 = 0;
struct wpa_dbus_dict_entry entry;
@ -237,16 +241,16 @@ DBusMessage *wpas_dbus_handler_p2p_presence_request(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "duration1") &&
if (!os_strcmp(entry.key, "duration1") &&
(entry.type == DBUS_TYPE_INT32))
dur1 = entry.uint32_value;
else if (!strcmp(entry.key, "interval1") &&
else if (!os_strcmp(entry.key, "interval1") &&
entry.type == DBUS_TYPE_INT32)
int1 = entry.uint32_value;
else if (!strcmp(entry.key, "duration2") &&
else if (!os_strcmp(entry.key, "duration2") &&
entry.type == DBUS_TYPE_INT32)
dur2 = entry.uint32_value;
else if (!strcmp(entry.key, "interval2") &&
else if (!os_strcmp(entry.key, "interval2") &&
entry.type == DBUS_TYPE_INT32)
int2 = entry.uint32_value;
else
@ -266,6 +270,7 @@ error:
return wpas_dbus_error_invalid_args(message, entry.key);
}
DBusMessage * wpas_dbus_handler_p2p_group_add(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -290,15 +295,15 @@ DBusMessage *wpas_dbus_handler_p2p_group_add(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto inv_args;
if (!strcmp(entry.key, "persistent") &&
if (!os_strcmp(entry.key, "persistent") &&
(entry.type == DBUS_TYPE_BOOLEAN)) {
persistent_group = (entry.bool_value == TRUE) ? 1 : 0;
} else if (!strcmp(entry.key, "frequency") &&
} else if (!os_strcmp(entry.key, "frequency") &&
(entry.type == DBUS_TYPE_INT32)) {
freq = entry.int32_value;
if (freq <= 0)
goto inv_args_clear;
} else if (!strcmp(entry.key, "persistent_group_object") &&
} else if (!os_strcmp(entry.key, "persistent_group_object") &&
entry.type == DBUS_TYPE_OBJECT_PATH)
pg_object_path = os_strdup(entry.str_value);
else
@ -336,7 +341,8 @@ DBusMessage *wpas_dbus_handler_p2p_group_add(DBusMessage * message,
goto inv_args;
if (wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq)) {
reply = wpas_dbus_error_unknown_error(message,
reply = wpas_dbus_error_unknown_error(
message,
"Failed to reinvoke a persistent group");
goto out;
}
@ -355,6 +361,7 @@ inv_args:
goto out;
}
DBusMessage * wpas_dbus_handler_p2p_disconnect(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -365,6 +372,7 @@ DBusMessage *wpas_dbus_handler_p2p_disconnect(DBusMessage *message,
return NULL;
}
DBusMessage * wpas_dbus_handler_p2p_flush(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -375,6 +383,7 @@ DBusMessage *wpas_dbus_handler_p2p_flush(DBusMessage * message,
return NULL;
}
DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -404,43 +413,43 @@ DBusMessage *wpas_dbus_handler_p2p_connect(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto inv_args;
if (!strcmp(entry.key, "peer") &&
if (!os_strcmp(entry.key, "peer") &&
(entry.type == DBUS_TYPE_OBJECT_PATH)) {
peer_object_path = os_strdup(entry.str_value);
} else if (!strcmp(entry.key, "persistent") &&
} else if (!os_strcmp(entry.key, "persistent") &&
(entry.type == DBUS_TYPE_BOOLEAN)) {
persistent_group = (entry.bool_value == TRUE) ? 1 : 0;
} else if (!strcmp(entry.key, "join") &&
} else if (!os_strcmp(entry.key, "join") &&
(entry.type == DBUS_TYPE_BOOLEAN)) {
join = (entry.bool_value == TRUE) ? 1 : 0;
} else if (!strcmp(entry.key, "authorize_only") &&
} else if (!os_strcmp(entry.key, "authorize_only") &&
(entry.type == DBUS_TYPE_BOOLEAN)) {
authorize_only = (entry.bool_value == TRUE) ? 1 : 0;
} else if (!strcmp(entry.key, "frequency") &&
} else if (!os_strcmp(entry.key, "frequency") &&
(entry.type == DBUS_TYPE_INT32)) {
freq = entry.int32_value;
if (freq <= 0)
goto inv_args_clear;
} else if (!strcmp(entry.key, "go_intent") &&
} else if (!os_strcmp(entry.key, "go_intent") &&
(entry.type == DBUS_TYPE_INT32)) {
go_intent = entry.int32_value;
if ((go_intent < 0) || (go_intent > 15))
goto inv_args_clear;
} else if (!strcmp(entry.key, "wps_method") &&
} else if (!os_strcmp(entry.key, "wps_method") &&
(entry.type == DBUS_TYPE_STRING)) {
if (!strcmp(entry.str_value, "pbc"))
if (!os_strcmp(entry.str_value, "pbc"))
wps_method = WPS_PBC;
else if (!strcmp(entry.str_value, "pin"))
else if (!os_strcmp(entry.str_value, "pin"))
wps_method = WPS_PIN_DISPLAY;
else if (!strcmp(entry.str_value, "label"))
else if (!os_strcmp(entry.str_value, "label"))
wps_method = WPS_PIN_LABEL;
else if (!strcmp(entry.str_value, "display"))
else if (!os_strcmp(entry.str_value, "display"))
wps_method = WPS_PIN_DISPLAY;
else if (!strcmp(entry.str_value, "keypad"))
else if (!os_strcmp(entry.str_value, "keypad"))
wps_method = WPS_PIN_KEYPAD;
else
goto inv_args_clear;
} else if (!strcmp(entry.key, "pin") &&
} else if (!os_strcmp(entry.key, "pin") &&
(entry.type == DBUS_TYPE_STRING)) {
pin = os_strdup(entry.str_value);
} else
@ -511,6 +520,7 @@ inv_args:
goto out;
}
DBusMessage * wpas_dbus_handler_p2p_invite(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -536,11 +546,11 @@ DBusMessage *wpas_dbus_handler_p2p_invite(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto err;
if (!strcmp(entry.key, "peer") &&
if (!os_strcmp(entry.key, "peer") &&
(entry.type == DBUS_TYPE_OBJECT_PATH)) {
peer_object_path = os_strdup(entry.str_value);
wpa_dbus_dict_entry_clear(&entry);
} else if (!strcmp(entry.key, "persistent_group_object") &&
} else if (!os_strcmp(entry.key, "persistent_group_object") &&
(entry.type == DBUS_TYPE_OBJECT_PATH)) {
pg_object_path = os_strdup(entry.str_value);
persistent = 1;
@ -561,15 +571,14 @@ DBusMessage *wpas_dbus_handler_p2p_invite(DBusMessage * message,
if (persistent) {
/*
* A group ID is defined meaning we want to re-invoke a
* persisatnt group
* persistant group
*/
iface = wpas_dbus_new_decompose_object_path(pg_object_path, 1,
&net_id_str, NULL);
if (iface == NULL ||
os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
reply =
wpas_dbus_error_invalid_args(message,
reply = wpas_dbus_error_invalid_args(message,
pg_object_path);
goto out;
}
@ -599,8 +608,7 @@ DBusMessage *wpas_dbus_handler_p2p_invite(DBusMessage * message,
if (wpas_p2p_invite_group(wpa_s, wpa_s->ifname,
peer_addr, NULL)) {
reply = wpas_dbus_error_unknown_error(
message,
"Failed to join to an active group");
message, "Failed to join to an active group");
goto out;
}
}
@ -615,6 +623,7 @@ err:
goto out;
}
DBusMessage * wpas_dbus_handler_p2p_prov_disc_req(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -650,13 +659,13 @@ DBusMessage *wpas_dbus_handler_p2p_prov_disc_req(DBusMessage * message,
return NULL;
}
/*
* P2P Device property accessor methods.
*/
DBusMessage *wpas_dbus_getter_p2p_device_properties(DBusMessage * message,
struct wpa_supplicant *
wpa_s)
DBusMessage * wpas_dbus_getter_p2p_device_properties(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
DBusMessage *reply = NULL;
DBusMessageIter iter, variant_iter, dict_iter;
@ -794,9 +803,9 @@ err_no_mem:
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY, NULL);
}
DBusMessage *wpas_dbus_setter_p2p_device_properties(DBusMessage * message,
struct wpa_supplicant *
wpa_s)
DBusMessage * wpas_dbus_setter_p2p_device_properties(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
DBusMessage *reply = NULL;
DBusMessageIter iter, variant_iter;
@ -851,7 +860,8 @@ DBusMessage *wpas_dbus_setter_p2p_device_properties(DBusMessage * message,
goto error;
for (i = 0; i < entry.array_len; i++)
if (wpabuf_len(entry.binarray_value[i]) != WPS_DEV_TYPE_LEN)
if (wpabuf_len(entry.binarray_value[i]) !=
WPS_DEV_TYPE_LEN)
goto err_no_mem_clear;
for (i = 0; i < entry.array_len; i++)
os_memcpy(wpa_s->conf->sec_device_type[i],
@ -882,11 +892,9 @@ DBusMessage *wpas_dbus_setter_p2p_device_properties(DBusMessage * message,
(entry.type == DBUS_TYPE_UINT32) &&
(entry.uint32_value <= 15))
wpa_s->conf->p2p_go_intent = entry.uint32_value;
else if ((os_strcmp(entry.key, "PersistantReconnect") == 0) &&
(entry.type == DBUS_TYPE_BOOLEAN))
wpa_s->conf->persistent_reconnect = entry.bool_value;
else if ((os_strcmp(entry.key, "ListenRegClass") == 0) &&
(entry.type == DBUS_TYPE_UINT32)) {
wpa_s->conf->p2p_listen_reg_class = entry.uint32_value;
@ -958,6 +966,7 @@ DBusMessage *wpas_dbus_setter_p2p_device_properties(DBusMessage * message,
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY, NULL);
}
DBusMessage * wpas_dbus_getter_p2p_peers(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -1036,6 +1045,7 @@ error:
return reply;
}
enum wpas_p2p_role {
WPAS_P2P_ROLE_DEVICE,
WPAS_P2P_ROLE_GO,
@ -1064,6 +1074,7 @@ static enum wpas_p2p_role wpas_get_p2p_role(struct wpa_supplicant *wpa_s)
}
}
DBusMessage * wpas_dbus_getter_p2p_role(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -1084,6 +1095,7 @@ DBusMessage *wpas_dbus_getter_p2p_role(DBusMessage * message,
&str);
}
DBusMessage * wpas_dbus_getter_p2p_group(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -1095,6 +1107,7 @@ DBusMessage *wpas_dbus_getter_p2p_group(DBusMessage * message,
&wpa_s->dbus_groupobj_path);
}
DBusMessage * wpas_dbus_getter_p2p_peergo(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -1111,18 +1124,20 @@ DBusMessage *wpas_dbus_getter_p2p_peergo(DBusMessage * message,
DBUS_TYPE_OBJECT_PATH, &path);
}
/*
* Peer object properties accessor methods
*/
DBusMessage *wpas_dbus_getter_p2p_peer_properties(DBusMessage * message,
struct peer_handler_args *
peer_args)
DBusMessage * wpas_dbus_getter_p2p_peer_properties(
DBusMessage *message, struct peer_handler_args *peer_args)
{
DBusMessage *reply = NULL;
DBusMessageIter iter, variant_iter, dict_iter;
const struct p2p_peer_info *info = NULL;
char devtype[WPS_DEV_TYPE_BUFSIZE];
const struct wpabuf *vendor_extension[P2P_MAX_WPS_VENDOR_EXT];
int i, num;
/* get the peer info */
info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
@ -1170,7 +1185,6 @@ DBusMessage *wpas_dbus_getter_p2p_peer_properties(DBusMessage * message,
u8 *sec_dev_type_list = NULL;
char secdevtype[WPS_DEV_TYPE_BUFSIZE];
int num_sec_dev_types = 0;
int i;
sec_dev_type_list = os_zalloc(info->wps_sec_dev_type_list_len);
@ -1188,8 +1202,7 @@ DBusMessage *wpas_dbus_getter_p2p_peer_properties(DBusMessage * message,
if (!sec_dev_types[i] ||
wps_dev_type_bin2str(
&sec_dev_type_list[i *
WPS_DEV_TYPE_LEN],
&sec_dev_type_list[i * WPS_DEV_TYPE_LEN],
sec_dev_types[i],
sizeof(secdevtype)) == NULL) {
while (--i >= 0)
@ -1218,23 +1231,17 @@ DBusMessage *wpas_dbus_getter_p2p_peer_properties(DBusMessage * message,
}
}
{
/* Add WPS vendor extensions attribute */
const struct wpabuf *vendor_extension[P2P_MAX_WPS_VENDOR_EXT];
int i, num = 0;
for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) {
for (i = 0, num = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) {
if (info->wps_vendor_ext[i] == NULL)
continue;
vendor_extension[num] = info->wps_vendor_ext[i];
num++;
}
if (!wpa_dbus_dict_append_wpabuf_array(
&dict_iter, "VendorExtension",
if (!wpa_dbus_dict_append_wpabuf_array(&dict_iter, "VendorExtension",
vendor_extension, num))
goto err_no_mem;
}
if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
!dbus_message_iter_close_container(&iter, &variant_iter))
@ -1246,8 +1253,9 @@ err_no_mem:
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY, NULL);
}
DBusMessage *wpas_dbus_getter_p2p_peer_ies(DBusMessage * message,
struct peer_handler_args * peer_args)
DBusMessage * wpas_dbus_getter_p2p_peer_ies(
DBusMessage *message, struct peer_handler_args *peer_args)
{
return NULL;
}
@ -1625,8 +1633,7 @@ out_of_memory:
DBusMessage * wpas_dbus_getter_p2p_group_properties(
DBusMessage *message,
struct wpa_supplicant *wpa_s)
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
DBusMessage *reply = NULL;
DBusMessageIter iter, variant_iter, dict_iter;
@ -1679,16 +1686,15 @@ err_no_mem:
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY, NULL);
}
DBusMessage * wpas_dbus_setter_p2p_group_properties(
DBusMessage *message,
struct wpa_supplicant *wpa_s)
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
DBusMessage *reply = NULL;
DBusMessageIter iter, variant_iter;
struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING };
DBusMessageIter iter_dict;
unsigned int i;
struct hostapd_data *hapd = wpa_s->ap_iface->bss[0];
if (!hapd)
@ -1741,6 +1747,7 @@ error:
return reply;
}
DBusMessage * wpas_dbus_handler_p2p_add_service(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -1764,11 +1771,11 @@ DBusMessage *wpas_dbus_handler_p2p_add_service(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "service_type") &&
if (!os_strcmp(entry.key, "service_type") &&
(entry.type == DBUS_TYPE_STRING)) {
if (!strcmp(entry.str_value, "upnp"))
if (!os_strcmp(entry.str_value, "upnp"))
upnp = 1;
else if (!strcmp(entry.str_value, "bonjour"))
else if (!os_strcmp(entry.str_value, "bonjour"))
bonjour = 1;
else
goto error_clear;
@ -1781,10 +1788,10 @@ DBusMessage *wpas_dbus_handler_p2p_add_service(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "version") &&
if (!os_strcmp(entry.key, "version") &&
entry.type == DBUS_TYPE_INT32)
version = entry.uint32_value;
else if (!strcmp(entry.key, "service") &&
else if (!os_strcmp(entry.key, "service") &&
entry.type == DBUS_TYPE_STRING)
service = os_strdup(entry.str_value);
wpa_dbus_dict_entry_clear(&entry);
@ -1801,13 +1808,14 @@ DBusMessage *wpas_dbus_handler_p2p_add_service(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "query")) {
if (!os_strcmp(entry.key, "query")) {
if ((entry.type != DBUS_TYPE_ARRAY) ||
(entry.array_type != DBUS_TYPE_BYTE))
goto error_clear;
query = wpabuf_alloc_copy(entry.bytearray_value,
query = wpabuf_alloc_copy(
entry.bytearray_value,
entry.array_len);
} else if (!strcmp(entry.key, "response")) {
} else if (!os_strcmp(entry.key, "response")) {
if ((entry.type != DBUS_TYPE_ARRAY) ||
(entry.array_type != DBUS_TYPE_BYTE))
goto error_clear;
@ -1836,8 +1844,9 @@ error:
return wpas_dbus_error_invalid_args(message, NULL);
}
DBusMessage *wpas_dbus_handler_p2p_delete_service(DBusMessage * message,
struct wpa_supplicant * wpa_s)
DBusMessage * wpas_dbus_handler_p2p_delete_service(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
DBusMessageIter iter_dict;
DBusMessage *reply = NULL;
@ -1859,11 +1868,11 @@ DBusMessage *wpas_dbus_handler_p2p_delete_service(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "service_type") &&
if (!os_strcmp(entry.key, "service_type") &&
(entry.type == DBUS_TYPE_STRING)) {
if (!strcmp(entry.str_value, "upnp"))
if (!os_strcmp(entry.str_value, "upnp"))
upnp = 1;
else if (!strcmp(entry.str_value, "bonjour"))
else if (!os_strcmp(entry.str_value, "bonjour"))
bonjour = 1;
else
goto error_clear;
@ -1874,10 +1883,10 @@ DBusMessage *wpas_dbus_handler_p2p_delete_service(DBusMessage * message,
while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "version") &&
if (!os_strcmp(entry.key, "version") &&
entry.type == DBUS_TYPE_INT32)
version = entry.uint32_value;
else if (!strcmp(entry.key, "service") &&
else if (!os_strcmp(entry.key, "service") &&
entry.type == DBUS_TYPE_STRING)
service = os_strdup(entry.str_value);
else
@ -1898,11 +1907,12 @@ DBusMessage *wpas_dbus_handler_p2p_delete_service(DBusMessage * message,
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "query")) {
if (!os_strcmp(entry.key, "query")) {
if ((entry.type != DBUS_TYPE_ARRAY) ||
(entry.array_type != DBUS_TYPE_BYTE))
goto error_clear;
query = wpabuf_alloc_copy(entry.bytearray_value,
query = wpabuf_alloc_copy(
entry.bytearray_value,
entry.array_len);
} else
goto error_clear;
@ -1927,6 +1937,7 @@ error:
return wpas_dbus_error_invalid_args(message, NULL);
}
DBusMessage * wpas_dbus_handler_p2p_flush_service(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
@ -1934,8 +1945,9 @@ DBusMessage *wpas_dbus_handler_p2p_flush_service(DBusMessage * message,
return NULL;
}
DBusMessage *wpas_dbus_handler_p2p_service_sd_req(DBusMessage * message,
struct wpa_supplicant * wpa_s)
DBusMessage * wpas_dbus_handler_p2p_service_sd_req(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
DBusMessageIter iter_dict;
DBusMessage *reply = NULL;
@ -1957,22 +1969,22 @@ DBusMessage *wpas_dbus_handler_p2p_service_sd_req(DBusMessage * message,
while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "peer_object") &&
if (!os_strcmp(entry.key, "peer_object") &&
entry.type == DBUS_TYPE_OBJECT_PATH) {
peer_object_path = os_strdup(entry.str_value);
} else if (!strcmp(entry.key, "service_type") &&
} else if (!os_strcmp(entry.key, "service_type") &&
entry.type == DBUS_TYPE_STRING) {
if (!strcmp(entry.str_value, "upnp"))
if (!os_strcmp(entry.str_value, "upnp"))
upnp = 1;
else
goto error_clear;
} else if (!strcmp(entry.key, "version") &&
} else if (!os_strcmp(entry.key, "version") &&
entry.type == DBUS_TYPE_INT32) {
version = entry.uint32_value;
} else if (!strcmp(entry.key, "service") &&
} else if (!os_strcmp(entry.key, "service") &&
entry.type == DBUS_TYPE_STRING) {
service = os_strdup(entry.str_value);
} else if (!strcmp(entry.key, "tlv")) {
} else if (!os_strcmp(entry.key, "tlv")) {
if (entry.type != DBUS_TYPE_ARRAY ||
entry.array_type != DBUS_TYPE_BYTE)
goto error_clear;
@ -1994,7 +2006,8 @@ DBusMessage *wpas_dbus_handler_p2p_service_sd_req(DBusMessage * message,
goto error;
ref = (unsigned long) wpas_p2p_sd_request_upnp(wpa_s, addr,
version, service);
version,
service);
} else {
if (tlv == NULL)
goto error;
@ -2007,8 +2020,8 @@ DBusMessage *wpas_dbus_handler_p2p_service_sd_req(DBusMessage * message,
dbus_message_append_args(reply, DBUS_TYPE_UINT64,
&ref, DBUS_TYPE_INVALID);
} else {
reply = wpas_dbus_error_unknown_error(message,
"Unable to send SD request");
reply = wpas_dbus_error_unknown_error(
message, "Unable to send SD request");
}
out:
os_free(service);
@ -2023,6 +2036,7 @@ error:
goto out;
}
DBusMessage * wpas_dbus_handler_p2p_service_sd_res(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
@ -2045,16 +2059,16 @@ DBusMessage *wpas_dbus_handler_p2p_service_sd_res(
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
goto error;
if (!strcmp(entry.key, "peer_object") &&
if (!os_strcmp(entry.key, "peer_object") &&
entry.type == DBUS_TYPE_OBJECT_PATH) {
peer_object_path = os_strdup(entry.str_value);
} else if (!strcmp(entry.key, "frequency") &&
} else if (!os_strcmp(entry.key, "frequency") &&
entry.type == DBUS_TYPE_INT32) {
freq = entry.uint32_value;
} else if (!strcmp(entry.key, "dialog_token") &&
} else if (!os_strcmp(entry.key, "dialog_token") &&
entry.type == DBUS_TYPE_UINT32) {
dlg_tok = entry.uint32_value;
} else if (!strcmp(entry.key, "tlvs")) {
} else if (!os_strcmp(entry.key, "tlvs")) {
if (entry.type != DBUS_TYPE_ARRAY ||
entry.array_type != DBUS_TYPE_BYTE)
goto error_clear;
@ -2085,8 +2099,9 @@ error:
goto out;
}
DBusMessage *wpas_dbus_handler_p2p_service_sd_cancel_req(DBusMessage * message, struct wpa_supplicant
*wpa_s)
DBusMessage * wpas_dbus_handler_p2p_service_sd_cancel_req(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
DBusMessageIter iter;
u64 req = 0;
@ -2105,16 +2120,17 @@ error:
return wpas_dbus_error_invalid_args(message, NULL);
}
DBusMessage *wpas_dbus_handler_p2p_service_update(DBusMessage * message,
struct wpa_supplicant * wpa_s)
DBusMessage * wpas_dbus_handler_p2p_service_update(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
wpas_p2p_sd_service_update(wpa_s);
return NULL;
}
DBusMessage *wpas_dbus_handler_p2p_serv_disc_external(DBusMessage * message,
struct wpa_supplicant *
wpa_s)
DBusMessage * wpas_dbus_handler_p2p_serv_disc_external(
DBusMessage *message, struct wpa_supplicant *wpa_s)
{
DBusMessageIter iter;
int ext = 0;