Line data Source code
1 :
2 : /* Copyright (c) 2013, Daniel Nachbaur <daniel.nachbaur@epfl.ch>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQ_DEFLECT_CONNECTION_H
19 : #define EQ_DEFLECT_CONNECTION_H
20 :
21 : #include "proxy.h"
22 : #include <co/connection.h>
23 :
24 : namespace eq
25 : {
26 : namespace deflect
27 : {
28 : /**
29 : * @internal
30 : * A Deflect connection wrapper.
31 : *
32 : * This class is used to monitor multiple Deflect connections for events using a
33 : * co::ConnectionSet.
34 : */
35 : class Connection : public co::Connection
36 : {
37 : public:
38 0 : Connection(Proxy* proxy)
39 0 : : _proxy(proxy)
40 : {
41 0 : _setState(STATE_CONNECTED);
42 0 : }
43 :
44 0 : virtual ~Connection() { _setState(STATE_CLOSED); }
45 0 : virtual Notifier getNotifier() const
46 : {
47 0 : return _proxy->getSocketDescriptor();
48 : }
49 :
50 0 : const Proxy* getProxy() const { return _proxy; }
51 : protected:
52 0 : virtual void readNB(void*, const uint64_t) { LBDONTCALL; }
53 0 : virtual int64_t readSync(void*, const uint64_t, const bool)
54 : {
55 0 : LBDONTCALL;
56 0 : return -1;
57 : }
58 0 : virtual int64_t write(const void*, const uint64_t)
59 : {
60 0 : LBDONTCALL;
61 0 : return -1;
62 : }
63 :
64 : private:
65 : Proxy* const _proxy;
66 : };
67 : }
68 : }
69 :
70 : #endif // EQ_DC_CONNECTION_H
|