dplayx: Code to parse PlayerEnumeration messages
[wine/gsoc_dplay.git] / dlls / dplayx / dplay_global.h
blob714b377c9b24670ac214c6a4c84b1db93852aa1c
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 lpReplyHdr;
64 LPVOID lpReplyMsg;
65 DWORD dwMsgBodySize;
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
79 DPNAME name;
80 DPID parentID;
82 LPVOID lpPlayerSPData;
83 DWORD dwPlayerSPDataSize;
84 LPVOID lpPlayerData;
85 DWORD dwPlayerDataSize;
87 DWORD dwPlayerCount;
88 LPDPID lpPlayerIDs;
89 DWORD dwShortcutCount;
90 LPDPID lpShortcutIDs;
91 } PACKEDPLAYERDATA, *LPPACKEDPLAYERDATA;
93 struct PlayerData
95 /* Individual player information */
96 DPID dpid;
98 DPNAME name;
99 HANDLE hEvent;
101 ULONG uRef; /* What is the reference count on this data? */
103 /* View of local data */
104 LPVOID lpLocalData;
105 DWORD dwLocalDataSize;
107 /* View of remote data */
108 LPVOID lpRemoteData;
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;
118 struct PlayerList
120 DPQ_ENTRY(PlayerList) players;
122 lpPlayerData lpPData;
124 typedef struct PlayerList* lpPlayerList;
126 struct GroupData
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 */
140 DPID dpid;
141 DPNAME name;
143 /* View of local data */
144 LPVOID lpLocalData;
145 DWORD dwLocalDataSize;
147 /* View of remote data */
148 LPVOID lpRemoteData;
149 DWORD dwRemoteDataSize;
151 typedef struct GroupData GroupData;
152 typedef struct GroupData* lpGroupData;
154 struct GroupList
156 DPQ_ENTRY(GroupList) groups;
158 lpGroupData lpGData;
160 typedef struct GroupList* lpGroupList;
162 struct DPMSG
164 DPQ_ENTRY( DPMSG ) msgs;
165 LPDPMSG_GENERIC msg;
166 DWORD dwMsgSize;
167 DPID idFrom, idTo;
169 typedef struct DPMSG* LPDPMSG;
171 enum SPSTATE
173 NO_PROVIDER = 0,
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;
196 /* I/O Msg queues */
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 */
201 SPINITDATA spData;
202 BOOL bSPInitialized;
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;
218 } DirectPlay2Data;
220 typedef struct tagDirectPlay3Data
222 BOOL dummy;
223 } DirectPlay3Data;
224 typedef struct tagDirectPlay4Data
226 BOOL dummy;
227 } DirectPlay4Data;
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;
239 DP_IMPL_FIELDS
242 struct IDirectPlay3Impl
244 const IDirectPlay3Vtbl *lpVtbl;
245 DP_IMPL_FIELDS
248 struct IDirectPlay4Impl
250 const IDirectPlay4Vtbl *lpVtbl;
251 DP_IMPL_FIELDS
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,
262 BOOL bAnsi );
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 */