diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:31:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:31:02 +0000 |
commit | bb12c1fd00eb51118749bbbc69c5596835fcbd3b (patch) | |
tree | 88038a98bd31c1b765f3390767a2ec12e37c79ec /src/cli_common.h | |
parent | Initial commit. (diff) | |
download | redis-bb12c1fd00eb51118749bbbc69c5596835fcbd3b.tar.xz redis-bb12c1fd00eb51118749bbbc69c5596835fcbd3b.zip |
Adding upstream version 5:7.0.15.upstream/5%7.0.15upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cli_common.h')
-rw-r--r-- | src/cli_common.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/cli_common.h b/src/cli_common.h new file mode 100644 index 0000000..c5c4c11 --- /dev/null +++ b/src/cli_common.h @@ -0,0 +1,54 @@ +#ifndef __CLICOMMON_H +#define __CLICOMMON_H + +#include <hiredis.h> +#include <sdscompat.h> /* Use hiredis' sds compat header that maps sds calls to their hi_ variants */ + +typedef struct cliSSLconfig { + /* Requested SNI, or NULL */ + char *sni; + /* CA Certificate file, or NULL */ + char *cacert; + /* Directory where trusted CA certificates are stored, or NULL */ + char *cacertdir; + /* Skip server certificate verification. */ + int skip_cert_verify; + /* Client certificate to authenticate with, or NULL */ + char *cert; + /* Private key file to authenticate with, or NULL */ + char *key; + /* Preferred cipher list, or NULL (applies only to <= TLSv1.2) */ + char* ciphers; + /* Preferred ciphersuites list, or NULL (applies only to TLSv1.3) */ + char* ciphersuites; +} cliSSLconfig; + + +/* server connection information object, used to describe an ip:port pair, db num user input, and user:pass. */ +typedef struct cliConnInfo { + char *hostip; + int hostport; + int input_dbnum; + char *auth; + char *user; +} cliConnInfo; + +int cliSecureConnection(redisContext *c, cliSSLconfig config, const char **err); + +ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len); + +int cliSecureInit(); + +sds readArgFromStdin(void); + +sds *getSdsArrayFromArgv(int argc,char **argv, int quoted); + +sds unquoteCString(char *str); + +void parseRedisUri(const char *uri, const char* tool_name, cliConnInfo *connInfo, int *tls_flag); + +void freeCliConnInfo(cliConnInfo connInfo); + +sds escapeJsonString(sds s, const char *p, size_t len); + +#endif /* __CLICOMMON_H */ |