- Add proper message reply mechanism and sp player data storage
[wine.git] / dlls / dplayx / dplay_global.h
blobb7daa7443bf5fa908b9c468e6496aec2a36436de
1 #ifndef __WINE_DPLAY_GLOBAL_INCLUDED
2 #define __WINE_DPLAY_GLOBAL_INCLUDED
4 #include "dplaysp.h"
5 #include "dplayx_queue.h"
7 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
8 LPCVOID lpAddress, DWORD dwAddressSize,
9 LPVOID lpContext );
11 extern DWORD DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc, BOOL bAnsi );
13 /*****************************************************************************
14 * Predeclare the interface implementation structures
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;
23 typedef struct tagDirectPlayIUnknownData
25 ULONG ulObjRef;
26 CRITICAL_SECTION DP_lock;
27 } DirectPlayIUnknownData;
29 typedef struct tagEnumSessionAsyncCallbackData
31 LPSPINITDATA lpSpData;
32 GUID requestGuid;
33 DWORD dwEnumSessionFlags;
34 DWORD dwTimeout;
35 HANDLE hSuicideRequest;
36 } EnumSessionAsyncCallbackData;
38 typedef struct tagDP_MSG_REPLY_STRUCT
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;
47 typedef struct tagDP_MSG_REPLY_STRUCT_LIST
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;
53 struct PlayerData
55 /* Individual player information */
56 DPID dpid;
58 DPNAME name;
59 HANDLE hEvent;
61 ULONG uRef; /* What is the reference count on this data? */
63 /* View of local data */
64 LPVOID lpLocalData;
65 DWORD dwLocalDataSize;
67 /* View of remote data */
68 LPVOID lpRemoteData;
69 DWORD dwRemoteDataSize;
71 /* SP data on a per player basis */
72 LPVOID lpSPPlayerData;
74 DWORD dwFlags; /* Special remarks about the type of player */
76 typedef struct PlayerData* lpPlayerData;
78 struct PlayerList
80 DPQ_ENTRY(PlayerList) players;
82 lpPlayerData lpPData;
84 typedef struct PlayerList* lpPlayerList;
86 struct GroupData
88 /* Internal information */
89 DPID parent; /* If parent == 0 it's a top level group */
91 ULONG uRef; /* Reference count */
93 DPQ_HEAD(GroupList) groups; /* A group has [0..n] groups */
94 DPQ_HEAD(PlayerList) players; /* A group has [0..n] players */
96 DPID idGroupOwner; /* ID of player who owns the group */
98 DWORD dwFlags; /* Flags describing anything special about the group */
100 DPID dpid;
101 DPNAME name;
103 /* View of local data */
104 LPVOID lpLocalData;
105 DWORD dwLocalDataSize;
107 /* View of remote data */
108 LPVOID lpRemoteData;
109 DWORD dwRemoteDataSize;
111 typedef struct GroupData GroupData;
112 typedef struct GroupData* lpGroupData;
114 struct GroupList
116 DPQ_ENTRY(GroupList) groups;
118 lpGroupData lpGData;
120 typedef struct GroupList* lpGroupList;
122 struct DPMSG
124 DPQ_ENTRY( DPMSG ) msgs;
125 DPMSG_GENERIC* msg;
127 typedef struct DPMSG* LPDPMSG;
129 /* Contains all dp1 and dp2 data members */
130 typedef struct tagDirectPlay2Data
132 BOOL bConnectionOpen;
134 /* For async EnumSessions requests */
135 HANDLE hEnumSessionThread;
136 HANDLE hKillEnumSessionThreadEvent;
138 LPVOID lpNameServerData; /* DPlay interface doesn't know contents */
140 BOOL bHostInterface; /* Did this interface create the session */
142 lpGroupData lpSysGroup; /* System group with _everything_ in it */
144 LPDPSESSIONDESC2 lpSessionDesc;
146 /* I/O Msg queues */
147 DPQ_HEAD( DPMSG ) receiveMsgs; /* Msg receive queue */
148 DPQ_HEAD( DPMSG ) sendMsgs; /* Msg send pending queue */
150 /* Information about the service provider active on this connection */
151 SPINITDATA spData;
153 /* Our service provider */
154 HMODULE hServiceProvider;
156 BOOL bConnectionInitialized;
158 /* Expected messages queue */
159 DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST ) replysExpected;
160 } DirectPlay2Data;
162 typedef struct tagDirectPlay3Data
164 BOOL dummy;
165 } DirectPlay3Data;
166 typedef struct tagDirectPlay4Data
168 BOOL dummy;
169 } DirectPlay4Data;
171 #define DP_IMPL_FIELDS \
172 ULONG ulInterfaceRef; \
173 DirectPlayIUnknownData* unk; \
174 DirectPlay2Data* dp2; \
175 DirectPlay3Data* dp3; \
176 DirectPlay4Data* dp4;
178 struct IDirectPlay2Impl
180 ICOM_VFIELD(IDirectPlay2);
181 DP_IMPL_FIELDS
184 struct IDirectPlay3Impl
186 ICOM_VFIELD(IDirectPlay3);
187 DP_IMPL_FIELDS
190 struct IDirectPlay4Impl
192 ICOM_VFIELD(IDirectPlay4);
193 DP_IMPL_FIELDS
196 /* Forward declarations of virtual tables */
197 extern ICOM_VTABLE(IDirectPlay2) directPlay2AVT;
198 extern ICOM_VTABLE(IDirectPlay3) directPlay3AVT;
199 extern ICOM_VTABLE(IDirectPlay4) directPlay4AVT;
201 extern ICOM_VTABLE(IDirectPlay2) directPlay2WVT;
202 extern ICOM_VTABLE(IDirectPlay3) directPlay3WVT;
203 extern ICOM_VTABLE(IDirectPlay4) directPlay4WVT;
206 HRESULT DP_HandleMessage( IDirectPlay2Impl* This, LPCVOID lpMessageBody,
207 DWORD dwMessageBodySize, LPCVOID lpMessageHeader,
208 WORD wCommandId, WORD wVersion,
209 LPVOID* lplpReply, LPDWORD lpdwMsgSize );
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 );
215 /* DP external interfaces to call into DPSP interface */
216 extern LPVOID DPSP_CreateSPPlayerData(void);
218 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */