SEQCONN.H 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: F:\projects\c&c\vcs\code\seqconn.h_v 1.13 01 Mar 1996 17:45:24 JOE_BOSTIC $ */
  19. /***************************************************************************
  20. ** 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 **
  21. ***************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : SEQCONN.H *
  26. * *
  27. * Programmer : Bill Randolph *
  28. * *
  29. * Start Date : December 19, 1994 *
  30. * *
  31. * Last Update : April 9, 1995 [BR] *
  32. * *
  33. *-------------------------------------------------------------------------*
  34. * *
  35. * This class provides a "Sequenced" ACK/Retry approach to packet *
  36. * transmission. It waits until the last packet has been ACK'd before *
  37. * sending another packet. Thus, it guarantees order of delivery of *
  38. * packets, but its performance will be slower than the Non-Sequenced *
  39. * approach. *
  40. * *
  41. * A derived class must provide: *
  42. * - Init: Initialization of any hardware-specific values. *
  43. * - Send: a hardware-dependent send routine. *
  44. * *
  45. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  46. #ifndef SEQCONN_H
  47. #define SEQCONN_H
  48. #include "connect.h"
  49. #include "comqueue.h"
  50. /*
  51. ***************************** Class Declaration *****************************
  52. */
  53. class SequencedConnClass : public ConnectionClass
  54. {
  55. /*
  56. ---------------------------- Public Interface ----------------------------
  57. */
  58. public:
  59. /*.....................................................................
  60. Constructor/destructor.
  61. .....................................................................*/
  62. SequencedConnClass (int numsend, int numrecieve, int maxlen,
  63. unsigned short magicnum, unsigned long retry_delta,
  64. unsigned long max_retries, unsigned long timeout);
  65. virtual ~SequencedConnClass ();
  66. /*.....................................................................
  67. Initialization.
  68. .....................................................................*/
  69. virtual void Init (void);
  70. /*.....................................................................
  71. Send/Receive routines.
  72. .....................................................................*/
  73. virtual int Send_Packet (void * buf, int buflen, int ack_req);
  74. virtual int Receive_Packet (void * buf, int buflen);
  75. virtual int Get_Packet (void * buf, int *buflen);
  76. /*.....................................................................
  77. The packet queue.
  78. .....................................................................*/
  79. CommQueueClass *Queue;
  80. /*
  81. -------------------------- Protected Interface ---------------------------
  82. */
  83. protected:
  84. /*.....................................................................
  85. Routines to service the Send & Receive queues.
  86. .....................................................................*/
  87. virtual int Service_Send_Queue (void);
  88. virtual int Service_Receive_Queue (void);
  89. /*.....................................................................
  90. Running totals of # of packets we send & receive which require an ACK,
  91. and those that don't.
  92. .....................................................................*/
  93. unsigned long NumRecNoAck;
  94. unsigned long NumRecAck;
  95. unsigned long NumSendNoAck;
  96. unsigned long NumSendAck;
  97. };
  98. #endif
  99. /*************************** end of seqconn.h ******************************/