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.

140 lines
6.2 KiB

  1. #include "resource.h" // main symbols
  2. #include "dplay8.h"
  3. //Forward declare the class
  4. class C_dxj_DirectPlayPeerObject;
  5. #define typedef__dxj_DirectPlayPeer IDirectPlay8Peer*
  6. /////////////////////////////////////////////////////////////////////////////
  7. // Direct Net Peer
  8. //REVIEW -- using pointers to ID's is necessary because some compilers don't like
  9. //references as template arguments.
  10. class C_dxj_DirectPlayPeerObject :
  11. #ifdef USING_IDISPATCH
  12. public CComDualImpl<I_dxj_DirectPlayPeer, &IID_I_dxj_DirectPlayPeer, &LIBID_DIRECTLib>,
  13. public ISupportErrorInfo,
  14. #else
  15. public I_dxj_DirectPlayPeer,
  16. #endif
  17. public CComObjectRoot
  18. {
  19. public:
  20. C_dxj_DirectPlayPeerObject() ;
  21. virtual ~C_dxj_DirectPlayPeerObject() ;
  22. BEGIN_COM_MAP(C_dxj_DirectPlayPeerObject)
  23. COM_INTERFACE_ENTRY(I_dxj_DirectPlayPeer)
  24. #ifdef USING_IDISPATCH
  25. COM_INTERFACE_ENTRY(IDispatch)
  26. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  27. #endif
  28. END_COM_MAP()
  29. DECLARE_AGGREGATABLE(C_dxj_DirectPlayPeerObject)
  30. #ifdef USING_IDISPATCH
  31. // ISupportsErrorInfo
  32. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  33. #endif
  34. // I_dxj_DirectPlayPeer
  35. public:
  36. /* [hidden] */ HRESULT STDMETHODCALLTYPE InternalSetObject(
  37. /* [in] */ IUnknown __RPC_FAR *lpdd);
  38. /* [hidden] */ HRESULT STDMETHODCALLTYPE InternalGetObject(
  39. /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *lpdd);
  40. HRESULT STDMETHODCALLTYPE DestroyGroup(long idGroup,long lFlags, long *hAsyncHandle);
  41. HRESULT STDMETHODCALLTYPE RemovePlayerFromGroup(long idGroup, long idClient,long lFlags, long *hAsyncHandle);
  42. HRESULT STDMETHODCALLTYPE DestroyPeer(long idClient, long lFlags, void *UserData, long UserDataSize);
  43. HRESULT STDMETHODCALLTYPE Connect(DPN_APPLICATION_DESC_CDESC *AppDesc,I_dxj_DirectPlayAddress *Address,I_dxj_DirectPlayAddress *DeviceInfo, long lFlags, void *UserData, long UserDataSize, long *hAsyncHandle);
  44. HRESULT STDMETHODCALLTYPE RegisterMessageHandler(I_dxj_DirectPlayEvent *event);
  45. HRESULT STDMETHODCALLTYPE EnumHosts(DPN_APPLICATION_DESC_CDESC *ApplicationDesc,I_dxj_DirectPlayAddress *AddrHost,I_dxj_DirectPlayAddress *DeviceInfo,long lRetryCount, long lRetryInterval, long lTimeOut,long lFlags, void *UserData, long UserDataSize, long *lAsync);
  46. HRESULT STDMETHODCALLTYPE GetCountServiceProviders(long lFlags, long *ret);
  47. HRESULT STDMETHODCALLTYPE GetServiceProvider(long lIndex, DPN_SERVICE_PROVIDER_INFO_CDESC *ret);
  48. // Enum for Clients/Groups
  49. HRESULT STDMETHODCALLTYPE GetCountPlayersAndGroups(long lFlags, long *ret);
  50. HRESULT STDMETHODCALLTYPE GetPlayerOrGroup(long lIndex, long *ret);
  51. // Enum Players in groups
  52. HRESULT STDMETHODCALLTYPE GetCountGroupMembers(long dpid,long lFlags, long *ret);
  53. HRESULT STDMETHODCALLTYPE GetGroupMember(long lIndex,long dpid, long *ret);
  54. HRESULT STDMETHODCALLTYPE ReturnBuffer(long lBufferHandle);
  55. HRESULT STDMETHODCALLTYPE Host(DPN_APPLICATION_DESC_CDESC *AppDesc,I_dxj_DirectPlayAddress *Address, long lFlags );
  56. HRESULT STDMETHODCALLTYPE CancelAsyncOperation(long lAsyncHandle, long lFlags);
  57. HRESULT STDMETHODCALLTYPE GetApplicationDesc(long lFlags, DPN_APPLICATION_DESC_CDESC __RPC_FAR *ret);
  58. HRESULT STDMETHODCALLTYPE SetApplicationDesc(DPN_APPLICATION_DESC_CDESC *AppDesc, long lFlags);
  59. HRESULT STDMETHODCALLTYPE Close(long lFlags);
  60. HRESULT STDMETHODCALLTYPE GetCaps(long lFlags, DPNCAPS_CDESC __RPC_FAR *ret);
  61. HRESULT STDMETHODCALLTYPE SetCaps(DPNCAPS_CDESC __RPC_FAR *Caps, long lFlags);
  62. HRESULT STDMETHODCALLTYPE SendTo(long idSend ,SAFEARRAY **Buffer,long lTimeOut,long lFlags, long *hAsyncHandle);
  63. HRESULT STDMETHODCALLTYPE CreateGroup(DPN_GROUP_INFO_CDESC *GroupInfo,long lFlags, long *hAsyncHandle);
  64. HRESULT STDMETHODCALLTYPE AddPlayerToGroup(long idGroup, long idClient,long lFlags, long *hAsyncHandle);
  65. HRESULT STDMETHODCALLTYPE GetSendQueueInfo(long idPlayer, long *lNumMsgs, long *lNumBytes, long lFlags);
  66. HRESULT STDMETHODCALLTYPE SetGroupInfo(long idGroup, DPN_GROUP_INFO_CDESC *PlayerInfo,long lFlags, long *hAsyncHandle);
  67. HRESULT STDMETHODCALLTYPE GetGroupInfo(long idGroup,long lFlags, DPN_GROUP_INFO_CDESC *layerInfo);
  68. HRESULT STDMETHODCALLTYPE SetPeerInfo(DPN_PLAYER_INFO_CDESC *PlayerInfo,long lFlags, long *hAsyncHandle);
  69. HRESULT STDMETHODCALLTYPE GetPeerInfo(long idPeer,long lFlags, DPN_PLAYER_INFO_CDESC *layerInfo);
  70. HRESULT STDMETHODCALLTYPE RegisterLobby(long dpnHandle, I_dxj_DirectPlayLobbiedApplication *LobbyApp, long lFlags);
  71. HRESULT STDMETHODCALLTYPE GetConnectionInfo(long idPlayer, long lFlags, DPN_CONNECTION_INFO_CDESC *pdpConnectionInfo);
  72. HRESULT STDMETHODCALLTYPE GetPeerAddress(long idPlayer, long lFlags, I_dxj_DirectPlayAddress **pAddress);
  73. HRESULT STDMETHODCALLTYPE GetLocalHostAddress(long lFlags, I_dxj_DirectPlayAddress **pAddress);
  74. HRESULT STDMETHODCALLTYPE SetSPCaps(BSTR guidSP, DPN_SP_CAPS_CDESC *spCaps, long lFlags);
  75. HRESULT STDMETHODCALLTYPE GetSPCaps(BSTR guidSP, long lFlags, DPN_SP_CAPS_CDESC *spCaps);
  76. HRESULT STDMETHODCALLTYPE TerminateSession(long lFlags, void *UserData, long UserDataSize);
  77. HRESULT STDMETHODCALLTYPE GetUserData(void *UserData, long *UserDataSize);
  78. HRESULT STDMETHODCALLTYPE SetUserData(void *UserData, long UserDataSize);
  79. HRESULT STDMETHODCALLTYPE UnRegisterMessageHandler();
  80. ////////////////////////////////////////////////////////////////////////
  81. //
  82. // note: this is public for the callbacks
  83. DECL_VARIABLE(_dxj_DirectPlayPeer);
  84. private:
  85. DPN_SERVICE_PROVIDER_INFO *m_SPInfo;
  86. DWORD m_dwSPCount;
  87. DPNID *m_ClientsGroups;
  88. DPNID *m_GroupMembers;
  89. DPNID m_dwGroupID;
  90. DWORD m_dwClientCount;
  91. DWORD m_dwGroupMemberCount;
  92. BOOL m_fInit;
  93. HRESULT STDMETHODCALLTYPE GetSP(long lFlags);
  94. HRESULT STDMETHODCALLTYPE GetClientsAndGroups(long lFlags);
  95. HRESULT STDMETHODCALLTYPE GetGroupMembers(long lFlags, DPNID dpGroupID);
  96. HRESULT STDMETHODCALLTYPE FlushBuffer(LONG dwNumMessagesLeft);
  97. public:
  98. DX3J_GLOBAL_LINKS(_dxj_DirectPlayPeer);
  99. DWORD InternalAddRef();
  100. DWORD InternalRelease();
  101. // We need these for our user data vars
  102. void *m_pUserData;
  103. DWORD m_dwUserDataSize;
  104. // For our reply data
  105. void *m_pReplyData;
  106. DWORD m_dwReplyDataSize;
  107. BOOL m_fHandleEvents;
  108. IStream *m_pEventStream;
  109. //We need to keep a count of the messages
  110. LONG m_dwMsgCount;
  111. };