plugin-utils.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright 2001 Sun Microsystems, Inc.
  3. * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
  4. * All rights reserved.
  5. * END COPYRIGHT BLOCK **/
  6. /***********************************************************************
  7. **
  8. ** NAME
  9. ** plugin-utils.h
  10. **
  11. ** DESCRIPTION
  12. **
  13. **
  14. ** AUTHOR
  15. ** <[email protected]>
  16. **
  17. ***********************************************************************/
  18. #ifndef _PLUGIN_UTILS_H_
  19. #define _PLUGIN_UTILS_H_
  20. /***********************************************************************
  21. ** Includes
  22. ***********************************************************************/
  23. #include <slapi-plugin.h>
  24. /*
  25. * slapi-plugin-compat4.h is needed because we use the following deprecated
  26. * functions:
  27. *
  28. * slapi_search_internal()
  29. * slapi_modify_internal()
  30. */
  31. #include "slapi-plugin-compat4.h"
  32. #include <dirlite_strings.h>
  33. #include <stdio.h>
  34. #include <string.h>
  35. #ifdef _WINDOWS
  36. #undef strcasecmp
  37. #define strcasecmp strcmpi
  38. #endif
  39. #include "dirver.h"
  40. #ifdef LDAP_DEBUG
  41. #ifndef DEBUG
  42. #define DEBUG
  43. #endif
  44. #endif
  45. #define BEGIN do {
  46. #define END } while(0);
  47. int initCounterLock();
  48. int op_error(int internal_error);
  49. Slapi_PBlock *readPblockAndEntry( const char *baseDN, const char *filter,
  50. char *attrs[] );
  51. int entryHasObjectClass(Slapi_PBlock *pb, Slapi_Entry *e,
  52. const char *objectClass);
  53. Slapi_PBlock *dnHasObjectClass( const char *baseDN, const char *objectClass );
  54. Slapi_PBlock *dnHasAttribute( const char *baseDN, const char *attrName );
  55. int setCounter( Slapi_Entry *e, const char *attrName, int value );
  56. int updateCounter( Slapi_Entry *e, const char *attrName, int increment );
  57. int updateCounterByDN( const char *dn, const char *attrName, int increment );
  58. typedef struct DNLink {
  59. char *dn;
  60. void *data;
  61. struct DNLink *next;
  62. } DNLink;
  63. DNLink *cacheInit( void );
  64. DNLink *cacheAdd( DNLink *root, char *dn, void *data );
  65. char *cacheRemove( DNLink *root, char *dn );
  66. int cacheDelete( DNLink *root, char *dn );
  67. DNLink *cacheFind( DNLink *root, char *dn );
  68. #endif /* _PLUGIN_UTILS_H_ */