repl_helper.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. * END COPYRIGHT BLOCK **/
  6. /*
  7. * repl_helper.h - Helper functions (should actually be repl_utils.h)
  8. *
  9. *
  10. *
  11. */
  12. #ifndef _REPL_HELPER_H
  13. #define _REPL_HELPER_H
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #include "nspr.h"
  18. #include "slapi-plugin.h"
  19. /*
  20. * shamelessly stolen from the xp library
  21. *
  22. */
  23. /*
  24. Linked list manipulation routines
  25. this is a very standard linked list structure
  26. used by many many programmers all over the world
  27. The lists have been modified to be doubly linked. The
  28. first element in a list is always the header. The 'next'
  29. pointer of the header is the first element in the list.
  30. The 'prev' pointer of the header is the last element in
  31. the list.
  32. The 'prev' pointer of the first real element in the list
  33. is NULL as is the 'next' pointer of the last real element
  34. in the list
  35. */
  36. typedef struct _repl_genericList {
  37. void *object;
  38. struct _repl_genericList *next;
  39. struct _repl_genericList *prev;
  40. } ReplGenericList;
  41. typedef void *(ReplGenericListObjectDestroyFn)(void *obj);
  42. ReplGenericList *ReplGenericListNew(void);
  43. void ReplGenericListDestroy(ReplGenericList *list, ReplGenericListObjectDestroyFn destroyFn);
  44. void ReplGenericListAddObject(ReplGenericList *list,
  45. void *newObject);
  46. ReplGenericList *ReplGenericListFindObject(ReplGenericList *list,
  47. void *obj);
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif