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 :
25 : namespace eq
26 : {
27 : namespace deflect
28 : {
29 : /**
30 : * @internal
31 : * A Deflect connection wrapper.
32 : *
33 : * This class is used to monitor multiple Deflect connections for events using a
34 : * co::ConnectionSet.
35 : */
36 : class Connection : public co::Connection
37 : {
38 : public:
39 0 : Connection( Proxy* proxy )
40 0 : : _proxy( proxy ) { _setState( STATE_CONNECTED ); }
41 :
42 0 : virtual ~Connection() { _setState( STATE_CLOSED ); }
43 :
44 0 : virtual Notifier getNotifier() const
45 0 : { return _proxy->getSocketDescriptor(); }
46 :
47 0 : const Proxy* getProxy() const { return _proxy; }
48 :
49 : protected:
50 0 : virtual void readNB( void*, const uint64_t ) { LBDONTCALL; }
51 0 : virtual int64_t readSync( void*, const uint64_t, const bool )
52 0 : { LBDONTCALL; return -1; }
53 0 : virtual int64_t write( const void*, const uint64_t )
54 0 : { LBDONTCALL; return -1; }
55 :
56 : private:
57 : Proxy* const _proxy;
58 : };
59 : }
60 : }
61 :
62 : #endif // EQ_DC_CONNECTION_H
|