CppCMS
cppcms/session_sid.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_SID_H
00009 #define CPPCMS_SESSION_SID_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 <cppcms/session_storage.h>
00016 
00017 namespace cppcms {
00018 namespace sessions {
00019 
00020         namespace impl { class sid_generator; }
00021         
00025         class CPPCMS_API session_sid : public session_api {
00026         public:
00030                 session_sid(booster::shared_ptr<session_storage> s);
00034                 ~session_sid();
00038                 virtual void save(session_interface &,std::string const &data,time_t timeout,bool,bool);
00042                 virtual bool load(session_interface &,std::string &data,time_t &timeout);
00046                 virtual bool is_blocking();
00050                 virtual void clear(session_interface &);
00051 
00052         private:
00053 
00054                 std::string get_new_sid();
00055                 bool valid_sid(std::string const &cookie,std::string &id);
00056                 
00057                 struct _data;
00058                 booster::hold_ptr<_data> d;
00059                 booster::shared_ptr<session_storage> storage_;
00060         };
00061 
00062 } // sessions
00063 } // cppcms
00064 
00065 
00066 #endif