ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
980 B

  1. #ifndef CPPCMS_SESSION_SID_H
  2. #define CPPCMS_SESSION_SID_H
  3. #include <sys/time.h>
  4. #include <boost/shared_ptr.hpp>
  5. #include "session_api.h"
  6. namespace cppcms {
  7. class session_server_storage;
  8. class session_interface;
  9. namespace details {
  10. class sid_generator : public util::noncopyable {
  11. struct for_hash {
  12. char uid[16];
  13. uint64_t session_counter;
  14. struct timeval tv;
  15. } hashed;
  16. public:
  17. sid_generator();
  18. std::string operator()();
  19. };
  20. }
  21. class session_sid : public session_api {
  22. details::sid_generator sid;
  23. boost::shared_ptr<session_server_storage> storage;
  24. bool cache;
  25. std::string key(std::string sid);
  26. public:
  27. bool valid_sid(std::string const &str);
  28. session_sid(boost::shared_ptr<session_server_storage> s,bool c=false) :
  29. storage(s),
  30. cache(c)
  31. {
  32. }
  33. virtual void save(session_interface *,std::string const &data,time_t timeout,bool);
  34. virtual bool load(session_interface *,std::string &data,time_t &timeout);
  35. virtual void clear(session_interface *);
  36. };
  37. }
  38. #endif