2 +--------------------------------------------------------------------+
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-2014, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
13 #ifndef PHP_HTTP_COOKIE_H
14 #define PHP_HTTP_COOKIE_H
16 #define PHP_HTTP_COOKIE_SECURE 0x10L
17 #define PHP_HTTP_COOKIE_HTTPONLY 0x20L
19 #define PHP_HTTP_COOKIE_PARSE_RAW 0x01L
22 generally a netscape cookie compliant struct, recognizing httpOnly attribute, too;
23 cookie params like those from rfc2109 and rfc2965 are just put into extras, if
24 one specifies them in allowed extras, else they're treated like cookies themself
26 typedef struct php_http_cookie_list
{
34 } php_http_cookie_list_t
;
36 PHP_HTTP_API php_http_cookie_list_t
*php_http_cookie_list_init(php_http_cookie_list_t
*list
);
37 PHP_HTTP_API php_http_cookie_list_t
*php_http_cookie_list_parse(php_http_cookie_list_t
*list
, const char *str
, size_t len
, long flags
, char **allowed_extras
);
38 PHP_HTTP_API php_http_cookie_list_t
*php_http_cookie_list_copy(php_http_cookie_list_t
*from
, php_http_cookie_list_t
*to
);
39 PHP_HTTP_API
void php_http_cookie_list_dtor(php_http_cookie_list_t
*list
);
40 PHP_HTTP_API
void php_http_cookie_list_free(php_http_cookie_list_t
**list
);
42 #define php_http_cookie_list_has_cookie(list, name, name_len) zend_symtable_str_exists(&(list)->cookies, (name), (name_len))
43 #define php_http_cookie_list_del_cookie(list, name, name_len) zend_symtable_str_del(&(list)->cookies, (name), (name_len))
44 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
);
45 PHP_HTTP_API
const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t
*list
, const char *name
, size_t name_len
, zval
*cookie
);
47 #define php_http_cookie_list_has_extra(list, name, name_len) zend_symtable_str_exists(&(list)->extras, (name), (name_len))
48 #define php_http_cookie_list_del_extra(list, name, name_len) zend_symtable_str_del(&(list)->extras, (name), (name_len))
49 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
);
50 PHP_HTTP_API
const char *php_http_cookie_list_get_extra(php_http_cookie_list_t
*list
, const char *name
, size_t name_len
, zval
*extra
);
52 PHP_HTTP_API
void php_http_cookie_list_to_string(php_http_cookie_list_t
*list
, char **str
, size_t *len
);
53 PHP_HTTP_API php_http_cookie_list_t
*php_http_cookie_list_from_struct(php_http_cookie_list_t
*list
, zval
*strct
);
54 PHP_HTTP_API
void php_http_cookie_list_to_struct(php_http_cookie_list_t
*list
, zval
*strct
);
56 PHP_HTTP_API zend_class_entry
*php_http_cookie_get_class_entry(void);
58 typedef struct php_http_cookie_object
{
59 php_http_cookie_list_t
*list
;
61 } php_http_cookie_object_t
;
63 zend_object
*php_http_cookie_object_new(zend_class_entry
*ce
);
64 php_http_cookie_object_t
*php_http_cookie_object_new_ex(zend_class_entry
*ce
, php_http_cookie_list_t
*list
);
65 zend_object
*php_http_cookie_object_clone(zval
*this_ptr
);
66 void php_http_cookie_object_free(zend_object
*object
);
68 PHP_MINIT_FUNCTION(http_cookie
);
77 * vim600: noet sw=4 ts=4 fdm=marker
78 * vim<600: noet sw=4 ts=4