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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __WINE_DPLAY_GLOBAL_INCLUDED
20 #define __WINE_DPLAY_GLOBAL_INCLUDED
24 #include "dplayx_queue.h"
26 extern HRESULT
DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback
,
27 LPCVOID lpAddress
, DWORD dwAddressSize
,
30 extern DWORD
DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc
, BOOL bAnsi
);
32 /*****************************************************************************
33 * Predeclare the interface implementation structures
35 typedef struct IDirectPlay2Impl IDirectPlay2AImpl
;
36 typedef struct IDirectPlay2Impl IDirectPlay2Impl
;
37 typedef struct IDirectPlay3Impl IDirectPlay3AImpl
;
38 typedef struct IDirectPlay3Impl IDirectPlay3Impl
;
39 typedef struct IDirectPlay4Impl IDirectPlay4AImpl
;
40 typedef struct IDirectPlay4Impl IDirectPlay4Impl
;
42 typedef struct tagDirectPlayIUnknownData
45 CRITICAL_SECTION DP_lock
;
46 } DirectPlayIUnknownData
;
48 typedef struct tagEnumSessionAsyncCallbackData
50 LPSPINITDATA lpSpData
;
52 DWORD dwEnumSessionFlags
;
54 HANDLE hSuicideRequest
;
55 } EnumSessionAsyncCallbackData
;
57 typedef struct tagDP_MSG_REPLY_STRUCT
63 /* FIXME: Is the message header required as well? */
64 } DP_MSG_REPLY_STRUCT
, *LPDP_MSG_REPLY_STRUCT
;
66 typedef struct tagDP_MSG_REPLY_STRUCT_LIST
68 DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST
) replysExpected
;
69 DP_MSG_REPLY_STRUCT replyExpected
;
70 } DP_MSG_REPLY_STRUCT_LIST
, *LPDP_MSG_REPLY_STRUCT_LIST
;
74 /* Individual player information */
80 ULONG uRef
; /* What is the reference count on this data? */
82 /* View of local data */
84 DWORD dwLocalDataSize
;
86 /* View of remote data */
88 DWORD dwRemoteDataSize
;
90 /* SP data on a per player basis */
91 LPVOID lpSPPlayerData
;
93 DWORD dwFlags
; /* Special remarks about the type of player */
95 typedef struct PlayerData
* lpPlayerData
;
99 DPQ_ENTRY(PlayerList
) players
;
101 lpPlayerData lpPData
;
103 typedef struct PlayerList
* lpPlayerList
;
107 /* Internal information */
108 DPID parent
; /* If parent == 0 it's a top level group */
110 ULONG uRef
; /* Reference count */
112 DPQ_HEAD(GroupList
) groups
; /* A group has [0..n] groups */
113 DPQ_HEAD(PlayerList
) players
; /* A group has [0..n] players */
115 DPID idGroupOwner
; /* ID of player who owns the group */
117 DWORD dwFlags
; /* Flags describing anything special about the group */
122 /* View of local data */
124 DWORD dwLocalDataSize
;
126 /* View of remote data */
128 DWORD dwRemoteDataSize
;
130 typedef struct GroupData GroupData
;
131 typedef struct GroupData
* lpGroupData
;
135 DPQ_ENTRY(GroupList
) groups
;
139 typedef struct GroupList
* lpGroupList
;
143 DPQ_ENTRY( DPMSG
) msgs
;
146 typedef struct DPMSG
* LPDPMSG
;
151 DP_SERVICE_PROVIDER
= 1,
152 DP_LOBBY_PROVIDER
= 2
155 /* Contains all data members. FIXME: Rename me */
156 typedef struct tagDirectPlay2Data
158 BOOL bConnectionOpen
;
160 /* For async EnumSessions requests */
161 HANDLE hEnumSessionThread
;
162 HANDLE hKillEnumSessionThreadEvent
;
164 LPVOID lpNameServerData
; /* DPlay interface doesn't know contents */
166 BOOL bHostInterface
; /* Did this interface create the session */
168 lpGroupData lpSysGroup
; /* System group with _everything_ in it */
170 LPDPSESSIONDESC2 lpSessionDesc
;
173 DPQ_HEAD( DPMSG
) receiveMsgs
; /* Msg receive queue */
174 DPQ_HEAD( DPMSG
) sendMsgs
; /* Msg send pending queue */
176 /* Information about the service provider active on this connection */
180 /* Information about the lobby server that's attached to this DP object */
181 SPDATA_INIT dplspData
;
182 BOOL bDPLSPInitialized
;
184 /* Our service provider */
185 HMODULE hServiceProvider
;
187 /* Our DP lobby provider */
188 HMODULE hDPLobbyProvider
;
190 enum SPSTATE connectionInitialized
;
192 /* Expected messages queue */
193 DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST
) replysExpected
;
196 typedef struct tagDirectPlay3Data
200 typedef struct tagDirectPlay4Data
205 #define DP_IMPL_FIELDS \
206 ULONG ulInterfaceRef; \
207 DirectPlayIUnknownData* unk; \
208 DirectPlay2Data* dp2; \
209 DirectPlay3Data* dp3; \
210 DirectPlay4Data* dp4;
212 struct IDirectPlay2Impl
214 ICOM_VFIELD(IDirectPlay2
);
218 struct IDirectPlay3Impl
220 ICOM_VFIELD(IDirectPlay3
);
224 struct IDirectPlay4Impl
226 ICOM_VFIELD(IDirectPlay4
);
230 /* Forward declarations of virtual tables */
231 extern ICOM_VTABLE(IDirectPlay2
) directPlay2AVT
;
232 extern ICOM_VTABLE(IDirectPlay3
) directPlay3AVT
;
233 extern ICOM_VTABLE(IDirectPlay4
) directPlay4AVT
;
235 extern ICOM_VTABLE(IDirectPlay2
) directPlay2WVT
;
236 extern ICOM_VTABLE(IDirectPlay3
) directPlay3WVT
;
237 extern ICOM_VTABLE(IDirectPlay4
) directPlay4WVT
;
240 HRESULT
DP_HandleMessage( IDirectPlay2Impl
* This
, LPCVOID lpMessageBody
,
241 DWORD dwMessageBodySize
, LPCVOID lpMessageHeader
,
242 WORD wCommandId
, WORD wVersion
,
243 LPVOID
* lplpReply
, LPDWORD lpdwMsgSize
);
245 /* DP SP external interfaces into DirectPlay */
246 extern HRESULT
DP_GetSPPlayerData( IDirectPlay2Impl
* lpDP
, DPID idPlayer
, LPVOID
* lplpData
);
247 extern HRESULT
DP_SetSPPlayerData( IDirectPlay2Impl
* lpDP
, DPID idPlayer
, LPVOID lpData
);
249 /* DP external interfaces to call into DPSP interface */
250 extern LPVOID
DPSP_CreateSPPlayerData(void);
252 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */