Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. splay.h
  5. Abstract:
  6. Header file for splay.cpp (see a description of the data structures there)
  7. Author:
  8. Vishnu Patankar (vishnup) 15-Aug-2000 created
  9. --*/
  10. #include <nt.h>
  11. #include <ntrtl.h>
  12. #include <nturtl.h>
  13. #include <windows.h>
  14. #include <string.h>
  15. #include <wchar.h>
  16. #include <stddef.h>
  17. #include <stdlib.h>
  18. #include <stdio.h>
  19. #ifndef _splay_h
  20. #define _splay_h
  21. #ifndef Thread
  22. #define Thread __declspec( thread )
  23. #endif
  24. //
  25. // This typedef can be changed for making the splay library more generic
  26. // and exportable perhaps (will require function pointers for generic compares)
  27. //
  28. typedef enum _SCEP_NODE_VALUE_TYPE {
  29. SplayNodeSidType = 1,
  30. SplayNodeStringType
  31. } SCEP_NODE_VALUE_TYPE;
  32. typedef struct _SCEP_SPLAY_NODE_ {
  33. PVOID Value;
  34. DWORD dwByteLength;
  35. struct _SCEP_SPLAY_NODE_ *Left;
  36. struct _SCEP_SPLAY_NODE_ *Right;
  37. } SCEP_SPLAY_NODE, *PSCEP_SPLAY_NODE;
  38. typedef struct _SCEP_SPLAY_TREE_ {
  39. _SCEP_SPLAY_NODE_ *Root;
  40. _SCEP_SPLAY_NODE_ *Sentinel;
  41. SCEP_NODE_VALUE_TYPE Type;
  42. } SCEP_SPLAY_TREE, *PSCEP_SPLAY_TREE;
  43. //
  44. // functions to do operations on the splay tree
  45. //
  46. VOID
  47. ScepSplayFreeTree(
  48. IN PSCEP_SPLAY_TREE *ppTreeRoot,
  49. IN BOOL bDestroyTree
  50. );
  51. PSCEP_SPLAY_TREE
  52. ScepSplayInitialize(
  53. SCEP_NODE_VALUE_TYPE Type
  54. );
  55. DWORD
  56. ScepSplayInsert(
  57. IN PVOID Value,
  58. IN OUT PSCEP_SPLAY_TREE pTreeRoot,
  59. OUT BOOL *pbExists
  60. );
  61. DWORD
  62. ScepSplayDelete(
  63. IN PVOID Value,
  64. IN OUT PSCEP_SPLAY_TREE pTreeRoot
  65. );
  66. BOOL
  67. ScepSplayValueExist(
  68. IN PVOID Value,
  69. IN OUT PSCEP_SPLAY_TREE pTreeRoot
  70. );
  71. BOOL
  72. ScepSplayTreeEmpty(
  73. IN PSCEP_SPLAY_TREE pTreeRoot
  74. );
  75. #endif