FS2_Open
Open source remastering of the Freespace 2 engine
tcp_client.cpp
Go to the documentation of this file.
1 // TCP_Client.cpp
2 // TCP Client Functions for FS2Open PXO
3 // Derek Meek
4 // 2-14-2003
5 
6 // ############## ATTENTION ##########
7 // Licensed under the Academic Free License version 2.0
8 // View License at http://www.opensource.org/licenses/afl-2.0.php
9 // ###################################
10 
11 
12 
13 
14 
15 
16 #include "fs2netd/fs2netd_client.h"
17 #include "fs2netd/protocol.h"
18 #include "fs2netd/tcp_client.h"
19 #include "fs2netd/tcp_socket.h"
20 #include "globalincs/pstypes.h"
21 #include "io/timer.h"
22 #include "network/multi.h"
23 #include "network/multi_log.h"
24 #include "network/multiutil.h"
25 #include "playerman/player.h"
26 #include "ship/ship.h"
27 
28 #include <iostream>
29 #include <string>
30 #include <limits.h>
31 
32 
34 
35 
36 int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, bool do_send)
37 {
38  int buffer_size, buffer_offset;
39  bool my_packet = false;
40  char buffer[100];
41 
42  if (do_send) {
44 
45  PXO_ADD_STRING( m_name );
46  PXO_ADD_UINT( crc32 );
47 
48  DONE_PACKET();
49 
50  if ( FS2NetD_SendData(buffer, buffer_size) == -1 ) {
51  return 3;
52  }
53  } else if ( FS2NetD_DataReady() ) {
54  int rc;
55  uint rc_total = 0;
56 
57  do {
58  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer)-rc_total);
59 
60  if (rc <= 0) {
61  break;
62  }
63 
64  rc_total += rc;
65 
66  Sleep(20);
67  } while ( FS2NetD_DataReady() && (rc_total < (int)sizeof(buffer)) );
68 
69  if (rc < BASE_PACKET_SIZE) {
70  return 0;
71  }
72 
74 
75  if ( !my_packet ) {
76  return 0;
77  }
78 
79  ubyte status = 0;
80  PXO_GET_DATA( status );
81  Assert( (status == 0) || (status == 1) );
82 
83  // anything beyond 'true' is considered a failure of some kind
84  if (status > 1) {
85  status = 0;
86  }
87 
88  return status+1;
89  }
90 
91  return 0;
92 }
93 
94 int FS2NetD_SendPlayerData(const char *player_name, player *pl, bool do_send)
95 {
96  int buffer_size, buffer_offset;
97  bool my_packet = false;
98  char buffer[16384];
99 
100  if (do_send) {
101  int i, num_type_kills = 0;
102 
103  // send packet... (fs2open_pilot_update)
105 
107 
108  PXO_ADD_STRING( player_name ); // name
110 
111  PXO_ADD_INT( pl->stats.score ); // points
112  PXO_ADD_UINT( pl->stats.missions_flown ); // missions
113  PXO_ADD_UINT( pl->stats.flight_time ); // flighttime
114  PXO_ADD_INT( pl->stats.last_flown ); // LastFlight
115  PXO_ADD_INT( pl->stats.kill_count ); // Kills
116  PXO_ADD_INT( pl->stats.kill_count_ok ); // NonFriendlyKills
117  PXO_ADD_INT( pl->stats.assists ); // Assists
118  PXO_ADD_UINT( pl->stats.p_shots_fired ); // PriShots
119  PXO_ADD_UINT( pl->stats.p_shots_hit ); // PriHits
120  PXO_ADD_UINT( pl->stats.p_bonehead_hits ); // PriFHits
121  PXO_ADD_UINT( pl->stats.s_shots_fired ); // SecShots
122  PXO_ADD_UINT( pl->stats.s_shots_hit ); // SecHits
123  PXO_ADD_UINT( pl->stats.s_bonehead_hits ); // SecFHits
124  PXO_ADD_INT( pl->stats.rank ); // rank
125 
126  for (i = 0; i < MAX_SHIP_CLASSES; i++) {
127  if (pl->stats.kills[i] > 0) {
128  Assert( (pl->stats.kills[i] >= 0) && (pl->stats.kills[i] < USHRT_MAX) );
129  num_type_kills++;
130  }
131  }
132 
133  Assert( (num_type_kills >= 0) && (num_type_kills < USHRT_MAX) );
134  PXO_ADD_USHORT( (ushort)num_type_kills );
135 
136  for (i = 0; i < MAX_SHIP_CLASSES; i++) {
137  if (pl->stats.kills[i] > 0) {
139  PXO_ADD_USHORT( (ushort)pl->stats.kills[i] );
140  }
141  }
142 
143  Assert( (Num_medals >= 0) && (Num_medals < USHRT_MAX) );
145 
146  for (i = 0; i < Num_medals; i++) {
147  PXO_ADD_INT( pl->stats.medal_counts[i] );
148  }
149 
150  DONE_PACKET();
151 
152  if ( FS2NetD_SendData(buffer, buffer_size) == -1 ) {
153  return -1;
154  }
155  } else if ( FS2NetD_DataReady() ) {
156  int rc;
157  uint rc_total = 0;
158 
159  do {
160  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer)-rc_total);
161 
162  if (rc <= 0) {
163  break;
164  }
165 
166  rc_total += rc;
167 
168  Sleep(20);
169  } while ( FS2NetD_DataReady() && (rc_total < (int)sizeof(buffer)) );
170 
171  if (rc < BASE_PACKET_SIZE) {
172  return -1;
173  }
174 
176 
177  if ( !my_packet ) {
178  return -1;
179  }
180 
181  ubyte status;
182  PXO_GET_DATA( status );
183  Assert( (status == 0) || (status == 1) || (status == 2) );
184 
185  if (status > 2) {
186  status = 2;
187  }
188 
189  return (int)status;
190  }
191 
192  return -1;
193 }
194 
195 int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create, bool do_send)
196 {
197  int buffer_size, buffer_offset;
198  bool my_packet = false;
199  char buffer[16384];
200 
201  if (do_send) {
202  ubyte create = (ubyte)can_create;
203 
205 
206  PXO_ADD_INT( (can_create) ? Multi_tracker_id : -2 );
207  PXO_ADD_STRING( player_name );
208  PXO_ADD_DATA( create );
209 
210  DONE_PACKET();
211 
212  if ( FS2NetD_SendData(buffer, buffer_size) == -1 ) {
213  return -1;
214  }
215  } else if ( FS2NetD_DataReady() ) {
216  const fix end_time = timer_get_fixed_seconds() + (15 * F1_0);
217  int rc;
218  uint rc_total = 0;
219  ubyte reply_type = 0;
220  int si_index = 0;
221  ushort bogus __UNUSED;
222  ushort num_type_kills = 0, num_medals = 0;
223  char ship_name[NAME_LENGTH];
224  int idx;
225 
226  do {
227  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer)-rc_total);
228 
229  if (rc <= 0) {
230  break;
231  }
232 
233  rc_total += rc;
234 
235  Sleep(20);
236  } while ( FS2NetD_DataReady() && (rc_total < (int)sizeof(buffer)) );
237 
238  if (rc < BASE_PACKET_SIZE) {
239  return -1;
240  }
241 
243 
244  if ( !my_packet ) {
245  return -1;
246  }
247 
248  if ( buffer_size > (int)sizeof(buffer) ) {
249  ml_printf("FS2NetD WARNING: Pilot update data is larger than receive buffer! Some data will be lost!");
250  }
251 
252  // make sure that we get the entire packet
253  while ( (rc_total < (uint)buffer_size) && (rc_total < sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
254  if ( FS2NetD_DataReady() ) {
255  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer) - rc_total);
256 
257  if (rc <= 0) {
258  continue;
259  }
260 
261  rc_total += rc;
262  }
263 
264  Sleep(20);
265  }
266 
267  PXO_GET_DATA( reply_type );
268 
269  // if we weren't retrieved then bail out now
270  if (reply_type != 0) {
271  return (int)reply_type;
272  }
273 
274  PXO_GET_INT( pl->stats.score ); // points
275  PXO_GET_UINT( pl->stats.missions_flown ); // missions
276  PXO_GET_UINT( pl->stats.flight_time ); // flighttime
277  PXO_GET_INT( pl->stats.last_flown ); // LastFlight
278  PXO_GET_INT( pl->stats.kill_count ); // Kills
279  PXO_GET_INT( pl->stats.kill_count_ok ); // NonFriendlyKills
280  PXO_GET_INT( pl->stats.assists ); // Assists
281  PXO_GET_UINT( pl->stats.p_shots_fired ); // PriShots
282  PXO_GET_UINT( pl->stats.p_shots_hit ); // PriHits
283  PXO_GET_UINT( pl->stats.p_bonehead_hits ); // PriFHits
284  PXO_GET_UINT( pl->stats.s_shots_fired ); // SecShots
285  PXO_GET_UINT( pl->stats.s_shots_hit ); // SecHits
286  PXO_GET_UINT( pl->stats.s_bonehead_hits ); // SecFHits
287  PXO_GET_INT( pl->stats.rank ); // rank
288 
289  PXO_GET_USHORT( num_type_kills );
290 
291  for (idx = 0; idx < (int)num_type_kills; idx++) {
292  memset( ship_name, 0, sizeof(ship_name) );
293 
294  PXO_GET_STRING( ship_name );
295 
296  si_index = ship_info_lookup( ship_name );
297 
298  if (si_index == -1) {
299  PXO_GET_USHORT( bogus );
300  } else {
301  PXO_GET_USHORT( pl->stats.kills[si_index] );
302  }
303  }
304 
305  PXO_GET_USHORT( num_medals );
306 
307  for (idx = 0; (idx < Num_medals) && (idx < num_medals); idx++) {
308  PXO_GET_INT( pl->stats.medal_counts[idx] );
309  }
310 
311  return (int)reply_type;
312  }
313 
314  return -1;
315 }
316 
317 int FS2NetD_GetBanList(SCP_vector<SCP_string> &mask_list, bool do_send)
318 {
319  int buffer_size, buffer_offset;
320  bool my_packet = false;
321  char buffer[16384];
322 
323  if (do_send) {
325  DONE_PACKET();
326 
327  if ( FS2NetD_SendData(buffer, buffer_size) == -1 ) {
328  return -1;
329  }
330  } else if ( FS2NetD_DataReady() ) {
331  const fix end_time = timer_get_fixed_seconds() + (15 * F1_0);
332  int rc;
333  uint rc_total = 0;
334  int num_files = 0;
335  char ip_mask[32];
336  int idx;
337 
338  do {
339  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer)-rc_total);
340 
341  if (rc <= 0) {
342  break;
343  }
344 
345  rc_total += rc;
346 
347  Sleep(20);
348  } while ( FS2NetD_DataReady() && (rc_total < (int)sizeof(buffer)) );
349 
350  if (rc < BASE_PACKET_SIZE) {
351  return -1;
352  }
353 
355 
356  if ( !my_packet ) {
357  return 0;
358  }
359 
360  if ( buffer_size > (int)sizeof(buffer) ) {
361  ml_printf("FS2NetD WARNING: Banned user list data is larger than receive buffer! Some data will be lost!");
362  }
363 
364  // make sure that we get the entire packet
365  while ( (rc_total < (uint)buffer_size) && (rc_total < sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
366  if ( FS2NetD_DataReady() ) {
367  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer) - rc_total);
368 
369  if (rc <= 0) {
370  continue;
371  }
372 
373  rc_total += rc;
374  }
375 
376  Sleep(20);
377  }
378 
379  PXO_GET_INT( num_files );
380 
381  for (idx = 0; idx < num_files; idx++) {
382  PXO_GET_STRING( ip_mask );
383  mask_list.push_back( ip_mask );
384  }
385 
386  return 1;
387  }
388 
389  return 0;
390 }
391 
393 {
394  int buffer_size, buffer_offset;
395  bool my_packet = false;
396  char buffer[16384];
397 
398  if (do_send) {
400  DONE_PACKET();
401 
402  if ( FS2NetD_SendData(buffer, buffer_size) == -1 ) {
403  return -1;
404  }
405  } else if ( FS2NetD_DataReady() ) {
406  const fix end_time = timer_get_fixed_seconds() + (15 * F1_0);
407  int rc;
408  uint rc_total = 0;
409  int i, num_files = 0;
410  file_record nrec;
411 
412  do {
413  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer)-rc_total);
414 
415  if (rc <= 0) {
416  break;
417  }
418 
419  rc_total += rc;
420 
421  Sleep(20);
422  } while ( FS2NetD_DataReady() && (rc_total < (int)sizeof(buffer)) );
423 
424  if (rc < BASE_PACKET_SIZE) {
425  return 0;
426  }
427 
429 
430  if ( !my_packet ) {
431  return 0;
432  }
433 
434  if ( buffer_size > (int)sizeof(buffer) ) {
435  ml_printf("FS2NetD WARNING: Mission list data is larger than receive buffer! Some data will be lost!");
436  }
437 
438  // make sure that we get the entire packet
439  while ( (rc_total < (uint)buffer_size) && (rc_total < sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
440  if ( FS2NetD_DataReady() ) {
441  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer) - rc_total);
442 
443  if (rc <= 0) {
444  continue;
445  }
446 
447  rc_total += rc;
448  }
449 
450  Sleep(20);
451  }
452 
453  PXO_GET_INT( num_files );
454 
455  for (i = 0; i < num_files; i++) {
456  memset(&nrec, 0, sizeof(file_record));
457 
458  PXO_GET_STRING( nrec.name );
459  PXO_GET_UINT( nrec.crc32 );
460 
461  m_list.push_back( nrec );
462  }
463 
464  return 1;
465  }
466 
467  return 0;
468 }
469 
470 int FS2NetD_Login(const char *username, const char *password, bool do_send)
471 {
472  int buffer_size, buffer_offset;
473  bool my_packet = false;
474  char buffer[150];
475 
476  if (do_send) {
478 
479  PXO_ADD_STRING( username );
480  PXO_ADD_STRING( password );
482 
483  DONE_PACKET();
484 
485  if (FS2NetD_SendData(buffer, buffer_size) == -1) {
486  return -1;
487  }
488  } else if ( FS2NetD_DataReady() ) {
489  int rc;
490  uint rc_total = 0;
491  ubyte login_status = 0;
492  int sid __UNUSED;
493  short pilots __UNUSED;
494 
495  do {
496  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer)-rc_total);
497 
498  if (rc <= 0) {
499  break;
500  }
501 
502  rc_total += rc;
503 
504  Sleep(20);
505  } while ( FS2NetD_DataReady() && (rc_total < (int)sizeof(buffer)) );
506 
507  if (rc < BASE_PACKET_SIZE) {
508  return -1;
509  }
510 
512 
513  if ( !my_packet ) {
514  return -1;
515  }
516 
517  PXO_GET_DATA( login_status );
518 
519  if ( !login_status ) {
520  return -2;
521  }
522 
523  PXO_GET_INT( sid );
524 
525  PXO_GET_SHORT( pilots );
526 
527  return sid;
528  }
529 
530  return -1;
531 }
532 
534 {
535  int buffer_size;
536  char buffer[550];
537  ubyte tvar;
538 
540 
545 
546  tvar = (ubyte)Netgame.campaign_mode;
547  PXO_ADD_DATA( tvar );
548 
551 
552  PXO_ADD_SHORT( (short)multi_num_players() );
554 
555  tvar = (ubyte)Netgame.mode;
556  PXO_ADD_DATA( tvar );
557 
558  tvar = (ubyte)Netgame.rank_base;
559  PXO_ADD_DATA( tvar );
560 
561  tvar = (ubyte)Netgame.game_state;
562  PXO_ADD_DATA( tvar );
563 
565  PXO_ADD_DATA( tvar );
566 
568 
569  DONE_PACKET();
570 
571  FS2NetD_SendData(buffer, buffer_size);
572 }
573 
575 {
576  int buffer_size;
577  char buffer[550];
578  ubyte tvar;
579 
581 
585 
586  tvar = (ubyte)Netgame.campaign_mode;
587  PXO_ADD_DATA( tvar );
588 
589  PXO_ADD_SHORT( (short)multi_num_players() );
590 
591  tvar = (ubyte)Netgame.game_state;
592  PXO_ADD_DATA( tvar );
593 
594  DONE_PACKET();
595 
596  FS2NetD_SendData(buffer, buffer_size);
597 }
598 
600 {
601  int buffer_size;
602  char buffer[BASE_PACKET_SIZE];
603 
605 
606  DONE_PACKET();
607 
608  FS2NetD_SendData(buffer, buffer_size);
609 }
610 
612 {
613  int buffer_size;
614  char buffer[BASE_PACKET_SIZE+sizeof(int)+sizeof(int)+sizeof(int)+MAX_PATH];
615  int all = 0xFFFFFFFF;
616  bool filtered = false;
617 
618  if ( strlen(Multi_fs_tracker_filter) ) {
619  filtered = true;
620  }
621 
622  // send request packet
624 
625  PXO_ADD_INT( all ); // type
626  PXO_ADD_INT( all ); // status
627 
628  if (filtered) {
630  }
631 
632  DONE_PACKET();
633 
634  FS2NetD_SendData(buffer, buffer_size);
635 }
636 
638 {
639  int buffer_size;
640  char buffer[BASE_PACKET_SIZE+sizeof(int)];
641 
643 
644  int time = timer_get_milliseconds();
645  PXO_ADD_INT( time );
646 
647  DONE_PACKET();
648 
649  FS2NetD_SendData(buffer, buffer_size);
650 }
651 
652 void FS2NetD_Pong(int tstamp)
653 {
654  int buffer_size;
655  char buffer[BASE_PACKET_SIZE+sizeof(int)];
656 
658 
659  PXO_ADD_INT( tstamp );
660 
661  DONE_PACKET();
662 
663  FS2NetD_SendData(buffer, buffer_size);
664 }
665 
667 {
668  int buffer_size;
669  char buffer[BASE_PACKET_SIZE+sizeof(int)];
670 
671  // create and send request packet
673 
675 
676  DONE_PACKET();
677 
678  if (FS2NetD_SendData(buffer, buffer_size) == -1) {
679  return -1;
680  }
681 
682  return 0;
683 }
684 
685 int FS2NetD_ValidateTableList(bool do_send)
686 {
687  int buffer_size, buffer_offset;
688  bool my_packet = false;
689  char buffer[4096];
690  ushort num_tables = 0;
691 
692  if (do_send) {
693  // create and send the request packet
695 
696  num_tables = (ushort)Table_valid_status.size();
697 
698  PXO_ADD_USHORT( num_tables );
699 
700  for (SCP_vector<crc_valid_status>::iterator tvs = Table_valid_status.begin(); tvs != Table_valid_status.end(); ++tvs) {
701  PXO_ADD_STRING(tvs->name );
702  PXO_ADD_UINT( tvs->crc32 );
703  }
704 
705  DONE_PACKET();
706 
707  if (FS2NetD_SendData(buffer, buffer_size) == -1) {
708  return -1;
709  }
710  } else if ( FS2NetD_DataReady() ) {
711  int rc;
712  const fix end_time = timer_get_fixed_seconds() + (15 * F1_0);
713  ubyte tbl_valid_status = 0;
714  uint rc_total = 0;
715 
716  do {
717  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer)-rc_total);
718 
719  if (rc <= 0) {
720  break;
721  }
722 
723  rc_total += rc;
724 
725  Sleep(20);
726  } while ( FS2NetD_DataReady() && (rc_total < (int)sizeof(buffer)) );
727 
728  if (rc < BASE_PACKET_SIZE) {
729  return -1;
730  }
731 
733 
734  if ( !my_packet ) {
735  return -1;
736  }
737 
738  // make sure that we get the entire packet
739  while ( (rc_total < (uint)buffer_size) && (rc_total < sizeof(buffer)) && (timer_get_fixed_seconds() <= end_time) ) {
740  if ( FS2NetD_DataReady() ) {
741  rc = FS2NetD_GetData(buffer+rc_total, sizeof(buffer) - rc_total);
742 
743  if (rc <= 0) {
744  continue;
745  }
746 
747  rc_total += rc;
748  }
749 
750  Sleep(20);
751  }
752 
753  PXO_GET_USHORT( num_tables );
754 
755  if ( !num_tables ) {
756  return -1;
757  }
758 
759  if ( num_tables > (int)Table_valid_status.size() ) {
760  ml_printf("FS2NetD WARNING: Table list contains %i tables, but we only requested %i! Invalid data!", num_tables, Table_valid_status.size());
761  return -1;
762  }
763 
764  for (SCP_vector<crc_valid_status>::iterator tvs = Table_valid_status.begin(); tvs != Table_valid_status.end(); ++tvs) {
765  PXO_GET_DATA( tbl_valid_status );
766  Assert( (tbl_valid_status == 0) || (tbl_valid_status == 1) );
767 
768  tvs->valid = tbl_valid_status;
769  }
770 
771  return 2;
772  }
773 
774  return 0;
775 }
776 
777 void FS2NetD_GameCountUpdate(const char *chan_name)
778 {
779  int buffer_size;
781 
783 
784  PXO_ADD_STRING( chan_name );
785 
786  DONE_PACKET();
787 
788  FS2NetD_SendData(buffer, buffer_size);
789 }
790 
792 {
793  int buffer_size;
794  char buffer[BASE_PACKET_SIZE + sizeof(int) + sizeof(ubyte) + (MAX_PLAYERS * sizeof(int)) + 10];
795  int ids_count = 0;
796  int *ids = new int[MAX_PLAYERS];
797  int idx;
798 
799  if ( !ids ) {
800  return;
801  }
802 
803  for (idx = 0; idx < MAX_PLAYERS; idx++) {
805  if ( (Net_players[idx].tracker_player_id >= 0) && (Net_players[idx].tracker_player_id != Multi_tracker_id) ) {
806  ids[ids_count] = Net_players[idx].tracker_player_id;
807  ids_count++;
808  }
809  }
810  }
811 
812  if ( !ids_count ) {
813  delete [] ids;
814  return;
815  }
816 
818 
820 
821  Assert( MAX_PLAYERS <= 255 );
822 
823  ubyte tvar = (ubyte)ids_count;
824  PXO_ADD_DATA( tvar );
825 
826  for (idx = 0; idx < ids_count; idx++) {
827  PXO_ADD_INT( ids[idx] );
828  }
829 
830  DONE_PACKET();
831 
832  FS2NetD_SendData(buffer, buffer_size);
833 
834  delete [] ids;
835 }
#define __UNUSED
Definition: clang.h:23
#define PXO_GET_UINT(d)
Definition: tcp_client.h:70
void FS2NetD_Pong(int tstamp)
Definition: tcp_client.cpp:652
#define PCKT_MISSION_CHECK
Definition: protocol.h:43
int ship_info_lookup(const char *token)
Definition: ship.cpp:12772
int i
Definition: multi_pxo.cpp:466
int kill_count_ok
Definition: scoring.h:90
char Multi_fs_tracker_channel[MAX_PATH]
int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, bool do_send)
Definition: tcp_client.cpp:36
#define PXO_GET_STRING(s)
Definition: tcp_client.h:71
int kills[MAX_SHIP_CLASSES]
Definition: scoring.h:87
#define F1_0
Definition: fix.h:15
int FS2NetD_GetBanList(SCP_vector< SCP_string > &mask_list, bool do_send)
Definition: tcp_client.cpp:317
#define PCKT_LOGIN_AUTH
Definition: protocol.h:30
int FS2NetD_SendData(char *buffer, int blen)
Definition: tcp_socket.cpp:236
#define MAX_PATH
#define PXO_ADD_STRING(s)
Definition: tcp_client.h:64
int mode
Definition: multi.h:494
#define PCKT_PING
Definition: protocol.h:40
#define MULTI_STANDALONE(np)
Definition: multi.h:139
Assert(pm!=NULL)
char name[33]
Definition: protocol.h:78
bool FS2NetD_DataReady()
Definition: tcp_socket.cpp:245
_fs_time_t last_flown
Definition: scoring.h:103
#define PCKT_PILOT_UPDATE
Definition: protocol.h:38
int kill_count
Definition: scoring.h:89
int multi_get_connection_speed()
Definition: multiutil.cpp:2999
GLuint * ids
Definition: Glext.h:5484
int FS2NetD_CheckValidID()
Definition: tcp_client.cpp:666
#define PCKT_VALID_SID_RQST
Definition: protocol.h:48
#define PXO_ADD_INT(d)
Definition: tcp_client.h:62
unsigned int s_shots_fired
Definition: scoring.h:92
void FS2NetD_GameCountUpdate(const char *chan_name)
Definition: tcp_client.cpp:777
void FS2NetD_SendServerDisconnect()
Definition: tcp_client.cpp:599
int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create, bool do_send)
Definition: tcp_client.cpp:195
#define PCKT_SLIST_REQUEST_FILTER
Definition: protocol.h:57
int game_state
Definition: multi.h:498
#define PXO_GET_DATA(d)
Definition: tcp_client.h:66
#define PCKT_CHAT_CHAN_COUNT_RQST
Definition: protocol.h:51
#define PXO_ADD_DATA(d)
Definition: tcp_client.h:59
#define PCKT_PILOT_UREPLY
Definition: protocol.h:39
#define PXO_ADD_UINT(d)
Definition: tcp_client.h:63
int tracker_player_id
Definition: multi.h:461
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
unsigned int missions_flown
Definition: scoring.h:101
int multi_num_players()
Definition: multiutil.cpp:1799
Definition: player.h:85
int type_flags
Definition: multi.h:493
int FS2NetD_GetData(char *buffer, int blen)
Definition: tcp_socket.cpp:224
unsigned int uint
Definition: pstypes.h:64
void ml_printf(const char *format,...)
Definition: multi_log.cpp:112
#define PCKT_SERVER_DISCONNECT
Definition: protocol.h:54
char name[MAX_GAMENAME_LEN+1]
Definition: multi.h:487
unsigned int p_shots_fired
Definition: scoring.h:91
#define MAX_SHIP_CLASSES
Definition: globals.h:48
netgame_info Netgame
Definition: multi.cpp:97
#define PCKT_MISSIONS_REPLY
Definition: protocol.h:33
#define DONE_PACKET()
Definition: tcp_client.h:76
void FS2NetD_CheckDuplicateLogin()
Definition: tcp_client.cpp:791
uint crc32
Definition: protocol.h:79
#define BASE_PACKET_SIZE
Definition: tcp_client.h:57
SCP_vector< crc_valid_status > Table_valid_status
GLuint buffer
Definition: Glext.h:5492
#define PXO_GET_SHORT(d)
Definition: tcp_client.h:67
#define MAX_PLAYERS
Definition: pstypes.h:32
char mission_name[NAME_LENGTH+1]
Definition: multi.h:488
SCP_vector< int > medal_counts
Definition: scoring.h:85
void FS2NetD_SendServerStart()
Definition: tcp_client.cpp:533
int idx
Definition: multiui.cpp:761
char campaign_name[NAME_LENGTH+1]
Definition: multi.h:490
#define PCKT_MCHECK_REPLY
Definition: protocol.h:44
long fix
Definition: pstypes.h:54
unsigned char ubyte
Definition: pstypes.h:62
char title[NAME_LENGTH+1]
Definition: multi.h:489
int rank_base
Definition: multi.h:496
int Multi_tracker_id
Definition: multi.cpp:146
GLuint const GLchar * name
Definition: Glext.h:5608
#define MULTI_PERM_OBSERVER(np)
Definition: multi.h:142
#define VRFY_PACKET2(x)
Definition: tcp_client.h:79
unsigned int flight_time
Definition: scoring.h:102
#define PCKT_BANLIST_RPLY
Definition: protocol.h:46
int campaign_mode
Definition: multi.h:509
#define PCKT_PILOT_REPLY
Definition: protocol.h:37
#define NAME_LENGTH
Definition: globals.h:15
#define MULTI_CONNECTED(np)
Definition: multi.h:136
fix timer_get_fixed_seconds()
Definition: timer.cpp:116
#define PCKT_PILOT_GET
Definition: protocol.h:36
#define INIT_PACKET(x)
Definition: tcp_client.h:74
#define PCKT_LOGIN_REPLY
Definition: protocol.h:31
unsigned short ushort
Definition: pstypes.h:63
unsigned int p_shots_hit
Definition: scoring.h:94
#define PCKT_SERVER_START
Definition: protocol.h:58
char Multi_fs_tracker_filter[MAX_PATH]
#define PCKT_SERVER_UPDATE
Definition: protocol.h:60
void FS2NetD_Ping()
Definition: tcp_client.cpp:637
unsigned int p_bonehead_hits
Definition: scoring.h:97
void Sleep(int mili)
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
void FS2NetD_RequestServerList()
Definition: tcp_client.cpp:611
#define PCKT_BANLIST_RQST
Definition: protocol.h:45
int FS2NetD_GetMissionsList(SCP_vector< file_record > &m_list, bool do_send)
Definition: tcp_client.cpp:392
#define PXO_ADD_SHORT(d)
Definition: tcp_client.h:60
void FS2NetD_SendServerUpdate()
Definition: tcp_client.cpp:574
int FS2NetD_SendPlayerData(const char *player_name, player *pl, bool do_send)
Definition: tcp_client.cpp:94
#define PXO_ADD_USHORT(d)
Definition: tcp_client.h:61
#define PCKT_PONG
Definition: protocol.h:41
#define PCKT_SLIST_REQUEST
Definition: protocol.h:27
#define PXO_GET_USHORT(d)
Definition: tcp_client.h:68
#define PCKT_MISSIONS_RQST
Definition: protocol.h:32
#define PXO_GET_INT(d)
Definition: tcp_client.h:69
#define PCKT_TABLES_REPLY
Definition: protocol.h:35
#define PCKT_DUP_LOGIN_RQST
Definition: protocol.h:55
int FS2NetD_ValidateTableList(bool do_send)
Definition: tcp_client.cpp:685
net_player Net_players[MAX_PLAYERS]
Definition: multi.cpp:93
int Num_medals
Definition: medals.cpp:30
#define PCKT_TABLES_RQST
Definition: protocol.h:34
int max_players
Definition: multi.h:497
int timer_get_milliseconds()
Definition: timer.cpp:150
unsigned int s_shots_hit
Definition: scoring.h:95
char Multi_tracker_login[MULTI_TRACKER_STRING_LEN+1]
Definition: multi.cpp:143
multi_global_options Multi_options_g
int flags
Definition: multi.h:495
unsigned int s_bonehead_hits
Definition: scoring.h:98
scoring_struct stats
Definition: player.h:127
int FS2NetD_Login(const char *username, const char *password, bool do_send)
Definition: tcp_client.cpp:470