CONNMGR.H 7.4 KB

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