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.

635 lines
25 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dvprotocol.h
  6. * Content: Defines structures / types for DirectXVoice protocol
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 07/02/99 rodtoll Created It
  12. * 07/21/99 rodtoll Added settings confirm message to protocol
  13. * 08/18/99 rodtoll Changed the message type to a BYTE
  14. * 08/25/99 rodtoll General Cleanup/Modifications to support new
  15. * compression sub-system.
  16. * 09/07/99 rodtoll Moved definition of settarget message to dvoice.h
  17. * 09/30/99 rodtoll Updated to include more comments
  18. * 12/16/99 rodtoll Updated to include new messages used by host migration
  19. * and update protocol number
  20. * 01/14/2000 rodtoll Updated with new speech packets which optimize peer
  21. * to peer and allow multiple targets in multicast/mixing
  22. * and updated protocol number.
  23. * 04/07/2000 rodtoll Code cleanup, proper structure defs
  24. * 01/04/2001 rodtoll WinBug #94200 - Remove stray comments
  25. * 01/22/2001 rodtoll WINBUG #288437 - IA64 Pointer misalignment due to wire packets
  26. *
  27. ***************************************************************************/
  28. #ifndef __DVPROTOCOL_H
  29. #define __DVPROTOCOL_H
  30. #pragma pack(push,1)
  31. // DVPROTOCOL_VERSION_XXXXXX
  32. //
  33. // These are the values developers should use to send in the ucVersionMajor
  34. // ucVersionMinor and dwVersionBuild (respectively) members of the ConnectRequest
  35. // and connect accept messages.
  36. #define DVPROTOCOL_VERSION_MAJOR 1
  37. #define DVPROTOCOL_VERSION_MINOR 0
  38. #define DVPROTOCOL_VERSION_BUILD 3
  39. //
  40. // PROTOCOL DESCRIPTION
  41. //
  42. // Connection Process
  43. // ------------------
  44. //
  45. // Clients connect to the voice session by sending a DVPROTOCOLMSG_CONNECTREQUEST.
  46. // The host then determines if the client is allowed to join the session. If
  47. // the client's request is rejected, the client receives a DVPROTOCOLMSG_CONNECTREFUSE.
  48. // If the client's request is accepted, the client receives a
  49. // DVPROTOCOLMSG_CONNECTACCEPT. This packet contains all the information the client
  50. // requires to determine if they are compatible.
  51. //
  52. // The client will then attempt to initialize themselves using the compression
  53. // type transmitted by the server. If the client fails to initialize it takes
  54. // no further action. If the client initializes succesfully it transmits a
  55. // DVPROTOCOLMSG_SETTINGSCONFIRM message and is added to the session. All players
  56. // in the session will then receive a DVPROTOCOLMSG_PLAYERJOIN.
  57. //
  58. // Until a DVPROTOCOLMSG_SETTINGSCONFIRM message is received by the host, the client is
  59. // not considered to be part of the session. As such it will not transmit
  60. // speech. (However, it may receive speech).
  61. //
  62. // The server then sends DVPROTOCOLMSG_PLAYERLIST message(s) to give the client the
  63. // current player table. (Peer to peer only).
  64. //
  65. // Disconnection Process
  66. // ---------------------
  67. //
  68. // If a client wishes to disconnect from the voice session, it sends a
  69. // DVPROTOCOLMSG_DISCONNECT message to the host. The host will then transmit
  70. // to all players a DVPROTOCOLMSG_PLAYERQUIT message and will send a
  71. // DVPROTOCOLMSG_DISCONNECT message back to the player to confirm.
  72. //
  73. // If the client disconnects unexpectedly the voice host will detect this and
  74. // will automatically send DVPROTOCOLMSG_PLAYERQUIT messages to all the other clients
  75. // in the session.
  76. //
  77. // Speech Messages
  78. // ---------------
  79. //
  80. // Speech messages are described in detail in the description for DVPROTOCOLMSG_SPEECH.
  81. //
  82. // Messages sent from the host are sent with the DVMSGID_SPEECHBOUNCE instead
  83. // of DVMSGID_SPEECH so that whena host and client share a single dplay id
  84. // the client can ignore it's own speech packets.
  85. //
  86. // Host Migration
  87. // --------------
  88. //
  89. // NEW HOST MIGRATION
  90. //
  91. // Pros/Cons:
  92. //
  93. // First, the advantages to the new system:
  94. // - The new host migration mechanism allows DirectPlay Voice to have a host
  95. // - seperate from the directplay host.
  96. // - Shutting down the host without stopping the dplay interface causes voice host
  97. // to migrate.
  98. // - Minimizes changes to directplay.
  99. // - Removes requirement that all clients had to run voice clients.
  100. // - You can prevent the host from migrating when you call stopsession by
  101. // specifying the new DVFLAGS_NOHOSTMIGRATE which causes the session to be
  102. // stopped.
  103. //
  104. // Disadvantages of the new system:
  105. // - If there are no voice clients in the session when the host is lost, then the
  106. // voice session will be lost.
  107. //
  108. // Host Election
  109. //
  110. // In order to elect a new host, each client is given a "Host Order ID" when
  111. // they have completed their connection. All clients are informed of an
  112. // individual's "Host Order ID" when they find out about the player. These
  113. // identifiers start at 0, are a DWORD in size, and are incremented with each
  114. // new user. Therefore the first player in the session will have ID 0, the
  115. // second will have ID 1, etc.
  116. //
  117. // By using this method we ensure that the client elected to be the host will be
  118. // the oldest client in the session. This has the advantage (because of the way
  119. // the name table is distributed) if any client has any clients at all, they
  120. // will have the oldest clients. Therefore everyone in the session will either
  121. // have just themselves, or at the very least the client who will become the new
  122. // host. If a client doesn't have anyone in the session, it means they either
  123. // are the only ones in the session (in which case they become the new host) or
  124. // they haven't received the name table yet. If they haven't received the name
  125. // table they will not yet have a "Host Order ID" and will therefore be
  126. // inelligable to become the new host.
  127. //
  128. // When the host migrates to a new host, the new host offsets a constant (in
  129. // this case defined in dvcleng.cpp as DVMIGRATE_ORDERID_OFFSET) from it's own
  130. // Host Order ID and uses it as the next Host Order ID to hand out. (So
  131. // duplicate host order IDs are not handed out).
  132. //
  133. // Unless.. you get DVMIGRATE_ORDERID_OFFSET connects between when the new host
  134. // joined and a new player joins before a player with a higher ID joins. (If a
  135. // player informs the server that it's Host Order ID is > then the seed the host
  136. // bumps the seed to be DVMIGRATE_ORDERID_OFFSET from the user's value). In
  137. // this case you may end up with > 1 host. (But this case is extremely unlikely).
  138. //
  139. // How It's Implemented
  140. //
  141. // Each client in the session knows the DPID of the host. Therefore, to detect
  142. // the situation where the host will migrate the client looks at if the session
  143. // supports host migration and for one of two things:
  144. //
  145. // - A DVPROTOCOLMSG_HOSTMIGRATELEAVE message - This is sent by the host when StopSession (
  146. // without the DVFLAGS_NOHOSTMIGRATE flag) or Release is called.
  147. // - DirectPlay informs DirectPlay Voice that the player ID belonging to the
  148. // session host has left the session.
  149. //
  150. // Once one of the above occurs, each clients runs the new host election
  151. // algorithm. Their action will depend on the situation:
  152. //
  153. // - If no clients are found that are elligible to become the new host. Then the
  154. // client will disconnect.
  155. // - If clients are found that are elligible to become the new host but it is not
  156. // the local client, the local client takes no action.
  157. // - If the local client is to be the new host then it starts up a new host locally.
  158. //
  159. // Once the new host starts up, it will send a DVPROTOCOLMSG_HOSTMIGRATE message to all
  160. // the users in the session. Each client in the session responds with their
  161. // current settings using a DVPROTOCOLMSG_SETTINGSCONFIRM message (which includes the
  162. // client's current "Host Order ID". Using these messages the new host rebuilds
  163. // the player list. Also, in response to the DVPROTOCOLMSG_SETTINGSCONFIRM message each
  164. // client receives a copy of the latest name table. For players who respond to
  165. // the host migration after you, DVPROTOCOLMSG_CREATEVOICEPLAYER messages will be sent.
  166. // This player ensures that every client ends up with a proper and up to date
  167. // name table.
  168. //
  169. // Each client in the session ignores duplicate CREATEVOICEPLAYER messages.
  170. //
  171. // The client object that creates the new host holds a reference to the new host
  172. // and will destroy it when the client is destroyed. (Possibly causing the host
  173. // to migrate again).
  174. //
  175. // Session Losses
  176. //
  177. // Using this new scheme it is possible to lose the voice session if there are
  178. // no voice clients elligeble to become the new voice host. (Meaning there are
  179. // no clients properly connected). All clients which are not yet completed
  180. // their connection will detect this situation and will disconnect from the
  181. // session.
  182. //
  183. // In addition, when the host goes to stop, it checks to see if there are any
  184. // clients elligeble to become the host. If there are none it transmits a
  185. // DVPROTOCOLMSG_SESSIONLOST message to all players in the session.
  186. //
  187. // Notes:
  188. //
  189. // One thing to watch for is since the DirectPlayVoice host may migrate to a
  190. // different client then the DirectPlay host does, just because you know who the
  191. // DirectPlay Host is doesn't mean you know who the voice host is.
  192. //
  193. // In order to implement this new mechanism the following related changes were
  194. // made:
  195. //
  196. // - Clients with differing major/minor/build protocol version numbers are
  197. // rejected by the host now. The result is that new clients may be able to
  198. // connect to old hosts but may crash, and old clients are now rejected by new
  199. // hosts. (Handling of these cases on old clients was not good -- just don't do
  200. // it).
  201. // - DirectPlay host migration messages are ignored.
  202. // - Connection requests are sent to everyone in the session. The client
  203. // determines who the host is by seeing who responded to their message.
  204. // - Handling of rejection messages now results in the connection failing. (There
  205. // was a bug).
  206. // - The rejection message now contains the major/minor/build protocol version of
  207. // the host.
  208. // - Instead of sending individual messages for each user in the current session
  209. // to a client when it first joins the host now sends a DVPROTOCOLMSG_PLAYERLIST which
  210. // is a list of players in the session. This reduces bandwidth and makes the
  211. // connection process shorter.
  212. /////////////////////////////////////////////////////////////////////////////////
  213. //
  214. // PROTOCOL SPECIFIC DEFINES
  215. //
  216. /////////////////////////////////////////////////////////////////////////////////
  217. // The maximum size in bytes that a single playerlist packet can be.
  218. //
  219. // (Holds about 120 entries / packet).
  220. //
  221. #define DVPROTOCOL_PLAYERLIST_MAXSIZE 1000
  222. #define DVPROTOCOL_HOSTORDER_INVALID 0xFFFFFFFF
  223. // DVMIGRATE_ORDERID_OFFSET
  224. //
  225. // This is the number to add to this client's Host Order ID to be the
  226. // next value handed out by the host which the client is creating in
  227. // response to host migration.
  228. //
  229. #define DVMIGRATE_ORDERID_OFFSET 256
  230. /////////////////////////////////////////////////////////////////////////////////
  231. //
  232. // MESSAGE IDENTIFIERS
  233. //
  234. /////////////////////////////////////////////////////////////////////////////////
  235. #define DVMSGID_INTERNALBASE 0x0050
  236. #define DVMSGID_CONNECTREQUEST DVMSGID_INTERNALBASE+0x0001
  237. #define DVMSGID_CONNECTREFUSE DVMSGID_INTERNALBASE+0x0003
  238. #define DVMSGID_DISCONNECT DVMSGID_INTERNALBASE+0x0004
  239. #define DVMSGID_SPEECH DVMSGID_INTERNALBASE+0x0005
  240. #define DVMSGID_CONNECTACCEPT DVMSGID_INTERNALBASE+0x0006
  241. #define DVMSGID_SETTINGSCONFIRM DVMSGID_INTERNALBASE+0x0008
  242. #define DVMSGID_SETTINGSREJECT DVMSGID_INTERNALBASE+0x0009
  243. #define DVMSGID_DISCONNECTCONFIRM DVMSGID_INTERNALBASE+0x000A
  244. #define DVMSGID_SPEECHBOUNCE DVMSGID_INTERNALBASE+0x0010
  245. #define DVMSGID_PLAYERLIST DVMSGID_INTERNALBASE+0x0011
  246. #define DVMSGID_HOSTMIGRATELEAVE DVMSGID_INTERNALBASE+0x0012
  247. #define DVMSGID_SPEECHWITHTARGET DVMSGID_INTERNALBASE+0x0013
  248. #define DVMSGID_SPEECHWITHFROM DVMSGID_INTERNALBASE+0x0014
  249. /////////////////////////////////////////////////////////////////////////////////
  250. //
  251. // CONNECT MESSAGES
  252. //
  253. /////////////////////////////////////////////////////////////////////////////////
  254. //
  255. // DVPROTOCOLMSG_CONNECTREQUEST
  256. //
  257. // Session Types: ALL
  258. // Message Flow : Voice Client -> Voice Host
  259. //
  260. // Requests a connection to the existing DirectXVoice session.
  261. //
  262. typedef UNALIGNED struct _DVPROTOCOLMSG_CONNECTREQUEST
  263. {
  264. BYTE dwType; // = DVMID_CONNECTREQUEST
  265. BYTE ucVersionMajor; // Client's protocol version (major)
  266. BYTE ucVersionMinor; // Client's protocol version (minor)
  267. DWORD dwVersionBuild; // Client's protocol version (build)
  268. } DVPROTOCOLMSG_CONNECTREQUEST, *PDVPROTOCOLMSG_CONNECTREQUEST;
  269. //
  270. // DVPROTOCOLMSG_CONNECTREFUSE
  271. //
  272. // Session Types: ALL
  273. // Message Flow : Voice Host -> Voice Clients
  274. //
  275. // Server responds with this if no voice session available or needs
  276. // to refuse the connection. E.g. out of memory or incompatible
  277. // version.
  278. //
  279. typedef UNALIGNED struct _DVPROTOCOLMSG_CONNECTREFUSE
  280. {
  281. BYTE dwType; // = DVMSGID_CONNECTREFUSE
  282. HRESULT hresResult; // Reason for refusal (DVERR_XXXXXX)
  283. BYTE ucVersionMajor; // Server's protocol version (major)
  284. BYTE ucVersionMinor; // Server's protocol version (minor)
  285. DWORD dwVersionBuild; // Server's protocol version (build)
  286. } DVPROTOCOLMSG_CONNECTREFUSE, *PDVPROTOCOLMSG_CONNECTREFUSE;
  287. //
  288. // DVPROTOCOLMSG_CONNECTACCEPT
  289. //
  290. // Session Types: ALL
  291. // Message Flow : Voice Host -> Voice Clients
  292. //
  293. // Indicates to the client that their connect request was accepted.
  294. // This message contains information about the voice session that
  295. // the client needs to initialize.
  296. //
  297. typedef UNALIGNED struct _DVPROTOCOLMSG_CONNECTACCEPT
  298. {
  299. BYTE dwType; // = DVMSGID_CONNECTACCEPT
  300. DWORD dwSessionType; // Type of session = DVSESSIONTYPE_XXXXXX
  301. BYTE ucVersionMajor; // Server's protocol version (major)
  302. BYTE ucVersionMinor; // Server's protocol version (minor)
  303. DWORD dwVersionBuild; // Server's protocol version (build)
  304. DWORD dwSessionFlags; // Flags for the session (Combination of DVSESSION_XXXXXX values)
  305. GUID guidCT; // Compression Type (= DPVCTGUID_XXXXXX)
  306. } DVPROTOCOLMSG_CONNECTACCEPT, *PDVPROTOCOLMSG_CONNECTACCEPT;
  307. //
  308. // DVPROTOCOLMSG_SETTINGSCONFIRM
  309. //
  310. // Session Types: ALL
  311. // Message Flow : Voice Client -> Voice Host
  312. //
  313. // Sent by client to confirm they can handle current compression
  314. // settings. This message is sent once the client has determined that
  315. // they can support the specified compression type and the sound
  316. // system has succesfully initialized.
  317. //
  318. // This message is also sent from voice clients to the new voice host
  319. // when a migration has taken place.
  320. //
  321. typedef UNALIGNED struct _DVPROTOCOLMSG_SETTINGSCONFIRM
  322. {
  323. BYTE dwType; // Message Type = DVMSGID_SETTINGSCONFIRM
  324. DWORD dwFlags; // Client Flags (Only valid one is half duplex)
  325. DWORD dwHostOrderID; // Host Order ID (=INVALID to assign new one)
  326. } DVPROTOCOLMSG_SETTINGSCONFIRM, *PDVPROTOCOLMSG_SETTINGSCONFIRM;
  327. //
  328. // DVPROTOCOLMSG_PLAYERLIST
  329. //
  330. // Session Types: Peer to Peer
  331. // Message Flow : Voice Host -> Voice Clients
  332. //
  333. // Builds a list of players in the session to be sent to the
  334. // client once they have confirmed they are connected.
  335. //
  336. // May be spread over multiple packets.
  337. //
  338. // These messages will be the following header followed by a
  339. // list of DVPROTOCOLMSG_PLAYERLIST_ENTRY structures (the # will be
  340. // specified in dwNumEntries).
  341. //
  342. typedef UNALIGNED struct _DVPROTOCOLMSG_PLAYERLIST
  343. {
  344. BYTE dwType; // = DVMSGID_PLAYERLIST
  345. DWORD dwHostOrderID; // Host migration sequence number (for client)
  346. DWORD dwNumEntries; // Number of DVPROTOCOLMSG_PLAYERLIST_ENTRY structures
  347. // following this header in this packet
  348. } DVPROTOCOLMSG_PLAYERLIST, *PDVPROTOCOLMSG_PLAYERLIST;
  349. //
  350. // DVPROTOCOLMSG_PLAYERLIST_ENTRY
  351. //
  352. // Sent as part of a DVPROTOCOLMSG_PLAYERLIST message.
  353. //
  354. // Peer to Peer Only
  355. //
  356. // Each of these structures represents a player in the session.
  357. // They are sent as part of the DVPROTOCOLMSG_PLAYERLIST structure.
  358. //
  359. typedef UNALIGNED struct _DVPROTOCOLMSG_PLAYERLIST_ENTRY
  360. {
  361. DVID dvidID; // Player's DVID
  362. DWORD dwPlayerFlags; // Player's player flags (DVPLAYERCAPS_XXXXX)
  363. DWORD dwHostOrderID; // Host migration sequence number
  364. } DVPROTOCOLMSG_PLAYERLIST_ENTRY, *PDVPROTOCOLMSG_PLAYERLIST_ENTRY;
  365. /////////////////////////////////////////////////////////////////////////////////////
  366. //
  367. // IN-SESSION MESSAGES - SPEECH
  368. //
  369. /////////////////////////////////////////////////////////////////////////////////////
  370. //
  371. // DVPROTOCOLMSG_SPEECHHEADER
  372. //
  373. // This message is used for transporting speech. Speech packets contain
  374. // one of these headers followed by the audio data. After this header
  375. // the audio data will be the remaining part of the packet.
  376. //
  377. // ----
  378. //
  379. // Session Types: Peer to Peer
  380. // Message Flow : Voice Clients <-> Voice Clients
  381. //
  382. // Session Types: Mixing
  383. // Message Flow : Voice Mixing Server --> Voice Clients
  384. //
  385. // Session Types: Echo
  386. // Message Flow : Voice Host <-> Voice Clients
  387. //
  388. typedef UNALIGNED struct _DVPROTOCOLMSG_SPEECHHEADER
  389. {
  390. BYTE dwType; // = DVMSGID_SPEECH
  391. BYTE bMsgNum; // Message # for message
  392. BYTE bSeqNum; // Sequence # for message
  393. } DVPROTOCOLMSG_SPEECHHEADER, *PDVPROTOCOLMSG_SPEECHHEADER;
  394. //
  395. // DVPROTOCOLMSG_SPEECHWITHTARGET
  396. //
  397. // This message is used for transporting speech. The message consists
  398. // of this header followed by a single DVID for each target the packet
  399. // is targetted at. After the target list the audio data will be the
  400. // remaining part of the packet.
  401. //
  402. // ----
  403. // Sesssion Types: Mixing / Forwarding
  404. // Message Flow : Voice Clients --> Voice Host / Voice Mixing Server
  405. //
  406. typedef UNALIGNED struct _DVPROTOCOLMSG_SPEECHWITHTARGET
  407. {
  408. DVPROTOCOLMSG_SPEECHHEADER dvHeader;
  409. // dwType = DVMSGID_SPEECHWITHTARGET
  410. DWORD dwNumTargets; // # of targets following this header
  411. } DVPROTOCOLMSG_SPEECHWITHTARGET, *PDVPROTOCOLMSG_SPEECHWITHTARGET;
  412. //
  413. // DVPROTOCOLMSG_SPEECHWITHFROM
  414. //
  415. // This message is used by forwarding servers when a speech packet is
  416. // bounced. The packet contains this header followed by the audio
  417. // data. The audio data will be the remaining part of the packet.
  418. //
  419. // ---
  420. // Session Types: Forwarding
  421. // Message Flow : Forwarding Server --> Voice Clients
  422. //
  423. typedef UNALIGNED struct _DVPROTOCOLMSG_SPEECHWITHFROM
  424. {
  425. DVPROTOCOLMSG_SPEECHHEADER dvHeader;
  426. // dwType = DVMSGID_SPEECHWITHFROM
  427. DVID dvidFrom; // DVID of the client that this packet originated.
  428. } DVPROTOCOLMSG_SPEECHWITHFROM, *PDVPROTOCOLMSG_SPEECHWITHFROM;
  429. /////////////////////////////////////////////////////////////////////////////////////
  430. //
  431. // IN-SESSION MESSAGES - TARGET MANAGEMENT
  432. //
  433. /////////////////////////////////////////////////////////////////////////////////////
  434. //
  435. // DVPROTOCOLMSG_SETTARGET
  436. //
  437. // Tells client to switch it's target to the specified value. Used when
  438. // the server calls SetTransmitTarget for a particular player. This message
  439. // contains this header followed by dwNumTargets DWORDs containing the
  440. // players / groups that the client is targetting.
  441. //
  442. // ---
  443. // Session Types: Sessions with Server Controlled Targetting Enabled
  444. // Message Flow : Voice Host --> Voice Clients
  445. //
  446. typedef UNALIGNED struct _DVPROTOCOLMSG_SETTARGET
  447. {
  448. BYTE dwType; // = DVMSGID_SETTARGETS
  449. DWORD dwNumTargets; // # of targets (Can be 0 for no targets).
  450. } DVPROTOCOLMSG_SETTARGET, *PDVPROTOCOLMSG_SETTARGET;
  451. /////////////////////////////////////////////////////////////////////////////////////
  452. //
  453. // IN-SESSION MESSAGES - NAMETABLE MANAGEMENT
  454. //
  455. /////////////////////////////////////////////////////////////////////////////////////
  456. //
  457. // DVPROTOCOLMSG_PLAYERJOIN
  458. //
  459. // This message is used to inform clients when a new client has connected
  460. // to the session.
  461. //
  462. // ---
  463. // Session Types: Peer to Peer
  464. // Message Flow : Voice Host --> Voice Clients
  465. //
  466. typedef UNALIGNED struct _DVPROTOCOLMSG_PLAYERJOIN
  467. {
  468. BYTE dwType; // = DVMSGID_CREATEVOICEPLAYER
  469. DVID dvidID; // ID of the player
  470. DWORD dwFlags; // Player's player flags (DVPLAYERCAPS_XXXXX)
  471. DWORD dwHostOrderID; // Host Order ID
  472. } DVPROTOCOLMSG_PLAYERJOIN, *PDVPROTOCOLMSG_PLAYERJOIN;
  473. //
  474. // DVPROTOCOLMSG_PLAYERQUIT
  475. //
  476. // This message is used to inform clients when a client has left the voice
  477. // session.
  478. //
  479. // ---
  480. // Session Types: Peer to Peer
  481. // Message Flow : Voice Host --> Voice Clients
  482. //
  483. typedef UNALIGNED struct _DVPROTOCOLMSG_PLAYERQUIT
  484. {
  485. BYTE dwType; // = DVMSGID_DELETEVOICEPLAYER
  486. DVID dvidID; // ID of the player
  487. } DVPROTOCOLMSG_PLAYERQUIT, *PDVPROTOCOLMSG_PLAYERQUIT;
  488. //
  489. // DVPROTOCOLMSG_GENERIC
  490. //
  491. // Used to determine the type of a DirectPlayVoice message. Used in message
  492. // cracking.
  493. //
  494. typedef UNALIGNED struct _DVPROTOCOLMSG_GENERIC
  495. {
  496. BYTE dwType;
  497. } DVPROTOCOLMSG_GENERIC, *PDVPROTOCOLMSG_GENERIC;
  498. /////////////////////////////////////////////////////////////////////////////////////
  499. //
  500. // IN-SESSION MESSAGES - HOST MIGRATION MESSAGES
  501. //
  502. /////////////////////////////////////////////////////////////////////////////////////
  503. //
  504. // DVPROTOCOLMSG_HOSTMIGRATED
  505. //
  506. // This message is sent by the new host when a host migration has taken place.
  507. // The message is sent by the new host once they have finished initialization.
  508. // All clients should respond to this message with a DVPROTOCOLMSG_SETTINGSCONFIRM.
  509. //
  510. // ---
  511. // Session Types: Peer to Peer (With host migration enabled).
  512. // Message Flow : Voice Host (New) --> Voice Clients
  513. //
  514. typedef UNALIGNED struct _DVPROTOCOLMSG_HOSTMIGRATED
  515. {
  516. BYTE dwType; // = DVMSGID_HOSTMIGRATED
  517. } DVPROTOCOLMSG_HOSTMIGRATED, *PDVPROTOCOLMSG_HOSTMIGRATED;
  518. //
  519. // DVPROTOCOLMSG_HOSTMIGRATELEAVE
  520. //
  521. // This message is sent by a voice host if they are shutting down their interface
  522. // and host migration is enabled. It informs clients that they have to run their
  523. // election algorithm.
  524. //
  525. // ---
  526. // Session Types: Peer To Peer (With Host Migration Enabled)
  527. // Message Flow : Voice Host (Old) --> Voice Clients
  528. //
  529. typedef UNALIGNED struct _DVPROTOCOLMSG_HOSTMIGRATELEAVE
  530. {
  531. BYTE dwType; // = DVMSGID_HOSTMIGRATELEAVE
  532. } DVPROTOCOLMSG_HOSTMIGRATELEAVE, *PDVPROTOCOLMSG_HOSTMIGRATELEAVE;
  533. /////////////////////////////////////////////////////////////////////////////////////
  534. //
  535. // IN-SESSION MESSAGES - SESSION TERMINATION
  536. //
  537. /////////////////////////////////////////////////////////////////////////////////////
  538. //
  539. // DVPROTOCOLMSG_SESSIONLOST
  540. //
  541. // This message is sent by the voice host when they are shutting down and
  542. // host migration is not enabled or available.
  543. //
  544. // This message can also be sent if a host migration takes place and a
  545. // client encounters a fatal error when starting the new host.
  546. //
  547. // ---
  548. // Session Type: ALL
  549. // Message Flow: Voice Host (New) --> Voice Clients
  550. // Voice Host --> Voice Clients
  551. //
  552. typedef UNALIGNED struct _DVPROTOCOLMSG_SESSIONLOST
  553. {
  554. BYTE dwType; // = DVMSGID_SESSIONLOST
  555. HRESULT hresReason; // DVERR_XXXXXX or DV_OK
  556. } DVPROTOCOLMSG_SESSIONLOST, *PDVPROTOCOLMSG_SESSIONLOST;
  557. //
  558. // DVPROTOCOLMSG_DISCONNECT
  559. //
  560. // This message is sent by voice clients when they wish to disconnect
  561. // gracefully. The host responds with the same message to confirm
  562. // it received the request. Once the client receives the response
  563. // then it is free to disconnect.
  564. //
  565. // ---
  566. // Session Type: ALL
  567. // Message Flow: Voice Host --> Voice Client (dwType = DVPROTOCOLMSG_DISCONNECTCONFIRM)
  568. // Voice Client --> Voice Host (dwType = DVPROTOCOLMSG_DISCONNECT)
  569. //
  570. typedef UNALIGNED struct _DVPROTOCOLMSG_DISCONNECT
  571. {
  572. BYTE dwType; // = DVPROTOCOLMSG_DISCONNECTCONFIRM OR
  573. // DVPROTOCOLMSG_DISCONNECT
  574. HRESULT hresDisconnect; // HRESULT that caused the disconnect
  575. // DV_OK or DVERR_XXXXXX
  576. } DVPROTOCOLMSG_DISCONNECT, *PDVPROTOCOLMSG_DISCONNECT;
  577. typedef union _DVPROTOCOLMSG_FULLMESSAGE
  578. {
  579. DVPROTOCOLMSG_GENERIC dvGeneric;
  580. DVPROTOCOLMSG_SESSIONLOST dvSessionLost;
  581. DVPROTOCOLMSG_PLAYERJOIN dvPlayerJoin;
  582. DVPROTOCOLMSG_PLAYERQUIT dvPlayerQuit;
  583. DVPROTOCOLMSG_CONNECTACCEPT dvConnectAccept;
  584. DVPROTOCOLMSG_CONNECTREFUSE dvConnectRefuse;
  585. DVPROTOCOLMSG_CONNECTREQUEST dvConnectRequest;
  586. DVPROTOCOLMSG_SPEECHHEADER dvSpeech;
  587. DVPROTOCOLMSG_DISCONNECT dvDisconnect;
  588. DVPROTOCOLMSG_SETTARGET dvSetTarget;
  589. DVPROTOCOLMSG_SETTINGSCONFIRM dvSettingsConfirm;
  590. DVPROTOCOLMSG_PLAYERLIST dvPlayerList;
  591. DVPROTOCOLMSG_HOSTMIGRATED dvHostMigrated;
  592. DVPROTOCOLMSG_HOSTMIGRATELEAVE dvHostMigrateLeave;
  593. DVPROTOCOLMSG_SPEECHWITHTARGET dvSpeechWithTarget;
  594. DVPROTOCOLMSG_SPEECHWITHFROM dvSpeechWithFrom;
  595. } DVPROTOCOLMSG_FULLMESSAGE, *PDVPROTOCOLMSG_FULLMESSAGE;
  596. #pragma pack(pop)
  597. #endif