summaryrefslogtreecommitdiff
path: root/src/connectionmonitor.h
blob: 9910556a9a715632d2299d300e1901f07a421446 (plain)
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
/**@file
 * Describes the ConnectionMonitor class.
 */
#ifndef CONNECTIONMONITOR_H
#define CONNECTIONMONITOR_H

#include "connection.h"

/** Connection Monitor defines the base class of the objects that will be
  * notified whenever a connection is created or destroyed.
  *@author Mike Buland
  */
class ConnectionMonitor
{
public:
	/**
	 * This is only here for completeness.  It does nothing.
	 */
	ConnectionMonitor();

	/**
	 * This is only here for completeness.  It does nothing.
	 */
	virtual ~ConnectionMonitor();

	/** Receives the notification that new connection was received.
	  *@param pCon The connection that was created.
	  *@param nSocket The socket that the client connected to, used to determine
	  * which protocol to apply.
	  *@returns Should return a true value if everything is OK, a false to
	  * force a shutdown.
	  */
	virtual bool onNewConnection( Connection *pCon, int nPort ) = 0;
	virtual bool onNewClientConnection( Connection *pCon, int nPort )
	{
		return onNewConnection( pCon, nPort );
	};

	/** Receives the notification that a connection was closed.
	  *@param pCon The connection that was closed.
	  *@returns Should return a true value if everything is OK, a false to
	  * force a shutdown.
	  */
	virtual bool onClosedConnection( Connection *pCon ) = 0;
};

#endif