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.

189 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. queue.h
  5. Abstract:
  6. Domain Name System (DNS) Server
  7. Queue functionality specific to Dynamic DNS registration.
  8. Author:
  9. Ram Viswanathan (ramv) March 27 1997
  10. Revision History:
  11. Ram Viswanathan (ramv) March 27 1997 Created
  12. --*/
  13. typedef struct _QELEMENT {
  14. REGISTER_HOST_ENTRY HostAddr;
  15. LPWSTR pszName;
  16. DWORD dwTTL;
  17. BOOL fDoForward;
  18. BOOL fDoForwardOnly;
  19. DWORD dwOperation; // what operation needs to be performed
  20. DWORD dwRetryTime; //used by timed out queue (in secs)
  21. DWORD dwRetryCount;
  22. DHCP_CALLBACK_FN pfnDhcpCallBack; // call back function to call
  23. PVOID pvData;
  24. PIP_ARRAY DnsServerList;
  25. struct _QELEMENT* pFLink;
  26. struct _QELEMENT* pBLink; //doubly linked list
  27. } QELEMENT, *PQELEMENT;
  28. typedef struct _DynDnsQueue {
  29. PQELEMENT pHead; // pointer to the queue Head, where you take elements
  30. // off of the queue
  31. PQELEMENT pTail; // pointer to tail, where producer adds elements
  32. } DYNDNSQUEUE, *PDYNDNSQUEUE;
  33. //
  34. // methods to manipulate queue
  35. //
  36. DWORD
  37. InitializeQueues(
  38. PDYNDNSQUEUE * ppQueue,
  39. PDYNDNSQUEUE * ppTimedOutQueue
  40. );
  41. /*
  42. InitializeQueue()
  43. This function initializes the queue object. This is invoked for the first
  44. time when you create the main queue and timed out queue
  45. Allocates appropriate memory variables etc
  46. */
  47. DWORD
  48. FreeQueue(
  49. PDYNDNSQUEUE pqueue
  50. );
  51. /*
  52. FreeQueue()
  53. Frees the queue object. If there exist any entries in the queue, we
  54. just blow them away
  55. */
  56. DWORD
  57. Enqueue(
  58. PQELEMENT pNewElement,
  59. PDYNDNSQUEUE pQueue,
  60. PDYNDNSQUEUE pTimedOutQueue
  61. );
  62. /*
  63. Enqueue()
  64. Adds new element to queue. If there is a dependency, this moves into
  65. the timedout queue.
  66. Arguments:
  67. Return Value:
  68. is 0 if Success. and (DWORD)-1 if failure.
  69. */
  70. PQELEMENT
  71. Dequeue(
  72. PDYNDNSQUEUE pQueue
  73. );
  74. /*
  75. Dequeue()
  76. Removes an element from a queue, either the main queue or the timed
  77. out queue
  78. Arguments:
  79. Return Value:
  80. is the element at head of queue if Success. and NULL if failure.
  81. */
  82. DWORD
  83. AddToTimedOutQueue(
  84. PQELEMENT pNewElement,
  85. PDYNDNSQUEUE pRetryQueue,
  86. DWORD dwRetryTime
  87. );
  88. /*
  89. AddToTimedOutQueue()
  90. Adds new element to timedout queue. Now the new element is added in a list
  91. of elements sorted according to decreasing order of Retry Times. An
  92. insertion sort type of algorithm is used.
  93. Arguments:
  94. dwRetryTime is in seconds
  95. Return Value:
  96. is 0 if Success. and (DWORD)-1 if failure.
  97. */
  98. DWORD
  99. GetEarliestRetryTime(
  100. PDYNDNSQUEUE pRetryQueue
  101. );
  102. /*
  103. GetEarliestRetryTime()
  104. Checks to see if there is any element at the head of the queue
  105. and gets the retry time for this element
  106. Arguments:
  107. Return Value:
  108. is retrytime if success and INFINITE if there is no element or other
  109. failure
  110. */
  111. /*
  112. VOID
  113. ProcessMainQDependencies(
  114. PDYNDNSQUEUE pQueue,
  115. PQELEMENT pQElement
  116. );
  117. */
  118. DWORD
  119. ProcessQDependencies(
  120. PDYNDNSQUEUE pTimedOutQueue,
  121. PQELEMENT pQElement
  122. );