summaryrefslogtreecommitdiff
path: root/hiredis.h
diff options
context:
space:
mode:
authorMark Nunberg <mnunberg@haskalah.org>2017-11-27 13:10:21 +0000
committerMark Nunberg <mnunberg@haskalah.org>2019-02-20 09:10:10 -0500
commit0c1454490669f3c95e3c8b0ac6a83582d14e30e0 (patch)
tree858e159c0f3ba74849dd9f7b4a40edd93b6791fe /hiredis.h
parent4d00404b8fb47e618474d5538e4a720ac1c95d95 (diff)
Initial SSL (sync) implementation
Diffstat (limited to 'hiredis.h')
-rw-r--r--hiredis.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/hiredis.h b/hiredis.h
index 1b0d5e6..29c0253 100644
--- a/hiredis.h
+++ b/hiredis.h
@@ -74,6 +74,9 @@
/* Flag that is set when we should set SO_REUSEADDR before calling bind() */
#define REDIS_REUSEADDR 0x80
+/* Flag that is set when this connection is done through SSL */
+#define REDIS_SSL 0x100
+
#define REDIS_KEEPALIVE_INTERVAL 15 /* seconds */
/* number of times we retry to connect in the case of EADDRNOTAVAIL and
@@ -112,6 +115,8 @@ enum redisConnectionType {
REDIS_CONN_UNIX
};
+struct redisSsl;
+
/* Context for a connection to Redis */
typedef struct redisContext {
int err; /* Error flags, 0 when there is no error */
@@ -137,6 +142,9 @@ typedef struct redisContext {
/* For non-blocking connect */
struct sockadr *saddr;
size_t addrlen;
+ /* For SSL communication */
+ struct redisSsl *ssl;
+
} redisContext;
redisContext *redisConnect(const char *ip, int port);
@@ -152,6 +160,13 @@ redisContext *redisConnectUnixNonBlock(const char *path);
redisContext *redisConnectFd(int fd);
/**
+ * Secure the connection using SSL. This should be done before any command is
+ * executed on the connection.
+ */
+int redisSecureConnection(redisContext *c, const char *capath, const char *certpath,
+ const char *keypath);
+
+/**
* Reconnect the given context using the saved information.
*
* This re-uses the exact same connect options as in the initial connection.