diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-12-16 23:32:02 +0100 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-12-23 11:01:11 +0000 |
commit | a1e97d692e3b9ed3cd6c8751a70665d832199fff (patch) | |
tree | 9ea6957a2c0131f4e75feee38e5bcfdbd2666ff0 /deps/hiredis/async.h | |
parent | d3e5e28804bd3cfd038d95a1ffd85a92941bc788 (diff) | |
download | redis-a1e97d692e3b9ed3cd6c8751a70665d832199fff.tar.gz |
Update hiredis to 0.9.2
Diffstat (limited to 'deps/hiredis/async.h')
-rw-r--r-- | deps/hiredis/async.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/deps/hiredis/async.h b/deps/hiredis/async.h index d0a99da70..2ef0e21eb 100644 --- a/deps/hiredis/async.h +++ b/deps/hiredis/async.h @@ -31,6 +31,10 @@ #define __HIREDIS_ASYNC_H #include "hiredis.h" +#ifdef __cplusplus +extern "C" { +#endif + struct redisAsyncContext; /* need forward declaration of redisAsyncContext */ /* Reply callback prototype and container */ @@ -46,8 +50,9 @@ typedef struct redisCallbackList { redisCallback *head, *tail; } redisCallbackList; -/* Disconnect callback prototype */ +/* Connection callback prototypes */ typedef void (redisDisconnectCallback)(const struct redisAsyncContext*, int status); +typedef void (redisConnectCallback)(const struct redisAsyncContext*); /* Context for an async connection to Redis */ typedef struct redisAsyncContext { @@ -58,6 +63,12 @@ typedef struct redisAsyncContext { int err; char *errstr; + /* Not used by hiredis */ + void *data; + + /* Used by the different event lib adapters to store their private data */ + void *_adapter_data; + /* Called when the library expects to start reading/writing. * The supplied functions should be idempotent. */ void (*evAddRead)(void *privdata); @@ -65,12 +76,14 @@ typedef struct redisAsyncContext { void (*evAddWrite)(void *privdata); void (*evDelWrite)(void *privdata); void (*evCleanup)(void *privdata); - void *data; /* Called when either the connection is terminated due to an error or per * user request. The status is set accordingly (REDIS_OK, REDIS_ERR). */ redisDisconnectCallback *onDisconnect; + /* Called when the first write event was received. */ + redisConnectCallback *onConnect; + /* Reply callbacks */ redisCallbackList replies; } redisAsyncContext; @@ -78,6 +91,7 @@ typedef struct redisAsyncContext { /* Functions that proxy to hiredis */ redisAsyncContext *redisAsyncConnect(const char *ip, int port); int redisAsyncSetReplyObjectFunctions(redisAsyncContext *ac, redisReplyObjectFunctions *fn); +int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn); int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn); void redisAsyncDisconnect(redisAsyncContext *ac); @@ -91,4 +105,8 @@ int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdat int redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, ...); int redisAsyncCommandArgv(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, int argc, const char **argv, const size_t *argvlen); +#ifdef __cplusplus +} +#endif + #endif |