Fix backslashes in SHIBSP_PREFIX variable by manually creating it during the script...
[shibboleth/sp.git] / shibsp / SessionCacheEx.h
1 /*
2  *  Copyright 2001-2007 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file shibsp/SessionCacheEx.h
19  * 
20  * Extended SessionCache API with additional capabilities
21  */
22
23 #ifndef __shibsp_sessioncacheex_h__
24 #define __shibsp_sessioncacheex_h__
25
26 #include <shibsp/SessionCache.h>
27
28 namespace shibsp {
29
30     /**
31      * Extended SessionCache API with additional capabilities
32      */
33     class SHIBSP_API SessionCacheEx : public SessionCache
34     {
35     protected:
36         SessionCacheEx() {}
37     public:
38         virtual ~SessionCacheEx() {}
39         
40 #ifndef SHIBSP_LITE
41         /**
42          * Returns active sessions that match particular parameters and records the logout
43          * to prevent race conditions.
44          *
45          * <p>On exit, the mapping between these sessions and the associated information MAY be
46          * removed by the cache, so subsequent calls to this method may not return anything.
47          *
48          * <p>Until logout expiration, any attempt to create a session with the same parameters
49          * will be blocked by the cache.
50          * 
51          * @param application   reference to Application that owns the session(s)
52          * @param issuer        source of session(s)
53          * @param nameid        name identifier associated with the session(s) to terminate
54          * @param indexes       indexes of sessions, or NULL for all sessions associated with other parameters
55          * @param expires       logout expiration
56          * @param sessions      on exit, contains the IDs of the matching sessions found
57          */
58         virtual std::vector<std::string>::size_type logout(
59             const Application& application,
60             const opensaml::saml2md::EntityDescriptor* issuer,
61             const opensaml::saml2::NameID& nameid,
62             const std::set<std::string>* indexes,
63             time_t expires,
64             std::vector<std::string>& sessions
65             )=0;
66 #endif
67
68         /**
69          * Locates an existing session by ID.
70          * 
71          * <p>If the client address is supplied, then a check will be performed against
72          * the address recorded in the record.
73          * 
74          * @param application   reference to Application that owns the Session
75          * @param key           session key
76          * @param client_addr   network address of client (if known)
77          * @param timeout       inactivity timeout to enforce (0 for none, NULL to bypass check/update of last access)
78          * @return  pointer to locked Session, or NULL
79          */
80         virtual Session* find(const Application& application, const char* key, const char* client_addr=NULL, time_t* timeout=NULL)=0;
81
82         /**
83          * Deletes an existing session.
84          * 
85          * @param application   reference to Application that owns the Session
86          * @param key           session key
87          */
88         virtual void remove(const Application& application, const char* key)=0;
89     };
90 };
91
92 #endif /* __shibsp_sessioncacheex_h__ */