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