acl/lib_acl_cpp/include/acl_cpp/http/HttpSession.hpp

122 lines
4.1 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
#include "../stdlib/dbuf_pool.hpp"
#include "../session/session.hpp"
2014-11-19 00:25:21 +08:00
#include <map>
#ifndef ACL_CLIENT_ONLY
2014-11-19 00:25:21 +08:00
namespace acl {
class session;
/**
* HttpSession memcached
2014-11-19 00:25:21 +08:00
*/
class ACL_CPP_API HttpSession : public dbuf_obj
2014-11-19 00:25:21 +08:00
{
public:
/**
*
* @param session {session&}
2014-11-19 00:25:21 +08:00
*/
HttpSession(session& session);
virtual ~HttpSession(void);
/**
* session
* @param name {const char*} session
* @return {const char*} session
* ("\0")
*
*
2014-11-19 00:25:21 +08:00
*/
virtual const char* getAttribute(const char* name) const;
/**
* session
* @param name {const char*} session
* @param size {size_t*}
*
* @return {const void*} session
*
*
*
2014-11-19 00:25:21 +08:00
*/
virtual const void* getAttribute(const char* name, size_t* size) const;
/**
*
* @param attrs {std::map<string, session_string>&}
* @return {bool}
*/
virtual bool getAttributes(std::map<string, session_string>& attrs) const;
/**
*
* @param names {const std::vector<string>&}
* @param values {std::vector<session_string>&}
* @return {bool}
*/
virtual bool getAttributes(const std::vector<string>& names,
std::vector<session_string>& values) const;
2014-11-19 00:25:21 +08:00
/**
* session
* @param name {const char*} session
* @param value {const char*} session
* @return {bool} false
2014-11-19 00:25:21 +08:00
*/
virtual bool setAttribute(const char* name, const char* value);
/**
* session
* @param name {const char*} session
* @param value {const void*} session
* @param len {size_t} value
* @return {bool} false
2014-11-19 00:25:21 +08:00
*/
virtual bool setAttribute(const char* name, const void* value, size_t len);
/**
* session
* @param attrs {const std::map<string, session_string>&}
* @return {bool}
*/
virtual bool setAttributes(const std::map<string, session_string>& attrs);
2014-11-19 00:25:21 +08:00
/**
* session
* @param name {const char*} session
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
virtual bool removeAttribute(const char* name);
/**
* session
* @param ttl {time_t} ()
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
virtual bool setMaxAge(time_t ttl);
/**
* 使 session 使 session
* @return {bool} 使 session
2014-11-19 00:25:21 +08:00
*/
virtual bool invalidate(void);
/**
* session ID
* @return {const char*} '\0'
* ("\0") sid
2014-11-19 00:25:21 +08:00
*/
const char* getSid(void) const;
protected:
session& session_;
};
} // namespace acl
#endif // ACL_CLIENT_ONLY