Moved HDROP to shellapi.h.
[wine] / dlls / dplayx / dplay_global.h
1 #ifndef __WINE_DPLAY_GLOBAL_INCLUDED
2 #define __WINE_DPLAY_GLOBAL_INCLUDED
3
4 #include "dplaysp.h"
5 #include "dplayx_queue.h"
6
7 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, 
8                                 LPCVOID lpAddress, DWORD dwAddressSize, 
9                                 LPVOID lpContext );
10
11 extern DWORD DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc, BOOL bAnsi );
12
13 /*****************************************************************************
14  * Predeclare the interface implementation structures
15  */
16 typedef struct IDirectPlay2Impl IDirectPlay2AImpl;
17 typedef struct IDirectPlay2Impl IDirectPlay2Impl;
18 typedef struct IDirectPlay3Impl IDirectPlay3AImpl;
19 typedef struct IDirectPlay3Impl IDirectPlay3Impl;
20 typedef struct IDirectPlay4Impl IDirectPlay4AImpl;
21 typedef struct IDirectPlay4Impl IDirectPlay4Impl;
22
23 typedef struct tagDirectPlayIUnknownData
24 {
25   ULONG             ulObjRef;
26   CRITICAL_SECTION  DP_lock;
27 } DirectPlayIUnknownData;
28
29 typedef struct tagEnumSessionAsyncCallbackData
30 {
31   LPSPINITDATA lpSpData;
32   GUID         requestGuid;
33   DWORD        dwEnumSessionFlags;
34   DWORD        dwTimeout;
35   HANDLE       hSuicideRequest;
36 } EnumSessionAsyncCallbackData;
37
38 typedef struct tagDP_MSG_REPLY_STRUCT
39 {
40   HANDLE hReceipt;
41   WORD   wExpectedReply;
42   LPVOID lpReplyMsg;
43   DWORD  dwMsgBodySize;
44   /* FIXME: Is the message header required as well? */
45 } DP_MSG_REPLY_STRUCT, *LPDP_MSG_REPLY_STRUCT;
46
47 typedef struct tagDP_MSG_REPLY_STRUCT_LIST
48 {
49   DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST) replysExpected; 
50   DP_MSG_REPLY_STRUCT replyExpected;
51 } DP_MSG_REPLY_STRUCT_LIST, *LPDP_MSG_REPLY_STRUCT_LIST;
52
53 struct PlayerData
54 {
55   /* Individual player information */
56   DPID dpid;
57
58   DPNAME name;
59   HANDLE hEvent;
60
61   ULONG  uRef;  /* What is the reference count on this data? */
62
63   /* View of local data */
64   LPVOID lpLocalData;
65   DWORD  dwLocalDataSize;
66
67   /* View of remote data */
68   LPVOID lpRemoteData;
69   DWORD  dwRemoteDataSize;
70
71   /* SP data on a per player basis */
72   LPVOID lpSPPlayerData;
73
74   DWORD  dwFlags; /* Special remarks about the type of player */
75 };
76 typedef struct PlayerData* lpPlayerData;
77
78 struct PlayerList
79 {
80   DPQ_ENTRY(PlayerList) players;
81
82   lpPlayerData lpPData;
83 };
84 typedef struct PlayerList* lpPlayerList;
85
86 struct GroupData
87 {
88   /* Internal information */
89   DPID parent; /* If parent == 0 it's a top level group */
90
91   ULONG uRef; /* Reference count */
92
93   DPQ_HEAD(GroupList)  groups;  /* A group has [0..n] groups */
94   DPQ_HEAD(PlayerList) players; /* A group has [0..n] players */
95
96   DPID idGroupOwner; /* ID of player who owns the group */
97
98   DWORD dwFlags; /* Flags describing anything special about the group */
99
100   DPID   dpid;
101   DPNAME name;
102
103   /* View of local data */
104   LPVOID lpLocalData;
105   DWORD  dwLocalDataSize;
106
107   /* View of remote data */
108   LPVOID lpRemoteData;
109   DWORD  dwRemoteDataSize;
110 };
111 typedef struct GroupData  GroupData;
112 typedef struct GroupData* lpGroupData;
113
114 struct GroupList
115 {
116   DPQ_ENTRY(GroupList) groups;
117
118   lpGroupData lpGData;
119 };
120 typedef struct GroupList* lpGroupList;
121
122 struct DPMSG
123 {
124   DPQ_ENTRY( DPMSG ) msgs;
125   DPMSG_GENERIC* msg;
126 };
127 typedef struct DPMSG* LPDPMSG;
128
129 /* Contains all dp1 and dp2 data members */
130 typedef struct tagDirectPlay2Data
131 {
132   BOOL   bConnectionOpen;
133
134   /* For async EnumSessions requests */
135   HANDLE hEnumSessionThread;
136   HANDLE hKillEnumSessionThreadEvent;
137
138   LPVOID lpNameServerData; /* DPlay interface doesn't know contents */
139
140   BOOL bHostInterface; /* Did this interface create the session */
141
142   lpGroupData lpSysGroup; /* System group with _everything_ in it */
143
144   LPDPSESSIONDESC2 lpSessionDesc;
145
146   /* I/O Msg queues */
147   DPQ_HEAD( DPMSG ) receiveMsgs; /* Msg receive queue */
148   DPQ_HEAD( DPMSG ) sendMsgs;    /* Msg send pending queue */
149
150   /* Information about the service provider active on this connection */
151   SPINITDATA spData;
152
153   /* Our service provider */
154   HMODULE hServiceProvider;
155
156   BOOL bConnectionInitialized;
157
158   /* Expected messages queue */
159   DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST ) replysExpected;
160 } DirectPlay2Data;
161
162 typedef struct tagDirectPlay3Data
163 {
164   BOOL dummy;
165 } DirectPlay3Data;
166 typedef struct tagDirectPlay4Data
167 {
168   BOOL dummy;
169 } DirectPlay4Data;
170
171 #define DP_IMPL_FIELDS \
172   ULONG ulInterfaceRef; \
173   DirectPlayIUnknownData*  unk; \
174   DirectPlay2Data*         dp2; \
175   DirectPlay3Data*         dp3; \
176   DirectPlay4Data*         dp4;
177
178 struct IDirectPlay2Impl
179 {
180   ICOM_VFIELD(IDirectPlay2);
181   DP_IMPL_FIELDS
182 };
183
184 struct IDirectPlay3Impl
185 {
186   ICOM_VFIELD(IDirectPlay3);
187   DP_IMPL_FIELDS
188 };
189
190 struct IDirectPlay4Impl
191 {
192   ICOM_VFIELD(IDirectPlay4);
193   DP_IMPL_FIELDS
194 };
195
196 /* Forward declarations of virtual tables */
197 extern ICOM_VTABLE(IDirectPlay2) directPlay2AVT;
198 extern ICOM_VTABLE(IDirectPlay3) directPlay3AVT;
199 extern ICOM_VTABLE(IDirectPlay4) directPlay4AVT;
200
201 extern ICOM_VTABLE(IDirectPlay2) directPlay2WVT;
202 extern ICOM_VTABLE(IDirectPlay3) directPlay3WVT;
203 extern ICOM_VTABLE(IDirectPlay4) directPlay4WVT;
204
205
206 HRESULT DP_HandleMessage( IDirectPlay2Impl* This, LPCVOID lpMessageBody,
207                           DWORD  dwMessageBodySize, LPCVOID lpMessageHeader,
208                           WORD wCommandId, WORD wVersion, 
209                           LPVOID* lplpReply, LPDWORD lpdwMsgSize );
210
211 /* DP SP external interfaces into DirectPlay */
212 extern HRESULT DP_GetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID* lplpData );
213 extern HRESULT DP_SetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID lpData );
214
215 /* DP external interfaces to call into DPSP interface */
216 extern LPVOID DPSP_CreateSPPlayerData(void);
217
218 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */