CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

NOSEQCON.H (5914B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /* $Header:   F:\projects\c&c\vcs\code\noseqcon.h_v   1.13   01 Mar 1996 17:32:42   JOE_BOSTIC  $ */
     17 /***************************************************************************
     18  **   C O N F I D E N T I A L --- W E S T W O O D    S T U D I O S        **
     19  ***************************************************************************
     20  *                                                                         *
     21  *                 Project Name : Command & Conquer                        *
     22  *                                                                         *
     23  *                    File Name : NOSEQCON.H                               *
     24  *                                                                         *
     25  *                   Programmer : Bill Randolph                            *
     26  *                                                                         *
     27  *                   Start Date : December 19, 1994                        *
     28  *                                                                         *
     29  *                  Last Update : April 9, 1995   [BR]                 		*
     30  *                                                                         *
     31  *-------------------------------------------------------------------------*
     32  *                                                                         *
     33  * This class provides a "Non-Sequenced" ACK/Retry approach to packet		*
     34  * transmission.  It sends out as many packets as are in the queue, whose	*
     35  * resend delta times have expired; and it ACK's any packets its received	*
     36  * who haven't been ACK'd yet.  Thus, order of delivery is NOT guaranteed;	*
     37  * however, the performance is better than the Sequenced approach.			*
     38  *																									*
     39  *	A derived class must provide:															*
     40  * - Init: Initialization of any hardware-specific values.						*
     41  * - Send: a hardware-dependent send routine.										*
     42  *																									*
     43  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     44 
     45 #ifndef NONSEQCONN_H
     46 #define NONSEQCONN_H
     47 
     48 
     49 /*
     50 ********************************* Includes **********************************
     51 */
     52 #include "connect.h"
     53 #include "combuf.h"
     54 
     55 
     56 /*
     57 ***************************** Class Declaration *****************************
     58 */
     59 class NonSequencedConnClass : public ConnectionClass
     60 {
     61 	/*
     62 	---------------------------- Public Interface ----------------------------
     63 	*/
     64 	public:
     65 		/*.....................................................................
     66 		Constructor/destructor.
     67 		.....................................................................*/
     68 		NonSequencedConnClass (int numsend, int numrecieve, int maxlen, 
     69 			unsigned short magicnum, unsigned long retry_delta,
     70 			unsigned long max_retries, unsigned long timeout);
     71 		virtual ~NonSequencedConnClass ();
     72 
     73 		/*.....................................................................
     74 		Initialization.
     75 		.....................................................................*/
     76 		virtual void Init (void);
     77 
     78 		/*.....................................................................
     79 		Send/Receive routines.
     80 		.....................................................................*/
     81 		virtual int Send_Packet (void * buf, int buflen, int ack_req);
     82 		virtual int Receive_Packet (void * buf, int buflen);
     83 		virtual int Get_Packet (void * buf, int *buflen);
     84 
     85 		/*.....................................................................
     86 		The packet "queue"; this non-sequenced version isn't really much of
     87 		a queue, but more of a repository.
     88 		.....................................................................*/
     89 		CommBufferClass *Queue;
     90 
     91 	/*
     92 	-------------------------- Protected Interface ---------------------------
     93 	*/
     94 	protected:
     95 		/*.....................................................................
     96 		Routines to service the Send & Receive queues.
     97 		.....................................................................*/
     98 		virtual int Service_Send_Queue (void);
     99 		virtual int Service_Receive_Queue (void);
    100 
    101 		/*.....................................................................
    102 		Running totals of # of packets we send & receive which require an ACK, 
    103 		and those that don't.
    104 		.....................................................................*/
    105 		unsigned long NumRecNoAck;
    106 		unsigned long NumRecAck;
    107 		unsigned long NumSendNoAck;
    108 		unsigned long NumSendAck;
    109 
    110 		/*.....................................................................
    111 		This is the ID of the last consecutively-received packet; anything older 
    112 		than this, we know is a resend.  Anything newer than this MUST be lying 
    113 		around in the Queue for us to detect it as a resend.
    114 		.....................................................................*/
    115 		unsigned long LastSeqID;
    116 
    117 		/*.....................................................................
    118 		This is the ID of the PACKET_DATA_ACK packet we read last; it ensures
    119 		that the application reads that type of packet in order.
    120 		.....................................................................*/
    121 		unsigned long LastReadID;
    122 };
    123 
    124 #endif
    125 
    126