CppCMS
session_pool.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_SESSION_POOL_H
9 #define CPPCMS_SESSION_POOL_H
10 
11 #include <cppcms/defs.h>
12 #include <booster/shared_ptr.h>
13 #include <booster/hold_ptr.h>
14 #include <cppcms/session_api.h>
15 
16 #include <booster/auto_ptr_inc.h>
17 
18 namespace cppcms {
19  class service;
20  namespace impl {
21  struct cached_settings;
22  }
23  namespace sessions {
24  class encryptor_factory;
25  class session_storage_factory;
26  }
27  namespace json { class value; }
28 
35  class CPPCMS_API session_pool: public booster::noncopyable {
36  public:
40  session_pool(service &srv);
45  session_pool(json::value const &v);
46 
50  ~session_pool();
51 
58  void init();
59 
65 
69  void backend(std::auto_ptr<session_api_factory> b);
74  void encryptor(std::auto_ptr<sessions::encryptor_factory> e);
79  void storage(std::auto_ptr<sessions::session_storage_factory> s);
80  private:
81 
82  impl::cached_settings const &cached_settings();
83 
84  void after_fork();
85 
86  struct cookies_factory;
87  struct dual_factory;
88  struct sid_factory;
89  class gc_job;
90  template<typename Encryptor>
91  struct enc_factory;
92  template<typename Encryptor>
93  struct enc_factory_param;
94 
95  struct _data;
96 
97  friend struct cookies_factory;
98  friend struct dual_factory;
99  friend struct sid_factory;
100  friend class session_interface;
101  friend class gc_job;
102 
104 
105  std::auto_ptr<session_api_factory> backend_;
106  std::auto_ptr<sessions::encryptor_factory> encryptor_;
107  std::auto_ptr<sessions::session_storage_factory> storage_;
108 
109  service *service_;
110  };
111 }
112 
113 
114 #endif
This class is central representation of json objects.
Definition: json.h:140
This class represent the central event loop of the CppCMS applications.
Definition: service.h:62
This class provides an access to an application for session management.
Definition: session_interface.h:107
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
Definition: log.h:25
This class provides an access to session management backends an allow customization.
Definition: session_pool.h:35
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15