/build/buildd/libnl-1.0~pre6/include/netlink/cache.h

00001 /*
00002  * netlink/cache.h              Caching Module
00003  *
00004  *      This library is free software; you can redistribute it and/or
00005  *      modify it under the terms of the GNU Lesser General Public
00006  *      License as published by the Free Software Foundation version 2.1
00007  *      of the License.
00008  *
00009  * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
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 
00020 struct nl_cache;
00021 struct nl_cache_ops;
00022 
00023 /* Access Functions */
00024 extern int                      nl_cache_nitems(struct nl_cache *);
00025 extern int                      nl_cache_nitems_filter(struct nl_cache *,
00026                                                        struct nl_object *);
00027 extern struct nl_cache_ops *    nl_cache_get_ops(struct nl_cache *);
00028 extern struct nl_object *       nl_cache_get_first(struct nl_cache *);
00029 extern struct nl_object *       nl_cache_get_last(struct nl_cache *);
00030 extern struct nl_object *       nl_cache_get_next(struct nl_object *);
00031 extern struct nl_object *       nl_cache_get_prev(struct nl_object *);
00032 
00033 /* Cache creation/deletion */
00034 extern struct nl_cache *        nl_cache_alloc(void);
00035 extern struct nl_cache *        nl_cache_alloc_from_ops(struct nl_cache_ops *);
00036 extern struct nl_cache *        nl_cache_alloc_name(const char *);
00037 extern void                     nl_cache_clear(struct nl_cache *);
00038 extern void                     nl_cache_free(struct nl_cache *);
00039 
00040 /* Cache modification */
00041 extern int                      nl_cache_add(struct nl_cache *,
00042                                              struct nl_object *);
00043 extern int                      nl_cache_parse_and_add(struct nl_cache *,
00044                                                        struct nl_msg *);
00045 extern void                     nl_cache_delete(struct nl_cache *,
00046                                                 struct nl_object *);
00047 extern int                      nl_cache_update(struct nl_handle *,
00048                                                 struct nl_cache *);
00049 extern int                      nl_cache_pickup(struct nl_handle *,
00050                                                 struct nl_cache *);
00051 
00052 /* General */
00053 extern int                      nl_cache_is_empty(struct nl_cache *);
00054 
00055 /* Dumping */
00056 extern void                     nl_cache_dump(struct nl_cache *,
00057                                               struct nl_dump_params *);
00058 extern void                     nl_cache_dump_filter(struct nl_cache *,
00059                                                      struct nl_dump_params *,
00060                                                      struct nl_object *);
00061 
00062 /* Iterators */
00063 extern void                     nl_cache_foreach(struct nl_cache *,
00064                                                  void (*cb)(struct nl_object *,
00065                                                             void *),
00066                                                  void *arg);
00067 extern void                     nl_cache_foreach_filter(struct nl_cache *,
00068                                                         struct nl_object *,
00069                                                         void (*cb)(struct
00070                                                                    nl_object *,
00071                                                                    void *),
00072                                                         void *arg);
00073 
00074 /* --- cache management --- */
00075 
00076 /* Access Functions */
00077 extern char *                   nl_cache_ops_get_name(struct nl_cache_ops *);
00078 
00079 /* Message type association */
00080 extern struct nl_cache_ops *    nl_cache_mngt_associate(int, int);
00081 extern char *                   nl_cache_mngt_type2name(struct nl_cache_ops *,
00082                                                         int, char *, size_t);
00083 
00084 /* Cache type management */
00085 extern struct nl_cache_ops *    nl_cache_mngt_lookup(const char *);
00086 extern int                      nl_cache_mngt_register(struct nl_cache_ops *);
00087 extern int                      nl_cache_mngt_unregister(struct nl_cache_ops *);
00088 
00089 /* Global cache provisioning/requiring */
00090 extern void                     nl_cache_mngt_provide(struct nl_cache *);
00091 extern void                     nl_cache_mngt_unprovide(struct nl_cache *);
00092 extern struct nl_cache *        nl_cache_mngt_require(const char *);
00093 
00094 #endif

Generated on Fri Apr 27 14:14:07 2007 for libnl by  doxygen 1.5.1