Line data Source code
1 : // Copyright (c) 2012-2019 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // This program is free software; you can redistribute it and/or modify
4 : // it under the terms of the GNU General Public License as published by
5 : // the Free Software Foundation; either version 2 of the License, or
6 : // (at your option) any later version.
7 : //
8 : // This program is distributed in the hope that it will be useful,
9 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 : // GNU General Public License for more details.
12 : //
13 : // You should have received a copy of the GNU General Public License
14 : // along with this program; if not, write to the Free Software
15 : // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 : #pragma once
17 :
18 : // self
19 : //
20 : #include "eventdispatcher/connection.h"
21 : #include "eventdispatcher/tcp_bio_client.h"
22 : //#include "eventdispatcher/udp_client_server.h"
23 : //#include "eventdispatcher/utils.h"
24 : //
25 : //
26 : //// cppthread lib
27 : ////
28 : //#include "cppthread/thread.h"
29 : //
30 : //
31 : //// snapdev lib
32 : ////
33 : //#include "snapdev/not_used.h"
34 : //
35 : //
36 : //// C lib
37 : ////
38 : //#include <signal.h>
39 : //#include <sys/signalfd.h>
40 :
41 :
42 :
43 : namespace ed
44 : {
45 :
46 :
47 :
48 0 : class tcp_client_connection
49 : : public connection
50 : , public tcp_bio_client
51 : {
52 : public:
53 : typedef std::shared_ptr<tcp_client_connection> pointer_t;
54 :
55 : tcp_client_connection(
56 : std::string const & addr
57 : , int port
58 : , mode_t mode = mode_t::MODE_PLAIN);
59 :
60 : std::string const & get_remote_address() const;
61 :
62 : // snap_connection implementation
63 : virtual bool is_reader() const override;
64 : virtual int get_socket() const override;
65 :
66 : // new callbacks
67 : virtual ssize_t read(void * buf, size_t count);
68 : virtual ssize_t write(void const * buf, size_t count);
69 :
70 : private:
71 : std::string const f_remote_address = std::string();
72 : };
73 :
74 :
75 :
76 : } // namespace ed
77 : // vim: ts=4 sw=4 et
|