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