Debian Codegraph @

netcon/mtclient/mtpilottrack.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /*
20 * $Logfile: /DescentIII/Main/mtclient/mtpilottrack.h $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003-08-26 03:58:40 $
23 * $Author: kevinb $
24 *
25 * Pilot tracker client header
26 *
27 * $Log: not supported by cvs2svn $
28 *
29 * 13 4/20/99 8:57p Jeff
30 * compile for Linux
31 *
32 * 12 4/17/99 3:44p Kevin
33 * Demo2 changes & fixes
34 *
35 * 11 4/07/99 9:15a Kevin
36 * Changed PXO server addresses for release builds
37 *
38 * 10 3/02/99 5:50p Kevin
39 * Ouch. Duplicate structures existed and were conflicting.
40 *
41 * 9 2/16/99 12:36a Kevin
42 * Fixes for release builds of OEM V3 and KAtmai
43 *
44 * 8 2/03/99 6:14p Kevin
45 * OEM changes
46 *
47 * 7 12/23/98 6:38p Kevin
48 * All UDP data (except gamespy) now uses one (registered) port number
49 *
50 * 6 10/30/98 11:25a Kevin
51 * Message of the day for PXO
52 *
53 * 5 10/09/98 2:56p Kevin
54 * Changed IP addresses for PXO demo
55 *
56 * 4 10/01/98 11:37a Kevin
57 * UI fixes and stuff
58 *
59 * 3 9/03/98 11:12a Kevin
60 * Fixed bug in #define
61 *
62 * 2 6/01/98 10:10a Kevin
63 * Added DLL connection interface and auto update DLL
64 *
65 * 1 5/25/98 4:12p Kevin
66 *
67 * 11 5/14/98 6:08p Kevin
68 * fixed encryption bug
69 *
70 * 10 5/14/98 5:19p Kevin
71 * Encrypted pilot data
72 *
73 * 9 5/13/98 4:06p Kevin
74 * Added more mastertracker info
75 *
76 * 8 5/12/98 5:12p Kevin
77 * added virgin_pilot field
78 *
79 * 7 5/12/98 5:10p Kevin
80 * added lateral and rotational thrust
81 *
82 * 6 5/07/98 9:47a Kevin
83 * Made pilot reading more robust
84 *
85 * 5 5/04/98 12:53p Kevin
86 * Fixed mastertracker resend stuff
87 *
88 * 4 5/04/98 10:56a Kevin
89 * Mastertracker fixes/enhancements
90 *
91 * 3 4/30/98 3:50p Kevin
92 * Mastertracker pilot stats
93 *
94 * 2 4/27/98 7:12p Kevin
95 * Mastertracker pilot tracker
96 *
97 * 1 4/27/98 5:27p Kevin
98 * Initial version
99 *
100 * $NoKeywords: $
101 */
102
103 #ifndef _PILOT_TRACKER_HEADER
104 #define _PILOT_TRACKER_HEADERcxx . . $ `netcon/mtclient/mtpilottrack.h:104:9`!
105 // Pilot tracker client header
106
107 #ifdef WIN32
108 #pragma pack(push, r_udp)
109 #endif
110 #pragma pack(1)
111
112 // Definitions
113 #define STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`! 0
114 #define STATE_SENDING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:114:9`! 1
115 #define STATE_READING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:115:9`! 2
116 #define STATE_RECEIVED_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:116:9`! 3
117 #define STATE_WROTE_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:117:9`! 4
118 #define STATE_TIMED_OUTcxx . . $ `netcon/mtclient/mtpilottrack.h:118:9`! 5
119 #define STATE_PILOT_NOT_FOUNDcxx . . $ `netcon/mtclient/mtpilottrack.h:119:9`! 6
120 #define STATE_WRITE_PILOT_FAILEDcxx . . $ `netcon/mtclient/mtpilottrack.h:120:9`! 7
121
122 #define REGPORTcxx . . $ `netcon/mtclient/mtpilottrack.h:122:9`! 2092 // The UDP port
123 #define PILOTTRACKERNAMEcxx . . $ `netcon/mtclient/mtpilottrack.h:123:9`! "tracker.pxo.nottheeye.com"
124
125 #define PILOT_REQ_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottrack.h:125:9`! 30.000
126 #define PILOT_REQ_RESEND_TIMEcxx . . $ `netcon/mtclient/mtpilottrack.h:126:9`! 2.0
127
128 #define MAX_NET_RETRIEScxx . . $ `netcon/mtclient/mtpilottrack.h:128:9`! 30
129 #define NET_ACK_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottrack.h:129:9`! 1.5
130
131 // This is for type
132 #define UNT_CONTROLcxx . . $ `netcon/mtclient/mtpilottrack.h:132:9`! 0
133 #define UNT_NEW_ID_REQUESTcxx . . $ `netcon/mtclient/mtpilottrack.h:133:9`! 1
134 #define UNT_VALIDAT_ID_REQUESTcxx . . $ `netcon/mtclient/mtpilottrack.h:134:9`! 2
135 #define UNT_LOOKUP_ID_REQUESTcxx . . $ `netcon/mtclient/mtpilottrack.h:135:9`! 3
136 #define UNT_UPDATE_ID_REQUESTcxx . . $ `netcon/mtclient/mtpilottrack.h:136:9`! 4
137 #define UNT_MOTD_REQUESTcxx . . $ `netcon/mtclient/mtpilottrack.h:137:9`! 5
138 #define UNT_MOTD_RESPONSEcxx . . $ `netcon/mtclient/mtpilottrack.h:138:9`! 6
139 #define UNT_PILOT_DATA_READcxx . . $ `netcon/mtclient/mtpilottrack.h:139:9`! 7 // Request from the game for pilot info
140 #define UNT_PILOT_DATA_RESPONSEcxx . . $ `netcon/mtclient/mtpilottrack.h:140:9`! 8 // Mastertracker's response to a read request (has pilot data in this packet)
141 #define UNT_PILOT_DATA_WRITEcxx . . $ `netcon/mtclient/mtpilottrack.h:141:9`! 9 // Request from the server to write a user record
142 #define UNT_PILOT_WRITE_FAILEDcxx . . $ `netcon/mtclient/mtpilottrack.h:142:9`! 10 // Server didn't update the pilots record for some reason
143 #define UNT_PILOT_WRITE_SUCCESScxx . . $ `netcon/mtclient/mtpilottrack.h:143:9`! 11 // Server updated the pilots record
144 #define UNT_PILOT_READ_FAILEDcxx . . $ `netcon/mtclient/mtpilottrack.h:144:9`! 12 // Couldn't find the record
145 #define UNT_LOGIN_AUTH_REQUESTcxx . . $ `netcon/mtclient/mtpilottrack.h:145:9`! 13 // Request login authentication by login/password only (returns tracker id)
146 #define UNT_LOGIN_NO_AUTHcxx . . $ `netcon/mtclient/mtpilottrack.h:146:9`! 14 // Couldn't login this user (code has reason)
147 #define UNT_LOGIN_AUTHENTICATEDcxx . . $ `netcon/mtclient/mtpilottrack.h:147:9`! 15 // User was authenticated (data has sz string with tracker id)
148 #define UNT_TRACKER_VERSION_REQcxx . . $ `netcon/mtclient/mtpilottrack.h:148:9`! 16 // Request the latest MT version (xcode has game type) code has present version
149 #define UNT_TRACKER_VERSION_RSPcxx . . $ `netcon/mtclient/mtpilottrack.h:149:9`! \
150 17 // Response for the latest MT version (xcode has game type) code has version data has null term string with url for
151 // dll to download
152
153 // This is for code
154 #define CMD_NEW_USER_ACKcxx . . $ `netcon/mtclient/mtpilottrack.h:154:9`! 1
155 #define CMD_NEW_USER_NAKcxx . . $ `netcon/mtclient/mtpilottrack.h:155:9`! 2
156 #define CMD_VALIDATED_USER_ACKcxx . . $ `netcon/mtclient/mtpilottrack.h:156:9`! 3
157 #define CMD_UPDATED_USER_ACKcxx . . $ `netcon/mtclient/mtpilottrack.h:157:9`! 4
158 #define CMD_CLIENT_RECEIVEDcxx . . $ `netcon/mtclient/mtpilottrack.h:158:9`! 5
159 #define CMD_FIND_USER_NAKcxx . . $ `netcon/mtclient/mtpilottrack.h:159:9`! 6
160 #define CMD_FIND_USER_ACKcxx . . $ `netcon/mtclient/mtpilottrack.h:160:9`! 7
161 #define CMD_UPDATED_USER_NAKcxx . . $ `netcon/mtclient/mtpilottrack.h:161:9`! 8
162 #define CMD_VALIDATED_USER_NAKcxx . . $ `netcon/mtclient/mtpilottrack.h:162:9`! 9
163 // Game designators for UNT_PILOT_DATA_REQUEST and UNT_PILOT_DATA_RESPONSE
164 #define CMD_GAME_FREESPACEcxx . . $ `netcon/mtclient/mtpilottrack.h:164:9`! 10
165 #define CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`! 11
166
167 // This is for xcode
168 #define REG_NAK_EMAILcxx . . $ `netcon/mtclient/mtpilottrack.h:168:9`! 0 // failed to register the guy because of an invalid email address
169 #define REG_NAK_LOGINcxx . . $ `netcon/mtclient/mtpilottrack.h:169:9`! 1 // failed to register the guy because an existing login exists
170 #define REG_NAK_ERRORcxx . . $ `netcon/mtclient/mtpilottrack.h:170:9`! 2 // failed to register because of an error on the tracker
171 #define REG_NAK_STRINGScxx . . $ `netcon/mtclient/mtpilottrack.h:171:9`! 3 // failed to validate because of invalid password/login match
172 #define REG_NAK_UNKNOWNcxx . . $ `netcon/mtclient/mtpilottrack.h:172:9`! 4 // failed to validate because the player is unknown
173 #define REG_NAK_UPDATE_PLcxx . . $ `netcon/mtclient/mtpilottrack.h:173:9`! 5 // update info failed because login/passwd were not correct
174 #define REG_NAK_UPDATE_GENcxx . . $ `netcon/mtclient/mtpilottrack.h:174:9`! 6 // update info failed in general (tracker problem)
175 #define REG_NAK_UPDATE_LOGcxx . . $ `netcon/mtclient/mtpilottrack.h:175:9`! 7 // update failed because login not found
176 #define REG_ACK_NEW_IDcxx . . $ `netcon/mtclient/mtpilottrack.h:176:9`! 8 // New id created, just used for return code, not net packets.
177
178 #define MAX_UDP_DATA_LENGHcxx . . $ `netcon/mtclient/mtpilottrack.h:178:9`! 500
179 #define PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`! (sizeof(udp_packet_header) - MAX_UDP_DATA_LENGH)
180 // sizeof(update_id_request) //The largest packet
181
182 // data could be one of the following:
183
184 // type == UNT_NEW_ID_REQUEST
185 // Respond with ACK
186 struct new_id_requestcxx . . $ new_id_request# {
187 char first_namecxx . . $ new_id_request#first_name.[REAL_NAME_LENcxx . . $ `netcon/mtclient/mt_net.cpp:84:9`!]; // Real Name
188 char last_namecxx . . $ new_id_request#last_name.[REAL_NAME_LENcxx . . $ `netcon/mtclient/mt_net.cpp:84:9`!]; // Real Name
189 char logincxx . . $ new_id_request#login.[LOGIN_LENcxx . . $ `netcon/mtclient/mt_net.cpp:83:9`!]; // Login id
190 char passwordcxx . . $ new_id_request#password.[PASSWORD_LENcxx . . $ `netcon/mtclient/mt_net.cpp:85:9`!]; // password
191 char emailcxx . . $ new_id_request#email.[EMAIL_LENcxx . . $ `netcon/mtclient/mt_net.cpp:86:9`!]; // Email Address
192 uint8_tcxx . . $ uint8_t# showemailcxx . . $ new_id_request#showemail.; // 0==don't show 1 == show
193 uint8_tcxx . . $ uint8_t# shownamecxx . . $ new_id_request#showname.; // 0==don't show 1 == show
194 };
195
196 // type == UNT_VALIDAT_ID_REQUEST or UNT_LOOKUP_ID_REQUEST
197 struct validate_id_requestcxx . . $ validate_id_request# {
198 char logincxx . . $ validate_id_request#login.[LOGIN_LENcxx . . $ `netcon/mtclient/mt_net.cpp:83:9`!]; // Login id
199 char passwordcxx . . $ validate_id_request#password.[PASSWORD_LENcxx . . $ `netcon/mtclient/mt_net.cpp:85:9`!]; // password
200 char tracker_idcxx . . $ validate_id_request#tracker_id.[TRACKER_ID_LENcxx . . $ `netcon/mtclient/mt_net.cpp:87:9`!]; // Tracker ID
201 };
202
203 // type == UNT_UPDATE_ID_REQUEST
204 struct update_id_requestcxx . . $ update_id_request# {
205 char old_logincxx . . $ update_id_request#old_login.[LOGIN_LENcxx . . $ `netcon/mtclient/mt_net.cpp:83:9`!]; // Login before it's changed.
206 char old_passwordcxx . . $ update_id_request#old_password.[PASSWORD_LENcxx . . $ `netcon/mtclient/mt_net.cpp:85:9`!]; // Password before it's changed
207 char tracker_idcxx . . $ update_id_request#tracker_id.[TRACKER_ID_LENcxx . . $ `netcon/mtclient/mt_net.cpp:87:9`!]; // Tracker ID (not sure if we need it for updating, but maybe)
208 char first_namecxx . . $ update_id_request#first_name.[REAL_NAME_LENcxx . . $ `netcon/mtclient/mt_net.cpp:84:9`!]; // Real Name
209 char last_namecxx . . $ update_id_request#last_name.[REAL_NAME_LENcxx . . $ `netcon/mtclient/mt_net.cpp:84:9`!]; // Real Name
210 char logincxx . . $ update_id_request#login.[LOGIN_LENcxx . . $ `netcon/mtclient/mt_net.cpp:83:9`!]; // Login id (new)
211 char passwordcxx . . $ update_id_request#password.[PASSWORD_LENcxx . . $ `netcon/mtclient/mt_net.cpp:85:9`!]; // password (new)
212 char emailcxx . . $ update_id_request#email.[EMAIL_LENcxx . . $ `netcon/mtclient/mt_net.cpp:86:9`!]; // Email Address (new)
213 uint8_tcxx . . $ uint8_t# showemailcxx . . $ update_id_request#showemail.; // 0==don't show 1 == show
214 uint8_tcxx . . $ uint8_t# shownamecxx . . $ update_id_request#showname.; // 0==don't show 1 == show
215 };
216
217 struct pilot_requestcxx . . $ pilot_request# {
218 char pilot_namecxx . . $ pilot_request#pilot_name.[PILOT_NAME_LENcxx . . $ `netcon/mtclient/mt_net.cpp:88:9`!]; // Login id
219 char tracker_idcxx . . $ pilot_request#tracker_id.[TRACKER_ID_LENcxx . . $ `netcon/mtclient/mt_net.cpp:87:9`!]; // Tracker ID
220 };
221
222 struct udp_packet_headercxx . . $ udp_packet_header# {
223 uint8_tcxx . . $ uint8_t# typecxx . . $ udp_packet_header#type.; // Type of request
224 uint16_tcxx . . $ uint16_t# lencxx . . $ udp_packet_header#len.; // Length of total packet, including this header
225 uint32_tcxx . . $ uint32_t# codecxx . . $ udp_packet_header#code.; // For control messages
226 uint16_tcxx . . $ uint16_t# xcodecxx . . $ udp_packet_header#xcode.; // For control/NAK messages and for sigs.
227 uint32_tcxx . . $ uint32_t# sigcxx . . $ udp_packet_header#sig.; // To identify unique return ACKs
228 uint32_tcxx . . $ uint32_t# securitycxx . . $ udp_packet_header#security.; // Just a random value, we store the last value used in the user record
229 // So we don't process the same request twice.
230 uint8_tcxx . . $ uint8_t# datacxx . . $ udp_packet_header#data.[MAX_UDP_DATA_LENGHcxx . . $ `netcon/mtclient/mtpilottrack.h:178:9`!];
231 };
232
233 #ifdef WIN32
234 // Queue -- We need a queue to put responses in, so after a certain amount of time
235 // If we don't get an ACK back from the client, we resend the packet, until eventually
236 // We give up.
237
238 struct net_reg_queue {
239 char login[LOGIN_LEN]; // Login id
240 uint32_t time_last_sent; // Time in milliseconds since we last sent this packet
241 int retries; // Number of times this has been sent
242 udp_packet_header packet; // Packet containing the actual data to resend, etc.
243 struct net_reg_queue *next; // Pointer to next item in the list
244 SOCKADDR netaddr;
245 uint32_t sig; // Signature to be used by the client to ACK our response.
246 };
247 #endif
248
249 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
250 // GAME SPECIFIC structures
251
252 /*
253 #pragma pack(1)
254 struct vmt_descent3_struct {
255 char tracker_id[TRACKER_ID_LEN];
256 char pilot_name[PILOT_NAME_LEN];
257 int rank;
258
259 int kills;
260 int deaths;
261 int suicides;
262 int online_time;
263 int games_played;
264 uint32_t security;
265 uint8_t virgin_pilot; //This pilot was just created if TRUE
266 uint32_t lateral_thrust;
267 uint32_t rotational_thrust;
268 uint32_t sliding_pct; //Percentage of the time you were sliding
269 uint32_t checksum; //This value needs to be equal to whatever the checksum is once the
270 packet is decoded uint32_t pad; //just to provide room for out 4 byte encryption boundry only needed on
271 the client side for now
272 };
273 */
274
275 //
276 // -------------------------------------------------------------------------------------------------------------
277
278 /**
279 * Get MOTD from remote. Call with NULL to poll. Call with valid pointer and maxlen to get the message of the day.
280 * @param szmotd
281 * @param maxlen
282 * @return
283 * -3 - Error, called with NULL, but no request is waiting;
284 * -2 - Error, already waiting on message of the day (hasn't timed out yet);
285 * -1 - Timeout waiting for message of the day;
286 * 0 - Waiting for data;
287 * 1 - Data received.
288 */
289 int GetD3MOTDcxx . . $ GetD3MOTD(6abd07ddb1a912f0).(char *szmotd, int maxlen);
290
291 /**
292 * Cancel previous MOTD request
293 * @return
294 * -3 Error, called with NULL, but no request is waiting
295 * 2 Request successfully cancelled
296 */
297 int GetD3MOTDCancelcxx . . $ GetD3MOTDCancel(b126dc7c1de90089).();
298
299 // Function prototypes
300 int InitPilotTrackerClientcxx . . $ InitPilotTrackerClient(b126dc7c1de90089).();
301 void AckServercxx . . $ AckServer(cb2f890c2fdad230).(uint32_tcxx . . $ uint32_t# sig);
302
303 int SendD3PilotDatacxx . . $ SendD3PilotData(1eb61746e1114d84).(vmt_descent3_structcxx . . $ vmt_descent3_struct# *d3_pilot);
304 int GetD3PilotDatacxx . . $ GetD3PilotData(dd34ac9befeb2967).(vmt_descent3_structcxx . . $ vmt_descent3_struct# *d3_pilot, char *pilot_name, char *tracker_id);
305
306 /**
307 * Cancel previous GetD3PilotData() wait
308 * @return
309 * -3: Error - Called GetD3PilotData with NULL, but no request is waiting;
310 * 2: Request successfully canceled;
311 */
312 int GetD3PilotDataCancelcxx . . $ GetD3PilotDataCancel(b126dc7c1de90089).();
313 void PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).();
314 void ValidIdlecxx . . $ ValidIdle(49f6e7a06ebc5aa8).();
315 // int ValidateUser(validate_id_request *valid_id);
316 int ValidateUsercxx . . $ ValidateUser(1b54b1e9ed0f18f2).(validate_id_requestcxx . . $ validate_id_request# *valid_id, char *trackerid);
317 void xorcodecxx . . $ xorcode(c68aebd18e69fbb8).(void *data, uint32_tcxx . . $ uint32_t# len, uint32_tcxx . . $ uint32_t# hash);
318 extern int MTAVersionCheckcxx . . $ MTAVersionCheck(fa84e865f2d62ca9).(uint32_tcxx . . $ uint32_t# oldver, char *URL);
319 void VersionIdlecxx . . $ VersionIdle(49f6e7a06ebc5aa8).();
320 void HandlePilotDatacxx . . $ HandlePilotData(c3263a6d42f31e8c).(uint8_tcxx . . $ uint8_t# *data, int len, network_addresscxx . . $ network_address# *from);
321
322 #ifdef WIN32
323 #pragma pack(pop, r_udp)
324 #else
325 #pragma pack()
326 #endif
327 #endif