13 #ifndef PHP_RAPHF_API_H
14 #define PHP_RAPHF_API_H
25 typedef void *(*php_resource_factory_handle_ctor_t)(
void *opaque,
void *init_arg);
33 typedef void *(*php_resource_factory_handle_copy_t)(
void *opaque,
void *handle);
88 void (*dtor)(
void *data));
231 void *data,
void (*dtor)(
void *));
252 zend_string *name, zend_string *ident,
void(* dtor)(void *data)
User data destructor.
Definition: php_raphf_api.h:67
void * data
Opaque user data.
Definition: php_raphf_api.h:65
php_resource_factory_handle_copy_t copy
The resource's copy constructor.
Definition: php_raphf_api.h:53
void php_resource_factory_free(php_resource_factory_t **f)
Destroy and free the resource factory.
Definition: php_raphf_api.c:84
void *(* php_resource_factory_handle_ctor_t)(void *opaque, void *init_arg)
A resource constructor.
Definition: php_raphf_api.h:25
void(* php_persistent_handle_wakeup_t)(php_persistent_handle_factory_t *f, void **handle)
Wakeup the persistent handle on re-acquisition.
Definition: php_raphf_api.h:180
php_persistent_handle_list_t list
The list of free handles.
Definition: php_raphf_api.h:166
HashTable * php_persistent_handle_statall(HashTable *ht)
Retrieve statistics about the current process/thread's persistent handles.
Definition: php_raphf_api.c:493
unsigned php_resource_factory_addref(php_resource_factory_t *rf)
Increase the refcount of the resource factory.
Definition: php_raphf_api.c:70
void(* php_persistent_handle_retire_t)(php_persistent_handle_factory_t *f, void **handle)
Retire the persistent handle on release.
Definition: php_raphf_api.h:185
void php_persistent_handle_cleanup(zend_string *name, zend_string *ident)
Clean persistent handles up.
Definition: php_raphf_api.c:463
Persistent handles storage.
Definition: php_raphf_api.h:149
struct php_persistent_handle_list php_persistent_handle_list_t
Persistent handles storage.
unsigned refcount
How often this factory is referenced.
Definition: php_raphf_api.h:69
php_resource_factory_handle_dtor_t dtor
The resource's destructor.
Definition: php_raphf_api.h:55
void php_persistent_handle_abandon(php_persistent_handle_factory_t *a)
Abandon the persistent handle factory.
Definition: php_raphf_api.c:374
Definition of a persistent handle factory.
Definition: php_raphf_api.h:195
php_persistent_handle_retire_t retire
The persistent handle retire routine; may be NULL.
Definition: php_raphf_api.h:201
unsigned free_on_abandon
Whether it has to be free'd on php_persistent_handle_abandon()
Definition: php_raphf_api.h:207
php_resource_factory_t rf
The resource factory.
Definition: php_raphf_api.h:172
void *(* php_resource_factory_handle_copy_t)(void *opaque, void *handle)
The copy constructor of a resource.
Definition: php_raphf_api.h:33
#define PHP_RAPHF_API
Definition: php_raphf.h:26
void * php_persistent_handle_acquire(php_persistent_handle_factory_t *a, void *init_arg)
Acquire a persistent handle.
Definition: php_raphf_api.c:389
php_resource_factory_handle_ctor_t ctor
The resource constructor.
Definition: php_raphf_api.h:51
void(* php_resource_factory_handle_dtor_t)(void *opaque, void *handle)
The destructor of a resource.
Definition: php_raphf_api.h:41
HashTable free
Storage of free resources.
Definition: php_raphf_api.h:151
The resource ops consisting of a ctor, a copy ctor and a dtor.
Definition: php_raphf_api.h:49
php_persistent_handle_provider_t * provider
The persistent handle provider.
Definition: php_raphf_api.h:197
ulong used
Count of acquired resources.
Definition: php_raphf_api.h:153
php_resource_factory_ops_t * php_persistent_handle_get_resource_factory_ops(void)
Retrieve persistent handle resource factory ops.
Definition: php_raphf_api.c:516
void php_resource_factory_dtor(php_resource_factory_t *f)
Destroy the resource factory.
Definition: php_raphf_api.c:75
php_resource_factory_t * php_persistent_handle_resource_factory_init(php_resource_factory_t *a, php_persistent_handle_factory_t *pf)
Create a resource factory for persistent handles.
Definition: php_raphf_api.c:118
struct php_resource_factory php_resource_factory_t
The resource factory.
void * php_resource_factory_handle_ctor(php_resource_factory_t *f, void *init_arg)
Construct a resource by the resource factory f.
Definition: php_raphf_api.c:95
Definition of a persistent handle provider.
Definition: php_raphf_api.h:160
zend_string * ident
The ident for which this factory manages resources.
Definition: php_raphf_api.h:204
The resource factory.
Definition: php_raphf_api.h:61
void php_persistent_handle_release(php_persistent_handle_factory_t *a, void *handle)
Release a persistent handle.
Definition: php_raphf_api.c:440
php_persistent_handle_factory_t * php_persistent_handle_concede(php_persistent_handle_factory_t *a, zend_string *name, zend_string *ident, php_persistent_handle_wakeup_t wakeup, php_persistent_handle_retire_t retire)
Retrieve a persistent handle factory at runtime.
Definition: php_raphf_api.c:341
void php_resource_factory_handle_dtor(php_resource_factory_t *f, void *handle)
Destroy (and free) the resource.
Definition: php_raphf_api.c:111
void * php_resource_factory_handle_copy(php_resource_factory_t *f, void *handle)
Create a copy of the resource handle.
Definition: php_raphf_api.c:103
struct php_persistent_handle_provider php_persistent_handle_provider_t
Definition of a persistent handle provider.
php_persistent_handle_wakeup_t wakeup
The persistent handle wakeup routine; may be NULL.
Definition: php_raphf_api.h:199
php_resource_factory_t * php_resource_factory_init(php_resource_factory_t *f, php_resource_factory_ops_t *fops, void *data, void(*dtor)(void *data))
Initialize a resource factory.
Definition: php_raphf_api.c:52
ZEND_RESULT_CODE php_persistent_handle_provide(zend_string *name, php_resource_factory_ops_t *fops, void *data, void(*dtor)(void *))
Register a persistent handle provider in MINIT.
Definition: php_raphf_api.c:311
zend_bool php_resource_factory_is_persistent(php_resource_factory_t *a)
Check whether a resource factory is a persistent handle resource factory.
Definition: php_raphf_api.c:126
struct php_resource_factory_ops php_resource_factory_ops_t
The resource ops consisting of a ctor, a copy ctor and a dtor.
php_resource_factory_ops_t fops
The resource ops.
Definition: php_raphf_api.h:63
void * php_persistent_handle_accrete(php_persistent_handle_factory_t *a, void *handle)
Copy a persistent handle.
Definition: php_raphf_api.c:423