Apache HTTPD
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
84typedef 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 */
99
103typedef 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 */
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
133
134
145
146
158
159
171
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));
182
186extern module AP_MODULE_DECLARE_DATA session_module;
187
188#endif /* MOD_SESSION_H */
Symbol export macros and hook functions.
Apache hook functions.
APR-UTIL registration of functions exported by modules.
APR memory allocation.
APR Table library.
APR Time Library.
APR UUID library.
request_rec * r
#define APR_DECLARE_EXTERNAL_HOOK(ns, link, ret, name, args)
Definition apr_hooks.h:118
#define APR_DECLARE_OPTIONAL_FN(ret, name, args)
apr_size_t size
const char * value
Definition apr_env.h:51
int apr_status_t
Definition apr_errno.h:44
const char * key
apr_vformatter_buff_t const char va_list ap
Definition apr_lib.h:176
apr_int64_t apr_time_t
Definition apr_time.h:45
Apache Configuration.
HTTP Daemon routines.
static apr_status_t ap_session_load(request_rec *r, session_rec **z)
Definition mod_session.c:91
static apr_status_t ap_session_get(request_rec *r, session_rec *z, const char *key, const char **value)
static apr_status_t ap_session_save(request_rec *r, session_rec *z)
static apr_status_t ap_session_set(request_rec *r, session_rec *z, const char *key, const char *value)
A structure that represents the current request.
Definition httpd.h:845
apr_time_t expiry_update_time
apr_array_header_t * includes
const char * header
apr_array_header_t * excludes
apr_time_t expiry
Definition mod_session.h:90
apr_pool_t * pool
Definition mod_session.h:85
apr_table_t * entries
Definition mod_session.h:88
const char * remote_user
Definition mod_session.h:87
apr_uuid_t * uuid
Definition mod_session.h:86
const char * encoded
Definition mod_session.h:89