Hi Julien,

NACK from me about this particular patch, see below.

You made useless changes there (name changes, duplication of structs/cb_t).

Adding wps/wpspin to the agent callback is the relevant point of that patch.
---
  src/agent.c   |   27 +++++++++++++++++----------
  src/connman.h |   13 ++++++++++---
  src/service.c |    1 +
  3 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/agent.c b/src/agent.c
index d0b3ecd..4f11577 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -85,15 +85,21 @@ int __connman_agent_unregister(const char *sender, const 
char *path)
        return 0;
  }

-struct request_input_reply {
+struct request_passphrase_reply {
        struct connman_service *service;
-       authentication_cb_t callback;
+       passphrase_cb_t callback;
See below about this name change.
+       void *user_data;
+};
+
+struct request_login_reply {
+       struct connman_service *service;
+       login_cb_t callback;
See below about this name change.
        void *user_data;
  };
This change is not fixing anything and but this is out of scope of your commit message anyway
  static void request_input_passphrase_reply(DBusPendingCall *call, void 
*user_data)
  {
-       struct request_input_reply *passphrase_reply = user_data;
+       struct request_passphrase_reply *passphrase_reply = user_data;
        connman_bool_t values_received = FALSE;
        connman_bool_t wps = FALSE;
        char *identity = NULL;
@@ -194,6 +200,7 @@ done:
        passphrase_reply->callback(passphrase_reply->service, values_received,
                                name, name_len,
                                identity, passphrase,
+                               wps, wpspin,
                                passphrase_reply->user_data);
        connman_service_unref(passphrase_reply->service);
        dbus_message_unref(reply);
@@ -326,7 +333,7 @@ static void request_input_append_password(DBusMessageIter 
*iter,

  static void request_input_login_reply(DBusPendingCall *call, void *user_data)
  {
-       struct request_input_reply *username_password_reply = user_data;
+       struct request_login_reply *username_password_reply = user_data;
        char *username = NULL;
        char *password = NULL;
        char *key;
@@ -378,14 +385,14 @@ done:
  }

  int __connman_agent_request_passphrase_input(struct connman_service *service,
-                               authentication_cb_t callback, void *user_data)
+                               passphrase_cb_t callback, void *user_data)
  {
        DBusMessage *message;
        const char *path;
        DBusMessageIter iter;
        DBusMessageIter dict;
        DBusPendingCall *call;
-       struct request_input_reply *passphrase_reply;
+       struct request_passphrase_reply *passphrase_reply;

        if (service == NULL || agent_path == NULL || callback == NULL)
                return -ESRCH;
@@ -427,7 +434,7 @@ int __connman_agent_request_passphrase_input(struct 
connman_service *service,

        connman_dbus_dict_close(&iter,&dict);

-       passphrase_reply = g_try_new0(struct request_input_reply, 1);
+       passphrase_reply = g_try_new0(struct request_passphrase_reply, 1);
        if (passphrase_reply == NULL) {
                dbus_message_unref(message);
                return -ENOMEM;
@@ -459,14 +466,14 @@ int __connman_agent_request_passphrase_input(struct 
connman_service *service,
  }

  int __connman_agent_request_login_input(struct connman_service *service,
-                               authentication_cb_t callback, void *user_data)
+                               login_cb_t callback, void *user_data)
  {
        DBusMessage *message;
        const char *path;
        DBusMessageIter iter;
        DBusMessageIter dict;
        DBusPendingCall *call;
-       struct request_input_reply *username_password_reply;
+       struct request_login_reply *username_password_reply;

        if (service == NULL || agent_path == NULL || callback == NULL)
                return -ESRCH;
@@ -493,7 +500,7 @@ int __connman_agent_request_login_input(struct 
connman_service *service,

        connman_dbus_dict_close(&iter,&dict);

-       username_password_reply = g_try_new0(struct request_input_reply, 1);
+       username_password_reply = g_try_new0(struct request_login_reply, 1);
        if (username_password_reply == NULL) {
                dbus_message_unref(message);
                return -ENOMEM;
diff --git a/src/connman.h b/src/connman.h
index 225928c..b000989 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -86,7 +86,14 @@ struct connman_service;

  int __connman_service_add_passphrase(struct connman_service *service,
                                        const gchar *passphrase);
-typedef void (* authentication_cb_t) (struct connman_service *service,
+
+typedef void (* passphrase_cb_t) (struct connman_service *service,
+                               connman_bool_t values_received,
+                               const char *name, int name_len,
+                               const char *identity, const char *passphrase,
+                               gboolean wps, const char *wpspin,
+                               void *user_data);
Why do you change the name?
It changed to authentication due to the fact this callback is used in a variety of "authentication" process, not only passphrase requests:
- service passphrase
- wps pin (which is not a passphrase)
- login/pass for wispr (which is not a passphrase).

authentication is a more relevant word for this callback, I don't see the point of changing it into a too specific word.
(and it's out of scope of your commit message also)
+typedef void (* login_cb_t) (struct connman_service *service,
Keep authentication_cb_t even if some of its parameters are only used for certain cases (wps/wpspin for wps stuff, not login/pass).
                                connman_bool_t values_received,
                                const char *name, int name_len,
                                const char *identifier, const char *secret,
@@ -97,9 +104,9 @@ typedef void (* browser_authentication_cb_t) (struct 
connman_service *service,
  typedef void (* report_error_cb_t) (struct connman_service *service,
                                gboolean retry, void *user_data);
  int __connman_agent_request_passphrase_input(struct connman_service *service,
-                               authentication_cb_t callback, void *user_data);
+                               passphrase_cb_t callback, void *user_data);
  int __connman_agent_request_login_input(struct connman_service *service,
-                               authentication_cb_t callback, void *user_data);
+                               login_cb_t callback, void *user_data);
  int __connman_agent_request_browser(struct connman_service *service,
                                browser_authentication_cb_t callback,
                                const char *url, void *user_data);
diff --git a/src/service.c b/src/service.c
index 3935e9a..6b4cfe6 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4262,6 +4262,7 @@ static void request_input_cb (struct connman_service 
*service,
                        connman_bool_t values_received,
                        const char *name, int name_len,
                        const char *identity, const char *passphrase,
+                       gboolean wps, const char *wpspin,
                        void *user_data)
  {
        struct connman_device *device;

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to