|
| 1 | +/* |
| 2 | + +----------------------------------------------------------------------+ |
| 3 | + | PHP Version 5 | |
| 4 | + +----------------------------------------------------------------------+ |
| 5 | + | Copyright (c) 1997-2009 The PHP Group | |
| 6 | + +----------------------------------------------------------------------+ |
| 7 | + | This source file is subject to version 3.01 of the PHP license, | |
| 8 | + | that is bundled with this package in the file LICENSE, and is | |
| 9 | + | available through the world-wide-web at the following url: | |
| 10 | + | http://www.php.net/license/3_01.txt | |
| 11 | + | If you did not receive a copy of the PHP license and are unable to | |
| 12 | + | obtain it through the world-wide-web, please send a note to | |
| 13 | + | [email protected] so we can mail you a copy immediately. | |
| 14 | + +----------------------------------------------------------------------+ |
| 15 | + | Author: Alfonso Jimenez <[email protected]> | |
| 16 | + +----------------------------------------------------------------------+ |
| 17 | +*/ |
| 18 | + |
| 19 | +#ifndef PHP_REDIS_H |
| 20 | +#define PHP_REDIS_H |
| 21 | + |
| 22 | +extern zend_module_entry redis_module_entry; |
| 23 | + |
| 24 | +PHP_METHOD(Redis, __construct); |
| 25 | +PHP_METHOD(Redis, connect); |
| 26 | +PHP_METHOD(Redis, close); |
| 27 | +PHP_METHOD(Redis, ping); |
| 28 | +PHP_METHOD(Redis, get); |
| 29 | +PHP_METHOD(Redis, set); |
| 30 | +PHP_METHOD(Redis, add); |
| 31 | +PHP_METHOD(Redis, getMultiple); |
| 32 | +PHP_METHOD(Redis, exists); |
| 33 | +PHP_METHOD(Redis, delete); |
| 34 | +PHP_METHOD(Redis, incr); |
| 35 | +PHP_METHOD(Redis, decr); |
| 36 | +PHP_METHOD(Redis, type); |
| 37 | +PHP_METHOD(Redis, getKeys); |
| 38 | +PHP_METHOD(Redis, getSort); |
| 39 | +PHP_METHOD(Redis, lPush); |
| 40 | +PHP_METHOD(Redis, rPush); |
| 41 | +PHP_METHOD(Redis, lPop); |
| 42 | +PHP_METHOD(Redis, lSize); |
| 43 | +PHP_METHOD(Redis, lRemove); |
| 44 | +PHP_METHOD(Redis, listTrim); |
| 45 | +PHP_METHOD(Redis, lGet); |
| 46 | +PHP_METHOD(Redis, lGetRange); |
| 47 | +PHP_METHOD(Redis, lSet); |
| 48 | +PHP_METHOD(Redis, sAdd); |
| 49 | +PHP_METHOD(Redis, sSize); |
| 50 | +PHP_METHOD(Redis, sRemove); |
| 51 | +PHP_METHOD(Redis, sContains); |
| 52 | +PHP_METHOD(Redis, sGetMembers); |
| 53 | +PHP_METHOD(Redis, setTimeout); |
| 54 | + |
| 55 | +#ifdef PHP_WIN32 |
| 56 | +#define PHP_REDIS_API __declspec(dllexport) |
| 57 | +#else |
| 58 | +#define PHP_REDIS_API |
| 59 | +#endif |
| 60 | + |
| 61 | +#ifdef ZTS |
| 62 | +#include "TSRM.h" |
| 63 | +#endif |
| 64 | + |
| 65 | +PHP_MINIT_FUNCTION(redis); |
| 66 | +PHP_MSHUTDOWN_FUNCTION(redis); |
| 67 | +PHP_RINIT_FUNCTION(redis); |
| 68 | +PHP_RSHUTDOWN_FUNCTION(redis); |
| 69 | +PHP_MINFO_FUNCTION(redis); |
| 70 | + |
| 71 | +/* {{{ struct RedisSock */ |
| 72 | +typedef struct RedisSock_ { |
| 73 | + php_stream *stream; |
| 74 | + char *host; |
| 75 | + unsigned short port; |
| 76 | + long timeout; |
| 77 | + int failed; |
| 78 | + int status; |
| 79 | +} RedisSock; |
| 80 | +/* }}} */ |
| 81 | + |
| 82 | +#define redis_sock_name "Redis Socket Buffer" |
| 83 | + |
| 84 | +#define REDIS_SOCK_STATUS_FAILED 0 |
| 85 | +#define REDIS_SOCK_STATUS_DISCONNECTED 1 |
| 86 | +#define REDIS_SOCK_STATUS_UNKNOWN 2 |
| 87 | +#define REDIS_SOCK_STATUS_CONNECTED 3 |
| 88 | + |
| 89 | +/* {{{ internal function protos */ |
| 90 | +PHPAPI RedisSock* redis_sock_create(char *host, int host_len, unsigned short port, long timeout); |
| 91 | +PHPAPI int redis_sock_connect(RedisSock *redis_sock TSRMLS_DC); |
| 92 | +PHPAPI int redis_sock_disconnect(RedisSock *redis_sock TSRMLS_DC); |
| 93 | +PHPAPI int redis_sock_server_open(RedisSock *redis_sock, int TSRMLS_DC); |
| 94 | +PHPAPI char * redis_sock_read(RedisSock *redis_sock, int *buf_len TSRMLS_DC); |
| 95 | +PHPAPI char * redis_sock_read_bulk_reply(RedisSock *redis_sock, int bytes); |
| 96 | +PHPAPI int redis_sock_read_multibulk_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, int *buf_len TSRMLS_DC); |
| 97 | +PHPAPI int redis_sock_write(RedisSock *redis_sock, char *cmd, size_t sz); |
| 98 | +PHPAPI void redis_free_socket(RedisSock *redis_sock); |
| 99 | +/* }}} */ |
| 100 | + |
| 101 | +#ifdef ZTS |
| 102 | +#define REDIS_G(v) TSRMG(redis_globals_id, zend_redis_globals *, v) |
| 103 | +#else |
| 104 | +#define REDIS_G(v) (redis_globals.v) |
| 105 | +#endif |
| 106 | + |
| 107 | +#define PHP_REDIS_VERSION "0.1.0" |
| 108 | + |
| 109 | +#endif |
| 110 | + |
| 111 | +/* |
| 112 | + * Local variables: |
| 113 | + * tab-width: 4 |
| 114 | + * c-basic-offset: 4 |
| 115 | + * End: |
| 116 | + * vim600: noet sw=4 ts=4 fdm=marker |
| 117 | + * vim<600: noet sw=4 ts=4 |
| 118 | + */ |
0 commit comments