CppCMS
forwarder.h
1 //
3 // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
4 //
5 // See accompanying file COPYING.TXT file for licensing details.
6 //
8 #ifndef CPPCMS_FORWARDER_H
9 #define CPPCMS_FORWARDER_H
10 
11 #include <cppcms/defs.h>
12 #include <booster/hold_ptr.h>
13 #include <booster/shared_ptr.h>
14 #include <booster/noncopyable.h>
15 #include <booster/thread.h>
16 #include <string>
17 #include <map>
18 
19 namespace cppcms {
20  class mount_point;
21  namespace http {
22  class context;
23  }
24 
31  class CPPCMS_API forwarder {
32  public:
34  forwarder();
35  ~forwarder();
36 
37  typedef std::pair<std::string,int> address_type;
38  address_type check_forwading_rules(std::string const &h,std::string const &s,std::string const &p);
39  address_type check_forwading_rules(char const *h,char const *s,char const *p);
40 
42 
46  void add_forwarding_rule(booster::shared_ptr<mount_point> p,std::string const &ip,int port);
50  void remove_forwarding_rule(booster::shared_ptr<mount_point> p);
51 
52  private:
53  typedef std::map<booster::shared_ptr<mount_point> ,address_type> rules_type;
54  rules_type rules_;
55  booster::shared_mutex mutex_;
56  struct _data;
58  };
59 
70  void CPPCMS_API forward_connection(booster::shared_ptr<http::context> cont,std::string const &ip,int port);
71 }
72 
73 
74 
75 #endif
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
Shared mutex or a.k.a. Read-Write Lock.
Definition: thread.h:166
Definition: log.h:25
void CPPCMS_API forward_connection(booster::shared_ptr< http::context > cont, std::string const &ip, int port)
Class responsble for automaticall forwarding of HTTP/CGI requests to other hosts over SCGI...
Definition: forwarder.h:31