1 | /*
|
---|
2 | * synergy -- mouse and keyboard sharing utility
|
---|
3 | * Copyright (C) 2004 Chris Schoeneman
|
---|
4 | *
|
---|
5 | * This package is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU General Public License
|
---|
7 | * found in the file COPYING that should have accompanied this file.
|
---|
8 | *
|
---|
9 | * This package is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | * GNU General Public License for more details.
|
---|
13 | */
|
---|
14 |
|
---|
15 | #ifndef CCLIENTPROXYUNKNOWN_H
|
---|
16 | #define CCLIENTPROXYUNKNOWN_H
|
---|
17 |
|
---|
18 | #include "CEvent.h"
|
---|
19 |
|
---|
20 | class CClientProxy;
|
---|
21 | class CEventQueueTimer;
|
---|
22 | class IStream;
|
---|
23 |
|
---|
24 | class CClientProxyUnknown {
|
---|
25 | public:
|
---|
26 | CClientProxyUnknown(IStream* stream, double timeout);
|
---|
27 | ~CClientProxyUnknown();
|
---|
28 |
|
---|
29 | //! @name manipulators
|
---|
30 | //@{
|
---|
31 |
|
---|
32 | //! Get the client proxy
|
---|
33 | /*!
|
---|
34 | Returns the client proxy created after a successful handshake
|
---|
35 | (i.e. when this object sends a success event). Returns NULL
|
---|
36 | if the handshake is unsuccessful or incomplete.
|
---|
37 | */
|
---|
38 | CClientProxy* orphanClientProxy();
|
---|
39 |
|
---|
40 | //@}
|
---|
41 | //! @name accessors
|
---|
42 | //@{
|
---|
43 |
|
---|
44 | //! Get success event type
|
---|
45 | /*!
|
---|
46 | Returns the success event type. This is sent when the client has
|
---|
47 | correctly responded to the hello message. The target is this.
|
---|
48 | */
|
---|
49 | static CEvent::Type getSuccessEvent();
|
---|
50 |
|
---|
51 | //! Get failure event type
|
---|
52 | /*!
|
---|
53 | Returns the failure event type. This is sent when a client fails
|
---|
54 | to correctly respond to the hello message. The target is this.
|
---|
55 | */
|
---|
56 | static CEvent::Type getFailureEvent();
|
---|
57 |
|
---|
58 | //@}
|
---|
59 |
|
---|
60 | private:
|
---|
61 | void sendSuccess();
|
---|
62 | void sendFailure();
|
---|
63 | void addStreamHandlers();
|
---|
64 | void addProxyHandlers();
|
---|
65 | void removeHandlers();
|
---|
66 | void removeTimer();
|
---|
67 | void handleData(const CEvent&, void*);
|
---|
68 | void handleWriteError(const CEvent&, void*);
|
---|
69 | void handleTimeout(const CEvent&, void*);
|
---|
70 | void handleDisconnect(const CEvent&, void*);
|
---|
71 | void handleReady(const CEvent&, void*);
|
---|
72 |
|
---|
73 | private:
|
---|
74 | IStream* m_stream;
|
---|
75 | CEventQueueTimer* m_timer;
|
---|
76 | CClientProxy* m_proxy;
|
---|
77 | bool m_ready;
|
---|
78 |
|
---|
79 | static CEvent::Type s_successEvent;
|
---|
80 | static CEvent::Type s_failureEvent;
|
---|
81 | };
|
---|
82 |
|
---|
83 | #endif
|
---|