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.

130 lines
5.6 KiB

  1. #include "resource.h" // main symbols
  2. #include "dplay8.h"
  3. //Forward declare the class
  4. class C_dxj_DirectPlayServerObject;
  5. #define typedef__dxj_DirectPlayServer IDirectPlay8Server*
  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_DirectPlayServerObject :
  11. #ifdef USING_IDISPATCH
  12. public CComDualImpl<I_dxj_DirectPlayServer, &IID_I_dxj_DirectPlayServer, &LIBID_DIRECTLib>,
  13. public ISupportErrorInfo,
  14. #else
  15. public I_dxj_DirectPlayServer,
  16. #endif
  17. public CComObjectRoot
  18. {
  19. public:
  20. C_dxj_DirectPlayServerObject() ;
  21. virtual ~C_dxj_DirectPlayServerObject() ;
  22. BEGIN_COM_MAP(C_dxj_DirectPlayServerObject)
  23. COM_INTERFACE_ENTRY(I_dxj_DirectPlayServer)
  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_DirectPlayServerObject)
  30. #ifdef USING_IDISPATCH
  31. // ISupportsErrorInfo
  32. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  33. #endif
  34. // I_dxj_DirectPlayServer
  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 RegisterMessageHandler(I_dxj_DirectPlayEvent *event);
  41. // Enum for Clients/Groups
  42. HRESULT STDMETHODCALLTYPE GetCountPlayersAndGroups(long lFlags, long *ret);
  43. HRESULT STDMETHODCALLTYPE GetPlayerOrGroup(long lIndex, long *ret);
  44. // Enum Players in groups
  45. HRESULT STDMETHODCALLTYPE GetCountGroupMembers(long dpid,long lFlags, long *ret);
  46. HRESULT STDMETHODCALLTYPE GetGroupMember(long lIndex,long dpid, long *ret);
  47. HRESULT STDMETHODCALLTYPE GetCountServiceProviders(long lFlags, long *ret);
  48. HRESULT STDMETHODCALLTYPE GetServiceProvider(long lIndex, DPN_SERVICE_PROVIDER_INFO_CDESC *ret);
  49. HRESULT STDMETHODCALLTYPE CancelAsyncOperation(long lAsyncHandle, long lFlags);
  50. HRESULT STDMETHODCALLTYPE SendTo(long idSend ,SAFEARRAY **Buffer, long lTimeOut,long lFlags, long *hAsyncHandle);
  51. HRESULT STDMETHODCALLTYPE CreateGroup(DPN_GROUP_INFO_CDESC *GroupInfo,long lFlags, long *hAsyncHandle);
  52. HRESULT STDMETHODCALLTYPE AddPlayerToGroup(long idGroup, long idClient,long lFlags, long *hAsyncHandle);
  53. HRESULT STDMETHODCALLTYPE GetSendQueueInfo(long idPlayer, long *lNumMsgs, long *lNumBytes, long lFlags);
  54. HRESULT STDMETHODCALLTYPE SetGroupInfo(long idGroup, DPN_GROUP_INFO_CDESC *PlayerInfo,long lFlags, long *hAsyncHandle);
  55. HRESULT STDMETHODCALLTYPE GetGroupInfo(long idGroup,long lFlags, DPN_GROUP_INFO_CDESC *layerInfo);
  56. HRESULT STDMETHODCALLTYPE SetServerInfo(DPN_PLAYER_INFO_CDESC *PlayerInfo,long lFlags, long *hAsyncHandle);
  57. HRESULT STDMETHODCALLTYPE GetClientInfo(long idPeer,long lFlags, DPN_PLAYER_INFO_CDESC *layerInfo);
  58. HRESULT STDMETHODCALLTYPE GetApplicationDesc(long lFlags, DPN_APPLICATION_DESC_CDESC *ret);
  59. HRESULT STDMETHODCALLTYPE SetApplicationDesc(DPN_APPLICATION_DESC_CDESC *AppDesc, long lFlags);
  60. HRESULT STDMETHODCALLTYPE Host(DPN_APPLICATION_DESC_CDESC *AppDesc,I_dxj_DirectPlayAddress *Address, long lFlags);
  61. HRESULT STDMETHODCALLTYPE Close(long lFlags);
  62. HRESULT STDMETHODCALLTYPE GetCaps(long lFlags, DPNCAPS_CDESC *ret);
  63. HRESULT STDMETHODCALLTYPE SetCaps(DPNCAPS_CDESC *Caps, long lFlags);
  64. HRESULT STDMETHODCALLTYPE RemovePlayerFromGroup(long idGroup, long idClient,long lFlags,long *hAsyncHandle);
  65. HRESULT STDMETHODCALLTYPE ReturnBuffer(long lBufferHandle);
  66. HRESULT STDMETHODCALLTYPE DestroyClient(long idClient, long lFlags, void *UserData, long UserDataSize);
  67. HRESULT STDMETHODCALLTYPE DestroyGroup(long idGroup,long lFlags,long *hAsyncHandle);
  68. HRESULT STDMETHODCALLTYPE RegisterLobby(long dpnHandle, I_dxj_DirectPlayLobbiedApplication *LobbyApp, long lFlags);
  69. HRESULT STDMETHODCALLTYPE GetConnectionInfo(long idPlayer, long lFlags, DPN_CONNECTION_INFO_CDESC *pdpConnectionInfo);
  70. HRESULT STDMETHODCALLTYPE GetClientAddress(long idPlayer,long lFlags, I_dxj_DirectPlayAddress **pAddress);
  71. HRESULT STDMETHODCALLTYPE GetLocalHostAddress(long lFlags, I_dxj_DirectPlayAddress **pAddress);
  72. HRESULT STDMETHODCALLTYPE SetSPCaps(BSTR guidSP, DPN_SP_CAPS_CDESC *spCaps, long lFlags);
  73. HRESULT STDMETHODCALLTYPE GetSPCaps(BSTR guidSP, long lFlags, DPN_SP_CAPS_CDESC *spCaps);
  74. HRESULT STDMETHODCALLTYPE GetUserData(void *UserData, long *UserDataSize);
  75. HRESULT STDMETHODCALLTYPE SetUserData(void *UserData, long UserDataSize);
  76. HRESULT STDMETHODCALLTYPE UnRegisterMessageHandler();
  77. ////////////////////////////////////////////////////////////////////////
  78. //
  79. // note: this is public for the callbacks
  80. DECL_VARIABLE(_dxj_DirectPlayServer);
  81. private:
  82. BOOL m_fInit;
  83. DPN_SERVICE_PROVIDER_INFO *m_SPInfo;
  84. DWORD m_dwSPCount;
  85. DPNID *m_ClientsGroups;
  86. DPNID *m_GroupMembers;
  87. DPNID m_dwGroupID;
  88. DWORD m_dwClientCount;
  89. DWORD m_dwGroupMemberCount;
  90. HRESULT STDMETHODCALLTYPE GetSP(long lFlags);
  91. HRESULT STDMETHODCALLTYPE GetClientsAndGroups(long lFlags);
  92. HRESULT STDMETHODCALLTYPE GetGroupMembers(long lFlags, DPNID dpGroupID);
  93. HRESULT STDMETHODCALLTYPE FlushBuffer(LONG dwNumMessagesLeft);
  94. public:
  95. DX3J_GLOBAL_LINKS(_dxj_DirectPlayServer);
  96. DWORD InternalAddRef();
  97. DWORD InternalRelease();
  98. BOOL m_fHandleEvents;
  99. IStream *m_pEventStream;
  100. //We need to keep a count of the messages
  101. LONG m_dwMsgCount;
  102. };