This repository was archived by the owner on Feb 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 511
/
Copy pathCONNMGR.H
151 lines (139 loc) · 7.31 KB
/
CONNMGR.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
** Command & Conquer(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* $Header: F:\projects\c&c0\vcs\code\connmgr.h_v 1.25 02 Jan 1996 11:14:54 JOE_BOSTIC $ */
/***************************************************************************
** 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 **
***************************************************************************
* *
* Project Name : Command & Conquer *
* *
* File Name : CONNMGR.H *
* *
* Programmer : Bill Randolph *
* *
* Start Date : December 19, 1994 *
* *
* Last Update : April 3, 1995 [BR] *
* *
*-------------------------------------------------------------------------*
* *
* This is the Connection Manager base class. This is an abstract base *
* class that's just a shell for more functional derived classes. *
* The main job of the Connection Manager classes is to parse a "pool" of *
* incoming packets, which may be from different computers, and distribute *
* those packets to Connection Classes via their Receive_Packet function. *
* *
* This class should be the only access to the network/modem for the *
* application, so if the app needs any functions to access the *
* connections or the queue's, the derived versions of this class should *
* provide them. *
* *
* It's up to the derived class to define: *
* - Service: polling routine; should Service each connection *
* - Init: initialization; should perform hardware-dependent *
* initialization, then Init each connection; this function *
* isn't defined in this class, since the parameters will *
* be highly protocol-dependent) *
* - Send_Message:sends a packet across the connection (this function *
* isn't defined in this class, since the parameters will *
* be highly protocol-dependent) *
* - Get_Message: gets a message from the connection (this function *
* isn't defined in this class, since the parameters will *
* be highly protocol-dependent) *
* *
* If the derived class supports multiple connections, it should provide *
* functions for creating the connections, associating them with a name *
* or ID or both, destroying them, and sending data through all or any *
* connection. *
* *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef CONNMGR_H
#define CONNMGR_H
/*
***************************** Class Declaration *****************************
*/
class ConnManClass
{
/*
---------------------------- Public Interface ----------------------------
*/
public:
/*.....................................................................
Various useful enums:
.....................................................................*/
enum IPXConnTag {
CONNECTION_NONE = -1, // value of an invalid connection ID
};
/*.....................................................................
Constructor/Destructor. These currently do nothing.
.....................................................................*/
ConnManClass (void) {};
virtual ~ConnManClass () {};
/*.....................................................................
The Service routine:
- Parses incoming packets, and adds them to the Receive Queue for the
Connection Class(s) for this protocol
- Invokes each connection's Service routine; returns an error if the
connection's Service routine indicates an error.
.....................................................................*/
virtual int Service (void) = 0;
/*.....................................................................
Sending & receiving data
.....................................................................*/
virtual int Send_Private_Message (void *buf, int buflen,
int ack_req = 1, int conn_id = CONNECTION_NONE) = 0;
virtual int Get_Private_Message (void *buf, int *buflen,
int *conn_id) = 0;
/*.....................................................................
Connection management
.....................................................................*/
virtual int Num_Connections(void) = 0;
virtual int Connection_ID(int index) = 0;
virtual int Connection_Index(int id) = 0;
/*.....................................................................
Queue utility routines
.....................................................................*/
virtual int Global_Num_Send(void) = 0;
virtual int Global_Num_Receive(void) = 0;
virtual int Private_Num_Send(int id = CONNECTION_NONE) = 0;
virtual int Private_Num_Receive(int id = CONNECTION_NONE) = 0;
/*.....................................................................
Timing management
.....................................................................*/
virtual void Reset_Response_Time(void) = 0;
virtual unsigned long Response_Time(void) = 0;
virtual void Set_Timing (unsigned long retrydelta,
unsigned long maxretries, unsigned long timeout) = 0;
/*.....................................................................
Debugging
.....................................................................*/
virtual void Configure_Debug(int index, int type_offset, int type_size,
char **names, int maxnames) = 0;
virtual void Mono_Debug_Print(int index, int refresh) = 0;
/*
--------------------------- Private Interface ----------------------------
*/
private:
/*.....................................................................
This abstract class contains no data members; but a derived class
will contain:
- An instance of one or more derived Connection Classes
- A buffer to store incoming packets
.....................................................................*/
};
#endif