libnl
3.2.3
|
00001 /* 00002 * netlink/object.c Generic Cacheable Object 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-2008 Thomas Graf <tgraf@suug.ch> 00010 */ 00011 00012 #ifndef NETLINK_OBJECT_H_ 00013 #define NETLINK_OBJECT_H_ 00014 00015 #include <netlink/netlink.h> 00016 #include <netlink/utils.h> 00017 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif 00021 00022 struct nl_cache; 00023 struct nl_object; 00024 struct nl_object_ops; 00025 00026 #define OBJ_CAST(ptr) ((struct nl_object *) (ptr)) 00027 00028 /* General */ 00029 extern struct nl_object * nl_object_alloc(struct nl_object_ops *); 00030 extern int nl_object_alloc_name(const char *, 00031 struct nl_object **); 00032 extern void nl_object_free(struct nl_object *); 00033 extern struct nl_object * nl_object_clone(struct nl_object *obj); 00034 extern void nl_object_get(struct nl_object *); 00035 extern void nl_object_put(struct nl_object *); 00036 extern int nl_object_shared(struct nl_object *); 00037 extern void nl_object_dump(struct nl_object *, 00038 struct nl_dump_params *); 00039 extern void nl_object_dump_buf(struct nl_object *, char *, size_t); 00040 extern int nl_object_identical(struct nl_object *, 00041 struct nl_object *); 00042 extern uint32_t nl_object_diff(struct nl_object *, 00043 struct nl_object *); 00044 extern int nl_object_match_filter(struct nl_object *, 00045 struct nl_object *); 00046 extern char * nl_object_attrs2str(struct nl_object *, 00047 uint32_t attrs, char *buf, 00048 size_t); 00049 extern char * nl_object_attr_list(struct nl_object *, 00050 char *, size_t); 00051 00052 /* Marks */ 00053 extern void nl_object_mark(struct nl_object *); 00054 extern void nl_object_unmark(struct nl_object *); 00055 extern int nl_object_is_marked(struct nl_object *); 00056 00057 /* Access Functions */ 00058 extern int nl_object_get_refcnt(struct nl_object *); 00059 extern struct nl_cache * nl_object_get_cache(struct nl_object *); 00060 static inline void * nl_object_priv(struct nl_object *obj) 00061 { 00062 return obj; 00063 } 00064 00065 00066 #ifdef __cplusplus 00067 } 00068 #endif 00069 00070 #endif