Files
addons
app_download_files
extend
hyhproject
mobile
oss
static
thinkphp
upload
vendor
5ini99
composer
oss-sdk
swoole
.github
benchmark
examples
include
helper
Client.h
Connection.h
ReadMe
RingQueue.h
Server.h
array.h
asm_context.h
async.h
atomic.h
base64.h
buffer.h
context.h
coroutine.h
error.h
hash.h
hashmap.h
heap.h
http.h
http2.h
list.h
mqtt.h
rbtree.h
redis.h
sha1.h
socks5.h
swoole.h
table.h
tests.h
uthash.h
websocket.h
src
tests
thirdparty
tools
travis
.gitignore
.gitmodules
.travis.yml
CMakeLists.txt
CREDITS
LICENSE
README.md
Version2.md
build.sh
clear.sh
config.m4
make.sh
package.xml
php7_wrapper.h
php_swoole.h
swoole.c
swoole_async.c
swoole_atomic.c
swoole_buffer.c
swoole_channel.c
swoole_channel_coro.cc
swoole_client.c
swoole_client_coro.c
swoole_config.h
swoole_coroutine.cc
swoole_coroutine.h
swoole_coroutine_util.c
swoole_event.c
swoole_http.h
swoole_http_client.c
swoole_http_client.h
swoole_http_client_coro.c
swoole_http_server.c
swoole_http_v2_client.c
swoole_http_v2_client.h
swoole_http_v2_client_coro.c
swoole_http_v2_server.c
swoole_lock.c
swoole_memory_pool.c
swoole_mmap.c
swoole_msgqueue.c
swoole_mysql.c
swoole_mysql.h
swoole_mysql_coro.c
swoole_postgresql_coro.c
swoole_postgresql_coro.h
swoole_process.c
swoole_process_pool.c
swoole_redis.c
swoole_redis_coro.c
swoole_redis_server.c
swoole_ringqueue.c
swoole_runtime.cc
swoole_serialize.c
swoole_serialize.h
swoole_server.c
swoole_server_port.c
swoole_socket_coro.c
swoole_table.c
swoole_timer.c
swoole_trace.c
swoole_websocket_server.c
wechat
.htaccess
autoload.php
wxtmp
.gitignore
.htaccess
.user.ini
404.html
H5436787D.wgt
admin.php
app-release.apk
app_download.html
cash.lock
demo.php
get_startup.php
get_version.php
get_version_new.php
index.html
index.php
reg.lock
robots.txt
qlg.tsgz.moe/vendor/swoole/include/redis.h
2019-09-06 23:53:10 +08:00

73 lines
2.0 KiB
C
Executable File

/*
+----------------------------------------------------------------------+
| Swoole |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 of the Apache license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.apache.org/licenses/LICENSE-2.0.html |
| If you did not receive a copy of the Apache2.0 license and are unable|
| to obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Tianfeng Han <mikan.tenny@gmail.com> |
+----------------------------------------------------------------------+
*/
#ifndef SW_REDIS_H_
#define SW_REDIS_H_
#ifdef __cplusplus
extern "C"
{
#endif
enum swRedis_receive_state
{
SW_REDIS_RECEIVE_TOTAL_LINE,
SW_REDIS_RECEIVE_LENGTH,
SW_REDIS_RECEIVE_STRING,
};
enum swRedis_reply_type
{
SW_REDIS_REPLY_ERROR,
SW_REDIS_REPLY_NIL,
SW_REDIS_REPLY_STATUS,
SW_REDIS_REPLY_INT,
SW_REDIS_REPLY_STRING,
SW_REDIS_REPLY_SET,
SW_REDIS_REPLY_MAP,
};
#define SW_REDIS_RETURN_NIL "$-1\r\n"
#define SW_REDIS_MAX_COMMAND_SIZE 64
#define SW_REDIS_MAX_LINES 128
#define SW_REDIS_MAX_STRING_SIZE 536870912 //512M
static sw_inline char* swRedis_get_number(char *p, int *_ret)
{
char *endptr;
p++;
int ret = strtol(p, &endptr, 10);
if (strncmp(SW_CRLF, endptr, SW_CRLF_LEN) == 0)
{
p += (endptr - p) + SW_CRLF_LEN;
*_ret = ret;
return p;
}
else
{
return NULL;
}
}
int swRedis_recv(swProtocol *protocol, swConnection *conn, swString *buffer);
#ifdef __cplusplus
}
#endif
#endif /* SW_REDIS_H_ */