server: add async_terminated to allow server-side request changes before user apc
[wine/hacks.git] / dlls / dplayx / dplay_global.h
blob6c9c61a286ddc382f8786403e129bebc6e8f2977
1 /*
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
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wine/dplaysp.h"
27 #include "lobbysp.h"
28 #include "dplayx_queue.h"
30 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
31 LPCVOID lpAddress, DWORD dwAddressSize,
32 LPVOID lpContext );
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
46 LONG ulObjRef;
47 CRITICAL_SECTION DP_lock;
48 } DirectPlayIUnknownData;
50 typedef struct tagEnumSessionAsyncCallbackData
52 LPSPINITDATA lpSpData;
53 GUID requestGuid;
54 DWORD dwEnumSessionFlags;
55 DWORD dwTimeout;
56 HANDLE hSuicideRequest;
57 } EnumSessionAsyncCallbackData;
59 typedef struct tagDP_MSG_REPLY_STRUCT
61 HANDLE hReceipt;
62 WORD wExpectedReply;
63 LPVOID lpReplyMsg;
64 DWORD dwMsgBodySize;
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;
74 struct PlayerData
76 /* Individual player information */
77 DPID dpid;
79 DPNAME name;
80 HANDLE hEvent;
82 ULONG uRef; /* What is the reference count on this data? */
84 /* View of local data */
85 LPVOID lpLocalData;
86 DWORD dwLocalDataSize;
88 /* View of remote data */
89 LPVOID lpRemoteData;
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;
99 struct PlayerList
101 DPQ_ENTRY(PlayerList) players;
103 lpPlayerData lpPData;
105 typedef struct PlayerList* lpPlayerList;
107 struct GroupData
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 */
121 DPID dpid;
122 DPNAME name;
124 /* View of local data */
125 LPVOID lpLocalData;
126 DWORD dwLocalDataSize;
128 /* View of remote data */
129 LPVOID lpRemoteData;
130 DWORD dwRemoteDataSize;
132 typedef struct GroupData GroupData;
133 typedef struct GroupData* lpGroupData;
135 struct GroupList
137 DPQ_ENTRY(GroupList) groups;
139 lpGroupData lpGData;
141 typedef struct GroupList* lpGroupList;
143 struct DPMSG
145 DPQ_ENTRY( DPMSG ) msgs;
146 DPMSG_GENERIC* msg;
148 typedef struct DPMSG* LPDPMSG;
150 enum SPSTATE
152 NO_PROVIDER = 0,
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;
175 /* I/O Msg queues */
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 */
180 SPINITDATA spData;
181 BOOL bSPInitialized;
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;
197 } DirectPlay2Data;
199 typedef struct tagDirectPlay3Data
201 BOOL dummy;
202 } DirectPlay3Data;
203 typedef struct tagDirectPlay4Data
205 BOOL dummy;
206 } DirectPlay4Data;
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;
218 DP_IMPL_FIELDS
221 struct IDirectPlay3Impl
223 const IDirectPlay3Vtbl *lpVtbl;
224 DP_IMPL_FIELDS
227 struct IDirectPlay4Impl
229 const IDirectPlay4Vtbl *lpVtbl;
230 DP_IMPL_FIELDS
233 HRESULT DP_HandleMessage( IDirectPlay2Impl* This, LPCVOID lpMessageBody,
234 DWORD dwMessageBodySize, LPCVOID lpMessageHeader,
235 WORD wCommandId, WORD wVersion,
236 LPVOID* lplpReply, LPDWORD lpdwMsgSize );
238 /* DP SP external interfaces into DirectPlay */
239 extern HRESULT DP_GetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID* lplpData );
240 extern HRESULT DP_SetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID lpData );
242 /* DP external interfaces to call into DPSP interface */
243 extern LPVOID DPSP_CreateSPPlayerData(void);
245 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */