CppCMS
cppcms/session_dual.h
00001 
00002 //                                                                             
00003 //  Copyright (C) 2008-2012  Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>     
00004 //                                                                             
00005 //  See accompanying file COPYING.TXT file for licensing details.
00006 //
00008 #ifndef CPPCMS_SESSION_DUAL_H
00009 #define CPPCMS_SESSION_DUAL_H
00010 
00011 #include <cppcms/session_api.h>
00012 #include <cppcms/defs.h>
00013 #include <booster/hold_ptr.h>
00014 #include <booster/shared_ptr.h>
00015 #include <memory>
00016 
00017 namespace cppcms {
00018 namespace sessions {
00019 
00020 class session_storage;
00021 class session_sid;
00022 class session_cookies;
00023 class encryptor;
00024 
00028 class CPPCMS_API session_dual : public session_api {
00029 public:
00035         session_dual(   std::auto_ptr<encryptor> enc,
00036                         booster::shared_ptr<session_storage> storage,
00037                         size_t data_size_limit);
00041         virtual ~session_dual();
00045         virtual void save(session_interface &,std::string const &data,time_t timeout,bool new_session,bool on_server);
00049         virtual bool load(session_interface &,std::string &data,time_t &timeout);
00053         virtual void clear(session_interface &);
00054 
00058         virtual bool is_blocking();
00059 private:
00060         struct _data;
00061         booster::hold_ptr<_data> d;
00062         booster::shared_ptr<session_cookies>    client_;
00063         booster::shared_ptr<session_sid>        server_;
00064         size_t data_size_limit_;
00065 };
00066 
00067 } // sessions
00068 } // cppcms
00069 
00070 
00071 #endif