diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-04-01 14:21:34 -0700 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-04-01 14:35:55 -0700 |
commit | 8b0627dc02859dce9a7649b6796054ee932a9262 (patch) | |
tree | 115203ce8490a0ca18bd6ad4e6143e4aa02def79 | |
parent | 2b554f22f0f433120752f89b77fc87c1a3d48220 (diff) |
libwimaxll: add wimaxll_priv_get/set()
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
-rw-r--r-- | include/wimaxll.h | 2 | ||||
-rw-r--r-- | lib/internal.h | 3 | ||||
-rw-r--r-- | lib/wimax.c | 31 |
3 files changed, 36 insertions, 0 deletions
diff --git a/include/wimaxll.h b/include/wimaxll.h index f8b2668..ad2941e 100644 --- a/include/wimaxll.h +++ b/include/wimaxll.h @@ -304,6 +304,8 @@ typedef int (*wimaxll_state_change_cb_f)( /* Basic handle management */ struct wimaxll_handle *wimaxll_open(const char *device_name); +void *wimaxll_priv_get(struct wimaxll_handle *); +void wimaxll_priv_set(struct wimaxll_handle *, void *); void wimaxll_close(struct wimaxll_handle *); const char *wimaxll_ifname(const struct wimaxll_handle *); diff --git a/lib/internal.h b/lib/internal.h index 71e9ef2..392737f 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -201,6 +201,8 @@ void wimaxll_cb_maybe_set_result(struct wimaxll_cb_ctx *ctx, int val) * the new device is discovered. * \param mcg_id Id of the 'msg' multicast group * \param name name of the wimax interface + * \param priv Private pointer set with wimaxll_priv_set() or other + * accessors. Use wimaxll_priv_get() to access it. * \param nlh_tx handle for writing to the kernel. * Internal note: You \b have \b to set the handlers for * %NL_CB_VALID and nl_cb_err() callbacks, as each callsite will @@ -216,6 +218,7 @@ struct wimaxll_handle { unsigned ifidx; int gnl_family_id, mcg_id; char name[__WIMAXLL_IFNAME_LEN]; + void *priv; struct nl_handle *nlh_tx; struct nl_handle *nlh_rx; diff --git a/lib/wimax.c b/lib/wimax.c index 7be7ba0..c0a52e4 100644 --- a/lib/wimax.c +++ b/lib/wimax.c @@ -321,3 +321,34 @@ const char *wimaxll_ifname(const struct wimaxll_handle *wmx) { return wmx->name; } + + +/** + * Set the private data associated to a WiMAX device handle + * + * @param wmx WiMAX device handle + * + * @param priv Private data pointer to associate. + * + * @ingroup device_management + */ +void wimaxll_priv_set(struct wimaxll_handle *wmx, void *priv) +{ + wmx->priv = priv; +} + + +/** + * Return the private data associated to a WiMAX device handle + * + * @param wmx WiMAX device handle + * + * @returns pointer to priv data as set by wimaxll_priv_set() or + * wimaxll_open_name() or wimaxll_open_ifindex(). + * + * @ingroup device_management + */ +void * wimaxll_priv_get(struct wimaxll_handle *wmx) +{ + return wmx->priv; +} |