OSDN Git Service

*** empty log message ***
[modchxj/mod_chxj.git] / include / chxj_cookie.h
1 /*
2  * Copyright (C) 2005 QSDN,Inc. All rights reserved.
3  * Copyright (C) 2005 Atsushi Konno All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __CHXJ_COOKIE_H__
18 #define __CHXJ_COOKIE_H__
19
20 #include "mod_chxj.h"
21 #include "apr_file_io.h"
22 #include "apr_tables.h"
23
24 #define CHXJ_COOKIE_PARAM  "_chxj_cc"
25
26 #define DEFAULT_COOKIE_DB_DIR "/tmp"
27 #define COOKIE_DB_NAME        "cookie.db"
28 #define COOKIE_DB_LOCK_NAME   "cookie.db.lock"
29
30 #define COOKIE_EXPIRE_DB_NAME "cookie.expire.db"
31 #define COOKIE_EXPIRE_DB_LOCK_NAME   "cookie.expire.db.lock"
32
33 /* 
34  * default cookie timeout is 5 minute
35  */
36 #define DEFAULT_COOKIE_TIMEOUT (300)
37
38 typedef struct cookie_t cookie_t;
39
40
41 struct cookie_t {
42   char*               cookie_id;
43   apr_array_header_t* cookie_headers;
44 };
45
46
47 extern cookie_t* chxj_save_cookie(
48   request_rec *r);
49
50 extern char*     chxj_add_cookie_parameter(
51   request_rec* r, 
52   char*        value, 
53   cookie_t*    cookie);
54
55 extern int chxj_cookie_check_host(
56   request_rec* r, 
57   char*        value);
58
59 extern cookie_t* chxj_load_cookie(
60   request_rec* r, 
61   char*        cookie_id);
62
63 extern apr_file_t* chxj_cookie_db_lock(
64   request_rec* r);
65
66 extern void chxj_cookie_db_unlock(
67   request_rec* r, 
68   apr_file_t*  file);
69
70 extern void chxj_delete_cookie(
71   request_rec* r, 
72   char*        cookie_id);
73
74 extern char* chxj_cookie_db_name_create(
75   request_rec* r, 
76   const char*  dir);
77
78 extern char* chxj_cookie_db_lock_name_create(
79   request_rec* r, 
80   const char*  dir);
81
82 extern char* chxj_cookie_expire_db_lock_name_create(
83   request_rec* r, 
84   const char*  dir);
85
86 extern char* chxj_cookie_expire_db_name_create(
87   request_rec* r, 
88   const char*  dir);
89
90 extern apr_file_t* chxj_cookie_expire_db_lock(
91   request_rec* r);
92
93 extern void chxj_cookie_expire_db_unlock(
94   request_rec* r, 
95   apr_file_t*  file);
96
97 extern void chxj_save_cookie_expire(
98   request_rec* r, 
99   cookie_t*    cookie);
100
101 extern void chxj_delete_cookie_expire(
102   request_rec* r, 
103   char*        cookie_id);
104
105 extern void chxj_cookie_expire_gc(
106   request_rec* r);
107
108 cookie_t* chxj_update_cookie(
109   request_rec* r, 
110   cookie_t*    old_cookie);
111
112 #endif
113 /*
114  * vim:ts=2 et
115  */