repl_helper.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. /*
  13. * repl_helper.h - Helper functions (should actually be repl_utils.h)
  14. *
  15. *
  16. *
  17. */
  18. #ifndef _REPL_HELPER_H
  19. #define _REPL_HELPER_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #include "nspr.h"
  24. #include "slapi-plugin.h"
  25. /*
  26. * shamelessly stolen from the xp library
  27. *
  28. */
  29. /*
  30. Linked list manipulation routines
  31. this is a very standard linked list structure
  32. used by many many programmers all over the world
  33. The lists have been modified to be doubly linked. The
  34. first element in a list is always the header. The 'next'
  35. pointer of the header is the first element in the list.
  36. The 'prev' pointer of the header is the last element in
  37. the list.
  38. The 'prev' pointer of the first real element in the list
  39. is NULL as is the 'next' pointer of the last real element
  40. in the list
  41. */
  42. typedef struct _repl_genericList {
  43. void *object;
  44. struct _repl_genericList *next;
  45. struct _repl_genericList *prev;
  46. } ReplGenericList;
  47. typedef void *(ReplGenericListObjectDestroyFn)(void *obj);
  48. ReplGenericList *ReplGenericListNew(void);
  49. void ReplGenericListDestroy(ReplGenericList *list, ReplGenericListObjectDestroyFn destroyFn);
  50. void ReplGenericListAddObject(ReplGenericList *list,
  51. void *newObject);
  52. ReplGenericList *ReplGenericListFindObject(ReplGenericList *list,
  53. void *obj);
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif