Leaked source code of windows server 2003
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.

166 lines
4.6 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. nbf.h
  5. Abstract:
  6. Private include file for the NBF (NetBIOS Frames Protocol) transport
  7. provider subcomponent of the NTOS project.
  8. Author:
  9. Stephen E. Jones (stevej) 25-Oct-1989
  10. Revision History:
  11. David Beaver (dbeaver) 24-Sep-1990
  12. Remove PDI and PC586-specific support; add NDIS support
  13. --*/
  14. #ifndef _NBF_
  15. #define _NBF_
  16. #include <ntddk.h>
  17. typedef struct _RTL_SPLAY_LINKS {
  18. struct _RTL_SPLAY_LINKS *Parent;
  19. struct _RTL_SPLAY_LINKS *LeftChild;
  20. struct _RTL_SPLAY_LINKS *RightChild;
  21. } RTL_SPLAY_LINKS;
  22. typedef RTL_SPLAY_LINKS *PRTL_SPLAY_LINKS;
  23. #define RtlInitializeSplayLinks(Links) { \
  24. PRTL_SPLAY_LINKS _SplayLinks; \
  25. _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
  26. _SplayLinks->Parent = _SplayLinks; \
  27. _SplayLinks->LeftChild = NULL; \
  28. _SplayLinks->RightChild = NULL; \
  29. }
  30. #define RtlLeftChild(Links) ( \
  31. (PRTL_SPLAY_LINKS)(Links)->LeftChild \
  32. )
  33. #define RtlRightChild(Links) ( \
  34. (PRTL_SPLAY_LINKS)(Links)->RightChild \
  35. )
  36. #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) { \
  37. PRTL_SPLAY_LINKS _SplayParent; \
  38. PRTL_SPLAY_LINKS _SplayChild; \
  39. _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
  40. _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
  41. _SplayParent->LeftChild = _SplayChild; \
  42. _SplayChild->Parent = _SplayParent; \
  43. }
  44. #define RtlInsertAsRightChild(ParentLinks,ChildLinks) { \
  45. PRTL_SPLAY_LINKS _SplayParent; \
  46. PRTL_SPLAY_LINKS _SplayChild; \
  47. _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
  48. _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
  49. _SplayParent->RightChild = _SplayChild; \
  50. _SplayChild->Parent = _SplayParent; \
  51. }
  52. PRTL_SPLAY_LINKS
  53. NTAPI
  54. RtlDelete (
  55. PRTL_SPLAY_LINKS Links
  56. );
  57. VOID
  58. NTAPI
  59. RtlGetCallersAddress(
  60. OUT PVOID *CallersAddress,
  61. OUT PVOID *CallersCaller
  62. );
  63. #include <tdikrnl.h> // Transport Driver Interface.
  64. #include <ndis.h> // Physical Driver Interface.
  65. #if DEVL
  66. #define STATIC
  67. #else
  68. #define STATIC static
  69. #endif
  70. #include "nbfconst.h" // private NETBEUI constants.
  71. #include "nbfmac.h" // mac-specific definitions
  72. #include "nbfhdrs.h" // private NETBEUI protocol headers.
  73. #include "nbftypes.h" // private NETBEUI types.
  74. #include "nbfcnfg.h" // configuration information.
  75. #include "nbfprocs.h" // private NETBEUI function prototypes.
  76. #ifdef MEMPRINT
  77. #include "memprint.h" // drt's memory debug print
  78. #endif
  79. #ifndef NBF_LOCKS
  80. #define ACQUIRE_SPIN_LOCK(lock,irql) KeAcquireSpinLock(lock,irql)
  81. #define RELEASE_SPIN_LOCK(lock,irql) KeReleaseSpinLock(lock,irql)
  82. #if 0
  83. #define ACQUIRE_DPC_SPIN_LOCK(lock) \
  84. { KIRQL OldIrql; ASSERT ((lock != NULL) && (KeGetCurrentIrql() == DISPATCH_LEVEL)); KeAcquireSpinLock(lock,&OldIrql); }
  85. #define RELEASE_DPC_SPIN_LOCK(lock) \
  86. { ASSERT(lock != NULL); KeReleaseSpinLock(lock,DISPATCH_LEVEL); }
  87. #else
  88. #define ACQUIRE_DPC_SPIN_LOCK(lock) KeAcquireSpinLockAtDpcLevel(lock)
  89. #define RELEASE_DPC_SPIN_LOCK(lock) KeReleaseSpinLockFromDpcLevel(lock)
  90. #endif
  91. #define ENTER_NBF
  92. #define LEAVE_NBF
  93. #else
  94. VOID
  95. NbfAcquireSpinLock(
  96. IN PKSPIN_LOCK Lock,
  97. OUT PKIRQL OldIrql,
  98. IN PSZ LockName,
  99. IN PSZ FileName,
  100. IN ULONG LineNumber
  101. );
  102. VOID
  103. NbfReleaseSpinLock(
  104. IN PKSPIN_LOCK Lock,
  105. IN KIRQL OldIrql,
  106. IN PSZ LockName,
  107. IN PSZ FileName,
  108. IN ULONG LineNumber
  109. );
  110. #define ACQUIRE_SPIN_LOCK(lock,irql) \
  111. NbfAcquireSpinLock( lock, irql, #lock, __FILE__, __LINE__ )
  112. #define RELEASE_SPIN_LOCK(lock,irql) \
  113. NbfReleaseSpinLock( lock, irql, #lock, __FILE__, __LINE__ )
  114. #define ACQUIRE_DPC_SPIN_LOCK(lock) \
  115. { \
  116. KIRQL OldIrql; \
  117. NbfAcquireSpinLock( lock, &OldIrql, #lock, __FILE__, __LINE__ ); \
  118. }
  119. #define RELEASE_DPC_SPIN_LOCK(lock) \
  120. NbfReleaseSpinLock( lock, DISPATCH_LEVEL, #lock, __FILE__, __LINE__ )
  121. #define ENTER_NBF \
  122. NbfAcquireSpinLock( (PKSPIN_LOCK)NULL, (PKIRQL)NULL, "(Global)", __FILE__, __LINE__ )
  123. #define LEAVE_NBF \
  124. NbfReleaseSpinLock( (PKSPIN_LOCK)NULL, (KIRQL)-1, "(Global)", __FILE__, __LINE__ )
  125. #endif
  126. #endif // def _NBF_