Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mod_session.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. 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 #ifndef MOD_SESSION_H
18 #define MOD_SESSION_H
19 
20 /* Create a set of SESSION_DECLARE(type), SESSION_DECLARE_NONSTD(type) and
21  * SESSION_DECLARE_DATA with appropriate export and import tags for the platform
22  */
23 #if !defined(WIN32)
24 #define SESSION_DECLARE(type) type
25 #define SESSION_DECLARE_NONSTD(type) type
26 #define SESSION_DECLARE_DATA
27 #elif defined(SESSION_DECLARE_STATIC)
28 #define SESSION_DECLARE(type) type __stdcall
29 #define SESSION_DECLARE_NONSTD(type) type
30 #define SESSION_DECLARE_DATA
31 #elif defined(SESSION_DECLARE_EXPORT)
32 #define SESSION_DECLARE(type) __declspec(dllexport) type __stdcall
33 #define SESSION_DECLARE_NONSTD(type) __declspec(dllexport) type
34 #define SESSION_DECLARE_DATA __declspec(dllexport)
35 #else
36 #define SESSION_DECLARE(type) __declspec(dllimport) type __stdcall
37 #define SESSION_DECLARE_NONSTD(type) __declspec(dllimport) type
38 #define SESSION_DECLARE_DATA __declspec(dllimport)
39 #endif
40 
50 #include "apr_hooks.h"
51 #include "apr_optional.h"
52 #include "apr_tables.h"
53 #include "apr_uuid.h"
54 #include "apr_pools.h"
55 #include "apr_time.h"
56 
57 #include "httpd.h"
58 #include "http_config.h"
59 #include "ap_config.h"
60 
61 #define MOD_SESSION_NOTES_KEY "mod_session_key"
62 
67 #define MOD_SESSION_USER "user"
68 
73 #define MOD_SESSION_PW "pw"
74 
84 typedef struct {
85  apr_pool_t *pool; /* pool to be used for this session */
86  apr_uuid_t *uuid; /* anonymous uuid of this particular session */
87  const char *remote_user; /* user who owns this particular session */
88  apr_table_t *entries; /* key value pairs */
89  const char *encoded; /* the encoded version of the key value pairs */
90  apr_time_t expiry; /* if > 0, the time of expiry of this session */
91  long maxage; /* if > 0, the maxage of the session, from
92  * which expiry is calculated */
93  int dirty; /* dirty flag */
94  int cached; /* true if this session was loaded from a
95  * cache of some kind */
96  int written; /* true if this session has already been
97  * written */
98 } session_rec;
99 
103 typedef struct {
104  int enabled; /* whether the session has been enabled for
105  * this directory */
107  long maxage; /* seconds until session expiry */
109  const char *header; /* header to inject session */
111  int env; /* whether the session has been enabled for
112  * this directory */
113  int env_set;
114  apr_array_header_t *includes; /* URL prefixes to be included. All
115  * URLs included if empty */
116  apr_array_header_t *excludes; /* URL prefixes to be excluded. No
117  * URLs excluded if empty */
118  apr_time_t expiry_update_time; /* seconds the session expiry may change and
119  * not have to be rewritten */
122 
131 APR_DECLARE_EXTERNAL_HOOK(ap, SESSION, apr_status_t, session_load,
132  (request_rec * r, session_rec ** z))
133 
134 
143 APR_DECLARE_EXTERNAL_HOOK(ap, SESSION, apr_status_t, session_save,
144  (request_rec * r, session_rec * z))
145 
146 
156 APR_DECLARE_EXTERNAL_HOOK(ap, SESSION, apr_status_t, session_encode,
157  (request_rec * r, session_rec * z))
158 
159 
169 APR_DECLARE_EXTERNAL_HOOK(ap, SESSION, apr_status_t, session_decode,
170  (request_rec * r, session_rec * z))
171 
173  apr_status_t,
175  (request_rec * r, session_rec * z, const char *key, const char **value));
177  (request_rec * r, session_rec * z, const char *key, const char *value));
179  (request_rec *, session_rec **));
181  (request_rec *, session_rec *));
182 
187 
188 #endif /* MOD_SESSION_H */
189 
APR UUID library.
int env
Definition: mod_session.h:111
Apache Configuration.
Definition: mod_session.h:103
Definition: apr_tables.h:62
apr_status_t ap_session_save(request_rec *, session_rec *)
apr_array_header_t * excludes
Definition: mod_session.h:116
const char * remote_user
Definition: mod_session.h:87
APR-UTIL registration of functions exported by modules.
Symbol export macros and hook functions.
apr_int64_t apr_time_t
Definition: apr_time.h:45
int header_set
Definition: mod_session.h:110
APR memory allocation.
module AP_MODULE_DECLARE_DATA session_module
apr_pool_t * pool
Definition: mod_session.h:85
HTTP Daemon routines.
Apache hook functions.
apr_status_t ap_session_set(request_rec *r, session_rec *z, const char *key, const char *value)
apr_status_t ap_session_load(request_rec *, session_rec **)
Definition: apr_uuid.h:41
#define APR_DECLARE_EXTERNAL_HOOK(ns, link, ret, name, args)
Definition: apr_hooks.h:118
int enabled_set
Definition: mod_session.h:106
APR Table library.
long maxage
Definition: mod_session.h:107
int dirty
Definition: mod_session.h:93
int cached
Definition: mod_session.h:94
const char * encoded
Definition: mod_session.h:89
Definition: mod_session.h:84
apr_status_t ap_session_get(request_rec *r, session_rec *z, const char *key, const char **value)
#define AP_MODULE_DECLARE_DATA
Definition: macros.h:16
int expiry_update_set
Definition: mod_session.h:120
A structure that represents the current request.
Definition: httpd.h:806
long maxage
Definition: mod_session.h:91
apr_time_t expiry_update_time
Definition: mod_session.h:118
struct apr_table_t apr_table_t
Definition: apr_tables.h:56
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int enabled
Definition: mod_session.h:104
int env_set
Definition: mod_session.h:113
Definition: http_config.h:355
int apr_status_t
Definition: apr_errno.h:44
request_rec * r
Definition: mod_dav.h:515
#define APR_DECLARE_OPTIONAL_FN(ret, name, args)
Definition: apr_optional.h:50
APR Time Library.
apr_time_t expiry
Definition: mod_session.h:90
apr_array_header_t * includes
Definition: mod_session.h:114
int maxage_set
Definition: mod_session.h:108
const char * header
Definition: mod_session.h:109
int written
Definition: mod_session.h:96
apr_table_t * entries
Definition: mod_session.h:88
apr_uuid_t * uuid
Definition: mod_session.h:86