diff options
author | Thomas Graf <tgraf@redhat.com> | 2012-04-22 15:23:52 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@redhat.com> | 2012-04-22 15:23:52 +0200 |
commit | bd1e4d03840a4d8289ba87935096c6dcb0c18ea7 (patch) | |
tree | ece8ff6d7368fa3c7857f8f793043931742110d2 /include | |
parent | 2e23491c5017e578b34341fe0d0197c7ee1883cc (diff) | |
download | libnl-bd1e4d03840a4d8289ba87935096c6dcb0c18ea7.tar.gz |
cache: Add co_include_event allowing caches to provide their own nl_cache_include() implementation
Diffstat (limited to 'include')
-rw-r--r-- | include/netlink/cache-api.h | 20 | ||||
-rw-r--r-- | include/netlink/cache.h | 2 |
2 files changed, 19 insertions, 3 deletions
diff --git a/include/netlink/cache-api.h b/include/netlink/cache-api.h index c1c3aaa..390cbea 100644 --- a/include/netlink/cache-api.h +++ b/include/netlink/cache-api.h @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ #ifndef NETLINK_CACHE_API_H_ @@ -18,6 +18,8 @@ extern "C" { #endif +typedef void (*change_func_t)(struct nl_cache *, struct nl_object *, int, void *); + /** * @ingroup cache * @defgroup cache_api Cache Implementation @@ -225,6 +227,22 @@ struct nl_cache_ops */ int (*co_event_filter)(struct nl_cache *, struct nl_object *obj); + /** + * The function registered under this callback is called when an + * object formed from a notification event needs to be included in + * a cache. + * + * For each modified object, the change callback \c change_cb must + * be called with the \c data argument provided. + * + * If no function is registered, the function nl_cache_include() + * will be used for this purpose. + * + * @see nl_cache_include() + */ + int (*co_include_event)(struct nl_cache *cache, struct nl_object *obj, + change_func_t change_cb, void *data); + /** Object operations */ struct nl_object_ops * co_obj_ops; diff --git a/include/netlink/cache.h b/include/netlink/cache.h index 1e2bb9d..fd137e1 100644 --- a/include/netlink/cache.h +++ b/include/netlink/cache.h @@ -24,8 +24,6 @@ extern "C" { struct nl_cache; -typedef void (*change_func_t)(struct nl_cache *, struct nl_object *, int, void *); - /* Access Functions */ extern int nl_cache_nitems(struct nl_cache *); extern int nl_cache_nitems_filter(struct nl_cache *, |