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 extern DWORD
DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc
, BOOL bAnsi
);
36 /*****************************************************************************
37 * Predeclare the interface implementation structures
39 typedef struct IDirectPlay2Impl IDirectPlay2AImpl
;
40 typedef struct IDirectPlay2Impl IDirectPlay2Impl
;
41 typedef struct IDirectPlay3Impl IDirectPlay3AImpl
;
42 typedef struct IDirectPlay3Impl IDirectPlay3Impl
;
43 typedef struct IDirectPlay4Impl IDirectPlay4AImpl
;
44 typedef struct IDirectPlay4Impl IDirectPlay4Impl
;
46 typedef struct tagDirectPlayIUnknownData
49 CRITICAL_SECTION DP_lock
;
50 } DirectPlayIUnknownData
;
52 typedef struct tagEnumSessionAsyncCallbackData
54 LPSPINITDATA lpSpData
;
56 DWORD dwEnumSessionFlags
;
58 HANDLE hSuicideRequest
;
59 } EnumSessionAsyncCallbackData
;
61 typedef struct tagDP_MSG_REPLY_STRUCT
67 /* FIXME: Is the message header required as well? */
68 } DP_MSG_REPLY_STRUCT
, *LPDP_MSG_REPLY_STRUCT
;
70 typedef struct tagDP_MSG_REPLY_STRUCT_LIST
72 DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST
) replysExpected
;
73 DP_MSG_REPLY_STRUCT replyExpected
;
74 } DP_MSG_REPLY_STRUCT_LIST
, *LPDP_MSG_REPLY_STRUCT_LIST
;
78 /* Individual player information */
84 ULONG uRef
; /* What is the reference count on this data? */
86 /* View of local data */
88 DWORD dwLocalDataSize
;
90 /* View of remote data */
92 DWORD dwRemoteDataSize
;
94 /* SP data on a per player basis */
95 LPVOID lpSPPlayerData
;
97 DWORD dwFlags
; /* Special remarks about the type of player */
99 typedef struct PlayerData
* lpPlayerData
;
103 DPQ_ENTRY(PlayerList
) players
;
105 lpPlayerData lpPData
;
107 typedef struct PlayerList
* lpPlayerList
;
111 /* Internal information */
112 DPID parent
; /* If parent == 0 it's a top level group */
114 ULONG uRef
; /* Reference count */
116 DPQ_HEAD(GroupList
) groups
; /* A group has [0..n] groups */
117 DPQ_HEAD(PlayerList
) players
; /* A group has [0..n] players */
119 DPID idGroupOwner
; /* ID of player who owns the group */
121 DWORD dwFlags
; /* Flags describing anything special about the group */
126 /* View of local data */
128 DWORD dwLocalDataSize
;
130 /* View of remote data */
132 DWORD dwRemoteDataSize
;
134 typedef struct GroupData GroupData
;
135 typedef struct GroupData
* lpGroupData
;
139 DPQ_ENTRY(GroupList
) groups
;
143 typedef struct GroupList
* lpGroupList
;
147 DPQ_ENTRY( DPMSG
) msgs
;
150 typedef struct DPMSG
* LPDPMSG
;
155 DP_SERVICE_PROVIDER
= 1,
156 DP_LOBBY_PROVIDER
= 2
159 /* Contains all data members. FIXME: Rename me */
160 typedef struct tagDirectPlay2Data
162 BOOL bConnectionOpen
;
164 /* For async EnumSessions requests */
165 HANDLE hEnumSessionThread
;
166 HANDLE hKillEnumSessionThreadEvent
;
167 DWORD dwEnumSessionLock
;
169 LPVOID lpNameServerData
; /* DPlay interface doesn't know contents */
171 BOOL bHostInterface
; /* Did this interface create the session */
173 lpGroupData lpSysGroup
; /* System group with _everything_ in it */
175 LPDPSESSIONDESC2 lpSessionDesc
;
178 DPQ_HEAD( DPMSG
) receiveMsgs
; /* Msg receive queue */
179 DPQ_HEAD( DPMSG
) sendMsgs
; /* Msg send pending queue */
181 /* Information about the service provider active on this connection */
185 /* Information about the lobby server that's attached to this DP object */
186 SPDATA_INIT dplspData
;
187 BOOL bDPLSPInitialized
;
189 /* Our service provider */
190 HMODULE hServiceProvider
;
192 /* Our DP lobby provider */
193 HMODULE hDPLobbyProvider
;
195 enum SPSTATE connectionInitialized
;
197 /* Expected messages queue */
198 DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST
) replysExpected
;
201 typedef struct tagDirectPlay3Data
205 typedef struct tagDirectPlay4Data
210 #define DP_IMPL_FIELDS \
211 LONG ulInterfaceRef; \
212 DirectPlayIUnknownData* unk; \
213 DirectPlay2Data* dp2; \
214 DirectPlay3Data* dp3; \
215 DirectPlay4Data* dp4;
217 struct IDirectPlay2Impl
219 const IDirectPlay2Vtbl
*lpVtbl
;
223 struct IDirectPlay3Impl
225 const IDirectPlay3Vtbl
*lpVtbl
;
229 struct IDirectPlay4Impl
231 const IDirectPlay4Vtbl
*lpVtbl
;
235 HRESULT
DP_HandleMessage( IDirectPlay2Impl
* This
, LPCVOID lpMessageBody
,
236 DWORD dwMessageBodySize
, LPCVOID lpMessageHeader
,
237 WORD wCommandId
, WORD wVersion
,
238 LPVOID
* lplpReply
, LPDWORD lpdwMsgSize
);
240 /* DP SP external interfaces into DirectPlay */
241 extern HRESULT
DP_GetSPPlayerData( IDirectPlay2Impl
* lpDP
, DPID idPlayer
, LPVOID
* lplpData
);
242 extern HRESULT
DP_SetSPPlayerData( IDirectPlay2Impl
* lpDP
, DPID idPlayer
, LPVOID lpData
);
244 /* DP external interfaces to call into DPSP interface */
245 extern LPVOID
DPSP_CreateSPPlayerData(void);
247 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */