From: Daniel Wagner <[email protected]>

There is a common pattern when writing a callback function. Let's
add a few helper for this.

It is added to session.h because apart from the core also
the session_policy_local.c will make use of it.

This is shamelessly stolen from oFono.
---
 include/session.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/session.h b/include/session.h
index 47d36c5..7c8b0d4 100644
--- a/include/session.h
+++ b/include/session.h
@@ -49,6 +49,23 @@ enum connman_session_type {
        CONNMAN_SESSION_TYPE_INTERNET = 3,
 };
 
+struct cb_data {
+       void *cb;
+       void *user_data;
+       void *data;
+};
+
+static inline struct cb_data *cb_data_new(void *cb, void *user_data)
+{
+       struct cb_data *ret;
+
+       ret = g_new0(struct cb_data, 1);
+       ret->cb = cb;
+       ret->user_data = user_data;
+
+       return ret;
+}
+
 struct connman_session;
 
 struct connman_session_config {
-- 
1.8.2.rc3.16.gce432ca

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

Reply via email to