libiqxmlrpc  0.12.4
 All Classes Namespaces Files Functions Typedefs Enumerations
connection.h
1 // Libiqxmlrpc - an object-oriented XML-RPC solution.
2 // Copyright (C) 2011 Anton Dedov
3 
4 #ifndef _libiqnet_connection_h_
5 #define _libiqnet_connection_h_
6 
7 #include "inet_addr.h"
8 #include "net_except.h"
9 #include "reactor.h"
10 
11 #include <string>
12 
13 namespace iqnet
14 {
15 
17 
21 class LIBIQXMLRPC_API Connection: public Event_handler {
22 protected:
23  Socket sock;
24 
25 public:
26  Connection( const Socket& );
27  virtual ~Connection();
28 
29  void finish();
30 
31  virtual void post_accept() {}
32  virtual void post_connect() {}
33 
34  const iqnet::Inet_addr& get_peer_addr() const
35  {
36  return sock.get_peer_addr();
37  }
38 
39  Socket::Handler get_handler() const
40  {
41  return sock.get_handler();
42  }
43 
44  virtual size_t send( const char*, size_t );
45  virtual size_t recv( char*, size_t );
46 };
47 
48 } // namespace iqnet
49 
50 #endif