summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2011-04-21 14:23:59 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2011-04-21 14:23:59 +0200
commitf0307c61724c19fa4b1788f7b6b3ca83387ea8be (patch)
treec5b5d6b7ef5cc08da8818ddd8a95a85b6dd2b7f2
parent41d4d9c6f4493fc2d69ddee6123bee8cef01020f (diff)
Move definitions around
-rw-r--r--hiredis.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/hiredis.h b/hiredis.h
index b809e56..514025b 100644
--- a/hiredis.h
+++ b/hiredis.h
@@ -114,19 +114,7 @@ typedef struct redisReplyObjectFunctions {
void (*freeObject)(void*);
} redisReplyObjectFunctions;
-/* Context for a connection to Redis */
-typedef struct redisContext {
- int fd;
- int flags;
- char *obuf; /* Write buffer */
- int err; /* Error flags, 0 when there is no error */
- char *errstr; /* String representation of error when applicable */
-
- /* Function set for reply buildup and reply reader */
- redisReplyObjectFunctions *fn;
- void *reader;
-} redisContext;
-
+/* State for the protocol parser */
typedef struct redisReader {
int err; /* Error flags, 0 when there is no error */
char errstr[128]; /* String representation of error when applicable */
@@ -158,6 +146,19 @@ int redisvFormatCommand(char **target, const char *format, va_list ap);
int redisFormatCommand(char **target, const char *format, ...);
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
+/* Context for a connection to Redis */
+typedef struct redisContext {
+ int fd;
+ int flags;
+ char *obuf; /* Write buffer */
+ int err; /* Error flags, 0 when there is no error */
+ char *errstr; /* String representation of error when applicable */
+
+ /* Function set for reply buildup and reply reader */
+ redisReplyObjectFunctions *fn;
+ void *reader;
+} redisContext;
+
redisContext *redisConnect(const char *ip, int port);
redisContext *redisConnectWithTimeout(const char *ip, int port, struct timeval tv);
redisContext *redisConnectNonBlock(const char *ip, int port);