Apache HTTPD
mod_cache.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
26#ifndef MOD_CACHE_H
27#define MOD_CACHE_H
28
29#include "httpd.h"
30#include "apr_date.h"
31#include "apr_optional.h"
32#include "apr_hooks.h"
33
34#include "cache_common.h"
35
36/* Create a set of CACHE_DECLARE(type), CACHE_DECLARE_NONSTD(type) and
37 * CACHE_DECLARE_DATA with appropriate export and import tags for the platform
38 */
39#if !defined(WIN32)
40#define CACHE_DECLARE(type) type
41#define CACHE_DECLARE_NONSTD(type) type
42#define CACHE_DECLARE_DATA
43#elif defined(CACHE_DECLARE_STATIC)
44#define CACHE_DECLARE(type) type __stdcall
45#define CACHE_DECLARE_NONSTD(type) type
46#define CACHE_DECLARE_DATA
47#elif defined(CACHE_DECLARE_EXPORT)
48#define CACHE_DECLARE(type) __declspec(dllexport) type __stdcall
49#define CACHE_DECLARE_NONSTD(type) __declspec(dllexport) type
50#define CACHE_DECLARE_DATA __declspec(dllexport)
51#else
52#define CACHE_DECLARE(type) __declspec(dllimport) type __stdcall
53#define CACHE_DECLARE_NONSTD(type) __declspec(dllimport) type
54#define CACHE_DECLARE_DATA __declspec(dllimport)
55#endif
56
57/* cache info information */
58typedef struct cache_info cache_info;
79
80/* cache handle information */
83 const char *key;
86 /* Opaque portion (specific to the implementation) of the cache object */
87 void *vobj;
88};
89
93 apr_table_t *req_hdrs; /* cached request headers */
94 apr_table_t *resp_hdrs; /* cached response headers */
95};
96
97#define CACHE_PROVIDER_GROUP "cache"
98
114
121
122#define AP_CACHE_HIT_ENV "cache-hit"
123#define AP_CACHE_REVALIDATE_ENV "cache-revalidate"
124#define AP_CACHE_MISS_ENV "cache-miss"
125#define AP_CACHE_INVALIDATE_ENV "cache-invalidate"
126#define AP_CACHE_STATUS_ENV "cache-status"
127
128
129/* cache_util.c */
130/* do a HTTP/1.1 age calculation */
133
136CACHE_DECLARE(char *) ap_cache_generate_name(apr_pool_t *p, int dirlevels,
137 int dirlength,
138 const char *name);
139CACHE_DECLARE(const char *)ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str);
140
141/* Create a new table consisting of those elements from an
142 * headers table that are allowed to be stored in a cache.
143 */
145 apr_table_t *t,
146 server_rec *s);
147
148/* Create a new table consisting of those elements from an input
149 * headers table that are allowed to be stored in a cache.
150 */
152
153/* Create a new table consisting of those elements from an output
154 * headers table that are allowed to be stored in a cache;
155 * ensure there is a content type and capture any errors.
156 */
158
165 const char *pragma_header, apr_table_t *headers);
166
167
168/* hooks */
169
184 const char *reason))
185
188 (request_rec *r, apr_pool_t*p, const char **key));
189
190
191#endif /*MOD_CACHE_H*/
const char apr_size_t len
Definition ap_regex.h:187
APR-UTIL date routines.
Apache hook functions.
APR-UTIL registration of functions exported by modules.
Common Cache structs.
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)
int ap_cache_control(request_rec *r, cache_control_t *cc, const char *cc_header, const char *pragma_header, apr_table_t *headers)
const char * ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str)
Definition cache_util.c:809
char * ap_cache_generate_name(apr_pool_t *p, int dirlevels, int dirlength, const char *name)
Definition cache_util.c:917
apr_table_t * ap_cache_cacheable_headers(apr_pool_t *pool, apr_table_t *t, server_rec *s)
ap_cache_status_e
Definition mod_cache.h:115
apr_time_t ap_cache_hex2usec(const char *x)
Definition cache_util.c:840
#define CACHE_DECLARE(type)
Definition mod_cache.h:40
void ap_cache_usec2hex(apr_time_t j, char *y)
Definition cache_util.c:860
apr_time_t ap_cache_current_age(cache_info *info, const apr_time_t age_value, apr_time_t now)
Definition cache_util.c:232
apr_table_t * ap_cache_cacheable_headers_in(request_rec *r)
apr_table_t * ap_cache_cacheable_headers_out(request_rec *r)
@ AP_CACHE_REVALIDATE
Definition mod_cache.h:117
@ AP_CACHE_INVALIDATE
Definition mod_cache.h:119
@ AP_CACHE_HIT
Definition mod_cache.h:116
@ AP_CACHE_MISS
Definition mod_cache.h:118
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
const apr_array_header_t * list
Definition apr_cstr.h:105
int apr_status_t
Definition apr_errno.h:44
const char * key
const apr_hash_t * h
Definition apr_hash.h:97
apr_interval_time_t t
const char * s
Definition apr_strings.h:95
apr_int32_t in
int reason
int int status
apr_int64_t apr_time_t
Definition apr_time.h:45
HTTP Daemon routines.
apr_pool_t * p
Definition md_event.c:32
static int cache_status(cache_handle_t *h, request_rec *r, apr_table_t *headers, ap_cache_status_e status, const char *reason)
Definition mod_cache.c:1776
static apr_status_t recall_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb)
static int remove_entity(cache_handle_t *h)
static apr_status_t store_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *in, apr_bucket_brigade *out)
static apr_status_t commit_entity(cache_handle_t *h, request_rec *r)
static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info *i)
static int create_entity(cache_handle_t *h, request_rec *r, const char *key, apr_off_t len, apr_bucket_brigade *bb)
static apr_status_t invalidate_entity(cache_handle_t *h, request_rec *r)
static int open_entity(cache_handle_t *h, request_rec *r, const char *key)
static apr_status_t recall_headers(cache_handle_t *h, request_rec *r)
static int remove_url(cache_handle_t *h, request_rec *r)
static apr_file_t * out
Definition mod_info.c:85
int i
Definition mod_so.c:347
char * name
apr_table_t * req_hdrs
Definition mod_cache.h:93
apr_table_t * resp_hdrs
Definition mod_cache.h:94
cache_object_t * cache_obj
Definition mod_cache.h:92
apr_time_t date
Definition mod_cache.h:64
apr_time_t expire
Definition mod_cache.h:66
apr_time_t request_time
Definition mod_cache.h:68
apr_time_t response_time
Definition mod_cache.h:70
cache_control_t control
Definition mod_cache.h:77
const char * key
Definition mod_cache.h:83
cache_object_t * next
Definition mod_cache.h:84
cache_info info
Definition mod_cache.h:85
void * vobj
Definition mod_cache.h:87
A structure that represents the current request.
Definition httpd.h:845
A structure to store information for each virtual server.
Definition httpd.h:1322
static apr_time_t now
Definition testtime.c:33
#define str
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray
INT info