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);
28 SDL_COMPILE_TIME_ASSERT(vmt_freespace2_struct, sizeof(vmt_freespace2_struct) == 440);
29 SDL_COMPILE_TIME_ASSERT(validate_id_request, sizeof(validate_id_request) == 60);
30 SDL_COMPILE_TIME_ASSERT(squad_war_request, sizeof(squad_war_request) == 104);
31 SDL_COMPILE_TIME_ASSERT(squad_war_response, sizeof(squad_war_response) == 256);
32 SDL_COMPILE_TIME_ASSERT(squad_war_result, sizeof(squad_war_result) == 72);
33 SDL_COMPILE_TIME_ASSERT(pilot_request, sizeof(pilot_request) == 32);
40 struct sockaddr_in ptrackaddr;
45 unsigned int FSLastSentWrite;
46 unsigned int FSFirstSentWrite;
47 unsigned int FSLastSent;
48 unsigned int FSFirstSent;
51 unsigned int SWLastSentWrite;
52 unsigned int SWFirstSentWrite;
55 udp_packet_header fs_pilot_req, fs_pilot_write, sw_res_write;
58 vmt_freespace_struct *ReadFSPilot;
60 vmt_freespace2_struct *ReadFSPilot;
64 squad_war_response SquadWarWriteResponse;
67 static int SerializePilotPacket(const udp_packet_header *uph, ubyte *data)
72 PXO_ADD_DATA(uph->type);
73 PXO_ADD_USHORT(uph->len);
74 PXO_ADD_UINT(uph->code);
75 PXO_ADD_USHORT(uph->xcode);
76 PXO_ADD_UINT(uph->sig);
77 PXO_ADD_UINT(uph->security);
80 // no extra data for this
84 case UNT_PILOT_DATA_WRITE_NEW: {
85 vmt_freespace2_struct *fs2 = (vmt_freespace2_struct *)&uph->data;
87 PXO_ADD_DATA(fs2->tracker_id);
88 PXO_ADD_DATA(fs2->pilot_name);
90 PXO_ADD_DATA(fs2->pad_a); // junk, for size/alignment
92 PXO_ADD_INT(fs2->score);
93 PXO_ADD_INT(fs2->rank);
94 PXO_ADD_INT(fs2->assists);
95 PXO_ADD_INT(fs2->kill_count);
96 PXO_ADD_INT(fs2->kill_count_ok);
97 PXO_ADD_UINT(fs2->p_shots_fired);
98 PXO_ADD_UINT(fs2->s_shots_fired);
100 PXO_ADD_UINT(fs2->p_shots_hit);
101 PXO_ADD_UINT(fs2->s_shots_hit);
103 PXO_ADD_UINT(fs2->p_bonehead_hits);
104 PXO_ADD_UINT(fs2->s_bonehead_hits);
105 PXO_ADD_INT(fs2->bonehead_kills);
107 PXO_ADD_INT(fs2->security);
108 PXO_ADD_DATA(fs2->virgin_pilot);
110 PXO_ADD_DATA(fs2->pad_b); // junk, for size/alignment
112 PXO_ADD_UINT(fs2->checksum);
114 PXO_ADD_UINT(fs2->missions_flown);
115 PXO_ADD_UINT(fs2->flight_time);
116 PXO_ADD_UINT(fs2->last_flown);
118 PXO_ADD_USHORT(fs2->num_medals);
119 PXO_ADD_USHORT(fs2->num_ship_types);
121 for (i = 0; i < MAX_FS2_MEDALS; i++) {
122 PXO_ADD_INT(fs2->medals[i]);
125 for (i =0; i < MAX_FS2_SHIP_TYPES; i++) {
126 PXO_ADD_USHORT(fs2->kills[i]);
132 case UNT_SW_RESULT_WRITE: {
133 squad_war_result *sw_result = (squad_war_result *)&uph->data;
135 PXO_ADD_DATA(sw_result->match_code);
136 PXO_ADD_DATA(sw_result->result);
137 PXO_ADD_DATA(sw_result->squad_count1);
138 PXO_ADD_DATA(sw_result->squad_count2);
139 PXO_ADD_DATA(sw_result->pad); // junk, for size/alignment
141 for (i = 0; i < MAX_SQUAD_PLAYERS; i++) {
142 PXO_ADD_INT(sw_result->squad_winners[i]);
145 for (i = 0; i < MAX_SQUAD_PLAYERS; i++) {
146 PXO_ADD_INT(sw_result->squad_losers[i]);
152 case UNT_PILOT_DATA_READ_NEW:
153 case UNT_PILOT_DATA_READ: {
154 pilot_request *pr = (pilot_request *)&uph->data;
156 PXO_ADD_DATA(pr->pilot_name);
157 PXO_ADD_DATA(pr->tracker_id);
158 PXO_ADD_DATA(pr->pad); // junk, for size/alignment
163 // we shouldn't be sending any other packet types
169 SDL_assert(packet_size >= (int)PACKED_HEADER_ONLY_SIZE);
170 SDL_assert(packet_size == (int)uph->len);
175 static void DeserializePilotPacket(const ubyte *data, const int data_size, udp_packet_header *uph)
180 memset(uph, 0, sizeof(udp_packet_header));
182 // make sure we received a complete base packet
183 if (data_size < (int)PACKED_HEADER_ONLY_SIZE) {
190 PXO_GET_DATA(uph->type);
191 PXO_GET_USHORT(uph->len);
192 PXO_GET_UINT(uph->code);
193 PXO_GET_USHORT(uph->xcode);
194 PXO_GET_UINT(uph->sig);
195 PXO_GET_UINT(uph->security);
197 // sanity check data size to make sure we reveived all of the expected packet
198 // (not exactly sure what -1 is for, but that's how it is later)
199 if ((int)uph->len-1 > data_size) {
207 // no extra data for these
208 case UNT_PILOT_READ_FAILED:
209 case UNT_PILOT_WRITE_SUCCESS:
210 case UNT_PILOT_WRITE_FAILED:
213 case UNT_PILOT_DATA_RESPONSE: {
214 vmt_freespace2_struct *fs2 = (vmt_freespace2_struct *)&uph->data;
216 PXO_GET_DATA(fs2->tracker_id);
217 PXO_GET_DATA(fs2->pilot_name);
219 PXO_GET_DATA(fs2->pad_a); // junk, for size/alignment
221 PXO_GET_INT(fs2->score);
222 PXO_GET_INT(fs2->rank);
223 PXO_GET_INT(fs2->assists);
224 PXO_GET_INT(fs2->kill_count);
225 PXO_GET_INT(fs2->kill_count_ok);
226 PXO_GET_UINT(fs2->p_shots_fired);
227 PXO_GET_UINT(fs2->s_shots_fired);
229 PXO_GET_UINT(fs2->p_shots_hit);
230 PXO_GET_UINT(fs2->s_shots_hit);
232 PXO_GET_UINT(fs2->p_bonehead_hits);
233 PXO_GET_UINT(fs2->s_bonehead_hits);
234 PXO_GET_INT(fs2->bonehead_kills);
236 PXO_GET_INT(fs2->security);
237 PXO_GET_DATA(fs2->virgin_pilot);
239 PXO_GET_DATA(fs2->pad_b); // junk, for size/alignment
241 PXO_GET_UINT(fs2->checksum);
243 PXO_GET_UINT(fs2->missions_flown);
244 PXO_GET_UINT(fs2->flight_time);
245 PXO_GET_UINT(fs2->last_flown);
247 PXO_GET_USHORT(fs2->num_medals);
248 PXO_GET_USHORT(fs2->num_ship_types);
250 for (i = 0; i < MAX_FS2_MEDALS; i++) {
251 PXO_GET_INT(fs2->medals[i]);
254 for (i =0; i < MAX_FS2_SHIP_TYPES; i++) {
255 PXO_GET_USHORT(fs2->kills[i]);
261 case UNT_SW_RESULT_RESPONSE: {
262 squad_war_response *sw_resp = (squad_war_response *)&uph->data;
264 PXO_GET_DATA(sw_resp->reason);
265 PXO_GET_DATA(sw_resp->accepted);
274 //SDL_assert(offset == data_size);
278 int InitPilotTrackerClient()
280 struct sockaddr_in sockaddr;
283 FSWriteState = STATE_IDLE;
284 FSReadState = STATE_IDLE;
285 SWWriteState = STATE_IDLE;
289 fs_pr = (pilot_request *)&fs_pilot_req.data;
292 pilotsock = socket(AF_INET,SOCK_DGRAM,0);
294 if ( pilotsock == INVALID_SOCKET )
296 printf("Unable to open a socket.\n");
301 memset( &sockaddr, 0, sizeof(struct sockaddr_in) );
302 sockaddr.sin_family = AF_INET;
303 sockaddr.sin_addr.s_addr = INADDR_ANY;
304 sockaddr.sin_port = 0;//htons(REGPORT);
307 if (SOCKET_ERROR==bind(pilotsock, (struct sockaddr*)&sockaddr, sizeof (sockaddr)))
309 printf("Unable to bind a socket.\n");
310 printf("WSAGetLastError() returned %d.\n",WSAGetLastError());
315 // iaddr = inet_addr ( Multi_user_tracker_ip_address );
317 // first try and resolve by name
318 iaddr = inet_addr( Multi_options_g.user_tracker_ip );
319 if ( iaddr == INADDR_NONE ) {
321 he = gethostbyname( Multi_options_g.user_tracker_ip );
326 // try and resolve by address
327 unsigned int n_order = inet_addr(Multi_user_tracker_ip_address);
328 he = gethostbyaddr((char*)&n_order,4,PF_INET);
335 memcpy(&iaddr, he->h_addr_list[0],4);
338 memcpy(&ptrackaddr.sin_addr.s_addr, &iaddr, 4);
339 ptrackaddr.sin_family = AF_INET;
340 ptrackaddr.sin_port = htons(REGPORT);
346 // -3 Error -- Called with NULL, but no request is waiting
347 // -2 Error -- Already sending data (hasn't timed out yet)
348 // -1 Timeout trying to send pilot data
350 // 1 Data succesfully sent
351 // 2 Send Cancelled (data may still have been written already, we just haven't been ACK'd yet)
352 // 3 Pilot not written (for some reason)
354 // Call with NULL to poll
355 // Call with -1 to cancel send
356 // Call with valid pointer to a vmt_descent3_struct to initiate send
358 int SendFSPilotData(vmt_freespace_struct *fs_pilot)
360 int SendFSPilotData(vmt_freespace2_struct *fs_pilot)
363 //First check the network
368 if(FSWriteState == STATE_IDLE)
372 if(FSWriteState == STATE_SENDING_PILOT)
376 if(FSWriteState == STATE_WROTE_PILOT)
378 //We wrote this pilot, and now we are about to inform the app, so back to idle
379 FSWriteState = STATE_IDLE;
382 if(FSWriteState == STATE_TIMED_OUT)
384 //We gave up on sending this pilot, and now we are about to inform the app, so back to idle
385 FSWriteState = STATE_IDLE;
389 if(FSWriteState == STATE_WRITE_PILOT_FAILED)
391 //The tracker said this dude couldn't be written
392 FSWriteState = STATE_IDLE;
398 else if(fs_pilot == (vmt_freespace2_struct*)0xffffffff)
400 if(FSWriteState == STATE_IDLE)
407 FSWriteState = STATE_IDLE;
413 else if(FSWriteState == STATE_IDLE)
415 //New request, send out the req, and go for it.
417 FSWriteState = STATE_SENDING_PILOT;
420 FSFirstSentWrite = timer_get_milliseconds();
422 fs_pilot_write.type = UNT_PILOT_DATA_WRITE_NEW;
424 fs_pilot_write.len = PACKED_HEADER_ONLY_SIZE+sizeof(vmt_freespace_struct);
425 fs_pilot_write.code = CMD_GAME_FREESPACE;
426 memcpy(&fs_pilot_write.data,fs_pilot,sizeof(vmt_freespace_struct));
428 fs_pilot_write.len = PACKED_HEADER_ONLY_SIZE+sizeof(vmt_freespace2_struct);
429 fs_pilot_write.code = CMD_GAME_FREESPACE2;
430 memcpy(&fs_pilot_write.data,fs_pilot,sizeof(vmt_freespace2_struct));
439 // -3 Error -- Called with NULL, but no request is waiting
440 // -2 Error -- Already sending data (hasn't timed out yet)
441 // -1 Timeout trying to send pilot data
443 // 1 Data succesfully sent
444 // 2 Send Cancelled (data may still have been written already, we just haven't been ACK'd yet)
445 // 3 Pilot not written (for some reason)
447 // Call with NULL to poll
448 // Call with -1 to cancel send
449 // Call with valid pointer to a vmt_descent3_struct to initiate send
450 int SendSWData(squad_war_result *sw_res, squad_war_response *sw_resp)
452 //First check the network
456 if(SWWriteState == STATE_IDLE){
459 if(SWWriteState == STATE_SENDING_PILOT){
463 // fill in the response
464 if(SWWriteState == STATE_WROTE_PILOT){
465 // We wrote this pilot, and now we are about to inform the app, so back to idle
466 SWWriteState = STATE_IDLE;
469 memcpy(sw_resp, &SquadWarWriteResponse, sizeof(squad_war_response));
473 // fill in the response
474 if(SWWriteState == STATE_WRITE_PILOT_FAILED){
475 // The tracker said this dude couldn't be written
476 SWWriteState = STATE_IDLE;
479 memcpy(sw_resp, &SquadWarWriteResponse, sizeof(squad_war_response));
484 if(SWWriteState == STATE_TIMED_OUT){
485 // We gave up on sending this pilot, and now we are about to inform the app, so back to idle
486 SWWriteState = STATE_IDLE;
490 } else if(sw_res == (squad_war_result*)0xffffffff){
491 if(SWWriteState == STATE_IDLE){
495 SWWriteState = STATE_IDLE;
499 } else if(SWWriteState == STATE_IDLE) {
500 //New request, send out the req, and go for it.
502 SWWriteState = STATE_SENDING_PILOT;
505 SWFirstSentWrite = timer_get_milliseconds();
507 sw_res_write.len = PACKED_HEADER_ONLY_SIZE+sizeof(squad_war_result);
508 sw_res_write.type = UNT_SW_RESULT_WRITE;
510 sw_res_write.code = CMD_GAME_FREESPACE;
512 sw_res_write.code = CMD_GAME_FREESPACE2;
514 memcpy(&sw_res_write.data, sw_res, sizeof(squad_war_result));
523 // -3 Error -- Called with NULL, but no request is waiting
524 // -2 Error -- Already waiting on data (hasn't timed out yet)
525 // -1 Timeout waiting for pilot data
526 // 0 Waiting for data
531 // Call with NULL to poll
532 // Call with -1 to cancel wait
533 // Call with valid pointer to a vmt_descent3_struct to get a response
535 int GetFSPilotData(vmt_freespace_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int get_security)
537 int GetFSPilotData(vmt_freespace2_struct *fs_pilot, const char *pilot_name, const char *tracker_id, int get_security)
540 //First check the network
545 if(FSReadState == STATE_IDLE)
549 if(FSReadState == STATE_READING_PILOT)
553 if(FSReadState == STATE_RECEIVED_PILOT)
555 // We got this pilot, and now we are about to inform the app, so back to idle
556 FSReadState = STATE_IDLE;
560 if(FSReadState == STATE_TIMED_OUT)
562 // We gave up on this pilot, and now we are about to inform the app, so back to idle
563 FSReadState = STATE_IDLE;
567 if(FSReadState == STATE_PILOT_NOT_FOUND)
569 //The tracker said this dude is not found.
570 FSReadState = STATE_IDLE;
576 else if(fs_pilot == (vmt_freespace2_struct*)0xffffffff)
578 if(FSReadState == STATE_IDLE)
585 FSReadState = STATE_IDLE;
591 else if(FSReadState == STATE_IDLE)
593 //New request, send out the req, and go for it.
595 FSReadState = STATE_READING_PILOT;
596 ReadFSPilot = fs_pilot;
598 FSFirstSent = timer_get_milliseconds();
600 fs_pilot_req.len = PACKED_HEADER_ONLY_SIZE+sizeof(pilot_request);
603 fs_pilot_req.type = UNT_PILOT_DATA_READ_NEW;
605 fs_pilot_req.type = UNT_PILOT_DATA_READ;
609 fs_pilot_req.code = CMD_GAME_FREESPACE;
611 fs_pilot_req.code = CMD_GAME_FREESPACE2;
613 strcpy(fs_pr->pilot_name,pilot_name);
614 strncpy(fs_pr->tracker_id,tracker_id,TRACKER_ID_LEN);
622 // Send an ACK to the server
623 void AckServer(unsigned int sig)
625 udp_packet_header ack_pack;
626 ubyte packet_data[sizeof(udp_packet_header)];
627 int packet_length = 0;
629 ack_pack.type = UNT_CONTROL;
631 ack_pack.code = CMD_CLIENT_RECEIVED;
632 ack_pack.len = PACKED_HEADER_ONLY_SIZE;
634 packet_length = SerializePilotPacket(&ack_pack, packet_data);
635 SDL_assert(packet_length == PACKED_HEADER_ONLY_SIZE);
636 SENDTO(Unreliable_socket, (char *)&packet_data, packet_length, 0, (struct sockaddr *)&ptrackaddr, sizeof(struct sockaddr_in), PSNET_TYPE_USER_TRACKER);
641 ubyte packet_data[sizeof(udp_packet_header)];
642 int packet_length = 0;
644 PSNET_TOP_LAYER_PROCESS();
646 // reading pilot data
647 if(FSReadState == STATE_READING_PILOT){
648 if((timer_get_milliseconds()-FSFirstSent)>=PILOT_REQ_TIMEOUT){
649 FSReadState = STATE_TIMED_OUT;
650 } else if((timer_get_milliseconds()-FSLastSent)>=PILOT_REQ_RESEND_TIME){
652 packet_length = SerializePilotPacket(&fs_pilot_req, packet_data);
653 SENDTO(Unreliable_socket, (char *)&packet_data, packet_length, 0, (struct sockaddr *)&ptrackaddr, sizeof(struct sockaddr_in), PSNET_TYPE_USER_TRACKER);
654 FSLastSent = timer_get_milliseconds();
658 // writing pilot data
659 if(FSWriteState == STATE_SENDING_PILOT){
660 if((timer_get_milliseconds()-FSFirstSentWrite)>=PILOT_REQ_TIMEOUT){
661 FSWriteState = STATE_TIMED_OUT;
663 } else if((timer_get_milliseconds()-FSLastSentWrite)>=PILOT_REQ_RESEND_TIME){
665 packet_length = SerializePilotPacket(&fs_pilot_write, packet_data);
666 SENDTO(Unreliable_socket, (char *)&packet_data, packet_length, 0, (struct sockaddr *)&ptrackaddr, sizeof(struct sockaddr_in), PSNET_TYPE_USER_TRACKER);
667 FSLastSentWrite = timer_get_milliseconds();
671 // writing squad war results
672 if(SWWriteState == STATE_SENDING_PILOT){
673 if((timer_get_milliseconds()-SWFirstSentWrite) >= PILOT_REQ_TIMEOUT){
674 SWWriteState = STATE_TIMED_OUT;
675 } else if((timer_get_milliseconds()-SWLastSentWrite) >= PILOT_REQ_RESEND_TIME){
677 packet_length = SerializePilotPacket(&sw_res_write, packet_data);
678 SENDTO(Unreliable_socket, (char *)&packet_data, packet_length, 0, (struct sockaddr *)&ptrackaddr, sizeof(struct sockaddr_in), PSNET_TYPE_USER_TRACKER);
679 SWLastSentWrite = timer_get_milliseconds();
687 struct timeval timeout;
688 ubyte packet_data[sizeof(udp_packet_header)];
696 FD_SET(Unreliable_socket, &read_fds);
699 if(SELECT(0, &read_fds,NULL,NULL,&timeout, PSNET_TYPE_USER_TRACKER)){
701 if(SELECT(Unreliable_socket+1, &read_fds,NULL,NULL,&timeout, PSNET_TYPE_USER_TRACKER)){
705 struct sockaddr_in fromaddr;
707 udp_packet_header inpacket;
708 addrsize = sizeof(struct sockaddr_in);
710 bytesin = RECVFROM(Unreliable_socket, (char *)&packet_data, sizeof(udp_packet_header), 0, (struct sockaddr *)&fromaddr, &addrsize, PSNET_TYPE_USER_TRACKER);
711 DeserializePilotPacket(packet_data, bytesin, &inpacket);
713 int wserr=WSAGetLastError();
714 printf("recvfrom() failure. WSAGetLastError() returned %d\n",wserr);
718 // decrease packet size by 1
721 //Check to make sure the packets ok
722 if(bytesin==inpacket.len){
723 switch(inpacket.type){
724 case UNT_PILOT_DATA_RESPONSE:
725 if(inpacket.code == CMD_GAME_FREESPACE2){
729 if(FSReadState == STATE_READING_PILOT){
730 vmt_freespace2_struct *stats;
732 // 9/17/98 MWA. Compare the tracker id of this packet with the tracker id of
733 // what we are expecting. Only set our state to something different when
734 // the tracker id's match. This fixes possible multiple packets for a single pilto
735 // accidentally getting set for the wrong pilot
737 stats = (vmt_freespace2_struct *)(&inpacket.data);
738 if ( !SDL_strncasecmp(stats->tracker_id, fs_pr->tracker_id,TRACKER_ID_LEN) ) {
740 memcpy(ReadFSPilot,&inpacket.data,sizeof(vmt_freespace2_struct));
742 FSReadState = STATE_RECEIVED_PILOT;
746 } else if(inpacket.code == CMD_GAME_FREESPACE){
750 if(FSReadState == STATE_READING_PILOT){
751 vmt_freespace_struct *stats;
753 // 9/17/98 MWA. Compare the tracker id of this packet with the tracker id of
754 // what we are expecting. Only set our state to something different when
755 // the tracker id's match. This fixes possible multiple packets for a single pilto
756 // accidentally getting set for the wrong pilot
758 stats = (vmt_freespace_struct *)(&inpacket.data);
759 if ( !SDL_strncasecmp(stats->tracker_id, fs_pr->tracker_id,TRACKER_ID_LEN) ) {
761 memcpy(ReadFSPilot,&inpacket.data,sizeof(vmt_freespace_struct));
763 FSReadState = STATE_RECEIVED_PILOT;
772 case UNT_PILOT_READ_FAILED:
773 if(inpacket.code == CMD_GAME_FREESPACE2){
777 if(FSReadState == STATE_READING_PILOT){
778 FSReadState = STATE_PILOT_NOT_FOUND;
781 } else if(inpacket.code == CMD_GAME_FREESPACE){
785 if(FSReadState == STATE_READING_PILOT){
786 FSReadState = STATE_PILOT_NOT_FOUND;
794 case UNT_PILOT_WRITE_SUCCESS:
795 if(inpacket.code == CMD_GAME_FREESPACE2){
799 if(FSWriteState == STATE_SENDING_PILOT){
800 FSWriteState = STATE_WROTE_PILOT;
803 } else if(inpacket.code == CMD_GAME_FREESPACE){
807 if(FSWriteState == STATE_SENDING_PILOT){
808 FSWriteState = STATE_WROTE_PILOT;
816 case UNT_PILOT_WRITE_FAILED:
817 if(inpacket.code == CMD_GAME_FREESPACE2){
821 if(FSWriteState == STATE_SENDING_PILOT){
822 FSWriteState = STATE_WRITE_PILOT_FAILED;
825 } else if(inpacket.code == CMD_GAME_FREESPACE){
829 if(FSWriteState == STATE_SENDING_PILOT){
830 FSWriteState = STATE_WRITE_PILOT_FAILED;
838 case UNT_SW_RESULT_RESPONSE:
839 if(SWWriteState == STATE_SENDING_PILOT){
841 SDL_assert((bytesin - PACKED_HEADER_ONLY_SIZE) == sizeof(squad_war_response));
842 if((bytesin - PACKED_HEADER_ONLY_SIZE) == sizeof(squad_war_response)){
843 memset(&SquadWarWriteResponse, 0, sizeof(squad_war_response));
844 memcpy(&SquadWarWriteResponse, inpacket.data, sizeof(squad_war_response));
846 // now check to see if we're good
847 if(SquadWarWriteResponse.accepted){
848 SWWriteState = STATE_WROTE_PILOT;
850 SWWriteState = STATE_WRITE_PILOT_FAILED;
853 SWWriteState = STATE_WRITE_PILOT_FAILED;
862 case UNT_CONTROL_VALIDATION:
869 AckServer(inpacket.sig);