}
#endif /* CONFIG_IEEE80211R */
-#ifdef ANDROID_P2P
- os_free(conf->prioritize);
-#endif
#ifdef CONFIG_WPS
os_free(conf->wps_pin_requests);
os_free(conf->device_name);
u8 uuid[16];
char *wps_pin_requests;
char *device_name;
-#ifdef ANDROID_P2P
- char *prioritize;
-#endif
char *manufacturer;
char *model_name;
char *model_number;
WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC
};
+enum p2p_sd_action {
+ SRV_UPDATE, SRV_ADD, SRV_DEL, SRV_FLUSH
+};
+
/**
* struct p2p_go_neg_results - P2P Group Owner Negotiation results
*/
enum p2p_scan_type {
P2P_SCAN_SOCIAL,
P2P_SCAN_FULL,
+ P2P_SCAN_SPECIFIC,
P2P_SCAN_SOCIAL_PLUS_ONE
};
* of the local services. This will increment the Service Update Indicator
* value which will be used in SD Request and Response frames.
*/
+#ifdef ANDROID_P2P
+void p2p_sd_service_update(struct p2p_data *p2p, int action);
+#else
void p2p_sd_service_update(struct p2p_data *p2p);
+#endif
enum p2p_invite_role {
* srv_update_indic - Service Update Indicator for local services
*/
u16 srv_update_indic;
-
+#ifdef ANDROID_P2P
+ /**
+ * srv_count - Registered services count
+ */
+ u16 srv_count;
+#endif
struct wpabuf *sd_resp; /* Fragmented SD response */
u8 sd_resp_addr[ETH_ALEN];
u8 sd_resp_dialog_token;
}
+#ifdef ANDROID_P2P
+void p2p_sd_service_update(struct p2p_data *p2p, int action)
+#else
void p2p_sd_service_update(struct p2p_data *p2p)
+#endif
{
p2p->srv_update_indic++;
+#ifdef ANDROID_P2P
+ if(action == SRV_FLUSH)
+ p2p->srv_count = 0;
+ else if (action == SRV_DEL)
+ p2p->srv_count--;
+ else if (action == SRV_ADD)
+ p2p->srv_count++;
+
+ if(p2p->cfg->sd_request) {
+ if (p2p->srv_count == 1) {
+ /* First Service Registered. Enable SD capability */
+ p2p->dev_capab |= P2P_DEV_CAPAB_SERVICE_DISCOVERY;
+ } else if (p2p->srv_count == 0 && !p2p->sd_queries) {
+ /* No services remaining + No queries registered .
+ * Remove the SD Capability
+ */
+ p2p->dev_capab &= ~P2P_DEV_CAPAB_SERVICE_DISCOVERY;
+ }
+ }
+#endif
}
wpabuf_free(config->wps_nfc_dh_pubkey);
wpabuf_free(config->wps_nfc_dh_privkey);
wpabuf_free(config->wps_nfc_dev_pw);
-#ifdef ANDROID_P2P
- os_free(config->prioritize);
-#endif
os_free(config);
}
{ INT(p2p_group_idle), 0 },
{ FUNC(p2p_pref_chan), CFG_CHANGED_P2P_PREF_CHAN },
#endif /* CONFIG_P2P */
-#ifdef ANDROID_P2P
- { STR_RANGE(prioritize, 0, 32), CFG_CHANGED_IFACE_PRIORITY },
-#endif
{ FUNC(country), CFG_CHANGED_COUNTRY },
{ INT(bss_max_count), 0 },
{ INT(bss_expiration_age), 0 },
#define CFG_CHANGED_P2P_LISTEN_CHANNEL BIT(11)
#define CFG_CHANGED_P2P_OPER_CHANNEL BIT(12)
#define CFG_CHANGED_P2P_PREF_CHAN BIT(13)
-#ifdef ANDROID_P2P
-#define CFG_CHANGED_IFACE_PRIORITY BIT(14)
-#endif
/**
* struct wpa_config - wpa_supplicant configuration data
if (p2p_ctrl_serv_disc_resp(wpa_s, buf + 19) < 0)
reply_len = -1;
} else if (os_strcmp(buf, "P2P_SERVICE_UPDATE") == 0) {
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_UPDATE);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
} else if (os_strncmp(buf, "P2P_SERV_DISC_EXTERNAL ", 23) == 0) {
if (p2p_ctrl_serv_disc_external(wpa_s, buf + 23) < 0)
reply_len = -1;
break;
case P2P_SCAN_FULL:
break;
+ case P2P_SCAN_SPECIFIC:
+ social_channels[0] = freq;
+ social_channels[1] = 0;
+ params.freqs = social_channels;
+ break;
case P2P_SCAN_SOCIAL_PLUS_ONE:
social_channels[3] = freq;
params.freqs = social_channels;
resp_tlvs);
}
-
+#ifdef ANDROID_P2P
+void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s, int action)
+#else
void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s)
+#endif
{
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
wpa_drv_p2p_service_update(wpa_s);
return;
}
if (wpa_s->global->p2p)
+#ifdef ANDROID_P2P
+ p2p_sd_service_update(wpa_s->global->p2p, action);
+#else
p2p_sd_service_update(wpa_s->global->p2p);
+#endif
}
struct p2p_srv_upnp, list)
wpas_p2p_srv_upnp_free(usrv);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_FLUSH);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
}
bsrv->resp = resp;
dl_list_add(&wpa_s->global->p2p_srv_bonjour, &bsrv->list);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_ADD);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
return 0;
}
if (bsrv == NULL)
return -1;
wpas_p2p_srv_bonjour_free(bsrv);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_DEL);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
return 0;
}
}
dl_list_add(&wpa_s->global->p2p_srv_upnp, &usrv->list);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_ADD);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
return 0;
}
if (usrv == NULL)
return -1;
wpas_p2p_srv_upnp_free(usrv);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_DEL);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
return 0;
}
void wpas_p2p_sd_response(struct wpa_supplicant *wpa_s, int freq,
const u8 *dst, u8 dialog_token,
const struct wpabuf *resp_tlvs);
+#ifdef ANDROID_P2P
+void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s, int action);
+#else
void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s);
+#endif
void wpas_p2p_service_flush(struct wpa_supplicant *wpa_s);
int wpas_p2p_service_add_bonjour(struct wpa_supplicant *wpa_s,
struct wpabuf *query, struct wpabuf *resp);