[PATCH 02/16] agent: Refactor the error reporting method to be more generic

2014-08-06 Thread Tomasz Bursztyka
Thus it will be possible afterwards to implement RequestPeerError very
simply.
---
 include/agent.h |  4 
 src/agent.c | 17 +
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/include/agent.h b/include/agent.h
index 05462df..6961f7a 100644
--- a/include/agent.h
+++ b/include/agent.h
@@ -52,6 +52,10 @@ void connman_agent_driver_unregister(struct 
connman_agent_driver *driver);
 typedef void (* report_error_cb_t) (void *user_context,
bool retry, void *user_data);
 
+int connman_agent_report_error_full(void *user_context, const char *path,
+   const char *method, const char *error,
+   report_error_cb_t callback,
+   const char *dbus_sender, void *user_data);
 int connman_agent_report_error(void *user_context, const char *path,
const char *error,
report_error_cb_t callback,
diff --git a/src/agent.c b/src/agent.c
index 90ff670..a340026 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -367,8 +367,8 @@ out:
g_free(report_error);
 }
 
-int connman_agent_report_error(void *user_context, const char *path,
-   const char *error,
+int connman_agent_report_error_full(void *user_context, const char *path,
+   const char *method, const char *error,
report_error_cb_t callback,
const char *dbus_sender, void *user_data)
 {
@@ -387,8 +387,7 @@ int connman_agent_report_error(void *user_context, const 
char *path,
return -ESRCH;
 
message = dbus_message_new_method_call(agent-owner, agent-path,
-   CONNMAN_AGENT_INTERFACE,
-   ReportError);
+   CONNMAN_AGENT_INTERFACE, method);
if (!message)
return -ENOMEM;
 
@@ -425,6 +424,16 @@ int connman_agent_report_error(void *user_context, const 
char *path,
return -EINPROGRESS;
 }
 
+int connman_agent_report_error(void *user_context, const char *path,
+   const char *error,
+   report_error_cb_t callback,
+   const char *dbus_sender, void *user_data)
+{
+   return connman_agent_report_error_full(user_context, path,
+   ReportError, error, callback, dbus_sender,
+   user_data);
+}
+
 static gint compare_priority(gconstpointer a, gconstpointer b)
 {
const struct connman_agent_driver *driver1 = a;
-- 
1.8.5.5

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


[PATCH 02/16] agent: Refactor the error reporting method to be more generic

2014-08-01 Thread Tomasz Bursztyka
Thus it will be possible afterwards to implement RequestPeerError very
simply.
---
 include/agent.h |  4 
 src/agent.c | 17 +
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/include/agent.h b/include/agent.h
index 05462df..6961f7a 100644
--- a/include/agent.h
+++ b/include/agent.h
@@ -52,6 +52,10 @@ void connman_agent_driver_unregister(struct 
connman_agent_driver *driver);
 typedef void (* report_error_cb_t) (void *user_context,
bool retry, void *user_data);
 
+int connman_agent_report_error_full(void *user_context, const char *path,
+   const char *method, const char *error,
+   report_error_cb_t callback,
+   const char *dbus_sender, void *user_data);
 int connman_agent_report_error(void *user_context, const char *path,
const char *error,
report_error_cb_t callback,
diff --git a/src/agent.c b/src/agent.c
index 37cf524..d23537d 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -363,8 +363,8 @@ static void report_error_reply(DBusMessage *reply, void 
*user_data)
g_free(report_error);
 }
 
-int connman_agent_report_error(void *user_context, const char *path,
-   const char *error,
+int connman_agent_report_error_full(void *user_context, const char *path,
+   const char *method, const char *error,
report_error_cb_t callback,
const char *dbus_sender, void *user_data)
 {
@@ -383,8 +383,7 @@ int connman_agent_report_error(void *user_context, const 
char *path,
return -ESRCH;
 
message = dbus_message_new_method_call(agent-owner, agent-path,
-   CONNMAN_AGENT_INTERFACE,
-   ReportError);
+   CONNMAN_AGENT_INTERFACE, method);
if (!message)
return -ENOMEM;
 
@@ -421,6 +420,16 @@ int connman_agent_report_error(void *user_context, const 
char *path,
return -EINPROGRESS;
 }
 
+int connman_agent_report_error(void *user_context, const char *path,
+   const char *error,
+   report_error_cb_t callback,
+   const char *dbus_sender, void *user_data)
+{
+   return connman_agent_report_error_full(user_context, path,
+   ReportError, error, callback, dbus_sender,
+   user_data);
+}
+
 static gint compare_priority(gconstpointer a, gconstpointer b)
 {
const struct connman_agent_driver *driver1 = a;
-- 
1.8.5.5

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