07aa796d958b8d2b1e7497ef8b7a6492df5d59a5
[m6w6/ext-http] / php_http_persistent_handle.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_persistent_handle_api.h 292841 2009-12-31 08:48:57Z mike $ */
14
15 #ifndef PHP_HTTP_PERSISTENT_HANDLE_H
16 #define PHP_HTTP_PERSISTENT_HANDLE_H
17
18 #include "php_http_resource_factory.h"
19
20 typedef struct php_http_persistent_handle_factory {
21 void *provider;
22
23 struct {
24 char *str;
25 size_t len;
26 } ident;
27
28 unsigned free_on_abandon:1;
29 } php_http_persistent_handle_factory_t;
30
31 struct php_http_persistent_handle_globals {
32 ulong limit;
33 struct {
34 ulong h;
35 char *s;
36 size_t l;
37 } ident;
38 };
39
40 PHP_MINIT_FUNCTION(http_persistent_handle);
41 PHP_MSHUTDOWN_FUNCTION(http_persistent_handle);
42
43 PHP_HTTP_API STATUS php_http_persistent_handle_provide(const char *name_str, size_t name_len, php_http_resource_factory_ops_t *fops, void *data, void (*dtor)(void *));
44 PHP_HTTP_API php_http_persistent_handle_factory_t *php_http_persistent_handle_concede(php_http_persistent_handle_factory_t *a, const char *name_str, size_t name_len, const char *ident_str, size_t ident_len TSRMLS_DC);
45 PHP_HTTP_API void php_http_persistent_handle_abandon(php_http_persistent_handle_factory_t *a);
46 PHP_HTTP_API void *php_http_persistent_handle_acquire(php_http_persistent_handle_factory_t *a TSRMLS_DC);
47 PHP_HTTP_API void php_http_persistent_handle_release(php_http_persistent_handle_factory_t *a, void *handle TSRMLS_DC);
48 PHP_HTTP_API void *php_http_persistent_handle_accrete(php_http_persistent_handle_factory_t *a, void *handle TSRMLS_DC);
49
50 PHP_HTTP_API php_http_resource_factory_ops_t *php_http_persistnet_handle_factory_ops(void);
51
52 PHP_HTTP_API void php_http_persistent_handle_cleanup(const char *name_str, size_t name_len, const char *ident_str, size_t ident_len TSRMLS_DC);
53 PHP_HTTP_API HashTable *php_http_persistent_handle_statall(HashTable *ht TSRMLS_DC);
54
55 PHP_HTTP_API STATUS php_http_persistent_handle_acquire2(const char *name_str, size_t name_len, const char *ident_str, size_t ident_len, void **handle TSRMLS_DC);
56 PHP_HTTP_API STATUS php_http_persistent_handle_release2(const char *name_str, size_t name_len, const char *ident_str, size_t ident_len, void **handle TSRMLS_DC);
57 PHP_HTTP_API STATUS php_http_persistent_handle_accrete2(const char *name_str, size_t name_len, const char *ident_str, size_t ident_len, void *old_handle, void **new_handle TSRMLS_DC);
58
59 #endif /* PHP_HTTP_PERSISTENT_HANDLE_H */
60
61 /*
62 * Local variables:
63 * tab-width: 4
64 * c-basic-offset: 4
65 * End:
66 * vim600: noet sw=4 ts=4 fdm=marker
67 * vim<600: noet sw=4 ts=4
68 */