2 * netlink/cache.h Caching Module
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
12 #ifndef NETLINK_CACHE_H_
13 #define NETLINK_CACHE_H_
15 #include <netlink/netlink.h>
16 #include <netlink/msg.h>
17 #include <netlink/utils.h>
18 #include <netlink/object.h>
23 /* Access Functions */
24 extern int nl_cache_nitems(struct nl_cache *);
25 extern int nl_cache_nitems_filter(struct nl_cache *,
27 extern struct nl_cache_ops * nl_cache_get_ops(struct nl_cache *);
28 extern struct nl_object * nl_cache_get_first(struct nl_cache *);
29 extern struct nl_object * nl_cache_get_last(struct nl_cache *);
30 extern struct nl_object * nl_cache_get_next(struct nl_object *);
31 extern struct nl_object * nl_cache_get_prev(struct nl_object *);
33 /* Cache creation/deletion */
34 extern struct nl_cache * nl_cache_alloc(void);
35 extern struct nl_cache * nl_cache_alloc_from_ops(struct nl_cache_ops *);
36 extern struct nl_cache * nl_cache_alloc_name(const char *);
37 extern void nl_cache_clear(struct nl_cache *);
38 extern void nl_cache_free(struct nl_cache *);
40 /* Cache modification */
41 extern int nl_cache_add(struct nl_cache *,
43 extern int nl_cache_parse_and_add(struct nl_cache *,
45 extern void nl_cache_delete(struct nl_cache *,
47 extern int nl_cache_update(struct nl_handle *,
49 extern int nl_cache_pickup(struct nl_handle *,
53 extern int nl_cache_is_empty(struct nl_cache *);
56 extern void nl_cache_dump(struct nl_cache *,
57 struct nl_dump_params *);
58 extern void nl_cache_dump_filter(struct nl_cache *,
59 struct nl_dump_params *,
63 extern void nl_cache_foreach(struct nl_cache *,
64 void (*cb)(struct nl_object *,
67 extern void nl_cache_foreach_filter(struct nl_cache *,
74 /* --- cache management --- */
76 /* Access Functions */
77 extern char * nl_cache_ops_get_name(struct nl_cache_ops *);
79 /* Message type association */
80 extern struct nl_cache_ops * nl_cache_mngt_associate(int, int);
81 extern char * nl_cache_mngt_type2name(struct nl_cache_ops *,
84 /* Cache type management */
85 extern struct nl_cache_ops * nl_cache_mngt_lookup(const char *);
86 extern int nl_cache_mngt_register(struct nl_cache_ops *);
87 extern int nl_cache_mngt_unregister(struct nl_cache_ops *);
89 /* Global cache provisioning/requiring */
90 extern void nl_cache_mngt_provide(struct nl_cache *);
91 extern void nl_cache_mngt_unprovide(struct nl_cache *);
92 extern struct nl_cache * nl_cache_mngt_require(const char *);