2 * Copyright (C) Volition, Inc. 2005. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on the
10 //Pilot tracker client code
13 #include <arpa/inet.h>
14 #include <netinet/in.h>
26 // check structs for size compatibility
27 //SDL_COMPILE_TIME_ASSERT(udp_packet_header, sizeof(udp_packet_header) == 497);
29 SDL_COMPILE_TIME_ASSERT(vmt_freespace2_struct, sizeof(vmt_freespace2_struct) == 440);
31 SDL_COMPILE_TIME_ASSERT(vmt_freespace_struct, sizeof(vmt_freespace_struct) == 468);
33 SDL_COMPILE_TIME_ASSERT(validate_id_request, sizeof(validate_id_request) == 60);
34 SDL_COMPILE_TIME_ASSERT(squad_war_request, sizeof(squad_war_request) == 104);
35 SDL_COMPILE_TIME_ASSERT(squad_war_response, sizeof(squad_war_response) == 256);
36 SDL_COMPILE_TIME_ASSERT(squad_war_result, sizeof(squad_war_result) == 72);
37 SDL_COMPILE_TIME_ASSERT(pilot_request, sizeof(pilot_request) == 32);
44 #define PILOTSOCK pilotsock
46 #define PILOTSOCK Unreliable_socket
49 struct sockaddr_in ptrackaddr;
54 unsigned int FSLastSentWrite;
55 unsigned int FSFirstSentWrite;
56 unsigned int FSLastSent;
57 unsigned int FSFirstSent;
60 unsigned int SWLastSentWrite;
61 unsigned int SWFirstSentWrite;
64 udp_packet_header fs_pilot_req, fs_pilot_write, sw_res_write;
67 vmt_freespace_struct *ReadFSPilot;
69 vmt_freespace2_struct *ReadFSPilot;
73 squad_war_response SquadWarWriteResponse;
76 static int SerializePilotPacket(const udp_packet_header *uph, ubyte *data)
84 PXO_ADD_DATA(uph->type);
88 PXO_ADD_USHORT(uph->len);
89 PXO_ADD_UINT(uph->code);
90 PXO_ADD_USHORT(uph->xcode);
95 PXO_ADD_UINT(uph->sig);
96 PXO_ADD_UINT(uph->security);
99 // no extra data for this
103 case UNT_PILOT_DATA_WRITE_NEW: {
104 vmt_stats_struct *fs2 = (vmt_stats_struct *)&uph->data;
106 PXO_ADD_DATA(fs2->tracker_id);
107 PXO_ADD_DATA(fs2->pilot_name);
109 PXO_ADD_DATA(fs2->pad_a); // junk, for size/alignment
111 PXO_ADD_INT(fs2->score);
112 PXO_ADD_INT(fs2->rank);
115 for (i = 0; i < MAX_FS_MEDALS; i++) {
116 PXO_ADD_INT(fs2->medals[i]);
119 for (i = 0; i < MAX_FS_SHIP_TYPES; i++) {
120 PXO_ADD_INT(fs2->kills[i]);
124 PXO_ADD_INT(fs2->assists);
125 PXO_ADD_INT(fs2->kill_count);
126 PXO_ADD_INT(fs2->kill_count_ok);
127 PXO_ADD_UINT(fs2->p_shots_fired);
128 PXO_ADD_UINT(fs2->s_shots_fired);
130 PXO_ADD_UINT(fs2->p_shots_hit);
131 PXO_ADD_UINT(fs2->s_shots_hit);
133 PXO_ADD_UINT(fs2->p_bonehead_hits);
134 PXO_ADD_UINT(fs2->s_bonehead_hits);
135 PXO_ADD_INT(fs2->bonehead_kills);
137 PXO_ADD_INT(fs2->security);
138 PXO_ADD_DATA(fs2->virgin_pilot);
140 PXO_ADD_DATA(fs2->pad_b); // junk, for size/alignment
142 PXO_ADD_UINT(fs2->checksum);
144 PXO_ADD_UINT(fs2->missions_flown);
145 PXO_ADD_UINT(fs2->flight_time);
146 PXO_ADD_UINT(fs2->last_flown);
149 PXO_ADD_USHORT(fs2->num_medals);
150 PXO_ADD_USHORT(fs2->num_ship_types);
152 for (i = 0; i < MAX_FS2_MEDALS; i++) {
153 PXO_ADD_INT(fs2->medals[i]);
156 for (i = 0; i < MAX_FS2_SHIP_TYPES; i++) {
157 PXO_ADD_USHORT(fs2->kills[i]);
164 case UNT_SW_RESULT_WRITE: {
165 squad_war_result *sw_result = (squad_war_result *)&uph->data;
167 PXO_ADD_DATA(sw_result->match_code);
168 PXO_ADD_DATA(sw_result->result);
169 PXO_ADD_DATA(sw_result->squad_count1);
170 PXO_ADD_DATA(sw_result->squad_count2);
171 PXO_ADD_DATA(sw_result->pad); // junk, for size/alignment
173 for (i = 0; i < MAX_SQUAD_PLAYERS; i++) {
174 PXO_ADD_INT(sw_result->squad_winners[i]);
177 for (i = 0; i < MAX_SQUAD_PLAYERS; i++) {
178 PXO_ADD_INT(sw_result->squad_losers[i]);
184 case UNT_PILOT_DATA_READ_NEW:
185 case UNT_PILOT_DATA_READ: {
186 pilot_request *pr = (pilot_request *)&uph->data;
188 PXO_ADD_DATA(pr->pilot_name);
189 PXO_ADD_DATA(pr->tracker_id);
190 PXO_ADD_DATA(pr->pad); // junk, for size/alignment
195 // we shouldn't be sending any other packet types
201 SDL_assert(packet_size >= (int)PACKED_HEADER_ONLY_SIZE);
202 SDL_assert(packet_size == (int)uph->len);
207 static void DeserializePilotPacket(const ubyte *data, const int data_size, udp_packet_header *uph)
215 memset(uph, 0, sizeof(udp_packet_header));
217 // make sure we received a complete base packet
218 if (data_size < (int)PACKED_HEADER_ONLY_SIZE) {
225 PXO_GET_DATA(uph->type);
229 PXO_GET_USHORT(uph->len);
230 PXO_GET_UINT(uph->code);
231 PXO_GET_USHORT(uph->xcode);
236 PXO_GET_UINT(uph->sig);
237 PXO_GET_UINT(uph->security);
239 // sanity check data size to make sure we reveived all of the expected packet
241 // (the -1 is because psnet2 pops off one byte)
242 if ((int)uph->len-1 > data_size) {
244 if ((int)uph->len > data_size) {
253 // no extra data for these
254 case UNT_PILOT_READ_FAILED:
255 case UNT_PILOT_WRITE_SUCCESS:
256 case UNT_PILOT_WRITE_FAILED:
259 case UNT_PILOT_DATA_RESPONSE: {
260 vmt_stats_struct *fs2 = (vmt_stats_struct *)&uph->data;
262 PXO_GET_DATA(fs2->tracker_id);
263 PXO_GET_DATA(fs2->pilot_name);
265 PXO_GET_DATA(fs2->pad_a); // junk, for size/alignment
267 PXO_GET_INT(fs2->score);
268 PXO_GET_INT(fs2->rank);
271 for (i = 0; i < MAX_FS_MEDALS; i++) {
272 PXO_GET_INT(fs2->medals[i]);
275 for (i =0; i < MAX_FS_SHIP_TYPES; i++) {
276 PXO_GET_INT(fs2->kills[i]);
280 PXO_GET_INT(fs2->assists);
281 PXO_GET_INT(fs2->kill_count);
282 PXO_GET_INT(fs2->kill_count_ok);
283 PXO_GET_UINT(fs2->p_shots_fired);
284 PXO_GET_UINT(fs2->s_shots_fired);
286 PXO_GET_UINT(fs2->p_shots_hit);
287 PXO_GET_UINT(fs2->s_shots_hit);
289 PXO_GET_UINT(fs2->p_bonehead_hits);
290 PXO_GET_UINT(fs2->s_bonehead_hits);
291 PXO_GET_INT(fs2->bonehead_kills);
293 PXO_GET_INT(fs2->security);
294 PXO_GET_DATA(fs2->virgin_pilot);
296 PXO_GET_DATA(fs2->pad_b); // junk, for size/alignment
298 PXO_GET_UINT(fs2->checksum);
300 PXO_GET_UINT(fs2->missions_flown);
301 PXO_GET_UINT(fs2->flight_time);
302 PXO_GET_UINT(fs2->last_flown);
305 PXO_GET_USHORT(fs2->num_medals);
306 PXO_GET_USHORT(fs2->num_ship_types);
308 for (i = 0; i < MAX_FS2_MEDALS; i++) {
309 PXO_GET_INT(fs2->medals[i]);
312 for (i =0; i < MAX_FS2_SHIP_TYPES; i++) {
313 PXO_GET_USHORT(fs2->kills[i]);
320 case UNT_SW_RESULT_RESPONSE: {
321 squad_war_response *sw_resp = (squad_war_response *)&uph->data;
323 PXO_GET_DATA(sw_resp->reason);
324 PXO_GET_DATA(sw_resp->accepted);
333 //SDL_assert(offset == data_size);
337 int InitPilotTrackerClient()
339 struct sockaddr_in sockaddr;
342 FSWriteState = STATE_IDLE;
343 FSReadState = STATE_IDLE;
344 SWWriteState = STATE_IDLE;
348 fs_pr = (pilot_request *)&fs_pilot_req.data;
351 pilotsock = socket(AF_INET,SOCK_DGRAM,0);
353 if ( pilotsock == (SOCKET)INVALID_SOCKET )
355 mprintf(("Unable to open a socket.\n"));
360 memset( &sockaddr, 0, sizeof(struct sockaddr_in) );
361 sockaddr.sin_family = AF_INET;
362 sockaddr.sin_addr.s_addr = INADDR_ANY;
363 sockaddr.sin_port = 0;//htons(REGPORT);
366 if (SOCKET_ERROR==bind(pilotsock, (struct sockaddr*)&sockaddr, sizeof (sockaddr)))
368 mprintf(("Unable to bind a socket.\n"));
369 mprintf(("WSAGetLastError() returned %d.\n",WSAGetLastError()));
374 // iaddr = inet_addr ( Multi_user_tracker_ip_address );
376 // first try and resolve by name
377 iaddr = inet_addr( Multi_options_g.user_tracker_ip );
378 if ( iaddr == INADDR_NONE ) {
380 he = gethostbyname( Multi_options_g.user_tracker_ip );
385 // try and resolve by address
386 unsigned int n_order = inet_addr(Multi_user_tracker_ip_address);
387 he = gethostbyaddr((char*)&n_order,4,PF_INET);
394 iaddr = ((in_addr *)(he->h_addr))->s_addr;
397 ptrackaddr.sin_addr.s_addr = iaddr;
398 ptrackaddr.sin_family = AF_INET;
399 ptrackaddr.sin_port = htons(REGPORT);
405 // -3 Error -- Called with NULL, but no request is waiting
406 // -2 Error -- Already sending data (hasn't timed out yet)
407 // -1 Timeout trying to send pilot data
409 // 1 Data succesfully sent
410 // 2 Send Cancelled (data may still have been written already, we just haven't been ACK'd yet)
411 // 3 Pilot not written (for some reason)
413 // Call with NULL to poll
414 // Call with -1 to cancel send
415 // Call with valid pointer to a vmt_descent3_struct to initiate send
416 int SendFSPilotData(vmt_stats_struct *fs_pilot)
418 //First check the network
423 if(FSWriteState == STATE_IDLE)
427 if(FSWriteState == STATE_SENDING_PILOT)
431 if(FSWriteState == STATE_WROTE_PILOT)
433 //We wrote this pilot, and now we are about to inform the app, so back to idle
434 FSWriteState = STATE_IDLE;
437 if(FSWriteState == STATE_TIMED_OUT)
439 //We gave up on sending this pilot, and now we are about to inform the app, so back to idle
440 FSWriteState = STATE_IDLE;
444 if(FSWriteState == STATE_WRITE_PILOT_FAILED)
446 //The tracker said this dude couldn't be written
447 FSWriteState = STATE_IDLE;
453 else if(fs_pilot == (vmt_stats_struct*)0xffffffff)
455 if(FSWriteState == STATE_IDLE)
462 FSWriteState = STATE_IDLE;
468 else if(FSWriteState == STATE_IDLE)
470 //New request, send out the req, and go for it.
472 FSWriteState = STATE_SENDING_PILOT;
475 FSFirstSentWrite = timer_get_milliseconds();
477 fs_pilot_write.type = UNT_PILOT_DATA_WRITE_NEW;
479 fs_pilot_write.code = CMD_GAME_FREESPACE;
481 fs_pilot_write.code = CMD_GAME_FREESPACE2;
483 fs_pilot_write.len = PACKED_HEADER_ONLY_SIZE+sizeof(vmt_stats_struct);
484 memcpy(&fs_pilot_write.data,fs_pilot,sizeof(vmt_stats_struct));
492 // -3 Error -- Called with NULL, but no request is waiting
493 // -2 Error -- Already sending data (hasn't timed out yet)
494 // -1 Timeout trying to send pilot data
496 // 1 Data succesfully sent
497 // 2 Send Cancelled (data may still have been written already, we just haven't been ACK'd yet)
498 // 3 Pilot not written (for some reason)
500 // Call with NULL to poll
501 // Call with -1 to cancel send
502 // Call with valid pointer to a vmt_descent3_struct to initiate send
503 int SendSWData(squad_war_result *sw_res, squad_war_response *sw_resp)
505 //First check the network
509 if(SWWriteState == STATE_IDLE){
512 if(SWWriteState == STATE_SENDING_PILOT){
516 // fill in the response
517 if(SWWriteState == STATE_WROTE_PILOT){
518 // We wrote this pilot, and now we are about to inform the app, so back to idle
519 SWWriteState = STATE_IDLE;
522 memcpy(sw_resp, &SquadWarWriteResponse, sizeof(squad_war_response));
526 // fill in the response
527 if(SWWriteState == STATE_WRITE_PILOT_FAILED){
528 // The tracker said this dude couldn't be written
529 SWWriteState = STATE_IDLE;
532 memcpy(sw_resp, &SquadWarWriteResponse, sizeof(squad_war_response));
537 if(SWWriteState == STATE_TIMED_OUT){
538 // We gave up on sending this pilot, and now we are about to inform the app, so back to idle
539 SWWriteState = STATE_IDLE;
543 } else if(sw_res == (squad_war_result*)0xffffffff){
544 if(SWWriteState == STATE_IDLE){
548 SWWriteState = STATE_IDLE;
552 } else if(SWWriteState == STATE_IDLE) {
553 //New request, send out the req, and go for it.
555 SWWriteState = STATE_SENDING_PILOT;
558 SWFirstSentWrite = timer_get_milliseconds();
560 sw_res_write.len = PACKED_HEADER_ONLY_SIZE+sizeof(squad_war_result);
561 sw_res_write.type = UNT_SW_RESULT_WRITE;
563 sw_res_write.code = CMD_GAME_FREESPACE;
565 sw_res_write.code = CMD_GAME_FREESPACE2;
567 memcpy(&sw_res_write.data, sw_res, sizeof(squad_war_result));
576 // -3 Error -- Called with NULL, but no request is waiting
577 // -2 Error -- Already waiting on data (hasn't timed out yet)
578 // -1 Timeout waiting for pilot data
579 // 0 Waiting for data
584 // Call with NULL to poll
585 // Call with -1 to cancel wait
586 // Call with valid pointer to a vmt_descent3_struct to get a response
587 int GetFSPilotData(vmt_stats_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int get_security)
589 //First check the network
594 if(FSReadState == STATE_IDLE)
598 if(FSReadState == STATE_READING_PILOT)
602 if(FSReadState == STATE_RECEIVED_PILOT)
604 // We got this pilot, and now we are about to inform the app, so back to idle
605 FSReadState = STATE_IDLE;
609 if(FSReadState == STATE_TIMED_OUT)
611 // We gave up on this pilot, and now we are about to inform the app, so back to idle
612 FSReadState = STATE_IDLE;
616 if(FSReadState == STATE_PILOT_NOT_FOUND)
618 //The tracker said this dude is not found.
619 FSReadState = STATE_IDLE;
625 else if(fs_pilot == (vmt_stats_struct*)0xffffffff)
627 if(FSReadState == STATE_IDLE)
634 FSReadState = STATE_IDLE;
640 else if(FSReadState == STATE_IDLE)
642 //New request, send out the req, and go for it.
644 FSReadState = STATE_READING_PILOT;
645 ReadFSPilot = fs_pilot;
647 FSFirstSent = timer_get_milliseconds();
649 fs_pilot_req.len = PACKED_HEADER_ONLY_SIZE+sizeof(pilot_request);
652 fs_pilot_req.type = UNT_PILOT_DATA_READ_NEW;
654 fs_pilot_req.type = UNT_PILOT_DATA_READ;
658 fs_pilot_req.code = CMD_GAME_FREESPACE;
660 fs_pilot_req.code = CMD_GAME_FREESPACE2;
662 SDL_strlcpy(fs_pr->pilot_name, pilot_name, SDL_arraysize(fs_pr->pilot_name));
663 SDL_strlcpy(fs_pr->tracker_id, tracker_id, SDL_arraysize(fs_pr->tracker_id));
671 // Send an ACK to the server
672 void AckServer(unsigned int sig)
674 udp_packet_header ack_pack;
675 ubyte packet_data[sizeof(udp_packet_header)];
676 int packet_length = 0;
678 ack_pack.type = UNT_CONTROL;
680 ack_pack.code = CMD_CLIENT_RECEIVED;
681 ack_pack.len = PACKED_HEADER_ONLY_SIZE;
683 packet_length = SerializePilotPacket(&ack_pack, packet_data);
684 SDL_assert(packet_length == PACKED_HEADER_ONLY_SIZE);
685 PXO_SENDTO(PILOTSOCK, (char *)&packet_data, packet_length, 0, (struct sockaddr *)&ptrackaddr, sizeof(struct sockaddr_in), PSNET_TYPE_USER_TRACKER);
690 ubyte packet_data[sizeof(udp_packet_header)];
691 int packet_length = 0;
694 PSNET_TOP_LAYER_PROCESS();
697 // reading pilot data
698 if(FSReadState == STATE_READING_PILOT){
699 if((timer_get_milliseconds()-FSFirstSent)>=PILOT_REQ_TIMEOUT){
700 FSReadState = STATE_TIMED_OUT;
701 } else if((timer_get_milliseconds()-FSLastSent)>=PILOT_REQ_RESEND_TIME){
703 packet_length = SerializePilotPacket(&fs_pilot_req, packet_data);
704 PXO_SENDTO(PILOTSOCK, (char *)&packet_data, packet_length, 0, (struct sockaddr *)&ptrackaddr, sizeof(struct sockaddr_in), PSNET_TYPE_USER_TRACKER);
705 FSLastSent = timer_get_milliseconds();
709 // writing pilot data
710 if(FSWriteState == STATE_SENDING_PILOT){
711 if((timer_get_milliseconds()-FSFirstSentWrite)>=PILOT_REQ_TIMEOUT){
712 FSWriteState = STATE_TIMED_OUT;
714 } else if((timer_get_milliseconds()-FSLastSentWrite)>=PILOT_REQ_RESEND_TIME){
716 packet_length = SerializePilotPacket(&fs_pilot_write, packet_data);
717 PXO_SENDTO(PILOTSOCK, (char *)&packet_data, packet_length, 0, (struct sockaddr *)&ptrackaddr, sizeof(struct sockaddr_in), PSNET_TYPE_USER_TRACKER);
718 FSLastSentWrite = timer_get_milliseconds();
722 // writing squad war results
723 if(SWWriteState == STATE_SENDING_PILOT){
724 if((timer_get_milliseconds()-SWFirstSentWrite) >= PILOT_REQ_TIMEOUT){
725 SWWriteState = STATE_TIMED_OUT;
726 } else if((timer_get_milliseconds()-SWLastSentWrite) >= PILOT_REQ_RESEND_TIME){
728 packet_length = SerializePilotPacket(&sw_res_write, packet_data);
729 PXO_SENDTO(PILOTSOCK, (char *)&packet_data, packet_length, 0, (struct sockaddr *)&ptrackaddr, sizeof(struct sockaddr_in), PSNET_TYPE_USER_TRACKER);
730 SWLastSentWrite = timer_get_milliseconds();
738 struct timeval timeout;
739 ubyte packet_data[sizeof(udp_packet_header)];
747 FD_SET(PILOTSOCK, &read_fds);
749 if(PXO_SELECT(PILOTSOCK+1, &read_fds,NULL,NULL,&timeout, PSNET_TYPE_USER_TRACKER)){
752 struct sockaddr_in fromaddr;
754 udp_packet_header inpacket;
757 addrsize = sizeof(struct sockaddr_in);
759 bytesin = PXO_RECVFROM(PILOTSOCK, (char *)&packet_data, sizeof(udp_packet_header), 0, (struct sockaddr *)&fromaddr, &addrsize, PSNET_TYPE_USER_TRACKER);
762 DeserializePilotPacket(packet_data, bytesin, &inpacket);
765 // decrease packet size by 1
770 int wserr=WSAGetLastError();
771 mprintf(("recvfrom() failure. WSAGetLastError() returned %d\n",wserr));
775 //Check to make sure the packets ok
776 if ( (bytesin > 0) && (bytesin == inpacket.len) ) {
777 switch(inpacket.type){
778 case UNT_PILOT_DATA_RESPONSE:
779 if(inpacket.code == CMD_GAME_FREESPACE2){
783 if(FSReadState == STATE_READING_PILOT){
784 vmt_freespace2_struct *stats;
786 // 9/17/98 MWA. Compare the tracker id of this packet with the tracker id of
787 // what we are expecting. Only set our state to something different when
788 // the tracker id's match. This fixes possible multiple packets for a single pilto
789 // accidentally getting set for the wrong pilot
791 stats = (vmt_freespace2_struct *)(&inpacket.data);
792 if ( !SDL_strncasecmp(stats->tracker_id, fs_pr->tracker_id,TRACKER_ID_LEN) ) {
794 memcpy(ReadFSPilot,&inpacket.data,sizeof(vmt_freespace2_struct));
796 FSReadState = STATE_RECEIVED_PILOT;
800 } else if(inpacket.code == CMD_GAME_FREESPACE){
804 if(FSReadState == STATE_READING_PILOT){
805 vmt_freespace_struct *stats;
807 // 9/17/98 MWA. Compare the tracker id of this packet with the tracker id of
808 // what we are expecting. Only set our state to something different when
809 // the tracker id's match. This fixes possible multiple packets for a single pilto
810 // accidentally getting set for the wrong pilot
812 stats = (vmt_freespace_struct *)(&inpacket.data);
813 if ( !SDL_strncasecmp(stats->tracker_id, fs_pr->tracker_id,TRACKER_ID_LEN) ) {
815 memcpy(ReadFSPilot,&inpacket.data,sizeof(vmt_freespace_struct));
817 FSReadState = STATE_RECEIVED_PILOT;
826 case UNT_PILOT_READ_FAILED:
827 if(inpacket.code == CMD_GAME_FREESPACE2){
831 if(FSReadState == STATE_READING_PILOT){
832 FSReadState = STATE_PILOT_NOT_FOUND;
835 } else if(inpacket.code == CMD_GAME_FREESPACE){
839 if(FSReadState == STATE_READING_PILOT){
840 FSReadState = STATE_PILOT_NOT_FOUND;
848 case UNT_PILOT_WRITE_SUCCESS:
849 if(inpacket.code == CMD_GAME_FREESPACE2){
853 if(FSWriteState == STATE_SENDING_PILOT){
854 FSWriteState = STATE_WROTE_PILOT;
857 } else if(inpacket.code == CMD_GAME_FREESPACE){
861 if(FSWriteState == STATE_SENDING_PILOT){
862 FSWriteState = STATE_WROTE_PILOT;
870 case UNT_PILOT_WRITE_FAILED:
871 if(inpacket.code == CMD_GAME_FREESPACE2){
875 if(FSWriteState == STATE_SENDING_PILOT){
876 FSWriteState = STATE_WRITE_PILOT_FAILED;
879 } else if(inpacket.code == CMD_GAME_FREESPACE){
883 if(FSWriteState == STATE_SENDING_PILOT){
884 FSWriteState = STATE_WRITE_PILOT_FAILED;
892 case UNT_SW_RESULT_RESPONSE:
893 if(SWWriteState == STATE_SENDING_PILOT){
895 SDL_assert((bytesin - PACKED_HEADER_ONLY_SIZE) == sizeof(squad_war_response));
896 if((bytesin - PACKED_HEADER_ONLY_SIZE) == sizeof(squad_war_response)){
897 memset(&SquadWarWriteResponse, 0, sizeof(squad_war_response));
898 memcpy(&SquadWarWriteResponse, inpacket.data, sizeof(squad_war_response));
900 // now check to see if we're good
901 if(SquadWarWriteResponse.accepted){
902 SWWriteState = STATE_WROTE_PILOT;
904 SWWriteState = STATE_WRITE_PILOT_FAILED;
907 SWWriteState = STATE_WRITE_PILOT_FAILED;
916 case UNT_CONTROL_VALIDATION:
923 AckServer(inpacket.sig);