P2P: Add option for Provision Discovery before GO Negotiation
[mech_eap.git] / src / drivers / driver_test.c
index 3faa85d..c18eaad 100644 (file)
@@ -2,14 +2,8 @@
  * Testing driver interface for a simulated network driver
  * Copyright (c) 2004-2010, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
 /* Make sure we get winsock2.h for Windows build to get sockaddr_storage */
@@ -1281,7 +1275,7 @@ static void * test_driver_init(struct hostapd_data *hapd,
                        alen = sizeof(addr_un);
                }
                if (bind(drv->test_socket, addr, alen) < 0) {
-                       perror("bind(PF_UNIX)");
+                       perror("test-driver-init: bind(PF_UNIX)");
                        close(drv->test_socket);
                        if (drv->own_socket_path)
                                unlink(drv->own_socket_path);
@@ -2258,7 +2252,7 @@ static int wpa_driver_test_attach(struct wpa_driver_test_data *drv,
        os_strlcpy(addr.sun_path, drv->own_socket_path, sizeof(addr.sun_path));
        if (bind(drv->test_socket, (struct sockaddr *) &addr,
                 sizeof(addr)) < 0) {
-               perror("bind(PF_UNIX)");
+               perror("test-driver-attach: bind(PF_UNIX)");
                close(drv->test_socket);
                unlink(drv->own_socket_path);
                os_free(drv->own_socket_path);
@@ -2832,7 +2826,7 @@ static int wpa_driver_test_p2p_find(void *priv, unsigned int timeout, int type)
        wpa_printf(MSG_DEBUG, "%s(timeout=%u)", __func__, timeout);
        if (!drv->p2p)
                return -1;
-       return p2p_find(drv->p2p, timeout, type, 0, NULL);
+       return p2p_find(drv->p2p, timeout, type, 0, NULL, NULL);
 }
 
 
@@ -2873,7 +2867,8 @@ static int wpa_driver_test_p2p_connect(void *priv, const u8 *peer_addr,
        if (!drv->p2p)
                return -1;
        return p2p_connect(drv->p2p, peer_addr, wps_method, go_intent,
-                          own_interface_addr, force_freq, persistent_group);
+                          own_interface_addr, force_freq, persistent_group,
+                          NULL, 0, 0);
 }
 
 
@@ -2918,7 +2913,7 @@ static int wpa_driver_test_p2p_set_params(void *priv,
 
 static int test_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
                         unsigned int num_req_dev_types,
-                        const u8 *req_dev_types)
+                        const u8 *req_dev_types, const u8 *dev_id, u16 pw_id)
 {
        struct wpa_driver_test_data *drv = ctx;
        struct wpa_driver_scan_params params;
@@ -2939,8 +2934,8 @@ static int test_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
 
 #if 0 /* TODO: WPS IE */
        wpa_s->wps->dev.p2p = 1;
-       wps_ie = wps_build_probe_req_ie(0, &wpa_s->wps->dev, wpa_s->wps->uuid,
-                                       WPS_REQ_ENROLLEE);
+       wps_ie = wps_build_probe_req_ie(pw_id, &wpa_s->wps->dev,
+                                       wpa_s->wps->uuid, WPS_REQ_ENROLLEE);
 #else
        wps_ie = wpabuf_alloc(1);
 #endif
@@ -2956,7 +2951,7 @@ static int test_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
        wpabuf_put_buf(ies, wps_ie);
        wpabuf_free(wps_ie);
 
-       p2p_scan_ie(drv->p2p, ies);
+       p2p_scan_ie(drv->p2p, ies, dev_id);
 
        params.extra_ies = wpabuf_head(ies);
        params.extra_ies_len = wpabuf_len(ies);
@@ -3196,7 +3191,8 @@ static void test_sd_response(void *ctx, const u8 *sa, u16 update_indic,
 static void test_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
                               const u8 *dev_addr, const u8 *pri_dev_type,
                               const char *dev_name, u16 supp_config_methods,
-                              u8 dev_capab, u8 group_capab)
+                              u8 dev_capab, u8 group_capab,
+                              const u8 *group_id, size_t group_id_len)
 {
        wpa_printf(MSG_DEBUG, "%s(peer=" MACSTR " config_methods=0x%x)",
                   __func__, MAC2STR(peer), config_methods);