libnl  3.2.20
nl_cache_ops Struct Reference

Cache Operations. More...

#include <cache-api.h>

Data Fields

char * co_name
 Name of cache type (must be unique)
int co_hdrsize
 Size of family specific netlink header.
int co_protocol
 Netlink protocol.
int co_hash_size
 cache object hash size
unsigned int co_flags
 cache flags
unsigned int co_refcnt
 Reference counter.
struct nl_af_groupco_groups
 Group definition.
int(* co_request_update )(struct nl_cache *, struct nl_sock *)
 Called whenever an update of the cache is required.
int(* co_msg_parser )(struct nl_cache_ops *, struct sockaddr_nl *, struct nlmsghdr *, struct nl_parser_param *)
 Called whenever a message was received that needs to be parsed.
int(* co_event_filter )(struct nl_cache *, struct nl_object *obj)
 The function registered under this callback is called after a netlink notification associated with this cache type has been parsed into an object and is being considered for inclusio into the specified cache.
int(* co_include_event )(struct nl_cache *cache, struct nl_object *obj, change_func_t change_cb, void *data)
 The function registered under this callback is called when an object formed from a notification event needs to be included in a cache.
void(* reserved_1 )(void)
void(* reserved_2 )(void)
void(* reserved_3 )(void)
void(* reserved_4 )(void)
void(* reserved_5 )(void)
void(* reserved_6 )(void)
void(* reserved_7 )(void)
void(* reserved_8 )(void)
struct nl_object_opsco_obj_ops
 Object operations.
struct nl_cache_opsco_next
 Internal, do not touch!
struct nl_cache * co_major_cache
struct genl_opsco_genl
struct nl_msgtype co_msgtypes []

Detailed Description

Cache Operations.

This structure defines the characterstics of a cache type. It contains pointers to functions which implement the specifics of the object type the cache can hold.

Definition at line 178 of file cache-api.h.


Field Documentation

int(* nl_cache_ops::co_request_update)(struct nl_cache *, struct nl_sock *)

Called whenever an update of the cache is required.

Must send a request message to the kernel requesting a complete dump.

Definition at line 205 of file cache-api.h.

int(* nl_cache_ops::co_msg_parser)(struct nl_cache_ops *, struct sockaddr_nl *, struct nlmsghdr *, struct nl_parser_param *)

Called whenever a message was received that needs to be parsed.

Must parse the message and call the paser callback function (nl_parser_param) provided via the argument.

Definition at line 212 of file cache-api.h.

Referenced by genl_register().

int(* nl_cache_ops::co_event_filter)(struct nl_cache *, struct nl_object *obj)

The function registered under this callback is called after a netlink notification associated with this cache type has been parsed into an object and is being considered for inclusio into the specified cache.

The purpose of this function is to filter out notifications which should be ignored when updating caches.

The function must return NL_SKIP to prevent the object from being included, or NL_OK to include it.

int my_filter(struct nl_cache *cache, struct nl_object *obj)
{
if (reason_to_not_include_obj(obj))
return NL_SKIP;
return NL_OK;
}

Definition at line 237 of file cache-api.h.

int(* nl_cache_ops::co_include_event)(struct nl_cache *cache, struct nl_object *obj, change_func_t change_cb, void *data)

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 change_cb must be called with the data argument provided.

If no function is registered, the function nl_cache_include() will be used for this purpose.

See also:
nl_cache_include()

Definition at line 252 of file cache-api.h.