diff options
Diffstat (limited to '')
-rw-r--r-- | src/old/protocol.h | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/old/protocol.h b/src/old/protocol.h deleted file mode 100644 index 09e1c98..0000000 --- a/src/old/protocol.h +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | #ifndef PROTOCOL_H | ||
2 | #define PROTOCOL_H | ||
3 | |||
4 | #include "connection.h" | ||
5 | |||
6 | /** This is the template for a class that handles specialized input and output | ||
7 | * to connections of different types with different protocols. | ||
8 | *@author Mike Buland | ||
9 | */ | ||
10 | class Protocol | ||
11 | { | ||
12 | public: | ||
13 | /** Constructor */ | ||
14 | Protocol(); | ||
15 | /** Deconstructor */ | ||
16 | virtual ~Protocol(); | ||
17 | |||
18 | /** | ||
19 | * Function is called every time there is new data on the line. This is | ||
20 | * called directly from the Connection class to process data. This is not | ||
21 | * called whever there is pending data on the input, but every time new data | ||
22 | * is added to the input buffer. | ||
23 | *@returns True if processing went alright, false if something went wrong, | ||
24 | * I suppose. In truth this value is thrown away right now. | ||
25 | *@todo Either make a return value of false mean something, or make these | ||
26 | * void. | ||
27 | */ | ||
28 | virtual bool onNewData()=0; | ||
29 | |||
30 | /** | ||
31 | * Function is called when there is a new connection. This should only | ||
32 | * happen once per Protocol object, but gives each protocol object a | ||
33 | * chance to perform connection handshaking and initialization at a point | ||
34 | * where they know that they have a handle to an active Connection. | ||
35 | *@returns See onNewData | ||
36 | */ | ||
37 | virtual bool onNewConnection()=0; | ||
38 | |||
39 | virtual void onNewClientConnection(){}; | ||
40 | |||
41 | virtual void poll(){}; | ||
42 | |||
43 | /** | ||
44 | * Sets the Protocol's Connection object. This is rather important, and | ||
45 | * handled usually by the ConnectionManager. | ||
46 | *@param pNewConnection The Connection object that this protocol will use to | ||
47 | * deal with the outside world. | ||
48 | */ | ||
49 | void setConnection( class Connection *pNewConnection ); | ||
50 | |||
51 | /** | ||
52 | * Get a pointer to this object's Connection object, or NULL if one was | ||
53 | * never set. If used with the ConnectionManager that should never happen. | ||
54 | *@returns A pointer to the active Connection. | ||
55 | */ | ||
56 | Connection *getConnection(); | ||
57 | |||
58 | private: | ||
59 | class Connection *pConnection; /**< The pointer to the Connection. */ | ||
60 | }; | ||
61 | |||
62 | #endif | ||