dmsynth: Dump data passed to Download method.
[wine] / dlls / dplayx / dplay_global.h
1 /*
2  * Copyright 2000 Peter Hunnisett
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #ifndef __WINE_DPLAY_GLOBAL_INCLUDED
20 #define __WINE_DPLAY_GLOBAL_INCLUDED
21
22 #include <stdarg.h>
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wine/dplaysp.h"
27 #include "lobbysp.h"
28 #include "dplayx_queue.h"
29
30 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
31                                 LPCVOID lpAddress, DWORD dwAddressSize,
32                                 LPVOID lpContext ) DECLSPEC_HIDDEN;
33
34 /*****************************************************************************
35  * Predeclare the interface implementation structures
36  */
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;
43
44 typedef struct tagDirectPlayIUnknownData
45 {
46   LONG              ulObjRef;
47   CRITICAL_SECTION  DP_lock;
48 } DirectPlayIUnknownData;
49
50 typedef struct tagEnumSessionAsyncCallbackData
51 {
52   LPSPINITDATA lpSpData;
53   GUID         requestGuid;
54   DWORD        dwEnumSessionFlags;
55   DWORD        dwTimeout;
56   HANDLE       hSuicideRequest;
57 } EnumSessionAsyncCallbackData;
58
59 typedef struct tagDP_MSG_REPLY_STRUCT
60 {
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;
67
68 typedef struct tagDP_MSG_REPLY_STRUCT_LIST
69 {
70   DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST) repliesExpected;
71   DP_MSG_REPLY_STRUCT replyExpected;
72 } DP_MSG_REPLY_STRUCT_LIST, *LPDP_MSG_REPLY_STRUCT_LIST;
73
74 struct PlayerData
75 {
76   /* Individual player information */
77   DPID dpid;
78
79   DPNAME name;
80   HANDLE hEvent;
81
82   ULONG  uRef;  /* What is the reference count on this data? */
83
84   /* View of local data */
85   LPVOID lpLocalData;
86   DWORD  dwLocalDataSize;
87
88   /* View of remote data */
89   LPVOID lpRemoteData;
90   DWORD  dwRemoteDataSize;
91
92   /* SP data on a per player basis */
93   LPVOID lpSPPlayerData;
94
95   DWORD  dwFlags; /* Special remarks about the type of player */
96 };
97 typedef struct PlayerData* lpPlayerData;
98
99 struct PlayerList
100 {
101   DPQ_ENTRY(PlayerList) players;
102
103   lpPlayerData lpPData;
104 };
105 typedef struct PlayerList* lpPlayerList;
106
107 struct GroupData
108 {
109   /* Internal information */
110   DPID parent; /* If parent == 0 it's a top level group */
111
112   ULONG uRef; /* Reference count */
113
114   DPQ_HEAD(GroupList)  groups;  /* A group has [0..n] groups */
115   DPQ_HEAD(PlayerList) players; /* A group has [0..n] players */
116
117   DPID idGroupOwner; /* ID of player who owns the group */
118
119   DWORD dwFlags; /* Flags describing anything special about the group */
120
121   DPID   dpid;
122   DPNAME name;
123
124   /* View of local data */
125   LPVOID lpLocalData;
126   DWORD  dwLocalDataSize;
127
128   /* View of remote data */
129   LPVOID lpRemoteData;
130   DWORD  dwRemoteDataSize;
131 };
132 typedef struct GroupData  GroupData;
133 typedef struct GroupData* lpGroupData;
134
135 struct GroupList
136 {
137   DPQ_ENTRY(GroupList) groups;
138
139   lpGroupData lpGData;
140 };
141 typedef struct GroupList* lpGroupList;
142
143 struct DPMSG
144 {
145   DPQ_ENTRY( DPMSG ) msgs;
146   DPMSG_GENERIC* msg;
147 };
148 typedef struct DPMSG* LPDPMSG;
149
150 enum SPSTATE
151 {
152   NO_PROVIDER = 0,
153   DP_SERVICE_PROVIDER = 1,
154   DP_LOBBY_PROVIDER = 2
155 };
156
157 /* Contains all data members. FIXME: Rename me */
158 typedef struct tagDirectPlay2Data
159 {
160   BOOL   bConnectionOpen;
161
162   /* For async EnumSessions requests */
163   HANDLE hEnumSessionThread;
164   HANDLE hKillEnumSessionThreadEvent;
165   DWORD  dwEnumSessionLock;
166
167   LPVOID lpNameServerData; /* DPlay interface doesn't know contents */
168
169   BOOL bHostInterface; /* Did this interface create the session */
170
171   lpGroupData lpSysGroup; /* System group with _everything_ in it */
172
173   LPDPSESSIONDESC2 lpSessionDesc;
174
175   /* I/O Msg queues */
176   DPQ_HEAD( DPMSG ) receiveMsgs; /* Msg receive queue */
177   DPQ_HEAD( DPMSG ) sendMsgs;    /* Msg send pending queue */
178
179   /* Information about the service provider active on this connection */
180   SPINITDATA spData;
181   BOOL       bSPInitialized;
182
183   /* Information about the lobby server that's attached to this DP object */
184   SPDATA_INIT dplspData;
185   BOOL        bDPLSPInitialized;
186
187   /* Our service provider */
188   HMODULE hServiceProvider;
189
190   /* Our DP lobby provider */
191   HMODULE hDPLobbyProvider;
192
193   enum SPSTATE connectionInitialized;
194
195   /* Expected messages queue */
196   DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST ) repliesExpected;
197 } DirectPlay2Data;
198
199 typedef struct tagDirectPlay3Data
200 {
201   BOOL dummy;
202 } DirectPlay3Data;
203 typedef struct tagDirectPlay4Data
204 {
205   BOOL dummy;
206 } DirectPlay4Data;
207
208 #define DP_IMPL_FIELDS \
209   LONG ulInterfaceRef; \
210   DirectPlayIUnknownData*  unk; \
211   DirectPlay2Data*         dp2; \
212   DirectPlay3Data*         dp3; \
213   DirectPlay4Data*         dp4;
214
215 struct IDirectPlay2Impl
216 {
217   const IDirectPlay2Vtbl *lpVtbl;
218   DP_IMPL_FIELDS
219 };
220
221 struct IDirectPlay3Impl
222 {
223   const IDirectPlay3Vtbl *lpVtbl;
224   DP_IMPL_FIELDS
225 };
226
227 struct IDirectPlay4Impl
228 {
229   const IDirectPlay4Vtbl *lpVtbl;
230   DP_IMPL_FIELDS
231 };
232
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;
237
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;
241
242 /* DP external interfaces to call into DPSP interface */
243 extern LPVOID DPSP_CreateSPPlayerData(void) DECLSPEC_HIDDEN;
244
245 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */