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.

75 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. DirectPlayConnection
  5. Abstract:
  6. DirectPlayConnection is a wrapper around the direct play interfaces
  7. to just do what is needed for this application. It takes care of
  8. connecting to the remote machine and sending/recieving the connction
  9. paramters.
  10. Author:
  11. Marc Reyhner 7/5/2000
  12. --*/
  13. #ifndef __DIRECTPLAYCONNECTION_H__
  14. #define __DIRECTPLAYCONNECTION_H__
  15. #include "dplobby.h"
  16. // We want to wait 15 seconds for the remote instance to start
  17. #define GETREMOTEPLAYERTIMEOUT (60*1000)
  18. // We want to wait 15 seconds for the message to show up
  19. #define GETPARMSTIMEOUT (60*1000)
  20. ////////////////////////////////////////////////
  21. //
  22. // CDirectPlayConnection
  23. //
  24. // Class for dealing with all the direct play APIs.
  25. //
  26. class CDirectPlayConnection
  27. {
  28. private:
  29. DPID m_PlayerID;
  30. BOOL m_bConnected;
  31. LPDIRECTPLAY2 m_rDirectPlay;
  32. LPDPLCONNECTION m_rSettings;
  33. LPDIRECTPLAYLOBBY m_rLobby;
  34. HANDLE m_hEventHandle;
  35. DPID xGetOtherPlayerID();
  36. LPDPMSG_GENERIC xReceiveMessage(DPID from, DPID to, DWORD dwFlags);
  37. public:
  38. // Constructor/Destructor
  39. CDirectPlayConnection();
  40. virtual ~CDirectPlayConnection();
  41. // This returns whether or not this is the server session.
  42. BOOL IsServer();
  43. // This fetches the connection parms from the server session.
  44. BSTR ReceiveConnectionParameters();
  45. // This sends the connection parms to the client session,
  46. VOID SendConnectionParameters(BSTR parms);
  47. // This connections you to the remote session.
  48. VOID ConnectToRemoteApplication();
  49. // This disconnects you from the remote session
  50. VOID DisconnectRemoteApplication();
  51. };
  52. #endif