xref: /PHP-7.4/ext/session/php_session.h (revision 033cafac)
1b7a7b1a6SStanislav Malyshev /*
2a1b42e3fSSascha Schumann    +----------------------------------------------------------------------+
3d0cb7153SJohannes Schlüter    | PHP Version 7                                                        |
4a1b42e3fSSascha Schumann    +----------------------------------------------------------------------+
50cf7de1cSZeev Suraski    | Copyright (c) The PHP Group                                          |
6a1b42e3fSSascha Schumann    +----------------------------------------------------------------------+
75bd93221Sfoobar    | This source file is subject to version 3.01 of the PHP license,      |
83f4a4a36SSebastian Bergmann    | that is bundled with this package in the file LICENSE, and is        |
9f68c7ff2SJames Cox    | available through the world-wide-web at the following url:           |
105bd93221Sfoobar    | http://www.php.net/license/3_01.txt                                  |
113f4a4a36SSebastian Bergmann    | If you did not receive a copy of the PHP license and are unable to   |
123f4a4a36SSebastian Bergmann    | obtain it through the world-wide-web, please send a note to          |
133f4a4a36SSebastian Bergmann    | license@php.net so we can mail you a copy immediately.               |
14a1b42e3fSSascha Schumann    +----------------------------------------------------------------------+
1590613d22SSebastian Bergmann    | Author: Sascha Schumann <sascha@schumann.cx>                         |
16a1b42e3fSSascha Schumann    +----------------------------------------------------------------------+
17a1b42e3fSSascha Schumann  */
18a1b42e3fSSascha Schumann 
19a1b42e3fSSascha Schumann #ifndef PHP_SESSION_H
20a1b42e3fSSascha Schumann #define PHP_SESSION_H
21a1b42e3fSSascha Schumann 
22f341f630SSascha Schumann #include "ext/standard/php_var.h"
23*033cafacSPeter Kokot #include "ext/hash/php_hash.h"
24525f3c47SJani Taskinen 
257f196e32SYasuo Ohgaki #define PHP_SESSION_API 20161017
26e6c8640aSYasuo Ohgaki 
27663074b6SAnatol Belski #include "php_version.h"
28663074b6SAnatol Belski #define PHP_SESSION_VERSION PHP_VERSION
29663074b6SAnatol Belski 
30e6c8640aSYasuo Ohgaki /* save handler macros */
31e6c8640aSYasuo Ohgaki #define PS_NUM_APIS      9
32e6c8640aSYasuo Ohgaki #define PS_OPEN_ARGS     void **mod_data, const char *save_path, const char *session_name
33e6c8640aSYasuo Ohgaki #define PS_CLOSE_ARGS    void **mod_data
343066851dSAnatol Belski #define PS_READ_ARGS     void **mod_data, zend_string *key, zend_string **val, zend_long maxlifetime
353066851dSAnatol Belski #define PS_WRITE_ARGS    void **mod_data, zend_string *key, zend_string *val, zend_long maxlifetime
36e6c8640aSYasuo Ohgaki #define PS_DESTROY_ARGS  void **mod_data, zend_string *key
37a4a2f66eSYasuo Ohgaki #define PS_GC_ARGS       void **mod_data, zend_long maxlifetime, zend_long *nrdels
38e112f6a0SAnatol Belski #define PS_CREATE_SID_ARGS void **mod_data
39e6c8640aSYasuo Ohgaki #define PS_VALIDATE_SID_ARGS void **mod_data, zend_string *key
403066851dSAnatol Belski #define PS_UPDATE_TIMESTAMP_ARGS void **mod_data, zend_string *key, zend_string *val, zend_long maxlifetime
41346d74a1SMark L. Woodward 
42a1b42e3fSSascha Schumann typedef struct ps_module_struct {
435e601732SSascha Schumann 	const char *s_name;
445e601732SSascha Schumann 	int (*s_open)(PS_OPEN_ARGS);
455e601732SSascha Schumann 	int (*s_close)(PS_CLOSE_ARGS);
465e601732SSascha Schumann 	int (*s_read)(PS_READ_ARGS);
475e601732SSascha Schumann 	int (*s_write)(PS_WRITE_ARGS);
485e601732SSascha Schumann 	int (*s_destroy)(PS_DESTROY_ARGS);
49a4a2f66eSYasuo Ohgaki 	zend_long (*s_gc)(PS_GC_ARGS);
50c9bca503SXinchen Hui 	zend_string *(*s_create_sid)(PS_CREATE_SID_ARGS);
51e6c8640aSYasuo Ohgaki 	int (*s_validate_sid)(PS_VALIDATE_SID_ARGS);
52e6c8640aSYasuo Ohgaki 	int (*s_update_timestamp)(PS_UPDATE_TIMESTAMP_ARGS);
53a1b42e3fSSascha Schumann } ps_module;
54a1b42e3fSSascha Schumann 
5549824ee8SSascha Schumann #define PS_GET_MOD_DATA() *mod_data
5649824ee8SSascha Schumann #define PS_SET_MOD_DATA(a) *mod_data = (a)
57a1b42e3fSSascha Schumann 
585bbddee8SSascha Schumann #define PS_OPEN_FUNC(x) 	int ps_open_##x(PS_OPEN_ARGS)
595bbddee8SSascha Schumann #define PS_CLOSE_FUNC(x) 	int ps_close_##x(PS_CLOSE_ARGS)
605bbddee8SSascha Schumann #define PS_READ_FUNC(x) 	int ps_read_##x(PS_READ_ARGS)
615bbddee8SSascha Schumann #define PS_WRITE_FUNC(x) 	int ps_write_##x(PS_WRITE_ARGS)
625bbddee8SSascha Schumann #define PS_DESTROY_FUNC(x) 	int ps_delete_##x(PS_DESTROY_ARGS)
63a4a2f66eSYasuo Ohgaki #define PS_GC_FUNC(x) 		zend_long ps_gc_##x(PS_GC_ARGS)
64c9bca503SXinchen Hui #define PS_CREATE_SID_FUNC(x)	zend_string *ps_create_sid_##x(PS_CREATE_SID_ARGS)
65e6c8640aSYasuo Ohgaki #define PS_VALIDATE_SID_FUNC(x)	int ps_validate_sid_##x(PS_VALIDATE_SID_ARGS)
66e6c8640aSYasuo Ohgaki #define PS_UPDATE_TIMESTAMP_FUNC(x) 	int ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS)
67a1b42e3fSSascha Schumann 
68e6c8640aSYasuo Ohgaki /* Legacy save handler module definitions */
69a1b42e3fSSascha Schumann #define PS_FUNCS(x) \
70a1b42e3fSSascha Schumann 	PS_OPEN_FUNC(x); \
71a1b42e3fSSascha Schumann 	PS_CLOSE_FUNC(x); \
72a1b42e3fSSascha Schumann 	PS_READ_FUNC(x); \
73a1b42e3fSSascha Schumann 	PS_WRITE_FUNC(x); \
741798a018SZeev Suraski 	PS_DESTROY_FUNC(x); \
75346d74a1SMark L. Woodward 	PS_GC_FUNC(x);	\
763a3acee3SSascha Schumann 	PS_CREATE_SID_FUNC(x)
77a1b42e3fSSascha Schumann 
78a1b42e3fSSascha Schumann #define PS_MOD(x) \
795bbddee8SSascha Schumann 	#x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
80e6c8640aSYasuo Ohgaki 	 ps_delete_##x, ps_gc_##x, php_session_create_id, \
81e6c8640aSYasuo Ohgaki 	 php_session_validate_sid, php_session_update_timestamp
82346d74a1SMark L. Woodward 
83e6c8640aSYasuo Ohgaki /* Legacy SID creation enabled save handler module definitions */
84346d74a1SMark L. Woodward #define PS_FUNCS_SID(x) \
85346d74a1SMark L. Woodward 	PS_OPEN_FUNC(x); \
86346d74a1SMark L. Woodward 	PS_CLOSE_FUNC(x); \
87346d74a1SMark L. Woodward 	PS_READ_FUNC(x); \
88346d74a1SMark L. Woodward 	PS_WRITE_FUNC(x); \
89346d74a1SMark L. Woodward 	PS_DESTROY_FUNC(x); \
90346d74a1SMark L. Woodward 	PS_GC_FUNC(x); \
91e6c8640aSYasuo Ohgaki 	PS_CREATE_SID_FUNC(x); \
92e6c8640aSYasuo Ohgaki 	PS_VALIDATE_SID_FUNC(x); \
93e6c8640aSYasuo Ohgaki 	PS_UPDATE_TIMESTAMP_FUNC(x);
94346d74a1SMark L. Woodward 
95346d74a1SMark L. Woodward #define PS_MOD_SID(x) \
96346d74a1SMark L. Woodward 	#x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
97e6c8640aSYasuo Ohgaki 	 ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \
98e6c8640aSYasuo Ohgaki 	 php_session_validate_sid, php_session_update_timestamp
99e6c8640aSYasuo Ohgaki 
100e6c8640aSYasuo Ohgaki /* Update timestamp enabled save handler module definitions
101e6c8640aSYasuo Ohgaki    New save handlers should use this API */
102e6c8640aSYasuo Ohgaki #define PS_FUNCS_UPDATE_TIMESTAMP(x) \
103e6c8640aSYasuo Ohgaki 	PS_OPEN_FUNC(x); \
104e6c8640aSYasuo Ohgaki 	PS_CLOSE_FUNC(x); \
105e6c8640aSYasuo Ohgaki 	PS_READ_FUNC(x); \
106e6c8640aSYasuo Ohgaki 	PS_WRITE_FUNC(x); \
107e6c8640aSYasuo Ohgaki 	PS_DESTROY_FUNC(x); \
108e6c8640aSYasuo Ohgaki 	PS_GC_FUNC(x); \
109e6c8640aSYasuo Ohgaki 	PS_CREATE_SID_FUNC(x); \
110e6c8640aSYasuo Ohgaki 	PS_VALIDATE_SID_FUNC(x); \
111e6c8640aSYasuo Ohgaki 	PS_UPDATE_TIMESTAMP_FUNC(x);
112e6c8640aSYasuo Ohgaki 
113e6c8640aSYasuo Ohgaki #define PS_MOD_UPDATE_TIMESTAMP(x) \
114e6c8640aSYasuo Ohgaki 	#x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
115e6c8640aSYasuo Ohgaki 	 ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \
116e6c8640aSYasuo Ohgaki 	 ps_validate_sid_##x, ps_update_timestamp_##x
117e6c8640aSYasuo Ohgaki 
118a1b42e3fSSascha Schumann 
119e15d0193SHartmut Holzgraefe typedef enum {
120e15d0193SHartmut Holzgraefe 	php_session_disabled,
121e15d0193SHartmut Holzgraefe 	php_session_none,
1228dd296ddSDoug MacEachern 	php_session_active
123e15d0193SHartmut Holzgraefe } php_session_status;
124e15d0193SHartmut Holzgraefe 
125da9448f3SArnaud Le Blanc typedef struct _php_session_rfc1867_progress {
126da9448f3SArnaud Le Blanc 	size_t    sname_len;
127da9448f3SArnaud Le Blanc 	zval      sid;
128da9448f3SArnaud Le Blanc 	smart_str key;
129da9448f3SArnaud Le Blanc 
130c3e3c98eSAnatol Belski 	zend_long      update_step;
131c3e3c98eSAnatol Belski 	zend_long      next_update;
132da9448f3SArnaud Le Blanc 	double    next_update_time;
133da9448f3SArnaud Le Blanc 	zend_bool cancel_upload;
134da9448f3SArnaud Le Blanc 	zend_bool apply_trans_sid;
135da9448f3SArnaud Le Blanc 	size_t    content_length;
136da9448f3SArnaud Le Blanc 
137c9bca503SXinchen Hui 	zval      data;                 /* the array exported to session data */
1385c1595caSXinchen Hui 	zval	 *post_bytes_processed; /* data["bytes_processed"] */
139c9bca503SXinchen Hui 	zval      files;                /* data["files"] array */
140c9bca503SXinchen Hui 	zval      current_file;         /* array of currently uploading file */
1415c1595caSXinchen Hui 	zval	 *current_file_bytes_processed;
142da9448f3SArnaud Le Blanc } php_session_rfc1867_progress;
143da9448f3SArnaud Le Blanc 
144bc596544SZeev Suraski typedef struct _php_ps_globals {
145a1b42e3fSSascha Schumann 	char *save_path;
146a1b42e3fSSascha Schumann 	char *session_name;
147c9bca503SXinchen Hui 	zend_string *id;
148070dfe08SSascha Schumann 	char *extern_referer_chk;
149996216b4SSascha Schumann 	char *cache_limiter;
150c3e3c98eSAnatol Belski 	zend_long cookie_lifetime;
1516a30ec53SSascha Schumann 	char *cookie_path;
1526a30ec53SSascha Schumann 	char *cookie_domain;
153e15d0193SHartmut Holzgraefe 	zend_bool  cookie_secure;
154e5fe441cSIlia Alshanetsky 	zend_bool  cookie_httponly;
15508b9310eSFrederik Bosch 	char *cookie_samesite;
15683e495e0SDmitry Stogov 	const ps_module *mod;
15783e495e0SDmitry Stogov 	const ps_module *default_mod;
158a1b42e3fSSascha Schumann 	void *mod_data;
159e15d0193SHartmut Holzgraefe 	php_session_status session_status;
160c3e3c98eSAnatol Belski 	zend_long gc_probability;
161c3e3c98eSAnatol Belski 	zend_long gc_divisor;
162c3e3c98eSAnatol Belski 	zend_long gc_maxlifetime;
16368de8a28SSascha Schumann 	int module_number;
164c3e3c98eSAnatol Belski 	zend_long cache_expire;
1653e99d5ccSGwynne Raskind 	union {
166e6c8640aSYasuo Ohgaki 		zval names[PS_NUM_APIS];
1673e99d5ccSGwynne Raskind 		struct {
168c9bca503SXinchen Hui 			zval ps_open;
169c9bca503SXinchen Hui 			zval ps_close;
170c9bca503SXinchen Hui 			zval ps_read;
171c9bca503SXinchen Hui 			zval ps_write;
172c9bca503SXinchen Hui 			zval ps_destroy;
173c9bca503SXinchen Hui 			zval ps_gc;
174c9bca503SXinchen Hui 			zval ps_create_sid;
175e6c8640aSYasuo Ohgaki 			zval ps_validate_sid;
176e6c8640aSYasuo Ohgaki 			zval ps_update_timestamp;
1773e99d5ccSGwynne Raskind 		} name;
1783e99d5ccSGwynne Raskind 	} mod_user_names;
1795bc97c6cSArpad Ray 	int mod_user_implemented;
1805bc97c6cSArpad Ray 	int mod_user_is_open;
1811f029140SSascha Schumann 	const struct ps_serializer_struct *serializer;
182c9bca503SXinchen Hui 	zval http_session_vars;
183fb69f854SZeev Suraski 	zend_bool auto_start;
184fb69f854SZeev Suraski 	zend_bool use_cookies;
185dcf67c44SSascha Schumann 	zend_bool use_only_cookies;
186f248df90SYasuo Ohgaki 	zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */
187f2f1f94eSSascha Schumann 
1883467526aSYasuo Ohgaki 	zend_long sid_length;
1893467526aSYasuo Ohgaki 	zend_long sid_bits_per_character;
1902699c26fSSascha Schumann 	int send_cookie;
1914ec77cfbSSascha Schumann 	int define_sid;
192da9448f3SArnaud Le Blanc 
193da9448f3SArnaud Le Blanc 	php_session_rfc1867_progress *rfc1867_progress;
194da9448f3SArnaud Le Blanc 	zend_bool rfc1867_enabled; /* session.upload_progress.enabled */
1954f3b6196SArnaud Le Blanc 	zend_bool rfc1867_cleanup; /* session.upload_progress.cleanup */
1965c1595caSXinchen Hui 	char *rfc1867_prefix;  /* session.upload_progress.prefix */
1975c1595caSXinchen Hui 	char *rfc1867_name;    /* session.upload_progress.name */
198c3e3c98eSAnatol Belski 	zend_long rfc1867_freq;         /* session.upload_progress.freq */
199da9448f3SArnaud Le Blanc 	double rfc1867_min_freq;   /* session.upload_progress.min_freq */
20025e8fcc8SYasuo Ohgaki 
20125e8fcc8SYasuo Ohgaki 	zend_bool use_strict_mode; /* whether or not PHP accepts unknown session ids */
202e6c8640aSYasuo Ohgaki 	zend_bool lazy_write; /* omit session write when it is possible */
203a93a51c3SYasuo Ohgaki 	zend_bool in_save_handler; /* state if session is in save handler or not */
204a93a51c3SYasuo Ohgaki 	zend_bool set_handler;     /* state if session module i setting handler or not */
2055eeec01bSAnatol Belski 	zend_string *session_vars; /* serialized original session data */
206a1b42e3fSSascha Schumann } php_ps_globals;
207a1b42e3fSSascha Schumann 
208ed6d751cSSterling Hughes typedef php_ps_globals zend_ps_globals;
209ed6d751cSSterling Hughes 
210a1b42e3fSSascha Schumann extern zend_module_entry session_module_entry;
211a1b42e3fSSascha Schumann #define phpext_session_ptr &session_module_entry
212a1b42e3fSSascha Schumann 
213a1b42e3fSSascha Schumann #ifdef ZTS
214fea10f6aSAnatol Belski #define PS(v) ZEND_TSRMG(ps_globals_id, php_ps_globals *, v)
215fea10f6aSAnatol Belski #ifdef COMPILE_DL_SESSION
2161ac15293SNikita Popov ZEND_TSRMLS_CACHE_EXTERN()
217fea10f6aSAnatol Belski #endif
218a1b42e3fSSascha Schumann #else
219a1b42e3fSSascha Schumann #define PS(v) (ps_globals.v)
220a1b42e3fSSascha Schumann #endif
221a1b42e3fSSascha Schumann 
2227b6ed8dbSAnatol Belski #define PS_SERIALIZER_ENCODE_ARGS void
2233066851dSAnatol Belski #define PS_SERIALIZER_DECODE_ARGS const char *val, size_t vallen
2241f029140SSascha Schumann 
2251f029140SSascha Schumann typedef struct ps_serializer_struct {
2261f029140SSascha Schumann 	const char *name;
227c9bca503SXinchen Hui 	zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS);
2281f029140SSascha Schumann 	int (*decode)(PS_SERIALIZER_DECODE_ARGS);
2291f029140SSascha Schumann } ps_serializer;
2301f029140SSascha Schumann 
231ea563184SAndrei Zmievski #define PS_SERIALIZER_ENCODE_NAME(x) ps_srlzr_encode_##x
232ea563184SAndrei Zmievski #define PS_SERIALIZER_DECODE_NAME(x) ps_srlzr_decode_##x
233ea563184SAndrei Zmievski 
2341f029140SSascha Schumann #define PS_SERIALIZER_ENCODE_FUNC(x) \
235c9bca503SXinchen Hui 	zend_string *PS_SERIALIZER_ENCODE_NAME(x)(PS_SERIALIZER_ENCODE_ARGS)
2361f029140SSascha Schumann #define PS_SERIALIZER_DECODE_FUNC(x) \
237ea563184SAndrei Zmievski 	int PS_SERIALIZER_DECODE_NAME(x)(PS_SERIALIZER_DECODE_ARGS)
2381f029140SSascha Schumann 
2391f029140SSascha Schumann #define PS_SERIALIZER_FUNCS(x) \
2401f029140SSascha Schumann 	PS_SERIALIZER_ENCODE_FUNC(x); \
2411f029140SSascha Schumann 	PS_SERIALIZER_DECODE_FUNC(x)
2421f029140SSascha Schumann 
2431f029140SSascha Schumann #define PS_SERIALIZER_ENTRY(x) \
244ea563184SAndrei Zmievski 	{ #x, PS_SERIALIZER_ENCODE_NAME(x), PS_SERIALIZER_DECODE_NAME(x) }
245a1b42e3fSSascha Schumann 
246e6c8640aSYasuo Ohgaki /* default create id function */
247e6c8640aSYasuo Ohgaki PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS);
248e6c8640aSYasuo Ohgaki /* Dummy PS module functions */
249e6c8640aSYasuo Ohgaki PHPAPI int php_session_validate_sid(PS_VALIDATE_SID_ARGS);
250e6c8640aSYasuo Ohgaki PHPAPI int php_session_update_timestamp(PS_UPDATE_TIMESTAMP_ARGS);
251e6c8640aSYasuo Ohgaki 
252bdeb220fSAnatol Belski PHPAPI void session_adapt_url(const char *, size_t, char **, size_t *);
25323251ebdSThies C. Arntzen 
254e10425feSdreamszhu PHPAPI int php_session_destroy(void);
255bdeb220fSAnatol Belski PHPAPI void php_add_session_var(zend_string *name);
256bdeb220fSAnatol Belski PHPAPI zval *php_set_session_var(zend_string *name, zval *state_val, php_unserialize_data_t *var_hash);
257bdeb220fSAnatol Belski PHPAPI zval *php_get_session_var(zend_string *name);
258ea563184SAndrei Zmievski 
25983e495e0SDmitry Stogov PHPAPI int php_session_register_module(const ps_module *);
2609de9b7c1SSascha Schumann 
261847fd9d5SYasuo Ohgaki PHPAPI int php_session_register_serializer(const char *name,
262c9bca503SXinchen Hui 	        zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS),
263ea563184SAndrei Zmievski 	        int (*decode)(PS_SERIALIZER_DECODE_ARGS));
264ea563184SAndrei Zmievski 
265bdeb220fSAnatol Belski PHPAPI void php_session_set_id(char *id);
2667f196e32SYasuo Ohgaki PHPAPI int php_session_start(void);
267e10425feSdreamszhu PHPAPI int php_session_flush(int write);
268e302d6a5SSterling Hughes 
26983e495e0SDmitry Stogov PHPAPI const ps_module *_php_find_ps_module(char *name);
270bdeb220fSAnatol Belski PHPAPI const ps_serializer *_php_find_ps_serializer(char *name);
271b1d8f7e0SIlia Alshanetsky 
27225e8fcc8SYasuo Ohgaki PHPAPI int php_session_valid_key(const char *key);
2737f196e32SYasuo Ohgaki PHPAPI int php_session_reset_id(void);
27425e8fcc8SYasuo Ohgaki 
2753647fc6fSXinchen Hui #define PS_ADD_VARL(name) do {										\
276bdeb220fSAnatol Belski 	php_add_session_var(name);							\
277856cd5e1SSascha Schumann } while (0)
278ea563184SAndrei Zmievski 
2793647fc6fSXinchen Hui #define PS_ADD_VAR(name) PS_ADD_VARL(name)
280ea563184SAndrei Zmievski 
2813647fc6fSXinchen Hui #define PS_DEL_VARL(name) do {										\
282d8651fbeSXinchen Hui 	if (!Z_ISNULL(PS(http_session_vars))) {							\
2833647fc6fSXinchen Hui 		zend_hash_del(Z_ARRVAL(PS(http_session_vars)), name);		\
2843647fc6fSXinchen Hui 	}																\
285856cd5e1SSascha Schumann } while (0)
286a702dc02SZeev Suraski 
287ea563184SAndrei Zmievski 
2883647fc6fSXinchen Hui #define PS_ENCODE_VARS 												\
2893647fc6fSXinchen Hui 	zend_string *key;												\
290c3e3c98eSAnatol Belski 	zend_ulong num_key;													\
291c9bca503SXinchen Hui 	zval *struc;
292ea563184SAndrei Zmievski 
2938d87e3b8SXinchen Hui #define PS_ENCODE_LOOP(code) do {									\
2948d87e3b8SXinchen Hui 	HashTable *_ht = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars)));	\
2958d87e3b8SXinchen Hui 	ZEND_HASH_FOREACH_KEY(_ht, num_key, key) {						\
2968d87e3b8SXinchen Hui 		if (key == NULL) {											\
297ccf4ae95SDmitry Stogov 			php_error_docref(NULL, E_NOTICE,						\
298ccf4ae95SDmitry Stogov 					"Skipping numeric key " ZEND_LONG_FMT, num_key);\
2998d87e3b8SXinchen Hui 			continue;												\
3008d87e3b8SXinchen Hui 		}															\
301ccf4ae95SDmitry Stogov 		if ((struc = php_get_session_var(key))) {					\
3028d87e3b8SXinchen Hui 			code;		 											\
3038d87e3b8SXinchen Hui 		} 															\
3048d87e3b8SXinchen Hui 	} ZEND_HASH_FOREACH_END();										\
3058d87e3b8SXinchen Hui } while(0)
306ea563184SAndrei Zmievski 
3076a1d0114Sfoobar PHPAPI ZEND_EXTERN_MODULE_GLOBALS(ps)
308ea563184SAndrei Zmievski 
309ea563184SAndrei Zmievski void php_session_auto_start(void *data);
310ea563184SAndrei Zmievski 
3115bc97c6cSArpad Ray #define PS_CLASS_NAME "SessionHandler"
312f7f32ba4Sdreamszhu extern PHPAPI zend_class_entry *php_session_class_entry;
3135bc97c6cSArpad Ray 
3145142a4edSArpad Ray #define PS_IFACE_NAME "SessionHandlerInterface"
315f7f32ba4Sdreamszhu extern PHPAPI zend_class_entry *php_session_iface_entry;
3165142a4edSArpad Ray 
3171e836cddSArpad Ray #define PS_SID_IFACE_NAME "SessionIdInterface"
318f7f32ba4Sdreamszhu extern PHPAPI zend_class_entry *php_session_id_iface_entry;
3191e836cddSArpad Ray 
320e6c8640aSYasuo Ohgaki #define PS_UPDATE_TIMESTAMP_IFACE_NAME "SessionUpdateTimestampHandlerInterface"
321f7f32ba4Sdreamszhu extern PHPAPI zend_class_entry *php_session_update_timestamp_iface_entry;
322e6c8640aSYasuo Ohgaki 
3235bc97c6cSArpad Ray extern PHP_METHOD(SessionHandler, open);
3245bc97c6cSArpad Ray extern PHP_METHOD(SessionHandler, close);
3255bc97c6cSArpad Ray extern PHP_METHOD(SessionHandler, read);
3265bc97c6cSArpad Ray extern PHP_METHOD(SessionHandler, write);
3275bc97c6cSArpad Ray extern PHP_METHOD(SessionHandler, destroy);
3285bc97c6cSArpad Ray extern PHP_METHOD(SessionHandler, gc);
32959cf3a24SLeigh extern PHP_METHOD(SessionHandler, create_sid);
330e6c8640aSYasuo Ohgaki extern PHP_METHOD(SessionHandler, validateId);
331e6c8640aSYasuo Ohgaki extern PHP_METHOD(SessionHandler, updateTimestamp);
3325bc97c6cSArpad Ray 
333a1b42e3fSSascha Schumann #endif
334