00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef NETLINK_CACHE_H_
00013 #define NETLINK_CACHE_H_
00014
00015 #include <netlink/netlink.h>
00016 #include <netlink/msg.h>
00017 #include <netlink/utils.h>
00018 #include <netlink/object.h>
00019 #include <netlink/cache-api.h>
00020
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024
00025 struct nl_cache;
00026
00027 typedef void (*change_func_t)(struct nl_cache *, struct nl_object *, int);
00028
00029
00030 extern int nl_cache_nitems(struct nl_cache *);
00031 extern int nl_cache_nitems_filter(struct nl_cache *,
00032 struct nl_object *);
00033 extern struct nl_cache_ops * nl_cache_get_ops(struct nl_cache *);
00034 extern struct nl_object * nl_cache_get_first(struct nl_cache *);
00035 extern struct nl_object * nl_cache_get_last(struct nl_cache *);
00036 extern struct nl_object * nl_cache_get_next(struct nl_object *);
00037 extern struct nl_object * nl_cache_get_prev(struct nl_object *);
00038
00039 extern struct nl_cache * nl_cache_alloc(struct nl_cache_ops *);
00040 extern int nl_cache_alloc_and_fill(struct nl_cache_ops *,
00041 struct nl_sock *,
00042 struct nl_cache **);
00043 extern int nl_cache_alloc_name(const char *,
00044 struct nl_cache **);
00045 extern struct nl_cache * nl_cache_subset(struct nl_cache *,
00046 struct nl_object *);
00047 extern void nl_cache_clear(struct nl_cache *);
00048 extern void nl_cache_free(struct nl_cache *);
00049
00050
00051 extern int nl_cache_add(struct nl_cache *,
00052 struct nl_object *);
00053 extern int nl_cache_parse_and_add(struct nl_cache *,
00054 struct nl_msg *);
00055 extern void nl_cache_remove(struct nl_object *);
00056 extern int nl_cache_refill(struct nl_sock *,
00057 struct nl_cache *);
00058 extern int nl_cache_pickup(struct nl_sock *,
00059 struct nl_cache *);
00060 extern int nl_cache_resync(struct nl_sock *,
00061 struct nl_cache *,
00062 change_func_t);
00063 extern int nl_cache_include(struct nl_cache *,
00064 struct nl_object *,
00065 change_func_t);
00066
00067
00068 extern int nl_cache_is_empty(struct nl_cache *);
00069 extern void nl_cache_mark_all(struct nl_cache *);
00070
00071
00072 extern void nl_cache_dump(struct nl_cache *,
00073 struct nl_dump_params *);
00074 extern void nl_cache_dump_filter(struct nl_cache *,
00075 struct nl_dump_params *,
00076 struct nl_object *);
00077
00078
00079 extern void nl_cache_foreach(struct nl_cache *,
00080 void (*cb)(struct nl_object *,
00081 void *),
00082 void *arg);
00083 extern void nl_cache_foreach_filter(struct nl_cache *,
00084 struct nl_object *,
00085 void (*cb)(struct
00086 nl_object *,
00087 void *),
00088 void *arg);
00089
00090
00091
00092
00093 extern struct nl_cache_ops * nl_cache_ops_lookup(const char *);
00094 extern struct nl_cache_ops * nl_cache_ops_associate(int, int);
00095 extern struct nl_msgtype * nl_msgtype_lookup(struct nl_cache_ops *, int);
00096 extern void nl_cache_ops_foreach(void (*cb)(struct nl_cache_ops *, void *), void *);
00097 extern int nl_cache_mngt_register(struct nl_cache_ops *);
00098 extern int nl_cache_mngt_unregister(struct nl_cache_ops *);
00099
00100
00101 extern void nl_cache_mngt_provide(struct nl_cache *);
00102 extern void nl_cache_mngt_unprovide(struct nl_cache *);
00103 extern struct nl_cache * nl_cache_mngt_require(const char *);
00104
00105 struct nl_cache_mngr;
00106
00107 #define NL_AUTO_PROVIDE 1
00108
00109 extern int nl_cache_mngr_alloc(struct nl_sock *,
00110 int, int,
00111 struct nl_cache_mngr **);
00112 extern int nl_cache_mngr_add(struct nl_cache_mngr *,
00113 const char *,
00114 change_func_t,
00115 struct nl_cache **);
00116 extern int nl_cache_mngr_get_fd(struct nl_cache_mngr *);
00117 extern int nl_cache_mngr_poll(struct nl_cache_mngr *,
00118 int);
00119 extern int nl_cache_mngr_data_ready(struct nl_cache_mngr *);
00120 extern void nl_cache_mngr_free(struct nl_cache_mngr *);
00121
00122 #ifdef __cplusplus
00123 }
00124 #endif
00125
00126 #endif