Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2020-06-25 03:00:01 +0300
committerGitHub <noreply@github.com>2020-06-25 03:00:01 +0300
commita311cc4ec3cecdbaf83ba66985efa82137e37cc0 (patch)
tree078ca80c140e3a77e088a213066b27d0b350c7c6 /php_redis.h
parent04def9fbe2194b3b711362de57260a6cd5216e69 (diff)
Support for Redis 6 ACLs (#1791)
Add support for Redis 6 ACLs in the `Redis`, `RedisCluster`, and `RedisArray` classes. On a related note, it adds a mechanism for users to customize how we generate persistent connection IDs such that they can be grouped in different ways depending on the specific use case required (e.g. it would allow connections to be grouped by username, or by user-defined persistent_id, or both).
Diffstat (limited to 'php_redis.h')
-rw-r--r--php_redis.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/php_redis.h b/php_redis.h
index af77ea00..a4ff9f4b 100644
--- a/php_redis.h
+++ b/php_redis.h
@@ -27,6 +27,7 @@
PHP_METHOD(Redis, __construct);
PHP_METHOD(Redis, __destruct);
+PHP_METHOD(Redis, acl);
PHP_METHOD(Redis, append);
PHP_METHOD(Redis, auth);
PHP_METHOD(Redis, bgSave);
@@ -252,6 +253,18 @@ PHP_METHOD(Redis, getPersistentID);
PHP_METHOD(Redis, getAuth);
PHP_METHOD(Redis, getMode);
+/* For convenience we store the salt as a printable hex string which requires 2
+ * characters per byte + 1 for the NULL terminator */
+#define REDIS_SALT_BYTES 32
+#define REDIS_SALT_SIZE ((2 * REDIS_SALT_BYTES) + 1)
+
+ZEND_BEGIN_MODULE_GLOBALS(redis)
+ char salt[REDIS_SALT_SIZE];
+ZEND_END_MODULE_GLOBALS(redis)
+
+ZEND_EXTERN_MODULE_GLOBALS(redis)
+#define REDIS_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(redis, v)
+
#ifdef ZTS
#include "TSRM.h"
#endif
@@ -261,8 +274,9 @@ PHP_MSHUTDOWN_FUNCTION(redis);
PHP_MINFO_FUNCTION(redis);
/* Redis response handler function callback prototype */
-typedef void (*ResultCallback)(INTERNAL_FUNCTION_PARAMETERS,
- RedisSock *redis_sock, zval *z_tab, void *ctx);
+typedef void (*ResultCallback)(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, zval *z_tab, void *ctx);
+
+typedef int (*FailableResultCallback)(INTERNAL_FUNCTION_PARAMETERS, RedisSock*, zval*, void*);
PHP_REDIS_API int redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);