CnC_Remastered_Collection

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

SEQCONN.H (5067B)


      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\seqconn.h_v   1.12   16 Oct 1995 16:47:58   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 : SEQCONN.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 "Sequenced" ACK/Retry approach to packet				*
     34  * transmission.  It waits until the last packet has been ACK'd before		*
     35  * sending another packet.  Thus, it guarantees order of delivery of			*
     36  * packets, but its performance will be slower than the Non-Sequenced		*
     37  * 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 SEQCONN_H
     46 #define SEQCONN_H
     47 
     48 #include "connect.h"
     49 #include "comqueue.h"
     50 
     51 
     52 /*
     53 ***************************** Class Declaration *****************************
     54 */
     55 class SequencedConnClass : public ConnectionClass
     56 {
     57 	/*
     58 	---------------------------- Public Interface ----------------------------
     59 	*/
     60 	public:
     61 		/*.....................................................................
     62 		Constructor/destructor.
     63 		.....................................................................*/
     64 		SequencedConnClass (int numsend, int numrecieve, int maxlen, 
     65 			unsigned short magicnum, unsigned long retry_delta,
     66 			unsigned long max_retries, unsigned long timeout);
     67 		virtual ~SequencedConnClass ();
     68 
     69 		/*.....................................................................
     70 		Initialization.
     71 		.....................................................................*/
     72 		virtual void Init (void);
     73 
     74 		/*.....................................................................
     75 		Send/Receive routines.
     76 		.....................................................................*/
     77 		virtual int Send_Packet (void * buf, int buflen, int ack_req);
     78 		virtual int Receive_Packet (void * buf, int buflen);
     79 		virtual int Get_Packet (void * buf, int *buflen);
     80 
     81 		/*.....................................................................
     82 		The packet queue.
     83 		.....................................................................*/
     84 		CommQueueClass *Queue;
     85 
     86 	/*
     87 	-------------------------- Protected Interface ---------------------------
     88 	*/
     89 	protected:
     90 		/*.....................................................................
     91 		Routines to service the Send & Receive queues.
     92 		.....................................................................*/
     93 		virtual int Service_Send_Queue (void);
     94 		virtual int Service_Receive_Queue (void);
     95 
     96 		/*.....................................................................
     97 		Running totals of # of packets we send & receive which require an ACK, 
     98 		and those that don't.
     99 		.....................................................................*/
    100 		unsigned long NumRecNoAck;
    101 		unsigned long NumRecAck;
    102 		unsigned long NumSendNoAck;
    103 		unsigned long NumSendAck;
    104 
    105 };
    106 
    107 #endif
    108 /*************************** end of seqconn.h ******************************/