fix problem when finishing a chunked encoding stream
[m6w6/ext-http] / php_http_cookie.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id: php_http_cookie_api.h 292841 2009-12-31 08:48:57Z mike $ */
14
15 #ifndef PHP_HTTP_COOKIE_H
16 #define PHP_HTTP_COOKIE_H
17
18 #define PHP_HTTP_COOKIE_SECURE 0x10L
19 #define PHP_HTTP_COOKIE_HTTPONLY 0x20L
20
21 #define PHP_HTTP_COOKIE_PARSE_RAW 0x01L
22
23 /*
24 generally a netscape cookie compliant struct, recognizing httpOnly attribute, too;
25 cookie params like those from rfc2109 and rfc2965 are just put into extras, if
26 one specifies them in allowed extras, else they're treated like cookies themself
27 */
28 typedef struct php_http_cookie_list {
29 HashTable cookies;
30 HashTable extras;
31 long flags;
32 char *path;
33 char *domain;
34 time_t expires;
35 } php_http_cookie_list_t;
36
37 PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_init(php_http_cookie_list_t *list TSRMLS_DC);
38 PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_parse(php_http_cookie_list_t * list, const char *string, long flags, char **allowed_extras TSRMLS_DC);
39 PHP_HTTP_API void php_http_cookie_list_dtor(php_http_cookie_list_t *list TSRMLS_DC);
40 PHP_HTTP_API void php_http_cookie_list_free(php_http_cookie_list_t **list TSRMLS_DC);
41
42 #define php_http_cookie_list_has_cookie(list, name, name_len) zend_hash_exists(&(list)->cookies, (name), (name_len)+1)
43 PHP_HTTP_API void php_http_cookie_list_add_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len TSRMLS_DC);
44 PHP_HTTP_API const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len TSRMLS_DC);
45
46 #define php_http_cookie_list_has_extra(list, name, name_len) zend_hash_exists(&(list)->extras, (name), (name_len)+1)
47 PHP_HTTP_API void php_http_cookie_list_add_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len TSRMLS_DC);
48 PHP_HTTP_API const char *php_http_cookie_list_get_extra(php_http_cookie_list_t *list, const char *name, size_t name_len TSRMLS_DC);
49
50 PHP_HTTP_API void php_http_cookie_list_to_string(php_http_cookie_list_t *list, char **str, size_t *len TSRMLS_DC);
51 PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_cookie_list_t *list, zval *strct TSRMLS_DC);
52 PHP_HTTP_API void php_http_cookie_list_to_struct(php_http_cookie_list_t *list, zval *strct TSRMLS_DC);
53
54
55 extern zend_class_entry *php_http_cookie_class_entry;
56 extern zend_function_entry php_http_cookie_method_entry[];
57
58 typedef struct php_http_cookie_object {
59 zend_object o;
60 php_http_cookie_list_t *list;
61 } php_http_cookie_object_t;
62
63 zend_object_value php_http_cookie_object_new(zend_class_entry *ce TSRMLS_DC);
64 zend_object_value php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list, php_http_cookie_object_t **obj TSRMLS_DC);
65 zend_object_value php_http_cookie_object_clone(zval *this_ptr TSRMLS_DC);
66 void php_http_cookie_object_free(void *object TSRMLS_DC);
67
68 PHP_METHOD(HttpCookie, __construct);
69 PHP_METHOD(HttpCookie, getCookies);
70 PHP_METHOD(HttpCookie, setCookies);
71 PHP_METHOD(HttpCookie, addCookies);
72 PHP_METHOD(HttpCookie, getExtras);
73 PHP_METHOD(HttpCookie, setExtras);
74 PHP_METHOD(HttpCookie, addExtras);
75 PHP_METHOD(HttpCookie, getCookie);
76 PHP_METHOD(HttpCookie, setCookie);
77 PHP_METHOD(HttpCookie, addCookie);
78 PHP_METHOD(HttpCookie, getExtra);
79 PHP_METHOD(HttpCookie, setExtra);
80 PHP_METHOD(HttpCookie, addExtra);
81 PHP_METHOD(HttpCookie, getDomain);
82 PHP_METHOD(HttpCookie, setDomain);
83 PHP_METHOD(HttpCookie, getPath);
84 PHP_METHOD(HttpCookie, setPath);
85 PHP_METHOD(HttpCookie, getExpires);
86 PHP_METHOD(HttpCookie, setExpires);
87 PHP_METHOD(HttpCookie, getFlags);
88 PHP_METHOD(HttpCookie, setFlags);
89 PHP_METHOD(HttpCookie, toString);
90 PHP_METHOD(HttpCookie, toArray);
91
92 extern PHP_MINIT_FUNCTION(http_cookie);
93
94
95 #endif
96
97 /*
98 * Local variables:
99 * tab-width: 4
100 * c-basic-offset: 4
101 * End:
102 * vim600: noet sw=4 ts=4 fdm=marker
103 * vim<600: noet sw=4 ts=4
104 */