2
* This File is part of Davix, The IO library for HTTP based protocols
3
* Copyright (C) 2013 Adrien Devresse <adrien.devresse@cern.ch>, CERN
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1
22
#ifndef DAVIXCONTEXT_HPP
2
23
#define DAVIXCONTEXT_HPP
5
26
#include <status/davixstatusrequest.hpp>
7
#include <davixuri.hpp>
27
#include <hooks/davix_hooks.hpp>
28
#include <utils/davix_uri.hpp>
9
30
#ifndef __DAVIX_INSIDE__
10
31
#error "Only davix.h or davix.hpp should be included."
55
78
/// clone this instance to a new context dynamically allocated,
60
/// enable or disablet the session caching
81
#ifndef DAVIX_STD_CXX03
83
/// set a new hook (callback) to intercept event in davix
84
/// see davix_hooks.hpp for more details about hooks
85
/// WARNING: setting a new HOOK override exiting ones
86
template<typename HookType>
87
inline void setHook(const HookType & id){
88
hookDefine<HookType>(getHookList(), id);
91
/// get the value register for one type of hook
92
template<typename HookType>
93
inline const HookType & getHook(){
94
return hookGet<HookType>(getHookList());
100
/// @brief load a plugin or a profile identified by name
101
/// @param name : name of the plugin or profile to load
103
/// Example: loadModule("grid") configure davix
104
/// for a grid environment usage
105
void loadModule(const std::string & name);
107
/// enable or disable the session caching
61
108
void setSessionCaching(bool caching);
110
/// get session caching status
63
111
bool getSessionCaching() const;
67
HttpRequest* createRequest(const Uri & uri, DavixError** err);
69
HttpRequest* createRequest(const std::string & url, DavixError** err);
71
DavPosix* createDavPosix();
74
114
// internal context
75
115
ContextInternal* _intern;
77
117
friend class DavPosix;
78
118
friend struct ContextExplorer;
119
HookList & getHookList();
123
HttpRequest* createRequest(const Uri & uri, DavixError** err);
125
HttpRequest* createRequest(const std::string & url, DavixError** err);
127
DavPosix* createDavPosix();