/usr/include/corvusoft/restbed/session.hpp is in librestbed-dev 4.0~dfsg1-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | /*
* Copyright 2013-2016, Corvusoft Ltd, All Rights Reserved.
*/
#ifndef _RESTBED_SESSION_H
#define _RESTBED_SESSION_H 1
//System Includes
#include <map>
#include <set>
#include <chrono>
#include <string>
#include <memory>
#include <functional>
//Project Includes
#include <corvusoft/restbed/byte.hpp>
#include <corvusoft/restbed/string.hpp>
#include <corvusoft/restbed/context_value.hpp>
//External Includes
//System Namespaces
//Project Namespaces
//External Namespaces
namespace restbed
{
//Forward Declarations
class Request;
class Session;
class Response;
class Resource;
namespace detail
{
class SessionImpl;
class ServiceImpl;
}
class Session : public std::enable_shared_from_this< Session >
{
public:
//Friends
//Definitions
//Constructors
explicit Session( const std::string& id );
virtual ~Session( void );
//Functionality
bool has( const std::string& name ) const;
void erase( const std::string& name = "" );
const std::set< std::string > keys( void ) const;
bool is_open( void ) const;
bool is_closed( void ) const;
void close( const Bytes& body );
void close( const Response& response );
void close( const std::string& body = "" );
void close( const int status, const Bytes& body );
void close( const int status, const std::string& body = "" );
void close( const int status, const std::multimap< std::string, std::string >& headers );
void close( const int status, const std::string& body, const std::multimap< std::string, std::string >& headers );
void close( const int status, const Bytes& body, const std::multimap< std::string, std::string >& headers );
void yield( const Bytes& data, const std::function< void ( const std::shared_ptr< Session > ) >& callback = nullptr );
void yield( const std::string& data, const std::function< void ( const std::shared_ptr< Session > ) >& callback = nullptr );
void yield( const Response& response, const std::function< void ( const std::shared_ptr< Session > ) >& callback = nullptr );
void yield( const int status, const std::string& body, const std::function< void ( const std::shared_ptr< Session > ) >& callback = nullptr );
void yield( const int status, const Bytes& body = { }, const std::function< void ( const std::shared_ptr< Session > ) >& callback = nullptr );
void yield( const int status, const std::multimap< std::string, std::string >& headers, const std::function< void ( const std::shared_ptr< Session > ) >& callback = nullptr );
void yield( const int status, const Bytes& body, const std::multimap< std::string, std::string >& headers, const std::function< void ( const std::shared_ptr< Session > ) >& callback = nullptr );
void yield( const int status, const std::string& body, const std::multimap< std::string, std::string >& headers, const std::function< void ( const std::shared_ptr< Session > ) >& callback = nullptr );
void fetch( const std::size_t length, const std::function< void ( const std::shared_ptr< Session >, const Bytes& ) >& callback );
void fetch( const std::string& delimiter, const std::function< void ( const std::shared_ptr< Session >, const Bytes& ) >& callback );
void sleep_for( const std::chrono::milliseconds& delay, const std::function< void ( const std::shared_ptr< Session > ) >& callback );
//Getters
const std::string& get_id( void ) const;
const std::string get_origin( void ) const;
const std::string get_destination( void ) const;
const std::shared_ptr< const Request > get_request( void ) const;
const std::shared_ptr< const Resource > get_resource( void ) const;
const std::multimap< std::string, std::string >& get_headers( void ) const;
const ContextValue& get( const std::string& name ) const;
const ContextValue& get( const std::string& name, const ContextValue& default_value ) const;
//Setters
void set_id( const std::string& value );
void set( const std::string& name, const ContextValue& value );
void set_header( const std::string& name, const std::string& value );
void set_headers( const std::multimap< std::string, std::string >& values );
//Operators
//Properties
protected:
//Friends
//Definitions
//Constructors
//Functionality
//Getters
//Setters
//Operators
//Properties
private:
//Friends
friend detail::ServiceImpl;
friend detail::SessionImpl;
//Definitions
//Constructors
Session( void ) = delete;
Session( const Session& original ) = delete;
//Functionality
//Getters
//Setters
//Operators
Session& operator =( const Session& value ) = delete;
//Properties
detail::SessionImpl* m_pimpl;
};
}
#endif /* _RESTBED_SESSION_H */
|