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.

165 lines
5.9 KiB

  1. #pragma once
  2. //-----------------------------------------------------------
  3. // Constants / macros
  4. #define TMMS_INFINITE 0x7fffffff
  5. #define TMMS_Tr 0x00000bb8 // Timeout until a rescan completes: ms(3sec)
  6. #define TMMS_Tc 0x0000ea60 // Timeout to retry a valid configuration: ms(1min)
  7. #define TMMS_Tp 0x000007d0 // Timeout to expect a media connect for a selected config: ms(2sec)
  8. #define TMMS_Tf 0x0000ea60 // Timeout to recover from a failed configuration: ms(1min)
  9. #define TMMS_Td 0x00001388 // Timeout to delay the {SSr} processing: ms(5sec)
  10. #define TIMER_SET(pIntf, tm, Err) Err=StateTmSetOneTimeTimer((pIntf), (tm))
  11. #define TIMER_RESET(pIntf, Err) Err=StateTmSetOneTimeTimer((pIntf), TMMS_INFINITE)
  12. extern DWORD DhcpStaticRefreshParams(IN LPWSTR Adapter);
  13. //-----------------------------------------------------------
  14. // Type definitions
  15. //
  16. // Defines the state handler function. The interface context contains
  17. // a pointer to one State Handler function. Based on the function it points
  18. // to, this pointer identifies the state where the context is in. There should
  19. // be one function call having this prototype for each possible state:
  20. // x StateInitFn {SI}
  21. // x StateHardResetFn, {SHr}
  22. // x StateSoftResetFn, {SSr}
  23. // x StateDelaySoftResetFn, {SDSr}
  24. // x StateQueryFn, {SQ}
  25. // x StateIterateFn, {SIter}
  26. // x StateNotifyFn, {SN}
  27. // x StateCfgHardKeyFn, {SCk}
  28. // x StateConfiguredFn, {SC}
  29. // x StateCfgRemoveFn, {SRs}
  30. // x StateCfgPreserveFn, {SPs}
  31. // x StateFailedFn, {SF}
  32. typedef struct _INTF_CONTEXT *PINTF_CONTEXT;
  33. typedef DWORD(*PFN_STATE_HANDLER)(PINTF_CONTEXT pIntfContext);
  34. // Enumeration for state transition events
  35. typedef enum
  36. {
  37. // a new interface has been added to the system (either device arrival or adapter bind)
  38. eEventAdd=0,
  39. // the interface has been removed from the system (either device removal or adapter unbind)
  40. eEventRemove,
  41. // media connect has been received for the interface
  42. eEventConnect,
  43. // media disconnect has been received for the interface
  44. eEventDisconnect,
  45. // a timeout occured for the interface
  46. eEventTimeout,
  47. // a refresh command has been issued
  48. eEventCmdRefresh,
  49. // a reset command has been issued
  50. eEventCmdReset,
  51. // a WZCCMD_CFG_NEXT command has been issued
  52. eEventCmdCfgNext,
  53. // a WZCCMD_CFG_DELETE command has been issued
  54. eEventCmdCfgDelete,
  55. // a WZCCMD_CFG_NOOP command has been issued
  56. eEventCmdCfgNoop
  57. } ESTATE_EVENT;
  58. //-----------------------------------------------------------
  59. // Function declarations
  60. //-----------------------------------------------------------
  61. // StateTmSetOneTimeTimer: Sets a one time timer for the given context with the
  62. // hardcoded callback WZCTimeoutCallback() and with the parameter the interface
  63. // context itself.
  64. // Parameters:
  65. // [in/out] pIntfContext: identifies the context for which is set the timer.
  66. // [in] dwMSeconds: miliseconds interval when the timer is due to fire
  67. DWORD
  68. StateTmSetOneTimeTimer(
  69. PINTF_CONTEXT pIntfContext,
  70. DWORD dwMSeconds);
  71. //-----------------------------------------------------------
  72. // StateDispatchEvent: processes an event that will cause the state machine to transition
  73. // through one or more states.
  74. // Parameters:
  75. // [in] StateEvent: identifies the event that triggers the transition(s)
  76. // [in] pIntfContext: points to the interface that is subject for the transition(s)
  77. // [in] pvEventData: any data related to the event
  78. DWORD
  79. StateDispatchEvent(
  80. ESTATE_EVENT StateEvent,
  81. PINTF_CONTEXT pIntfContext,
  82. PVOID pvEventData);
  83. //-----------------------------------------------------------
  84. // State Handler functions:
  85. //-----------------------------------------------------------
  86. // StateInitFn: Handler for the {SI} state.
  87. DWORD
  88. StateInitFn(
  89. PINTF_CONTEXT pIntfContext);
  90. //-----------------------------------------------------------
  91. // StateHardResetFn: Handler for the {SHr} state
  92. DWORD
  93. StateHardResetFn(
  94. PINTF_CONTEXT pIntfContext);
  95. //-----------------------------------------------------------
  96. // StateSoftResetFn: Handler for the {SSr} state
  97. DWORD
  98. StateSoftResetFn(
  99. PINTF_CONTEXT pIntfContext);
  100. //-----------------------------------------------------------
  101. // StateDelaySoftResetFn: Handler for the {SDSr} state
  102. DWORD
  103. StateDelaySoftResetFn(
  104. PINTF_CONTEXT pIntfContext);
  105. //-----------------------------------------------------------
  106. // StateQueryFn: Handler for the {SQ} state
  107. DWORD
  108. StateQueryFn(
  109. PINTF_CONTEXT pIntfContext);
  110. //-----------------------------------------------------------
  111. // StateIterateFn: Handler for the {SIter} state
  112. DWORD
  113. StateIterateFn(
  114. PINTF_CONTEXT pIntfContext);
  115. //-----------------------------------------------------------
  116. // StateConfiguredFn: Handler for the {SC} state
  117. DWORD
  118. StateConfiguredFn(
  119. PINTF_CONTEXT pIntfContext);
  120. //-----------------------------------------------------------
  121. // StateFailedFn: Handler for the {SF} state
  122. DWORD
  123. StateFailedFn(
  124. PINTF_CONTEXT pIntfContext);
  125. //-----------------------------------------------------------
  126. // StateCfgRemoveFn: Handler for the {SRs} state
  127. DWORD
  128. StateCfgRemoveFn(
  129. PINTF_CONTEXT pIntfContext);
  130. //-----------------------------------------------------------
  131. // StateCfgPreserveFn: Handler for the {SPs} state
  132. DWORD
  133. StateCfgPreserveFn(
  134. PINTF_CONTEXT pIntfContext);
  135. //-----------------------------------------------------------
  136. // StateCfgHardKeyFn: Handler for the {SCk} state
  137. DWORD
  138. StateCfgHardKeyFn(
  139. PINTF_CONTEXT pIntfContext);
  140. //-----------------------------------------------------------
  141. // StateNotifyFn: Handler for the {SN} state
  142. DWORD
  143. StateNotifyFn(
  144. PINTF_CONTEXT pIntfContext);