Hi,

On Wed, 2014-08-06 at 13:29 +0300, Tomasz Bursztyka wrote:
> This will be used by peer.c when there will be a need to choose between
> WPS PBC or PIN. This choice will be raised to the user via an agent
> RequestPeerAuthorization call.
> ---
>  src/agent-connman.c | 167 
> ++++++++++++++++++++++++++++++++++++++++++++++------
>  src/connman.h       |   8 +++
>  2 files changed, 158 insertions(+), 17 deletions(-)
> 
> diff --git a/src/agent-connman.c b/src/agent-connman.c
> index 7502f0f..f7a7f3a 100644
> --- a/src/agent-connman.c
> +++ b/src/agent-connman.c
> @@ -55,8 +55,15 @@ static bool check_reply_has_dict(DBusMessage *reply)
>  }
>  
>  struct request_input_reply {
> -     struct connman_service *service;
> -     authentication_cb_t callback;
> +     union {
> +             struct connman_service *service;
> +             struct connman_peer *peer;
> +     };
> +     union {
> +             authentication_cb_t service_callback;
> +             peer_wps_cb_t peer_callback;
> +     };
> +     bool wps_requested;
>       void *user_data;
>  };
>  
> @@ -151,12 +158,10 @@ static void request_input_passphrase_reply(DBusMessage 
> *reply, void *user_data)
>       }
>  
>  done:
> -     passphrase_reply->callback(passphrase_reply->service, values_received,
> -                             name, name_len,
> -                             identity, passphrase,
> -                             wps, wpspin, error,
> -                             passphrase_reply->user_data);
> -
> +     passphrase_reply->service_callback(passphrase_reply->service,
> +                                     values_received, name, name_len,
> +                                     identity, passphrase, wps, wpspin,
> +                                     error, passphrase_reply->user_data);
>  out:
>       g_free(passphrase_reply);
>  }
> @@ -236,13 +241,21 @@ static void 
> request_input_append_passphrase(DBusMessageIter *iter,
>       }
>  }
>  
> +struct request_wps_data {
> +     bool peer;
> +};
> +
>  static void request_input_append_wps(DBusMessageIter *iter, void *user_data)
>  {
> +     struct request_wps_data *wps = user_data;
>       const char *str = "wpspin";
>  
>       connman_dbus_dict_append_basic(iter, "Type",
>                               DBUS_TYPE_STRING, &str);
> -     str = "alternate";
> +     if (wps && wps->peer)

Since the peer and service pointers are grouped together in a union and
therefore share the same space in the struct, won't WPS always become
mandatory also for every service?

> +             str = "mandatory";
> +     else
> +             str = "alternate";
>       connman_dbus_dict_append_basic(iter, "Requirement",
>                               DBUS_TYPE_STRING, &str);
>  }

Cheers,

        Patrik

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to