object.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * netlink/object.c Generic Cacheable Object
  3. *
  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
  7. * of the License.
  8. *
  9. * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
  10. */
  11. #ifndef NETLINK_OBJECT_H_
  12. #define NETLINK_OBJECT_H_
  13. #include <netlink/netlink.h>
  14. #include <netlink/utils.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. struct nl_cache;
  19. struct nl_object;
  20. struct nl_object_ops;
  21. #define OBJ_CAST(ptr) ((struct nl_object *) (ptr))
  22. /* General */
  23. extern struct nl_object * nl_object_alloc(struct nl_object_ops *);
  24. extern struct nl_object * nl_object_alloc_name(const char *);
  25. extern void nl_object_free(struct nl_object *);
  26. extern struct nl_object * nl_object_clone(struct nl_object *obj);
  27. extern void nl_object_get(struct nl_object *);
  28. extern void nl_object_put(struct nl_object *);
  29. extern int nl_object_shared(struct nl_object *);
  30. extern void nl_object_dump(struct nl_object *,
  31. struct nl_dump_params *);
  32. extern int nl_object_identical(struct nl_object *,
  33. struct nl_object *);
  34. extern uint32_t nl_object_diff(struct nl_object *,
  35. struct nl_object *);
  36. extern int nl_object_match_filter(struct nl_object *,
  37. struct nl_object *);
  38. extern char * nl_object_attrs2str(struct nl_object *,
  39. uint32_t attrs, char *buf,
  40. size_t);
  41. extern char * nl_object_attr_list(struct nl_object *,
  42. char *, size_t);
  43. /* Marks */
  44. extern void nl_object_mark(struct nl_object *);
  45. extern void nl_object_unmark(struct nl_object *);
  46. extern int nl_object_is_marked(struct nl_object *);
  47. /* Access Functions */
  48. extern int nl_object_get_refcnt(struct nl_object *);
  49. extern struct nl_cache * nl_object_get_cache(struct nl_object *);
  50. static inline void * nl_object_priv(struct nl_object *obj)
  51. {
  52. return obj;
  53. }
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif