fastcgi++
A C++ FastCGI/Web API
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Fastcgipp::Http::SessionId Class Reference

Defines ID values for HTTP sessions. More...

#include <fastcgi++/http.hpp>

Public Member Functions

 SessionId ()
 This constructor initializes the ID data to a random value. More...
 
 SessionId (const SessionId &x)
 
template<class charT >
 SessionId (const std::basic_string< charT > &string)
 Initialize the ID data with a base64 encoded string. More...
 
bool operator< (const SessionId &x) const
 
bool operator== (const SessionId &x) const
 

Static Public Attributes

static const size_t size =15
 Size in bytes of the ID data. Make sure it is a multiple of 3. More...
 
static const size_t stringLength =size*4/3
 Size in characters of string representation. More...
 

Private Member Functions

void refresh () const
 Resets the last access timestamp to the current time. More...
 

Private Attributes

std::array< unsigned char, sizem_data
 ID data. More...
 
std::time_t m_timestamp
 Contains the time this session was last used. More...
 

Friends

template<class T >
class Sessions
 
template<class charT , class Traits >
std::basic_ostream< charT, Traits > & operator<< (std::basic_ostream< charT, Traits > &os, const SessionId &x)
 Output the ID data in base64 encoding. More...
 

Detailed Description

Defines ID values for HTTP sessions.

Date
March 24, 2016
Author
Eddie Carle <eddie.nosp@m.@isa.nosp@m.tec.c.nosp@m.a>

Definition at line 546 of file http.hpp.

Constructor & Destructor Documentation

◆ SessionId() [1/3]

Fastcgipp::Http::SessionId::SessionId ( )

This constructor initializes the ID data to a random value.

Definition at line 629 of file http.cpp.

References m_data, and m_timestamp.

◆ SessionId() [2/3]

Fastcgipp::Http::SessionId::SessionId ( const SessionId x)
inline

Definition at line 573 of file http.hpp.

References m_data.

◆ SessionId() [3/3]

template<class charT >
Fastcgipp::Http::SessionId::SessionId ( const std::basic_string< charT > &  string)

Initialize the ID data with a base64 encoded string.

Note that only stringLength characeters will be read from the string.

Parameters
[in]stringReference to base64 encoded string

Definition at line 643 of file http.cpp.

References Fastcgipp::Http::base64Decode().

Member Function Documentation

◆ operator<()

bool Fastcgipp::Http::SessionId::operator< ( const SessionId x) const
inline

Definition at line 594 of file http.hpp.

References m_data, and size.

◆ operator==()

bool Fastcgipp::Http::SessionId::operator== ( const SessionId x) const
inline

Definition at line 602 of file http.hpp.

References m_data, and size.

◆ refresh()

void Fastcgipp::Http::SessionId::refresh ( ) const
inlineprivate

Resets the last access timestamp to the current time.

Definition at line 563 of file http.hpp.

References m_timestamp.

Friends And Related Function Documentation

◆ operator<<

template<class charT , class Traits >
std::basic_ostream<charT, Traits>& operator<< ( std::basic_ostream< charT, Traits > &  os,
const SessionId x 
)
friend

Output the ID data in base64 encoding.

Definition at line 613 of file http.hpp.

◆ Sessions

template<class T >
friend class Sessions
friend

Definition at line 568 of file http.hpp.

Member Data Documentation

◆ m_data

std::array<unsigned char, size> Fastcgipp::Http::SessionId::m_data
private

ID data.

Definition at line 557 of file http.hpp.

Referenced by operator<(), Fastcgipp::Http::operator<<(), operator==(), and SessionId().

◆ m_timestamp

std::time_t Fastcgipp::Http::SessionId::m_timestamp
mutableprivate

Contains the time this session was last used.

Definition at line 560 of file http.hpp.

Referenced by refresh(), and SessionId().

◆ size

const size_t Fastcgipp::Http::SessionId::size =15
static

Size in bytes of the ID data. Make sure it is a multiple of 3.

Definition at line 550 of file http.hpp.

Referenced by operator<(), and operator==().

◆ stringLength

const size_t Fastcgipp::Http::SessionId::stringLength =size*4/3
static

Size in characters of string representation.

Definition at line 553 of file http.hpp.


The documentation for this class was generated from the following files: