Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

apreq_cookie.h

Go to the documentation of this file.
00001 /*
00002 **  Copyright 2003-2004  The Apache Software Foundation
00003 **
00004 **  Licensed under the Apache License, Version 2.0 (the "License");
00005 **  you may not use this file except in compliance with the License.
00006 **  You may obtain a copy of the License at
00007 **
00008 **      http://www.apache.org/licenses/LICENSE-2.0
00009 **
00010 **  Unless required by applicable law or agreed to in writing, software
00011 **  distributed under the License is distributed on an "AS IS" BASIS,
00012 **  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 **  See the License for the specific language governing permissions and
00014 **  limitations under the License.
00015 */
00016 
00017 #ifndef APREQ_COOKIE_H
00018 #define APREQ_COOKIE_H
00019 
00020 #include "apreq.h"
00021 #include "apr_tables.h"
00022 
00023 #ifdef  __cplusplus
00024 extern "C" {
00025 #endif 
00026 
00040 typedef struct apreq_jar_t {
00041     apr_table_t   *cookies;     
00042     void          *env;         
00043 } apreq_jar_t;
00044 
00045 
00056 typedef enum { APREQ_COOKIE_VERSION_NETSCAPE, 
00057                APREQ_COOKIE_VERSION_RFC } apreq_cookie_version_t;
00058 
00059 
00061 #define APREQ_COOKIE_VERSION_DEFAULT       APREQ_COOKIE_VERSION_NETSCAPE
00062 
00064 #define APREQ_COOKIE_MAX_LENGTH            4096
00065 
00067 typedef struct apreq_cookie_t {
00068 
00069     apreq_cookie_version_t version; 
00071     char           *path;
00072     char           *domain; 
00073     char           *port;
00074     unsigned        secure;
00075 
00076     char           *comment;
00077     char           *commentURL;
00078     apr_time_t      max_age;     
00079     apreq_value_t   v;           
00081 } apreq_cookie_t;
00082 
00083 
00084 #define apreq_value_to_cookie(ptr) apreq_attr_to_type(apreq_cookie_t, \
00085                                                       v, ptr)
00086 #define apreq_cookie_name(c)  ((c)->v.name)
00087 #define apreq_cookie_value(c) ((c)->v.data)
00088 
00089 #define apreq_jar_items(j) apr_table_elts(j->cookies)->nelts
00090 #define apreq_jar_nelts(j) apr_table_elts(j->cookies)->nelts
00091 
00099 APREQ_DECLARE(apreq_cookie_t *)apreq_cookie(const apreq_jar_t *jar,
00100                                             const char *name);
00101 
00109 APREQ_DECLARE(void) apreq_jar_add(apreq_jar_t *jar, 
00110                                      const apreq_cookie_t *c);
00111 
00112 #define apreq_add_cookie(j,c) apreq_jar_add(j,c)
00113 
00130 APREQ_DECLARE(apreq_jar_t *) apreq_jar(void *env, const char *hdr);
00131 
00141 APREQ_DECLARE(apreq_cookie_t *) apreq_cookie_make(apr_pool_t *pool, 
00142                                   const char *name, const apr_size_t nlen, 
00143                                   const char *value, const apr_size_t vlen);
00144 
00145 #define apreq_make_cookie(p,n,nl,v,vl) apreq_cookie_make(p,n,nl,v,vl)
00146 
00158 APREQ_DECLARE(apr_status_t) 
00159     apreq_cookie_attr(apr_pool_t *p, apreq_cookie_t *c, 
00160                       const char *attr, apr_size_t alen,
00161                       const char *val, apr_size_t vlen);
00162 
00163 
00171 APREQ_DECLARE(char*) apreq_cookie_as_string(const apreq_cookie_t *c,
00172                                             apr_pool_t *p);
00173 
00174 
00186 APREQ_DECLARE(int) apreq_cookie_serialize(const apreq_cookie_t *c,
00187                                           char *buf, apr_size_t len);
00188 
00189 #define apreq_serialize_cookie(buf,len,c) apreq_cookie_serialize(c,buf,len)
00190 
00202 APREQ_DECLARE(void) apreq_cookie_expires(apreq_cookie_t *c, 
00203                                          const char *time_str);
00204 
00210 APREQ_DECLARE(apr_status_t) apreq_cookie_bake(const apreq_cookie_t *c, 
00211                                               void *env);
00212 
00213 /* XXX: how about baking whole cookie jars, too ??? */
00214 
00220 APREQ_DECLARE(apr_status_t) apreq_cookie_bake2(const apreq_cookie_t *c,
00221                                                void *env);
00222 
00230 APREQ_DECLARE(apreq_cookie_version_t) apreq_ua_cookie_version(void *env);
00231 
00234 #ifdef __cplusplus
00235  }
00236 #endif
00237 
00238 #endif /*APREQ_COOKIE_H*/
00239 
00240 

Generated on Sat Jun 12 10:16:29 2004 for libapreq2 by doxygen1.2.15