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.

111 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. opaqueid.h
  5. Abstract:
  6. This module contains declarations for manipulating opaque IDs to
  7. kernel-mode objects.
  8. Author:
  9. Keith Moore (keithmo) 05-Aug-1998
  10. Revision History:
  11. --*/
  12. #ifndef _OPAQUEID_H_
  13. #define _OPAQUEID_H_
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. //
  18. // The maximum size of the first-level table. Out of 32 bits, we use 6 bits
  19. // for the processor (64) and 8 bits for the second-level table (256). So
  20. // we have 18 = (32 - 6 - 8) bits left, or 262,144 first-level tables per
  21. // processor, for a total of 67,108,864 opaque IDs per processor.
  22. //
  23. #define MAX_OPAQUE_ID_TABLE_SIZE (1 << (32 - 6 - 8))
  24. //
  25. // Types to set opaque IDs to for tag-like free checking.
  26. //
  27. typedef enum _UL_OPAQUE_ID_TYPE
  28. {
  29. UlOpaqueIdTypeInvalid = 0,
  30. UlOpaqueIdTypeConfigGroup,
  31. UlOpaqueIdTypeHttpConnection,
  32. UlOpaqueIdTypeHttpRequest,
  33. UlOpaqueIdTypeRawConnection,
  34. UlOpaqueIdTypeMaximum
  35. } UL_OPAQUE_ID_TYPE, *PUL_OPAQUE_ID_TYPE;
  36. //
  37. // Routines invoked to manipulate the reference count of an object.
  38. //
  39. typedef
  40. VOID
  41. (*PUL_OPAQUE_ID_OBJECT_REFERENCE)(
  42. IN PVOID pObject
  43. REFERENCE_DEBUG_FORMAL_PARAMS
  44. );
  45. //
  46. // Public functions.
  47. //
  48. NTSTATUS
  49. UlInitializeOpaqueIdTable(
  50. VOID
  51. );
  52. VOID
  53. UlTerminateOpaqueIdTable(
  54. VOID
  55. );
  56. NTSTATUS
  57. UlAllocateOpaqueId(
  58. OUT PHTTP_OPAQUE_ID pOpaqueId,
  59. IN UL_OPAQUE_ID_TYPE OpaqueIdType,
  60. IN PVOID pContext
  61. );
  62. VOID
  63. UlFreeOpaqueId(
  64. IN HTTP_OPAQUE_ID OpaqueId,
  65. IN UL_OPAQUE_ID_TYPE OpaqueIdType
  66. );
  67. PVOID
  68. UlGetObjectFromOpaqueId(
  69. IN HTTP_OPAQUE_ID OpaqueId,
  70. IN UL_OPAQUE_ID_TYPE OpaqueIdType,
  71. IN PUL_OPAQUE_ID_OBJECT_REFERENCE pReferenceRoutine
  72. );
  73. #ifdef __cplusplus
  74. }; // extern "C"
  75. #endif
  76. #endif // _OPAQUEID_H_