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.

134 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. ntos\tdi\isn\fwd\netbios.h
  5. Abstract:
  6. Netbios packet processing
  7. Author:
  8. Vadim Eydelman
  9. Revision History:
  10. --*/
  11. #ifndef IPXFWD_NETBIOS
  12. #define IPXFWD_NETBIOS
  13. extern LIST_ENTRY NetbiosQueue;
  14. extern KSPIN_LOCK NetbiosQueueLock;
  15. extern WORK_QUEUE_ITEM NetbiosWorker;
  16. extern BOOLEAN NetbiosWorkerScheduled;
  17. extern ULONG NetbiosPacketsQuota;
  18. extern ULONG MaxNetbiosPacketsQueued;
  19. #define DEF_MAX_NETBIOS_PACKETS_QUEUED 256
  20. /*++
  21. *******************************************************************
  22. I n i t i a l i z e N e t b i o s Q u e u e
  23. Routine Description:
  24. Initializes the netbios bradcast queue
  25. Arguments:
  26. None
  27. Return Value:
  28. None
  29. *******************************************************************
  30. --*/
  31. //VOID
  32. //InitializeNetbiosQueue (
  33. // void
  34. // )
  35. #define InitializeNetbiosQueue() { \
  36. InitializeListHead (&NetbiosQueue); \
  37. KeInitializeSpinLock (&NetbiosQueueLock); \
  38. ExInitializeWorkItem (&NetbiosWorker, &ProcessNetbiosQueue, NULL);\
  39. NetbiosWorkerScheduled = FALSE; \
  40. NetbiosPacketsQuota = MaxNetbiosPacketsQueued; \
  41. }
  42. /*++
  43. *******************************************************************
  44. D e l e t e N e t b i o s Q u e u e
  45. Routine Description:
  46. Deletes the netbios bradcast queue
  47. Arguments:
  48. None
  49. Return Value:
  50. None
  51. *******************************************************************
  52. --*/
  53. VOID
  54. DeleteNetbiosQueue (
  55. void
  56. );
  57. /*++
  58. *******************************************************************
  59. P r o c e s s N e t b i o s Q u e u e
  60. Routine Description:
  61. Process packets in the netbios bradcast queue
  62. Arguments:
  63. Context - unused
  64. Return Value:
  65. None
  66. *******************************************************************
  67. --*/
  68. VOID
  69. ProcessNetbiosQueue (
  70. PVOID Context
  71. );
  72. /*++
  73. *******************************************************************
  74. P r o c e s s N e t b i o s P a c k e t
  75. Routine Description:
  76. Processes received netbios broadcast packet
  77. Arguments:
  78. None
  79. Return Value:
  80. None
  81. *******************************************************************
  82. --*/
  83. VOID
  84. ProcessNetbiosPacket (
  85. PINTERFACE_CB srcIf,
  86. PPACKET_TAG pktTag
  87. );
  88. #define QueueNetbiosPacket(pktTag) { \
  89. KIRQL oldIRQL; \
  90. KeAcquireSpinLock (&NetbiosQueueLock, &oldIRQL); \
  91. InsertTailList (&NetbiosQueue, &pktTag->PT_QueueLink); \
  92. KeReleaseSpinLock (&NetbiosQueueLock, oldIRQL); \
  93. }
  94. #define ScheduleNetbiosWorker() { \
  95. KIRQL oldIRQL; \
  96. KeAcquireSpinLock (&NetbiosQueueLock, &oldIRQL); \
  97. if (!NetbiosWorkerScheduled \
  98. && !IsListEmpty (&NetbiosQueue) \
  99. && EnterForwarder ()) { \
  100. NetbiosWorkerScheduled = TRUE; \
  101. ExQueueWorkItem (&NetbiosWorker, DelayedWorkQueue); \
  102. } \
  103. KeReleaseSpinLock (&NetbiosQueueLock, oldIRQL); \
  104. }
  105. #endif