dplayx: Code to send CreatePlayer messages
[wine/gsoc_dplay.git] / dlls / dplayx / dplay_global.h
blob3481335ab75c42bd6e9e6920a9881035a8304cc7
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;
75 struct PlayerData
77 /* Individual player information */
78 DPID dpid;
80 DPNAME name;
81 HANDLE hEvent;
83 ULONG uRef; /* What is the reference count on this data? */
85 /* View of local data */
86 LPVOID lpLocalData;
87 DWORD dwLocalDataSize;
89 /* View of remote data */
90 LPVOID lpRemoteData;
91 DWORD dwRemoteDataSize;
93 /* SP data on a per player basis */
94 LPVOID lpSPPlayerData;
96 DWORD dwFlags; /* Special remarks about the type of player */
98 typedef struct PlayerData* lpPlayerData;
100 struct PlayerList
102 DPQ_ENTRY(PlayerList) players;
104 lpPlayerData lpPData;
106 typedef struct PlayerList* lpPlayerList;
108 struct GroupData
110 /* Internal information */
111 DPID parent; /* If parent == 0 it's a top level group */
113 ULONG uRef; /* Reference count */
115 DPQ_HEAD(GroupList) groups; /* A group has [0..n] groups */
116 DPQ_HEAD(PlayerList) players; /* A group has [0..n] players */
118 DPID idGroupOwner; /* ID of player who owns the group */
120 DWORD dwFlags; /* Flags describing anything special about the group */
122 DPID dpid;
123 DPNAME name;
125 /* View of local data */
126 LPVOID lpLocalData;
127 DWORD dwLocalDataSize;
129 /* View of remote data */
130 LPVOID lpRemoteData;
131 DWORD dwRemoteDataSize;
133 typedef struct GroupData GroupData;
134 typedef struct GroupData* lpGroupData;
136 struct GroupList
138 DPQ_ENTRY(GroupList) groups;
140 lpGroupData lpGData;
142 typedef struct GroupList* lpGroupList;
144 struct DPMSG
146 DPQ_ENTRY( DPMSG ) msgs;
147 LPDPMSG_GENERIC msg;
148 DWORD dwMsgSize;
149 DPID idFrom, idTo;
151 typedef struct DPMSG* LPDPMSG;
153 enum SPSTATE
155 NO_PROVIDER = 0,
156 DP_SERVICE_PROVIDER = 1,
157 DP_LOBBY_PROVIDER = 2
160 /* Contains all data members. FIXME: Rename me */
161 typedef struct tagDirectPlay2Data
163 BOOL bConnectionOpen;
165 /* For async EnumSessions requests */
166 HANDLE hEnumSessionThread;
167 HANDLE hKillEnumSessionThreadEvent;
168 DWORD dwEnumSessionLock;
170 LPVOID lpNameServerData; /* DPlay interface doesn't know contents */
172 BOOL bHostInterface; /* Did this interface create the session */
174 lpGroupData lpSysGroup; /* System group with _everything_ in it */
176 LPDPSESSIONDESC2 lpSessionDesc;
178 /* I/O Msg queues */
179 DPQ_HEAD( DPMSG ) receiveMsgs; /* Msg receive queue */
180 DPQ_HEAD( DPMSG ) sendMsgs; /* Msg send pending queue */
182 /* Information about the service provider active on this connection */
183 SPINITDATA spData;
184 BOOL bSPInitialized;
186 /* Information about the lobby server that's attached to this DP object */
187 SPDATA_INIT dplspData;
188 BOOL bDPLSPInitialized;
190 /* Our service provider */
191 HMODULE hServiceProvider;
193 /* Our DP lobby provider */
194 HMODULE hDPLobbyProvider;
196 enum SPSTATE connectionInitialized;
198 /* Expected messages queue */
199 DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST ) replysExpected;
200 } DirectPlay2Data;
202 typedef struct tagDirectPlay3Data
204 BOOL dummy;
205 } DirectPlay3Data;
206 typedef struct tagDirectPlay4Data
208 BOOL dummy;
209 } DirectPlay4Data;
211 #define DP_IMPL_FIELDS \
212 LONG ulInterfaceRef; \
213 DirectPlayIUnknownData* unk; \
214 DirectPlay2Data* dp2; \
215 DirectPlay3Data* dp3; \
216 DirectPlay4Data* dp4;
218 struct IDirectPlay2Impl
220 const IDirectPlay2Vtbl *lpVtbl;
221 DP_IMPL_FIELDS
224 struct IDirectPlay3Impl
226 const IDirectPlay3Vtbl *lpVtbl;
227 DP_IMPL_FIELDS
230 struct IDirectPlay4Impl
232 const IDirectPlay4Vtbl *lpVtbl;
233 DP_IMPL_FIELDS
236 HRESULT DP_HandleMessage( IDirectPlay2Impl* This, LPCVOID lpMessageBody,
237 DWORD dwMessageBodySize, LPCVOID lpMessageHeader,
238 WORD wCommandId, WORD wVersion,
239 LPVOID* lplpReply, LPDWORD lpdwMsgSize );
240 lpPlayerList DP_FindPlayer( IDirectPlay2AImpl* This, DPID dpid );
241 HRESULT DP_SetSessionDesc( IDirectPlay2Impl* This,
242 LPCDPSESSIONDESC2 lpSessDesc,
243 DWORD dwFlags, BOOL bInitial,
244 BOOL bAnsi );
245 HRESULT DP_CreatePlayer( IDirectPlay2Impl* This, DPID idPlayer,
246 LPDPNAME lpName, DWORD dwFlags,
247 LPVOID lpData, DWORD dwDataSize,
248 HANDLE hEvent, BOOL bAnsi,
249 lpPlayerData* lplpPlayer );
251 /* DP SP external interfaces into DirectPlay */
252 extern HRESULT DP_GetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID* lplpData );
253 extern HRESULT DP_SetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID lpData );
255 /* DP external interfaces to call into DPSP interface */
256 extern LPVOID DPSP_CreateSPPlayerData(void);
258 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */