libiqxmlrpc  0.12.4
 All Classes Namespaces Files Functions Typedefs Enumerations
client_conn.h
1 // Libiqxmlrpc - an object-oriented XML-RPC solution.
2 // Copyright (C) 2011 Anton Dedov
3 
4 #ifndef _iqxmlrpc_client_conn_h_
5 #define _iqxmlrpc_client_conn_h_
6 
7 #include "connection.h"
8 #include "http.h"
9 #include "request.h"
10 #include "response.h"
11 
12 namespace iqxmlrpc {
13 
14 class Client_options;
15 
17 class LIBIQXMLRPC_API Client_connection {
18 public:
20  virtual ~Client_connection();
21 
22  void set_options(const Client_options& o) { options = &o; }
23 
24  Response process_session(const Request&);
25 
26 protected:
27  http::Packet* read_response( const std::string&, bool read_hdr_only = false );
28  virtual http::Packet* do_process_session( const std::string& ) = 0;
29 
30  const Client_options& opts() const { return *options; }
31 
32 private:
33  virtual std::string decorate_uri() const;
34 
35  http::Packet_reader preader;
36  const Client_options* options;
37 
38 protected:
39  unsigned read_buf_sz;
40  char *read_buf;
41 };
42 
44 class LIBIQXMLRPC_API Client_timeout: public iqxmlrpc::Exception {
45 public:
47  Exception( "Connection timeout." ) {}
48 };
49 
50 } // namespace iqxmlrpc
51 
52 #endif
53 // vim:ts=2:sw=2:et