aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
commitf4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (patch)
tree13cdf64f7cf134f397a7165b7a3fe0807e37026b /src/protocol.h
parent74d4c8cd27334fc7204d5a8773deb3d424565778 (diff)
downloadlibbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.gz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.bz2
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.xz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.zip
Ok, no code is left in src, it's all in src/old. We'll gradually move code back
into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier.
Diffstat (limited to 'src/protocol.h')
-rw-r--r--src/protocol.h62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/protocol.h b/src/protocol.h
deleted file mode 100644
index 09e1c98..0000000
--- a/src/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 */
10class Protocol
11{
12public:
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
58private:
59 class Connection *pConnection; /**< The pointer to the Connection. */
60};
61
62#endif