diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-03-19 13:46:28 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-03-25 13:17:57 +0200 |
commit | a0b5c505ec9e42811bfe3b398b7b074cd7aab355 (patch) | |
tree | 3d607d971a7a10e8ddeeb487cb067c90bebc45a2 /include/session.h | |
parent | 4b8c92a7423ddc8e5c306e631f9025092f109284 (diff) | |
download | connman-a0b5c505ec9e42811bfe3b398b7b074cd7aab355.tar.gz connman-a0b5c505ec9e42811bfe3b398b7b074cd7aab355.tar.bz2 connman-a0b5c505ec9e42811bfe3b398b7b074cd7aab355.zip |
session: Add callback helpers
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.
Diffstat (limited to 'include/session.h')
-rw-r--r-- | include/session.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/session.h b/include/session.h index 47d36c5c..7c8b0d4c 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 { |