xref: /reactos/dll/directx/wine/dplayx/dplay_global.h (revision b819608e)
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 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
23                                 LPCVOID lpAddress, DWORD dwAddressSize,
24                                 LPVOID lpContext ) DECLSPEC_HIDDEN;
25 
26 typedef struct tagEnumSessionAsyncCallbackData
27 {
28   LPSPINITDATA lpSpData;
29   GUID         requestGuid;
30   DWORD        dwEnumSessionFlags;
31   DWORD        dwTimeout;
32   HANDLE       hSuicideRequest;
33 } EnumSessionAsyncCallbackData;
34 
35 typedef struct tagDP_MSG_REPLY_STRUCT
36 {
37   HANDLE hReceipt;
38   WORD   wExpectedReply;
39   LPVOID lpReplyMsg;
40   DWORD  dwMsgBodySize;
41   /* FIXME: Is the message header required as well? */
42 } DP_MSG_REPLY_STRUCT, *LPDP_MSG_REPLY_STRUCT;
43 
44 typedef struct tagDP_MSG_REPLY_STRUCT_LIST
45 {
46   DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST) repliesExpected;
47   DP_MSG_REPLY_STRUCT replyExpected;
48 } DP_MSG_REPLY_STRUCT_LIST, *LPDP_MSG_REPLY_STRUCT_LIST;
49 
50 struct PlayerData
51 {
52   /* Individual player information */
53   DPID dpid;
54 
55   DPNAME name;
56   HANDLE hEvent;
57 
58   ULONG  uRef;  /* What is the reference count on this data? */
59 
60   /* View of local data */
61   LPVOID lpLocalData;
62   DWORD  dwLocalDataSize;
63 
64   /* View of remote data */
65   LPVOID lpRemoteData;
66   DWORD  dwRemoteDataSize;
67 
68   /* SP data on a per player basis */
69   LPVOID lpSPPlayerData;
70 
71   DWORD  dwFlags; /* Special remarks about the type of player */
72 };
73 typedef struct PlayerData* lpPlayerData;
74 
75 struct PlayerList
76 {
77   DPQ_ENTRY(PlayerList) players;
78 
79   lpPlayerData lpPData;
80 };
81 typedef struct PlayerList* lpPlayerList;
82 
83 struct GroupData
84 {
85   /* Internal information */
86   DPID parent; /* If parent == 0 it's a top level group */
87 
88   ULONG uRef; /* Reference count */
89 
90   DPQ_HEAD(GroupList)  groups;  /* A group has [0..n] groups */
91   DPQ_HEAD(PlayerList) players; /* A group has [0..n] players */
92 
93   DPID idGroupOwner; /* ID of player who owns the group */
94 
95   DWORD dwFlags; /* Flags describing anything special about the group */
96 
97   DPID   dpid;
98   DPNAME name;
99 
100   /* View of local data */
101   LPVOID lpLocalData;
102   DWORD  dwLocalDataSize;
103 
104   /* View of remote data */
105   LPVOID lpRemoteData;
106   DWORD  dwRemoteDataSize;
107 };
108 typedef struct GroupData  GroupData;
109 typedef struct GroupData* lpGroupData;
110 
111 struct GroupList
112 {
113   DPQ_ENTRY(GroupList) groups;
114 
115   lpGroupData lpGData;
116 };
117 typedef struct GroupList* lpGroupList;
118 
119 struct DPMSG
120 {
121   DPQ_ENTRY( DPMSG ) msgs;
122   DPMSG_GENERIC* msg;
123 };
124 typedef struct DPMSG* LPDPMSG;
125 
126 enum SPSTATE
127 {
128   NO_PROVIDER = 0,
129   DP_SERVICE_PROVIDER = 1,
130   DP_LOBBY_PROVIDER = 2
131 };
132 
133 /* Contains all data members. FIXME: Rename me */
134 typedef struct tagDirectPlay2Data
135 {
136   BOOL   bConnectionOpen;
137 
138   /* For async EnumSessions requests */
139   HANDLE hEnumSessionThread;
140   HANDLE hKillEnumSessionThreadEvent;
141   DWORD  dwEnumSessionLock;
142 
143   LPVOID lpNameServerData; /* DPlay interface doesn't know contents */
144 
145   BOOL bHostInterface; /* Did this interface create the session */
146 
147   lpGroupData lpSysGroup; /* System group with _everything_ in it */
148 
149   LPDPSESSIONDESC2 lpSessionDesc;
150 
151   /* I/O Msg queues */
152   DPQ_HEAD( DPMSG ) receiveMsgs; /* Msg receive queue */
153   DPQ_HEAD( DPMSG ) sendMsgs;    /* Msg send pending queue */
154 
155   /* Information about the service provider active on this connection */
156   SPINITDATA spData;
157   BOOL       bSPInitialized;
158 
159   /* Information about the lobby server that's attached to this DP object */
160   SPDATA_INIT dplspData;
161   BOOL        bDPLSPInitialized;
162 
163   /* Our service provider */
164   HMODULE hServiceProvider;
165 
166   /* Our DP lobby provider */
167   HMODULE hDPLobbyProvider;
168 
169   enum SPSTATE connectionInitialized;
170 
171   /* Expected messages queue */
172   DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST ) repliesExpected;
173 } DirectPlay2Data;
174 
175 typedef struct IDirectPlayImpl
176 {
177   IDirectPlay IDirectPlay_iface;
178   IDirectPlay2A IDirectPlay2A_iface;
179   IDirectPlay2 IDirectPlay2_iface;
180   IDirectPlay3A IDirectPlay3A_iface;
181   IDirectPlay3 IDirectPlay3_iface;
182   IDirectPlay4A IDirectPlay4A_iface;
183   IDirectPlay4  IDirectPlay4_iface;
184   LONG numIfaces; /* "in use interfaces" refcount */
185   LONG ref, ref2A, ref2, ref3A, ref3, ref4A, ref4;
186   CRITICAL_SECTION lock;
187   DirectPlay2Data *dp2;
188 } IDirectPlayImpl;
189 
190 HRESULT DP_HandleMessage( IDirectPlayImpl *This, const void *lpMessageBody,
191         DWORD  dwMessageBodySize, const void *lpMessageHeader, WORD wCommandId, WORD wVersion,
192         void **lplpReply, DWORD *lpdwMsgSize ) DECLSPEC_HIDDEN;
193 
194 /* DP SP external interfaces into DirectPlay */
195 extern HRESULT DP_GetSPPlayerData( IDirectPlayImpl *lpDP, DPID idPlayer, void **lplpData ) DECLSPEC_HIDDEN;
196 extern HRESULT DP_SetSPPlayerData( IDirectPlayImpl *lpDP, DPID idPlayer, void *lpData ) DECLSPEC_HIDDEN;
197 
198 /* DP external interfaces to call into DPSP interface */
199 extern LPVOID DPSP_CreateSPPlayerData(void) DECLSPEC_HIDDEN;
200 
201 extern HRESULT dplay_create( REFIID riid, void **ppv ) DECLSPEC_HIDDEN;
202 extern HRESULT dplobby_create( REFIID riid, void **ppv ) DECLSPEC_HIDDEN;
203 extern HRESULT dplaysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) DECLSPEC_HIDDEN;
204 extern HRESULT dplobbysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) DECLSPEC_HIDDEN;
205 
206 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */
207