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