2 * Copyright 2000 Peter Hunnisett
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_DPLAY_GLOBAL_INCLUDED
20 #define __WINE_DPLAY_GLOBAL_INCLUDED
26 #include "wine/dplaysp.h"
28 #include "dplayx_queue.h"
30 extern HRESULT
DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback
,
31 LPCVOID lpAddress
, DWORD dwAddressSize
,
34 /*****************************************************************************
35 * Predeclare the interface implementation structures
37 typedef struct IDirectPlay2Impl IDirectPlay2AImpl
;
38 typedef struct IDirectPlay2Impl IDirectPlay2Impl
;
39 typedef struct IDirectPlay3Impl IDirectPlay3AImpl
;
40 typedef struct IDirectPlay3Impl IDirectPlay3Impl
;
41 typedef struct IDirectPlay4Impl IDirectPlay4AImpl
;
42 typedef struct IDirectPlay4Impl IDirectPlay4Impl
;
44 typedef struct tagDirectPlayIUnknownData
47 CRITICAL_SECTION DP_lock
;
48 } DirectPlayIUnknownData
;
50 typedef struct tagEnumSessionAsyncCallbackData
52 LPSPINITDATA lpSpData
;
54 DWORD dwEnumSessionFlags
;
56 HANDLE hSuicideRequest
;
57 } EnumSessionAsyncCallbackData
;
59 typedef struct tagDP_MSG_REPLY_STRUCT
66 /* FIXME: Is the message header required as well? */
67 } DP_MSG_REPLY_STRUCT
, *LPDP_MSG_REPLY_STRUCT
;
69 typedef struct tagDP_MSG_REPLY_STRUCT_LIST
71 DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST
) replysExpected
;
72 DP_MSG_REPLY_STRUCT replyExpected
;
73 } DP_MSG_REPLY_STRUCT_LIST
, *LPDP_MSG_REPLY_STRUCT_LIST
;
77 typedef struct tagPACKEDPLAYERDATA
82 LPVOID lpPlayerSPData
;
83 DWORD dwPlayerSPDataSize
;
85 DWORD dwPlayerDataSize
;
89 DWORD dwShortcutCount
;
91 } PACKEDPLAYERDATA
, *LPPACKEDPLAYERDATA
;
95 /* Individual player information */
101 ULONG uRef
; /* What is the reference count on this data? */
103 /* View of local data */
105 DWORD dwLocalDataSize
;
107 /* View of remote data */
109 DWORD dwRemoteDataSize
;
111 /* SP data on a per player basis */
112 LPVOID lpSPPlayerData
;
114 DWORD dwFlags
; /* Special remarks about the type of player */
116 typedef struct PlayerData
* lpPlayerData
;
120 DPQ_ENTRY(PlayerList
) players
;
122 lpPlayerData lpPData
;
124 typedef struct PlayerList
* lpPlayerList
;
128 /* Internal information */
129 DPID parent
; /* If parent == 0 it's a top level group */
131 ULONG uRef
; /* Reference count */
133 DPQ_HEAD(GroupList
) groups
; /* A group has [0..n] groups */
134 DPQ_HEAD(PlayerList
) players
; /* A group has [0..n] players */
136 DPID idGroupOwner
; /* ID of player who owns the group */
138 DWORD dwFlags
; /* Flags describing anything special about the group */
143 /* View of local data */
145 DWORD dwLocalDataSize
;
147 /* View of remote data */
149 DWORD dwRemoteDataSize
;
151 typedef struct GroupData GroupData
;
152 typedef struct GroupData
* lpGroupData
;
156 DPQ_ENTRY(GroupList
) groups
;
160 typedef struct GroupList
* lpGroupList
;
164 DPQ_ENTRY( DPMSG
) msgs
;
169 typedef struct DPMSG
* LPDPMSG
;
174 DP_SERVICE_PROVIDER
= 1,
175 DP_LOBBY_PROVIDER
= 2
178 /* Contains all data members. FIXME: Rename me */
179 typedef struct tagDirectPlay2Data
181 BOOL bConnectionOpen
;
183 /* For async EnumSessions requests */
184 HANDLE hEnumSessionThread
;
185 HANDLE hKillEnumSessionThreadEvent
;
186 DWORD dwEnumSessionLock
;
188 LPVOID lpNameServerData
; /* DPlay interface doesn't know contents */
190 BOOL bHostInterface
; /* Did this interface create the session */
192 lpGroupData lpSysGroup
; /* System group with _everything_ in it */
194 LPDPSESSIONDESC2 lpSessionDesc
;
197 DPQ_HEAD( DPMSG
) receiveMsgs
; /* Msg receive queue */
198 DPQ_HEAD( DPMSG
) sendMsgs
; /* Msg send pending queue */
200 /* Information about the service provider active on this connection */
204 /* Information about the lobby server that's attached to this DP object */
205 SPDATA_INIT dplspData
;
206 BOOL bDPLSPInitialized
;
208 /* Our service provider */
209 HMODULE hServiceProvider
;
211 /* Our DP lobby provider */
212 HMODULE hDPLobbyProvider
;
214 enum SPSTATE connectionInitialized
;
216 /* Expected messages queue */
217 DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST
) replysExpected
;
220 typedef struct tagDirectPlay3Data
224 typedef struct tagDirectPlay4Data
229 #define DP_IMPL_FIELDS \
230 LONG ulInterfaceRef; \
231 DirectPlayIUnknownData* unk; \
232 DirectPlay2Data* dp2; \
233 DirectPlay3Data* dp3; \
234 DirectPlay4Data* dp4;
236 struct IDirectPlay2Impl
238 const IDirectPlay2Vtbl
*lpVtbl
;
242 struct IDirectPlay3Impl
244 const IDirectPlay3Vtbl
*lpVtbl
;
248 struct IDirectPlay4Impl
250 const IDirectPlay4Vtbl
*lpVtbl
;
254 HRESULT
DP_HandleMessage( IDirectPlay2Impl
* This
, LPCVOID lpMessageBody
,
255 DWORD dwMessageBodySize
, LPCVOID lpMessageHeader
,
256 WORD wCommandId
, WORD wVersion
,
257 LPVOID
* lplpReply
, LPDWORD lpdwMsgSize
);
258 lpPlayerList
DP_FindPlayer( IDirectPlay2AImpl
* This
, DPID dpid
);
259 HRESULT
DP_SetSessionDesc( IDirectPlay2Impl
* This
,
260 LPCDPSESSIONDESC2 lpSessDesc
,
261 DWORD dwFlags
, BOOL bInitial
,
263 HRESULT
DP_CreatePlayer( IDirectPlay2Impl
* This
, DPID idPlayer
,
264 LPDPNAME lpName
, DWORD dwFlags
,
265 LPVOID lpData
, DWORD dwDataSize
,
266 HANDLE hEvent
, BOOL bAnsi
,
267 lpPlayerData
* lplpPlayer
);
269 /* DP SP external interfaces into DirectPlay */
270 extern HRESULT
DP_GetSPPlayerData( IDirectPlay2Impl
* lpDP
, DPID idPlayer
, LPVOID
* lplpData
);
271 extern HRESULT
DP_SetSPPlayerData( IDirectPlay2Impl
* lpDP
, DPID idPlayer
, LPVOID lpData
);
273 /* DP external interfaces to call into DPSP interface */
274 extern LPVOID
DPSP_CreateSPPlayerData(void);
276 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */