CONNMGR.H 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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: /CounterStrike/CONNMGR.H 1 3/03/97 10:24a 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 : CONNMGR.H *
  26. * *
  27. * Programmer : Bill Randolph *
  28. * *
  29. * Start Date : December 19, 1994 *
  30. * *
  31. * Last Update : April 3, 1995 [BR] *
  32. * *
  33. *-------------------------------------------------------------------------*
  34. * *
  35. * This is the Connection Manager base class. This is an abstract base *
  36. * class that's just a shell for more functional derived classes. *
  37. * The main job of the Connection Manager classes is to parse a "pool" of *
  38. * incoming packets, which may be from different computers, and distribute *
  39. * those packets to Connection Classes via their Receive_Packet function. *
  40. * *
  41. * This class should be the only access to the network/modem for the *
  42. * application, so if the app needs any functions to access the *
  43. * connections or the queue's, the derived versions of this class should *
  44. * provide them. *
  45. * *
  46. * It's up to the derived class to define: *
  47. * - Service: polling routine; should Service each connection *
  48. * - Init: initialization; should perform hardware-dependent *
  49. * initialization, then Init each connection; this function *
  50. * isn't defined in this class, since the parameters will *
  51. * be highly protocol-dependent) *
  52. * - Send_Message:sends a packet across the connection (this function *
  53. * isn't defined in this class, since the parameters will *
  54. * be highly protocol-dependent) *
  55. * - Get_Message: gets a message from the connection (this function *
  56. * isn't defined in this class, since the parameters will *
  57. * be highly protocol-dependent) *
  58. * *
  59. * If the derived class supports multiple connections, it should provide *
  60. * functions for creating the connections, associating them with a name *
  61. * or ID or both, destroying them, and sending data through all or any *
  62. * connection. *
  63. * *
  64. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  65. #ifndef CONNMGR_H
  66. #define CONNMGR_H
  67. /*
  68. ***************************** Class Declaration *****************************
  69. */
  70. class ConnManClass
  71. {
  72. /*
  73. ---------------------------- Public Interface ----------------------------
  74. */
  75. public:
  76. /*.....................................................................
  77. Various useful enums:
  78. .....................................................................*/
  79. enum IPXConnTag {
  80. CONNECTION_NONE = -1 // value of an invalid connection ID
  81. };
  82. /*.....................................................................
  83. Constructor/Destructor. These currently do nothing.
  84. .....................................................................*/
  85. ConnManClass (void) {};
  86. virtual ~ConnManClass () {};
  87. /*.....................................................................
  88. The Service routine:
  89. - Parses incoming packets, and adds them to the Receive Queue for the
  90. Connection Class(s) for this protocol
  91. - Invokes each connection's Service routine; returns an error if the
  92. connection's Service routine indicates an error.
  93. .....................................................................*/
  94. virtual int Service (void) = 0;
  95. /*.....................................................................
  96. Sending & receiving data
  97. .....................................................................*/
  98. virtual int Send_Private_Message (void *buf, int buflen,
  99. int ack_req = 1, int conn_id = CONNECTION_NONE) = 0;
  100. virtual int Get_Private_Message (void *buf, int *buflen,
  101. int *conn_id) = 0;
  102. /*.....................................................................
  103. Connection management
  104. .....................................................................*/
  105. virtual int Num_Connections(void) = 0;
  106. virtual int Connection_ID(int index) = 0;
  107. virtual int Connection_Index(int id) = 0;
  108. /*.....................................................................
  109. Queue utility routines
  110. .....................................................................*/
  111. virtual int Global_Num_Send(void) = 0;
  112. virtual int Global_Num_Receive(void) = 0;
  113. virtual int Private_Num_Send(int id = CONNECTION_NONE) = 0;
  114. virtual int Private_Num_Receive(int id = CONNECTION_NONE) = 0;
  115. /*.....................................................................
  116. Timing management
  117. .....................................................................*/
  118. virtual void Reset_Response_Time(void) = 0;
  119. virtual unsigned long Response_Time(void) = 0;
  120. virtual void Set_Timing (unsigned long retrydelta,
  121. unsigned long maxretries, unsigned long timeout) = 0;
  122. /*.....................................................................
  123. Debugging
  124. .....................................................................*/
  125. virtual void Configure_Debug(int index, int type_offset, int type_size,
  126. char **names, int namestart, int namecount) = 0;
  127. #ifdef CHEAT_KEYS
  128. virtual void Mono_Debug_Print(int index, int refresh) = 0;
  129. #endif
  130. /*
  131. --------------------------- Private Interface ----------------------------
  132. */
  133. private:
  134. /*.....................................................................
  135. This abstract class contains no data members; but a derived class
  136. will contain:
  137. - An instance of one or more derived Connection Classes
  138. - A buffer to store incoming packets
  139. .....................................................................*/
  140. };
  141. #endif