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
,
32 LPVOID lpContext
) DECLSPEC_HIDDEN
;
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
65 /* FIXME: Is the message header required as well? */
66 } DP_MSG_REPLY_STRUCT
, *LPDP_MSG_REPLY_STRUCT
;
68 typedef struct tagDP_MSG_REPLY_STRUCT_LIST
70 DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST
) replysExpected
;
71 DP_MSG_REPLY_STRUCT replyExpected
;
72 } DP_MSG_REPLY_STRUCT_LIST
, *LPDP_MSG_REPLY_STRUCT_LIST
;
76 /* Individual player information */
82 ULONG uRef
; /* What is the reference count on this data? */
84 /* View of local data */
86 DWORD dwLocalDataSize
;
88 /* View of remote data */
90 DWORD dwRemoteDataSize
;
92 /* SP data on a per player basis */
93 LPVOID lpSPPlayerData
;
95 DWORD dwFlags
; /* Special remarks about the type of player */
97 typedef struct PlayerData
* lpPlayerData
;
101 DPQ_ENTRY(PlayerList
) players
;
103 lpPlayerData lpPData
;
105 typedef struct PlayerList
* lpPlayerList
;
109 /* Internal information */
110 DPID parent
; /* If parent == 0 it's a top level group */
112 ULONG uRef
; /* Reference count */
114 DPQ_HEAD(GroupList
) groups
; /* A group has [0..n] groups */
115 DPQ_HEAD(PlayerList
) players
; /* A group has [0..n] players */
117 DPID idGroupOwner
; /* ID of player who owns the group */
119 DWORD dwFlags
; /* Flags describing anything special about the group */
124 /* View of local data */
126 DWORD dwLocalDataSize
;
128 /* View of remote data */
130 DWORD dwRemoteDataSize
;
132 typedef struct GroupData GroupData
;
133 typedef struct GroupData
* lpGroupData
;
137 DPQ_ENTRY(GroupList
) groups
;
141 typedef struct GroupList
* lpGroupList
;
145 DPQ_ENTRY( DPMSG
) msgs
;
148 typedef struct DPMSG
* LPDPMSG
;
153 DP_SERVICE_PROVIDER
= 1,
154 DP_LOBBY_PROVIDER
= 2
157 /* Contains all data members. FIXME: Rename me */
158 typedef struct tagDirectPlay2Data
160 BOOL bConnectionOpen
;
162 /* For async EnumSessions requests */
163 HANDLE hEnumSessionThread
;
164 HANDLE hKillEnumSessionThreadEvent
;
165 DWORD dwEnumSessionLock
;
167 LPVOID lpNameServerData
; /* DPlay interface doesn't know contents */
169 BOOL bHostInterface
; /* Did this interface create the session */
171 lpGroupData lpSysGroup
; /* System group with _everything_ in it */
173 LPDPSESSIONDESC2 lpSessionDesc
;
176 DPQ_HEAD( DPMSG
) receiveMsgs
; /* Msg receive queue */
177 DPQ_HEAD( DPMSG
) sendMsgs
; /* Msg send pending queue */
179 /* Information about the service provider active on this connection */
183 /* Information about the lobby server that's attached to this DP object */
184 SPDATA_INIT dplspData
;
185 BOOL bDPLSPInitialized
;
187 /* Our service provider */
188 HMODULE hServiceProvider
;
190 /* Our DP lobby provider */
191 HMODULE hDPLobbyProvider
;
193 enum SPSTATE connectionInitialized
;
195 /* Expected messages queue */
196 DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST
) replysExpected
;
199 typedef struct tagDirectPlay3Data
203 typedef struct tagDirectPlay4Data
208 #define DP_IMPL_FIELDS \
209 LONG ulInterfaceRef; \
210 DirectPlayIUnknownData* unk; \
211 DirectPlay2Data* dp2; \
212 DirectPlay3Data* dp3; \
213 DirectPlay4Data* dp4;
215 struct IDirectPlay2Impl
217 const IDirectPlay2Vtbl
*lpVtbl
;
221 struct IDirectPlay3Impl
223 const IDirectPlay3Vtbl
*lpVtbl
;
227 struct IDirectPlay4Impl
229 const IDirectPlay4Vtbl
*lpVtbl
;
233 HRESULT
DP_HandleMessage( IDirectPlay2Impl
* This
, LPCVOID lpMessageBody
,
234 DWORD dwMessageBodySize
, LPCVOID lpMessageHeader
,
235 WORD wCommandId
, WORD wVersion
,
236 LPVOID
* lplpReply
, LPDWORD lpdwMsgSize
) DECLSPEC_HIDDEN
;
238 /* DP SP external interfaces into DirectPlay */
239 extern HRESULT
DP_GetSPPlayerData( IDirectPlay2Impl
* lpDP
, DPID idPlayer
, LPVOID
* lplpData
) DECLSPEC_HIDDEN
;
240 extern HRESULT
DP_SetSPPlayerData( IDirectPlay2Impl
* lpDP
, DPID idPlayer
, LPVOID lpData
) DECLSPEC_HIDDEN
;
242 /* DP external interfaces to call into DPSP interface */
243 extern LPVOID
DPSP_CreateSPPlayerData(void) DECLSPEC_HIDDEN
;
245 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */