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.

156 lines
4.0 KiB

  1. //
  2. // CONTROL.H
  3. // Control by us, control of us
  4. //
  5. // Copyright (c) Microsoft 1997-
  6. //
  7. #ifndef _H_CA
  8. #define _H_CA
  9. //
  10. //
  11. // CONSTANTS
  12. //
  13. //
  14. #define CA_SEND_EVENT 0x0001
  15. #define CA_ALLOW_EVENT 0x0002
  16. //
  17. // Cleanup flags
  18. //
  19. #define CACLEAR_HOST 0x0001
  20. #define CACLEAR_VIEW 0x0002
  21. #define CACLEAR_ALL 0x0003
  22. //
  23. // Queued responses to control requests. We try to send them right away,
  24. // but that can fail.
  25. // Here's the logic:
  26. //
  27. // (1) For TAKING/RELEASING control (viewer)
  28. // There's only one at most pending. That's because a pending RELEASE
  29. // cancels out a pending TAKE.
  30. //
  31. // (2) For RESPONDING/REVOKING control (host)
  32. // These never cancel out. Each one will have a successive sequence ID.
  33. // There should NEVER be a pending BOUNCE in the queue with a
  34. // pending RESPOND for the same controller/request ID. Of course not,
  35. // since we don't change our state until the packet goes out,
  36. // and if the RESPOND CONFIRM packet hasn't gone out, we wouldn't
  37. // be bouncing anybody.
  38. //
  39. // Outgoing requests take precedence over incoming ones. In other words,
  40. // if the UI/user/SDK code asks us to take control of a remote, we will
  41. // turn any pending RESPOND CONFIRM packets into RESPOND DENIED ones. If
  42. // we are in control of another already, take will fail, it's the intermediate
  43. // phase that's undoable only.
  44. //
  45. // Here's the basic logic flow to TAKE CONTROL:
  46. // Viewer makes new sequence ID
  47. // Viewer sends private packet to host, requesting control
  48. // Viewer changes state to "asked for control"
  49. // Host receives private packet
  50. // Host sends private response packet to viewer, confirming or denying control
  51. // If confirming, host broadcasts notification to everybody sometime
  52. // later.
  53. // When viewer gets response, viewer moves to incontrol state, or
  54. // backs off
  55. //
  56. // Here's the basic logic flow to RELEASE CONTROL:
  57. // Viewer initiated:
  58. // Send INFORM RELEASED private packet to host
  59. // Change state to not in control
  60. // Host receives private packet
  61. // Host ignores if out of date (bounced already or whatever)
  62. // Host changes state to not controlled otherwise
  63. // Host initiated:
  64. // Send INFORM BOUNCED private packet to viewer
  65. // Change state to not controlled
  66. // Viewer receives private packet
  67. // Viewer ignores if out of date (released already or whatever)
  68. // Viewer changes state to not in control otherwise
  69. //
  70. // While pending take control, waiting to here confirmation, or in control
  71. // pending requests to control us are denied.
  72. //
  73. typedef union
  74. {
  75. CA_RTC_PACKET rtc;
  76. CA_REPLY_RTC_PACKET rrtc;
  77. CA_RGC_PACKET rgc;
  78. CA_REPLY_RGC_PACKET rrgc;
  79. CA_PPC_PACKET ppc;
  80. CA_INFORM_PACKET inform;
  81. }
  82. CA30P;
  83. typedef CA30P * PCA30P;
  84. class ASPerson;
  85. typedef struct tagCA30PENDING
  86. {
  87. ASPerson * pasReplyTo;
  88. UINT mcsOrg;
  89. UINT msg;
  90. CA30P request;
  91. }
  92. CA30PENDING;
  93. typedef CA30PENDING * PCA30PENDING;
  94. typedef struct tagCA30XREQ
  95. {
  96. CA30P packet;
  97. }
  98. CA30REQ;
  99. //
  100. // Private send/responses get queued up and our state can NOT change until
  101. // they go out.
  102. //
  103. typedef struct tagCAREQUEST
  104. {
  105. STRUCTURE_STAMP
  106. BASEDLIST chain;
  107. UINT destID;
  108. UINT msg;
  109. CA30REQ req30;
  110. }
  111. CAREQUEST;
  112. typedef CAREQUEST * PCAREQUEST;
  113. //
  114. // The location of the keyboard language toggle hotkey setting in the
  115. // registry.
  116. //
  117. #define LANGUAGE_TOGGLE_KEY "keyboard layout\\toggle"
  118. #define LANGUAGE_TOGGLE_KEY_VAL "Hotkey"
  119. //
  120. // A value we use to indicate that the registry entry is not present - it
  121. // could be any value except for '1', '2', or '3'
  122. //
  123. #define LANGUAGE_TOGGLE_NOT_PRESENT 0
  124. //
  125. // Query dialog
  126. //
  127. #define IDT_CAQUERY 50
  128. #define PERIOD_CAQUERY 30000 // 30 seconds
  129. INT_PTR CALLBACK CAQueryDlgProc(HWND, UINT, WPARAM, LPARAM);
  130. #endif // _H_CA