SEQCONN.H 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: F:\projects\c&c\vcs\code\seqconn.h_v 1.13 01 Mar 1996 17:45:24 JOE_BOSTIC $ */
  15. /***************************************************************************
  16. ** 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 **
  17. ***************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : SEQCONN.H *
  22. * *
  23. * Programmer : Bill Randolph *
  24. * *
  25. * Start Date : December 19, 1994 *
  26. * *
  27. * Last Update : April 9, 1995 [BR] *
  28. * *
  29. *-------------------------------------------------------------------------*
  30. * *
  31. * This class provides a "Sequenced" ACK/Retry approach to packet *
  32. * transmission. It waits until the last packet has been ACK'd before *
  33. * sending another packet. Thus, it guarantees order of delivery of *
  34. * packets, but its performance will be slower than the Non-Sequenced *
  35. * approach. *
  36. * *
  37. * A derived class must provide: *
  38. * - Init: Initialization of any hardware-specific values. *
  39. * - Send: a hardware-dependent send routine. *
  40. * *
  41. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  42. #ifndef SEQCONN_H
  43. #define SEQCONN_H
  44. #include "connect.h"
  45. #include "comqueue.h"
  46. /*
  47. ***************************** Class Declaration *****************************
  48. */
  49. class SequencedConnClass : public ConnectionClass
  50. {
  51. /*
  52. ---------------------------- Public Interface ----------------------------
  53. */
  54. public:
  55. /*.....................................................................
  56. Constructor/destructor.
  57. .....................................................................*/
  58. SequencedConnClass (int numsend, int numrecieve, int maxlen,
  59. unsigned short magicnum, unsigned long retry_delta,
  60. unsigned long max_retries, unsigned long timeout);
  61. virtual ~SequencedConnClass ();
  62. /*.....................................................................
  63. Initialization.
  64. .....................................................................*/
  65. virtual void Init (void);
  66. /*.....................................................................
  67. Send/Receive routines.
  68. .....................................................................*/
  69. virtual int Send_Packet (void * buf, int buflen, int ack_req);
  70. virtual int Receive_Packet (void * buf, int buflen);
  71. virtual int Get_Packet (void * buf, int *buflen);
  72. /*.....................................................................
  73. The packet queue.
  74. .....................................................................*/
  75. CommQueueClass *Queue;
  76. /*
  77. -------------------------- Protected Interface ---------------------------
  78. */
  79. protected:
  80. /*.....................................................................
  81. Routines to service the Send & Receive queues.
  82. .....................................................................*/
  83. virtual int Service_Send_Queue (void);
  84. virtual int Service_Receive_Queue (void);
  85. /*.....................................................................
  86. Running totals of # of packets we send & receive which require an ACK,
  87. and those that don't.
  88. .....................................................................*/
  89. unsigned long NumRecNoAck;
  90. unsigned long NumRecAck;
  91. unsigned long NumSendNoAck;
  92. unsigned long NumSendAck;
  93. };
  94. #endif
  95. /*************************** end of seqconn.h ******************************/