diff options
Diffstat (limited to 'hiredis.h')
-rw-r--r-- | hiredis.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/hiredis.h b/hiredis.h new file mode 100644 index 0000000..78da115 --- /dev/null +++ b/hiredis.h @@ -0,0 +1,25 @@ +#ifndef __HIREDIS_H +#define __HIREDIS_H + +#define REDIS_REPLY_ERROR 0 +#define REDIS_REPLY_STRING 1 +#define REDIS_REPLY_ARRAY 2 +#define REDIS_REPLY_INTEGER 3 +#define REDIS_REPLY_NIL 4 + +#include "sds.h" + +/* This is the reply object returned by redisCommand() */ +typedef struct redisReply { + int type; /* REDIS_REPLY_* */ + long long integer; /* The integer when type is REDIS_REPLY_INTEGER */ + char *reply; /* Used for both REDIS_REPLY_ERROR and REDIS_REPLY_STRING */ + size_t elements; /* number of elements, for REDIS_REPLY_ARRAY */ + struct redisReply **element; /* elements vector for REDIS_REPLY_ARRAY */ +} redisReply; + +redisReply *redisConnect(int *fd, char *ip, int port); +void freeReplyObject(redisReply *r); +redisReply *redisCommand(int fd, char *format, ...); + +#endif |